Patch level : 1.32
Files correlati : librerie e biblioteche comunali ed aziendali Ricompilazione Demo : [ ] Commento : Ecco una manciata di altri file utili git-svn-id: svn://10.65.10.50/trunk@10099 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b3b79ff0d8
commit
d3318b868a
@ -340,7 +340,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
||||
case E_CLOSE:
|
||||
if (can_close())
|
||||
stop_run();
|
||||
#ifdef XVGUY
|
||||
#ifdef XVAGA
|
||||
else
|
||||
return 1; // Divieto!
|
||||
#endif
|
||||
|
@ -17,7 +17,7 @@
|
||||
#define CHK_DONGLE 0 // dongle authorization checks
|
||||
#define CHK_USER 1 // user authorization checks
|
||||
|
||||
#ifdef XVGUY
|
||||
#ifdef XVAGA
|
||||
#define AUT_FILE "campo.aut"
|
||||
#else
|
||||
#define AUT_FILE "prassi.aut"
|
||||
|
@ -2176,8 +2176,8 @@ void TDropDownList::create()
|
||||
// Larghezza in pixel del bottone
|
||||
const int bw = int(_obj->itf->v.itf->fu_height * XI_FU_MULTIPLE / _obj->itf->v.itf->fu_width);
|
||||
len -= bw;
|
||||
#ifdef XVGUY
|
||||
len -= 4; // Don't ask why
|
||||
#ifdef XVAGA
|
||||
len -= 4; // Don't ask me why
|
||||
#endif
|
||||
}
|
||||
// Larghezza in form units dell'edit field
|
||||
|
@ -185,7 +185,7 @@ const TString& TDongle::administrator(TString* pwd)
|
||||
_admin = ini.get("Administrator");
|
||||
if (_admin.empty())
|
||||
{
|
||||
#ifdef XVGUY
|
||||
#ifdef XVAGA
|
||||
_admin = "PRASSI";
|
||||
#else
|
||||
_admin = "ADMIN";
|
||||
|
290
include/image.cpp
Executable file
290
include/image.cpp
Executable file
@ -0,0 +1,290 @@
|
||||
#include <colors.h>
|
||||
#include <image.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TImage
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Certified 99%
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Setta l'immagine e le sue dimensioni
|
||||
//
|
||||
// @rdesc Ritorna l'immagine stessa
|
||||
XVT_IMAGE TImage::set(
|
||||
XVT_IMAGE i) // @parm Immagine da settare
|
||||
|
||||
// @comm L'immagine precedente viene cancellata quando viene settata una nuova
|
||||
{
|
||||
if (_image)
|
||||
xvt_image_destroy(_image);
|
||||
_image = i;
|
||||
if (i)
|
||||
{
|
||||
_src.left = _src.top = 0;
|
||||
short w, h;
|
||||
xvt_image_get_dimensions(i, &w, &h);
|
||||
_src.right = w;
|
||||
_src.bottom = h;
|
||||
_dst = _src;
|
||||
}
|
||||
return _image;
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Legge l'immagine dal file
|
||||
XVT_IMAGE TImage::load(
|
||||
const char* n) // @parm Nome del file contenente l'immagine
|
||||
{
|
||||
// WinManager.free_handle();
|
||||
XVT_IMAGE i = xvt_image_read_bmp((char*)n);
|
||||
// WinManager.lock_handle();
|
||||
|
||||
if (i != NULL) set(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
XVT_IMAGE TImage::load(short id)
|
||||
{
|
||||
return set(xvt_res_get_image(id));
|
||||
}
|
||||
|
||||
|
||||
// Certified 100%
|
||||
TImage::TImage(const char* n) : _image(NULL)
|
||||
{
|
||||
if (n && *n) load(n);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
TImage::TImage(short id) : _image(NULL)
|
||||
{
|
||||
if (id > 0) load(id);
|
||||
}
|
||||
|
||||
// Certified 90%
|
||||
TImage::TImage(const TImage& im, short w, short h) : _image(NULL)
|
||||
{
|
||||
const XVT_IMAGE_FORMAT fmt = xvt_image_get_format(im._image);
|
||||
if (w < 0 || h < 0)
|
||||
{
|
||||
short iw, ih;
|
||||
xvt_image_get_dimensions(im._image, &iw, &ih);
|
||||
if (w < 0) w = iw;
|
||||
if (h < 0) h = ih;
|
||||
}
|
||||
set(xvt_image_create(fmt, w, h, NULL));
|
||||
|
||||
if (ok())
|
||||
{
|
||||
if (fmt == XVT_IMAGE_CL8)
|
||||
{
|
||||
const short colors = xvt_image_get_ncolors(im._image);
|
||||
xvt_image_set_ncolors(_image, colors);
|
||||
for (short c = 0; c < colors; c++)
|
||||
xvt_image_set_clut(_image, c, xvt_image_get_clut((XVT_IMAGE)im._image, c));
|
||||
}
|
||||
xvt_image_transfer(_image, (XVT_IMAGE)im._image, &_src, (RCT*)&im._src);
|
||||
}
|
||||
}
|
||||
|
||||
// Certified 90%
|
||||
TImage::TImage(short w, short h, XVT_IMAGE_FORMAT fmt) : _image(NULL)
|
||||
{
|
||||
set(xvt_image_create(fmt, w, h, NULL));
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
TImage::~TImage()
|
||||
{
|
||||
if (_image != NULL)
|
||||
xvt_image_destroy(_image);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Permette di settare la posizione della figura
|
||||
void TImage::set_pos(
|
||||
int x, // @parm Coordinata x dell'immagine da settare
|
||||
int y) // @parm Coordinata y dell'immagine da settare
|
||||
|
||||
// @comm Permette di aggiornare il mebro <p _dst> sommandogli i valori
|
||||
// passati con <p x> e <p y>
|
||||
{
|
||||
_dst = _src;
|
||||
xvt_rect_offset(&_dst, x, y);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TImage::draw(WINDOW w) const
|
||||
{
|
||||
xvt_dwin_draw_image(w, _image, (RCT*)&_dst, (RCT*)&_src);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Permette di gestire il disegno dell'immagine sullo schermo
|
||||
void TImage::draw(
|
||||
WINDOW w, // @parm Immagine da disegnare
|
||||
int x, // @parm Coordinata x in cui disegnare l'immagine
|
||||
int y) const // @parm Coordinata y in cui disegnare l'immagine
|
||||
// @parm RCT& | _src | Rettangolo contenente l'immagine da disegnare
|
||||
// @parm RCT& | _dst | Rettangolo in cui disegnare l'immagine
|
||||
|
||||
// @syntax void draw(WINDOW w);
|
||||
// @syntax void draw(WINDOW w, int x, int y);
|
||||
// @syntax void draw(WINDOW w, const RCT& dst);
|
||||
// @syntax void draw(WINDOW w, const RCT& dst, const RCT& src);
|
||||
|
||||
// @comm Nel caso utilizzo l'ultima sintassi e' possibile disegnare solo una parte
|
||||
// dell'immagine, precisamente delle dimensioni <p _dst> se tale parametro e'
|
||||
// minore di <p _pst>
|
||||
{
|
||||
RCT dst = _src;
|
||||
xvt_rect_offset(&dst, x, y);
|
||||
xvt_dwin_draw_image(w, _image, &dst, (RCT*)&_src);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TImage::draw(WINDOW w, const RCT& dst) const
|
||||
{
|
||||
xvt_dwin_draw_image(w, _image, (RCT*)&dst, (RCT*)&_src);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TImage::draw(WINDOW w, const RCT& dst, const RCT& src) const
|
||||
{
|
||||
xvt_dwin_draw_image(w, _image, (RCT*)&dst, (RCT*)&src);
|
||||
}
|
||||
|
||||
// Certified 99%
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Fa corrispondere la palette della finestra a quella dell'immagine
|
||||
void TImage::set_palette(
|
||||
WINDOW w) const // @parm Finestra a cui settare la palette
|
||||
{
|
||||
XVT_PALETTE wp = xvt_vobj_get_palet(w);
|
||||
if (wp != NULL)
|
||||
{
|
||||
XVT_PALETTE p = xvt_palet_create(XVT_PALETTE_USER, NULL);
|
||||
const int ncolors = xvt_palet_get_ncolors(wp);
|
||||
COLOR* color = new COLOR[ncolors];
|
||||
xvt_palet_get_colors(wp, color, ncolors);
|
||||
xvt_palet_add_colors(p, color, ncolors);
|
||||
delete color;
|
||||
xvt_palet_add_colors_from_image(p, _image);
|
||||
xvt_vobj_set_palet(w, p);
|
||||
xvt_palet_destroy(wp);
|
||||
}
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TImage::set_clut(byte n, COLOR c)
|
||||
{
|
||||
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
||||
xvt_image_set_clut(_image, n, c);
|
||||
}
|
||||
|
||||
void TImage::set_pixel(int x, int y, COLOR col)
|
||||
{
|
||||
xvt_image_set_pixel(_image, x, y, col);
|
||||
}
|
||||
|
||||
COLOR TImage::get_pixel(int x, int y) const
|
||||
{
|
||||
return xvt_image_get_pixel(_image, x, y);
|
||||
}
|
||||
|
||||
// Certified 99%
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Setta i colori dell'immagine in modo da renderla trasparente
|
||||
void TImage::convert_to_default_colors()
|
||||
|
||||
// @comm Legge nell'immagine i colori CYAN e DARK_CYAN e li setta a seconda del colore
|
||||
// della finestra per fare in modo di rendere trasparenti tali colori.
|
||||
{
|
||||
if (MASK_BACK_COLOR != COLOR_DKCYAN)
|
||||
{
|
||||
|
||||
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
||||
{
|
||||
for (int index = xvt_image_get_ncolors(_image)-1; index >=0; index--)
|
||||
{
|
||||
const COLOR c = xvt_image_get_clut(_image, index) & 0x00FFFFFF;
|
||||
switch (c)
|
||||
{
|
||||
case COLOR_DKCYAN & 0x00FFFFFF:
|
||||
xvt_image_set_clut(_image, index, MASK_BACK_COLOR); break;
|
||||
case COLOR_CYAN & 0x00FFFFFF:
|
||||
xvt_image_set_clut(_image, index, MASK_LIGHT_COLOR); break;
|
||||
case COLOR_GRAY & 0x00FFFFFF:
|
||||
xvt_image_set_clut(_image, index, MASK_DARK_COLOR); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
short dx, dy; xvt_image_get_dimensions(_image, &dx, &dy);
|
||||
for (short y = 0; y < dy; y++) for (short x = 0; x < dx; x++)
|
||||
{
|
||||
const COLOR c = get_pixel(x, y) & 0x00FFFFFF;
|
||||
switch (c)
|
||||
{
|
||||
case COLOR_DKCYAN & 0x00FFFFFF:
|
||||
set_pixel(x, y, MASK_BACK_COLOR); break;
|
||||
case COLOR_CYAN & 0x00FFFFFF:
|
||||
set_pixel(x, y, MASK_LIGHT_COLOR); break;
|
||||
case COLOR_GRAY & 0x00FFFFFF:
|
||||
set_pixel(x, y, MASK_DARK_COLOR); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @mfunc Setta i colori dell'immagine in modo da renderla trasparente
|
||||
void TImage::convert_transparent_color(COLOR transparent)
|
||||
|
||||
// @comm Legge nell'immagine i pixel uguali a quello in alto a sinistra e li setta
|
||||
// uguali allo sfondo delle maschere
|
||||
{
|
||||
if (_image == NULL)
|
||||
return; // Null image
|
||||
|
||||
const COLOR trans = get_pixel(0, 0) & 0x00FFFFFF;
|
||||
if (trans == (transparent & 0x00FFFFFF))
|
||||
return; // Nothing to do
|
||||
|
||||
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
||||
{
|
||||
for (int index = xvt_image_get_ncolors(_image)-1; index >=0; index--)
|
||||
if (trans == (xvt_image_get_clut(_image, index) & 0x00FFFFFF))
|
||||
{
|
||||
xvt_image_set_clut(_image, index, transparent);
|
||||
// break; don't break: replace all colors equal to upper left in the palette
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
short dx, dy; xvt_image_get_dimensions(_image, &dx, &dy);
|
||||
for (short y = 0; y < dy; y++) for (short x = 0; x < dx; x++)
|
||||
{
|
||||
const COLOR c = get_pixel(x, y) & 0x00FFFFFF;
|
||||
if (c == trans)
|
||||
set_pixel(x, y, MASK_BACK_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
95
include/image.h
Executable file
95
include/image.h
Executable file
@ -0,0 +1,95 @@
|
||||
#ifndef __IMAGE_H
|
||||
#define __IMAGE_H
|
||||
|
||||
#ifndef __OBJECT_H
|
||||
#include <object.h>
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TImage
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TImage | Classe per la gestione delle imagini a video
|
||||
//
|
||||
// @base public | TObject
|
||||
class TImage : public TObject
|
||||
|
||||
// @author:(INTERNAL) Guido
|
||||
{
|
||||
// @access Private Member
|
||||
|
||||
// @cmember:(INTERNAL) Immagine de gestire
|
||||
XVT_IMAGE _image;
|
||||
// @cmember:(INTERNAL) Rettangolo originale (origine 0,0 e dimensioni originali) dell'immagine
|
||||
RCT _src;
|
||||
// @cmember:(INTERNAL) Rettangolo di visualizzazione dell'immagine (dove mettere l'immagine)
|
||||
RCT _dst;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Fa corrispondere la palette della finestra a quella dell'immagine
|
||||
void set_palette(WINDOW w) const;
|
||||
// @cmember Permette di settare la posizione della figura
|
||||
void set_pos(int x, int y);
|
||||
|
||||
// @cmember Disegna l'immagine nella poszione di default e nella dimensione
|
||||
// di defalut
|
||||
void draw(WINDOW w) const ;
|
||||
// @cmember Disegna l'immagine con dimensione default in un punto dello schermo
|
||||
void draw(WINDOW w, int x, int y) const;
|
||||
// @cmember Disegna/modifica l'immagine sullo schermo
|
||||
void draw(WINDOW w, const RCT& dst) const;
|
||||
// @cmember Disegna l'immagine sulla finestra
|
||||
void draw(WINDOW w, const RCT& dst, const RCT& src) const;
|
||||
// @cmember Setta un pixel
|
||||
void set_pixel(int x, int y, COLOR c);
|
||||
// @cmember Legge un pixel
|
||||
COLOR get_pixel(int x, int y) const;
|
||||
|
||||
// @cmember Setta l'immagine e le sue dimensioni
|
||||
XVT_IMAGE set(XVT_IMAGE i);
|
||||
// @cmember Legge l'immagine dal file
|
||||
XVT_IMAGE load(const char* n);
|
||||
// @cmember Legge l'immagine dal file di risorse
|
||||
XVT_IMAGE load(short id);
|
||||
|
||||
// @cmember Controlla che l'immagine sia un oggetto valido (diverso da NULL)
|
||||
virtual bool ok() const
|
||||
{ return _image != NULL; }
|
||||
|
||||
// @cmember Ritorna la larghezza dell'immagine
|
||||
short width() const
|
||||
{ return _src.right; }
|
||||
// @cmember Ritorna l'altezza dell'immagine
|
||||
short height() const
|
||||
{ return _src.bottom; }
|
||||
// @cmember Ritorna il rettangolo dell'immagine originale
|
||||
const RCT& rect() const
|
||||
{ return _src; }
|
||||
|
||||
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
|
||||
// usando i colori di default (di Morpurgo)
|
||||
void convert_to_default_colors();
|
||||
|
||||
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
|
||||
// usando l'angolo in alto a sinistra dell'imagine stessa
|
||||
void convert_transparent_color(COLOR transparent);
|
||||
|
||||
// @cmember Setta l'<p n>.esime entry della paletta al colore <p c>
|
||||
void set_clut(byte n, COLOR c);
|
||||
|
||||
// @cmember Costruttore. Viene passato il nome del file
|
||||
TImage(const char* n);
|
||||
// @cmember Costruttore. Viene passato l'identificatore dell'immagine sul file di risorsa
|
||||
TImage(short id);
|
||||
// @cmember Costruttore. Viene passata l'immagine e le sue diemsioni
|
||||
TImage(const TImage& i, short width = -1, short height = -1);
|
||||
// @cmember Costruttore. Viene passata l'immagine e le sue diemsioni
|
||||
TImage(short width, short height, XVT_IMAGE_FORMAT fmt = XVT_IMAGE_CL8);
|
||||
// @cmember Distruttore
|
||||
virtual ~TImage();
|
||||
};
|
||||
|
||||
#endif
|
@ -724,7 +724,6 @@ TBaseisamfile::TBaseisamfile(
|
||||
if (err != NOERR)
|
||||
fatal_box("Non posso creare il file %s : errore n.ro %d", name, err);
|
||||
}
|
||||
_isamfile = NULL;
|
||||
_lasterr = NOERR;
|
||||
TFilename filename(name);
|
||||
_logicnum = prefix().get_handle(filename);
|
||||
@ -927,7 +926,8 @@ int TBaseisamfile::_write(const TRectype& rec)
|
||||
|
||||
// Controlla che la chiave sia piena
|
||||
TString256 key;
|
||||
__build_key(_isamfile->r, 1, rec.string(), key.get_buffer(), TRUE);
|
||||
|
||||
__build_key(rec.rec_des(), 1, rec.string(), key.get_buffer(), TRUE);
|
||||
if (key.blank())
|
||||
return _iskeyerr;
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ void TPrinter::read_configuration(
|
||||
_lines_per_inch = iniptr->get_int("Lines", NULL, -1, 6); // Linee per pollice
|
||||
_isgraphics = iniptr->get_bool("Graphic", NULL, -1, FALSE); // Grafica attiva
|
||||
|
||||
#ifdef XVGUY
|
||||
#ifdef XVAGA
|
||||
bool read_rcd = TRUE;
|
||||
const TString& host = iniptr->get("Host");
|
||||
if (host.not_empty())
|
||||
@ -1087,7 +1087,7 @@ void TPrinter::read_configuration(
|
||||
|
||||
TToken_string s(256);
|
||||
|
||||
#ifdef XVGUY
|
||||
#ifdef XVAGA
|
||||
// Devo leggere tutti numeri, anche se sono di pìù di quelli attuali!
|
||||
for (int index = 0; ; index++)
|
||||
{
|
||||
@ -1170,7 +1170,7 @@ void TPrinter::save_configuration()
|
||||
prini.set("Lines", _lines_per_inch); // Linee per pollice
|
||||
prini.set("Graphic", _isgraphics ? "X" : ""); // Grafica attiva
|
||||
|
||||
#ifdef XVGUY
|
||||
#ifdef XVAGA
|
||||
char hostname[32];
|
||||
aga_get_host_name(hostname, sizeof(hostname));
|
||||
prini.set("Host", hostname);
|
||||
|
@ -18,7 +18,7 @@ HIDDEN int LEN_SPACES(WINDOW win, int x)
|
||||
}
|
||||
const int k = int((w*x) / 132);
|
||||
|
||||
#if defined(DBG) && !defined(XVGUY)
|
||||
#if defined(DBG) && !defined(XVAGA)
|
||||
static bool error_on = TRUE;
|
||||
if (error_on)
|
||||
{
|
||||
@ -295,7 +295,7 @@ bool TPrintwin::print_band(
|
||||
return (j + k < _txt.lines() + _frlc);
|
||||
}
|
||||
|
||||
#ifdef XVGUY
|
||||
#ifdef XVAGA
|
||||
TPrintwin* _curr_print = NULL;
|
||||
|
||||
bool print_callback(int page, const RCT& rct)
|
||||
|
@ -702,7 +702,7 @@ void TWindow::frame(
|
||||
if (flag & 4)
|
||||
{
|
||||
set_mode(M_XOR);
|
||||
#ifdef XVGUY
|
||||
#ifdef XVAGA
|
||||
set_brush(COLOR_WHITE);
|
||||
#else
|
||||
set_brush(COLOR_BLACK); // Needed for Windows
|
||||
|
Loading…
x
Reference in New Issue
Block a user