Patch level : 2.0.370
Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione P@rtners 2.0 patch 369 git-svn-id: svn://10.65.10.50/trunk@10716 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
981678913a
commit
d5d454e929
@ -1,6 +1,8 @@
|
||||
#include <inst.h>
|
||||
#include <mask.h>
|
||||
#include <prefix.h>
|
||||
#include <modaut.h>
|
||||
#include <isam.h>
|
||||
|
||||
#include <tabutil.h>
|
||||
|
||||
#include <utility.h>
|
||||
|
@ -18,6 +18,107 @@
|
||||
|
||||
#include <bagn002.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Finestra informazioni
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TInfo_mask : public TMask
|
||||
{
|
||||
int _row, _col;
|
||||
|
||||
public:
|
||||
void add_row(const char* prompt, const char* value);
|
||||
void add_row(const char* prompt, unsigned long value);
|
||||
|
||||
TInfo_mask();
|
||||
};
|
||||
|
||||
void TInfo_mask::add_row(const char* prompt, const char* value)
|
||||
{
|
||||
const int MASK_WIDTH = 72;
|
||||
const int PROMPT_WIDTH = 12;
|
||||
|
||||
TString val(value);
|
||||
const int len = val.len();
|
||||
if (_col + PROMPT_WIDTH + len > MASK_WIDTH)
|
||||
{
|
||||
_row++;
|
||||
_col = 1;
|
||||
}
|
||||
|
||||
TString pr(prompt);
|
||||
if (pr.not_empty())
|
||||
pr.left_just(PROMPT_WIDTH);
|
||||
|
||||
const short id = 101 + _row*10 + (_col > 1);
|
||||
TEdit_field& e = add_string(id, 0, pr, _col, _row, len, "", len > 50 ? 50 : len);
|
||||
e.set(value);
|
||||
if (pr.len()+len > MASK_WIDTH/2)
|
||||
_col += MASK_WIDTH;
|
||||
else
|
||||
_col += MASK_WIDTH/2;
|
||||
}
|
||||
|
||||
void TInfo_mask::add_row(const char* prompt, unsigned long value)
|
||||
{
|
||||
TString8 str; str.format("%lu", value);
|
||||
add_row(prompt, str);
|
||||
}
|
||||
|
||||
TInfo_mask::TInfo_mask()
|
||||
: TMask("Informazioni", 1, 72, 9, -1, -1), _row(0), _col(1)
|
||||
{
|
||||
const word ser_no = dongle().number();
|
||||
int year, release, tag, patch;
|
||||
|
||||
TString16 versione = "2003.02";
|
||||
TString16 strpatch = "01.001";
|
||||
if (main_app().get_version_info(year, release, tag, patch))
|
||||
{
|
||||
versione.format("%d.%02d", year, release);
|
||||
strpatch.format("%02d.%03d", tag, patch);
|
||||
}
|
||||
|
||||
TString arg;
|
||||
for (int a = 0; a < main_app().argc(); a++)
|
||||
arg << main_app().argv(a) << ' ';
|
||||
arg.trim(); arg.lower();
|
||||
|
||||
const TFirm& firm = prefix().firm();
|
||||
TString prot;
|
||||
switch (dongle().hardware())
|
||||
{
|
||||
case 1: prot = "Hardlock"; break;
|
||||
case 2: prot = "Eutron"; break;
|
||||
case 3:
|
||||
{
|
||||
TConfig ini(CONFIG_INSTALL, "Server");
|
||||
prot = ini.get("Dongle");
|
||||
}
|
||||
break;
|
||||
default: prot = "NONE"; break;
|
||||
}
|
||||
|
||||
TString stampante = printer().printername();
|
||||
const int comma = stampante.find(',');
|
||||
if (comma > 0) stampante.cut(comma);
|
||||
|
||||
add_row(TR("Versione"), versione);
|
||||
add_row(TR("Patch"), strpatch);
|
||||
add_row(TR("N. di serie"), ser_no);
|
||||
add_row(TR("Protezione"), prot);
|
||||
add_row(TR("Programma"), arg);
|
||||
add_row(TR("Utente"), user());
|
||||
add_row(TR("Studio"), firm2dir(-1));
|
||||
add_row(TR("Ditta"), firm.codice());
|
||||
add_row(TR("Valuta"), firm.codice_valuta());
|
||||
add_row(TR("Stampante"), stampante);
|
||||
add_row(TR("Mb liberi"), os_get_disk_free_space("c:/", 'M'));
|
||||
|
||||
add_button(DLG_OK, 0, "", -11, -1, 10, 2);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Metodi di accesso globali all'applicazione corrente
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -76,7 +177,7 @@ HIDDEN const char* producer_name(TString& firm)
|
||||
}
|
||||
|
||||
if (firm.empty())
|
||||
firm = "Campo";
|
||||
firm = "Campo";
|
||||
|
||||
return firm;
|
||||
}
|
||||
@ -88,9 +189,7 @@ HIDDEN const char* producer_name(TString& firm)
|
||||
HIDDEN long backdrop_eh(WINDOW win, EVENT* ep)
|
||||
{
|
||||
XVT_DISPLAY_TYPE type = (XVT_DISPLAY_TYPE)xvt_vobj_get_attr(win, ATTR_DISPLAY_TYPE);
|
||||
bool has_palette = type != XVT_DISPLAY_DIRECT_COLOR;
|
||||
|
||||
if (!has_palette)
|
||||
if (type == XVT_DISPLAY_DIRECT_COLOR) // True color (senza palette)
|
||||
{
|
||||
const int base_r = XVT_COLOR_GET_RED(MASK_DARK_COLOR);
|
||||
const int base_g = XVT_COLOR_GET_GREEN(MASK_DARK_COLOR);
|
||||
@ -405,7 +504,8 @@ const TString & TApplication::god_string(const char* keyword) const
|
||||
|
||||
void TApplication::stop_run()
|
||||
{
|
||||
if (_savefirm) prefix().set_codditta(_savefirm);
|
||||
if (_savefirm)
|
||||
prefix().set_codditta(_savefirm);
|
||||
#ifdef _DEMO_
|
||||
{
|
||||
const TString16 hname(encode("ORA"));
|
||||
@ -708,20 +808,8 @@ bool TApplication::get_version_info(int& year, int& release, int& tag, int& patc
|
||||
// About box: risposta alla opzione Informazioni del menu File
|
||||
void TApplication::about() const
|
||||
{
|
||||
const TFilename n(argv(0));
|
||||
const word ser_no = dongle().number();
|
||||
int year, release, tag, patch;
|
||||
|
||||
if (get_version_info(year, release, tag, patch))
|
||||
{
|
||||
message_box(TR("Versione %d.%02d\nProgramma %s\nN.ro di serie %u-%02d.%03d \nUtente %s"),
|
||||
year, release, (const char*)n.name(), ser_no, tag, patch, (const char*)user());
|
||||
}
|
||||
else
|
||||
{
|
||||
message_box("Versione 2.00\nProgramma %s\nLibreria del %s\nNumero di serie %u\nUtente %s",
|
||||
(const char*)n.name(), __DATE__, ser_no, (const char*)user());
|
||||
}
|
||||
TInfo_mask info;
|
||||
info.run();
|
||||
}
|
||||
|
||||
// Risposta alla selezione Stampa del menu File
|
||||
|
@ -65,13 +65,13 @@ END
|
||||
LIST MSK_LINES 3
|
||||
BEGIN
|
||||
PROMPT 45 7 "Linee per pollice "
|
||||
ITEM "4|4"
|
||||
ITEM "5|5"
|
||||
ITEM "6|6"
|
||||
ITEM "7|7"
|
||||
ITEM "8|8"
|
||||
ITEM "9|9"
|
||||
ITEM "10|10"
|
||||
ITEM "4|4"
|
||||
ITEM "5|5"
|
||||
ITEM "6|6"
|
||||
ITEM "7|7"
|
||||
ITEM "8|8"
|
||||
ITEM "9|9"
|
||||
ITEM "10|10"
|
||||
HELP "Numero di linee per pollice"
|
||||
END
|
||||
|
||||
|
@ -34,6 +34,23 @@ COLOR choose_color(COLOR col, WINDOW win)
|
||||
return os_choose_color(col, win);
|
||||
}
|
||||
|
||||
COLOR blend_colors(COLOR col1, COLOR col2, int perc)
|
||||
{
|
||||
const unsigned int r1 = XVT_COLOR_GET_RED(col1);
|
||||
const unsigned int g1 = XVT_COLOR_GET_GREEN(col1);
|
||||
const unsigned int b1 = XVT_COLOR_GET_BLUE(col1);
|
||||
const unsigned int r2 = XVT_COLOR_GET_RED(col2);
|
||||
const unsigned int g2 = XVT_COLOR_GET_GREEN(col2);
|
||||
const unsigned int b2 = XVT_COLOR_GET_BLUE(col2);
|
||||
|
||||
const byte r = (r1 * perc + r2*(100-perc) + 50) / 100;
|
||||
const byte g = (g1 * perc + g2*(100-perc) + 50) / 100;
|
||||
const byte b = (b1 * perc + b2*(100-perc) + 50) / 100;
|
||||
|
||||
return RGB2COLOR(r, g, b);
|
||||
}
|
||||
|
||||
|
||||
class TColor_row_mask : public TMask
|
||||
{
|
||||
public:
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue);
|
||||
COLOR choose_color(COLOR col = COLOR_BLACK, WINDOW win = NULL_WIN);
|
||||
COLOR blend_colors(COLOR col1, COLOR col2, int perc = 50);
|
||||
|
||||
extern COLOR MASK_BACK_COLOR;
|
||||
extern COLOR MASK_LIGHT_COLOR;
|
||||
@ -25,6 +26,8 @@ extern COLOR DISABLED_COLOR;
|
||||
extern COLOR DISABLED_BACK_COLOR;
|
||||
extern COLOR FOCUS_COLOR;
|
||||
extern COLOR FOCUS_BACK_COLOR;
|
||||
extern COLOR REQUIRED_BACK_COLOR;
|
||||
|
||||
extern bool CAMPI_SCAVATI;
|
||||
extern bool AUTOSELECT;
|
||||
|
||||
|
@ -1,5 +1,14 @@
|
||||
#define XI_INTERNAL
|
||||
#include <xinclude.h>
|
||||
|
||||
#ifndef STX_DATA
|
||||
extern "C"
|
||||
{
|
||||
#include <xitext.h>
|
||||
#include <xistx.h>
|
||||
#include <xiutils.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <colors.h>
|
||||
#include <config.h>
|
||||
@ -24,30 +33,12 @@ COLOR DISABLED_COLOR = COLOR_DKGRAY;
|
||||
COLOR DISABLED_BACK_COLOR = MASK_BACK_COLOR;
|
||||
COLOR FOCUS_COLOR = NORMAL_COLOR;
|
||||
COLOR FOCUS_BACK_COLOR = COLOR_YELLOW;
|
||||
COLOR REQUIRED_BACK_COLOR = NORMAL_BACK_COLOR;
|
||||
|
||||
bool CAMPI_SCAVATI = TRUE;
|
||||
bool AUTOSELECT = FALSE;
|
||||
bool SMALL_ICONS=FALSE;
|
||||
|
||||
#ifndef STX_DATA
|
||||
// Very deep hacking
|
||||
typedef struct _stx_data
|
||||
{
|
||||
int cid;
|
||||
WINDOW win;
|
||||
RCT rct;
|
||||
#ifdef XI_R4
|
||||
RCT edit_rct;
|
||||
#endif
|
||||
unsigned long attrib;
|
||||
} STX_DATA;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <xiutils.h>
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
HIDDEN bool _button_blocked = FALSE;
|
||||
HIDDEN int _last_mouse_button = 0;
|
||||
|
||||
@ -288,6 +279,7 @@ void customize_colors()
|
||||
MASK_DARK_COLOR = colors.get_color("MaskDark", NULL, -1, MASK_DARK_COLOR);
|
||||
NORMAL_COLOR = colors.get_color("Normal", NULL, -1, NORMAL_COLOR);
|
||||
NORMAL_BACK_COLOR = colors.get_color("NormalBack", NULL, -1, NORMAL_BACK_COLOR);
|
||||
REQUIRED_BACK_COLOR = colors.get_color("RequiredBack", NULL, -1, REQUIRED_BACK_COLOR);
|
||||
DISABLED_COLOR = colors.get_color("Disabled", NULL, -1, DISABLED_COLOR);
|
||||
DISABLED_BACK_COLOR = colors.get_color("DisabledBack", NULL, -1, DISABLED_BACK_COLOR);
|
||||
FOCUS_COLOR = colors.get_color("Focus", NULL, -1, FOCUS_COLOR);
|
||||
@ -1356,6 +1348,11 @@ void TField_control::set_focus() const
|
||||
TControl::set_focus();
|
||||
}
|
||||
|
||||
void TField_control::set_back_color(COLOR col)
|
||||
{
|
||||
xi_set_color(_obj, XIC_BACK, col);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TMultiline_control
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -161,6 +161,7 @@ public:
|
||||
|
||||
bool read_only() const;
|
||||
void set_read_only(bool on = TRUE);
|
||||
void set_back_color(COLOR col);
|
||||
|
||||
// @cmember Costruttore
|
||||
TField_control(WINDOW win, short cid,
|
||||
|
@ -283,7 +283,7 @@ void TImage::convert_transparent_color(COLOR transparent)
|
||||
{
|
||||
const COLOR c = get_pixel(x, y) & 0x00FFFFFF;
|
||||
if (c == trans)
|
||||
set_pixel(x, y, MASK_BACK_COLOR);
|
||||
set_pixel(x, y, transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ int TSystemtempfile::dump(
|
||||
len[j] = (t == _datefld) ? 10 : curr().length(wfld);
|
||||
}
|
||||
TRecnotype i = 0;
|
||||
const TRecnotype nitems = nkey ? items() : filehnd()->d->EOD;
|
||||
const TRecnotype nitems = items();
|
||||
s.format("Esportazione archivio %s", filename());
|
||||
TProgind p(nitems, s, TRUE, TRUE, 70);
|
||||
TString s1;
|
||||
|
@ -2546,7 +2546,6 @@ int TSystemisamfile::dump(
|
||||
return error_box("Non e' possibile scaricare a lunghezza fissa un file con campi memo");
|
||||
}
|
||||
TRecnotype i = 0;
|
||||
// const TRecnotype nitems = nkey ? items() : filehnd()->d->EOD;
|
||||
const TRecnotype nitems = items();
|
||||
|
||||
s.format("Esportazione archivio %s", filename());
|
||||
|
@ -824,7 +824,7 @@ public:
|
||||
int dec() const { return (int) _dec;}
|
||||
TFieldtypes type() const
|
||||
// @cmember Ritorna il tipo del campo
|
||||
{ return (TFieldtypes) _type;}
|
||||
{ return _type;}
|
||||
// @cmember Ritorna il puntatore a inizio record
|
||||
TRectype& record() const
|
||||
{ return *_rec;}
|
||||
|
@ -246,21 +246,17 @@ bool rpc_UserLogin(const char* server, const char* user,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const bool local = server == NULL || *server == '\0' || stricmp(server, "localhost") == 0;
|
||||
TString name(40);
|
||||
if (local)
|
||||
name = "locale";
|
||||
else
|
||||
name = server;
|
||||
const char* str = (const char*)name;
|
||||
|
||||
TString80 error;
|
||||
|
||||
const bool local = server == NULL || *server == '\0' ||
|
||||
stricmp(server, "127.0.0.1") == 0 ||
|
||||
stricmp(server, "localhost") == 0;
|
||||
const TString name = local ? "locale" : server;
|
||||
|
||||
if (_connection != 0)
|
||||
_client->RemoveConnection(_connection);
|
||||
|
||||
_connection = _client->QueryConnection("1883", server);
|
||||
|
||||
TString error;
|
||||
if (_connection)
|
||||
{
|
||||
TString16 password;
|
||||
@ -275,12 +271,13 @@ bool rpc_UserLogin(const char* server, const char* user,
|
||||
if (!logged)
|
||||
{
|
||||
connected = FALSE;
|
||||
error.format("La connessione di %s e' stata rifiutata dal Server %s", (const char*)user, str);
|
||||
error.format("La connessione di %s e' stata rifiutata dal Server %s",
|
||||
(const char*)user, (const char*)name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.format("Impossibile connettersi al Server %s", str);
|
||||
error.format("Impossibile connettersi al Server %s", (const char*)name);
|
||||
}
|
||||
|
||||
if (!connected)
|
||||
@ -291,7 +288,8 @@ bool rpc_UserLogin(const char* server, const char* user,
|
||||
}
|
||||
else
|
||||
{
|
||||
error.format("Impossibile connettersi al Server %s", str);
|
||||
if (!local)
|
||||
error.format("Impossibile connettersi al Server %s", (const char*)name);
|
||||
}
|
||||
|
||||
if (error.not_empty())
|
||||
|
@ -962,7 +962,7 @@ WINDOW TMask::read_page(
|
||||
const TString title = dictionary_translate(scanner.string());
|
||||
|
||||
RCT r;
|
||||
if (toolwin())
|
||||
if (toolwin()) // Pagina successiva ad una toolbar
|
||||
{
|
||||
scanner.line();
|
||||
xvt_rect_set(&r, 0, 0, 0, tooly);
|
||||
@ -1702,7 +1702,7 @@ TButton_field& TMask::add_button (
|
||||
const char* prompt, // @parm Prompt del campo
|
||||
int x, // @parm Coordinata x (in caratteri)
|
||||
int y, // @parm Coordinata y (in caratteri)
|
||||
int dx, // @parm Larghezza del campo (in caratteri, defailt 9)
|
||||
int dx, // @parm Larghezza del campo (in caratteri, default 9)
|
||||
int dy, // @parm Altezza del campo (in caratteri, default 1)
|
||||
const char* flags, // @parm Flag di controllo del campo (default "")
|
||||
short bmpup, // @parm Icona normale
|
||||
|
@ -256,6 +256,7 @@ void TMask_field::construct(
|
||||
_ctl_data._width = width <= 0 ? 12 : width;
|
||||
break;
|
||||
case CLASS_MEMO_FIELD:
|
||||
case CLASS_TREE_FIELD:
|
||||
_ctl_data._height = len;
|
||||
_ctl_data._width = width;
|
||||
_ctl_data._size = len * width;
|
||||
@ -3147,6 +3148,14 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
||||
return TEditable_field::parse_item(scanner);
|
||||
}
|
||||
|
||||
void TEdit_field::check_type(CheckType c)
|
||||
{
|
||||
_check = c;
|
||||
if (NORMAL_BACK_COLOR != REQUIRED_BACK_COLOR)
|
||||
((TField_control*)_ctl)->set_back_color(required() ? REQUIRED_BACK_COLOR : NORMAL_BACK_COLOR);
|
||||
}
|
||||
|
||||
|
||||
// Filtro magico sulle ditte esistenti
|
||||
HIDDEN bool firm_filter(const TRelation* rel)
|
||||
{
|
||||
@ -3182,6 +3191,9 @@ void TEdit_field::create(WINDOW parent)
|
||||
cursor->set_filterfunction(firm_filter);
|
||||
}
|
||||
}
|
||||
|
||||
if (required())
|
||||
check_type(CHECK_REQUIRED); // Force color change
|
||||
}
|
||||
|
||||
const char* TEdit_field::reformat(const char* str) const
|
||||
@ -4927,8 +4939,8 @@ short TWindowed_field::dlg() const
|
||||
|
||||
void TWindowed_field::parse_head(TScanner& scanner)
|
||||
{
|
||||
_ctl_data._width = scanner.integer();
|
||||
_ctl_data._size = scanner.integer();
|
||||
_ctl_data._width = scanner.integer();
|
||||
_ctl_data._height = scanner.integer();
|
||||
}
|
||||
|
||||
TField_window* TWindowed_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
|
||||
@ -4941,7 +4953,7 @@ void TWindowed_field::create(WINDOW parent)
|
||||
{
|
||||
_dlg = _ctl_data._dlg;
|
||||
_win = create_window(_ctl_data._x, _ctl_data._y,
|
||||
_ctl_data._width, _ctl_data._size,
|
||||
_ctl_data._width, _ctl_data._height,
|
||||
parent);
|
||||
}
|
||||
|
||||
|
@ -1093,8 +1093,7 @@ public:
|
||||
{ return _check; }
|
||||
|
||||
// @cmember Setta il tipo di check da assegnare al campo (vedi <t Checktype>)
|
||||
virtual void check_type(CheckType c)
|
||||
{ _check = c; }
|
||||
virtual void check_type(CheckType c);
|
||||
|
||||
// @cmember Controlla se un campo e' forced
|
||||
bool forced() const
|
||||
|
@ -1086,14 +1086,15 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
xiev->v.cell_request.attrib &= ~XI_ATR_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool has_focus = rec == _cur_rec && cid2col(f->dlg()) == _cur_col;
|
||||
|
||||
if (!has_focus)
|
||||
get_back_and_fore_color(xiev->v.cell_request.back_color,
|
||||
xiev->v.cell_request.color, rec, col);
|
||||
{
|
||||
get_back_and_fore_color(xiev->v.cell_request.back_color,
|
||||
xiev->v.cell_request.color, rec, col);
|
||||
if (xiev->v.cell_request.back_color == 0 && f->required())
|
||||
xiev->v.cell_request.back_color = REQUIRED_BACK_COLOR;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (e->has_query_button())
|
||||
{
|
||||
xiev->v.cell_request.button = TRUE;
|
||||
@ -2706,6 +2707,12 @@ void TSheet_field::set_columns_order(TToken_string* order)
|
||||
s->set_columns_order(order);
|
||||
}
|
||||
|
||||
const char* TSheet_field::get_column_header( const int col) const
|
||||
{
|
||||
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
||||
return s->get_column_header(col);
|
||||
}
|
||||
|
||||
void TSheet_field::swap_rows( const int fromindex, const int toindex)
|
||||
{
|
||||
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
||||
|
@ -10,7 +10,7 @@
|
||||
#endif
|
||||
|
||||
enum os_type { os_Unknown, os_Win32s, os_Windows, os_Windows95, os_Windows98,
|
||||
os_WindowsME, os_WindowsNT, os_Windows2000 };
|
||||
os_WindowsME, os_WindowsNT, os_Windows2000, os_WindowsXP };
|
||||
os_type os_get_type();
|
||||
|
||||
void os_post_menu_event(WINDOW win, MENU_TAG tag);
|
||||
@ -20,8 +20,9 @@ unsigned long os_get_free_memory();
|
||||
bool os_is_removable_drive(const char* path);
|
||||
bool os_is_network_drive(const char* path);
|
||||
bool os_is_fixed_drive(const char* path);
|
||||
bool os_test_disk_free_space(const char* path, unsigned long filesize);
|
||||
unsigned long os_get_disk_size(const char* path);
|
||||
unsigned long os_get_disk_size(const char* path, char unit = 'b'); // units allowed: b, K, M, G, T
|
||||
unsigned long os_get_disk_free_space(const char* path, char unit = 'b');
|
||||
bool os_test_disk_free_space(const char* path, unsigned long filesize_bytes);
|
||||
|
||||
COLOR os_choose_color(COLOR col, WINDOW win);
|
||||
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild);
|
||||
|
@ -172,34 +172,45 @@ bool os_is_fixed_drive(const char* path)
|
||||
return dt == DRIVE_FIXED;
|
||||
}
|
||||
|
||||
unsigned long os_get_disk_size(const char* path)
|
||||
static unsigned long get_disk_size(const char* path, bool tot, char unit)
|
||||
{
|
||||
char drive[_MAX_DRIVE+1];
|
||||
_splitpath(path, drive, NULL, NULL, NULL);
|
||||
strcat(drive, "/");
|
||||
DWORD nSecPerClust, nBytePerSec, nFreeClust, nTotalClust;
|
||||
::GetDiskFreeSpace(drive, &nSecPerClust, &nBytePerSec, &nFreeClust, &nTotalClust);
|
||||
__int64 nFree = nTotalClust;
|
||||
nFree *= nSecPerClust;
|
||||
nFree *= nBytePerSec;
|
||||
unsigned long nVal = nFree > ULONG_MAX ? (unsigned long)ULONG_MAX
|
||||
: (unsigned long)nFree;
|
||||
return nVal;
|
||||
|
||||
__int64 nBytes = tot ? nTotalClust : nFreeClust;
|
||||
nBytes *= nSecPerClust;
|
||||
nBytes *= nBytePerSec;
|
||||
switch (unit)
|
||||
{
|
||||
case 'K': nBytes >>= 10; break; // Kilobytes
|
||||
case 'M': nBytes >>= 20; break; // Megabytes
|
||||
case 'G': nBytes >>= 30; break; // Gigabytes
|
||||
case 'T': nBytes >>= 40; break; // Terabytes
|
||||
default: break;
|
||||
}
|
||||
unsigned long nVal = nBytes > ULONG_MAX ? (unsigned long)ULONG_MAX
|
||||
: (unsigned long)nBytes;
|
||||
return nVal;
|
||||
}
|
||||
|
||||
unsigned long os_get_disk_size(const char* path, char unit)
|
||||
{
|
||||
return get_disk_size(path, true, unit);
|
||||
}
|
||||
|
||||
unsigned long os_get_disk_free_space(const char* path, char unit)
|
||||
{
|
||||
return get_disk_size(path, false, unit);
|
||||
}
|
||||
|
||||
bool os_test_disk_free_space(const char* path, unsigned long filesize)
|
||||
{
|
||||
char drive[_MAX_DRIVE+1];
|
||||
_splitpath(path, drive, NULL, NULL, NULL);
|
||||
strcat(drive, "/");
|
||||
DWORD nSecPerClust, nBytePerSec, nFreeClust, nTotalClust;
|
||||
::GetDiskFreeSpace(drive, &nSecPerClust, &nBytePerSec, &nFreeClust, &nTotalClust);
|
||||
__int64 nFree = nFreeClust;
|
||||
nFree *= nSecPerClust;
|
||||
nFree *= nBytePerSec;
|
||||
unsigned long nVal = nFree > ULONG_MAX ? (unsigned long)ULONG_MAX
|
||||
: (unsigned long)nFree;
|
||||
return filesize <= nVal;
|
||||
// Arrotonda per eccesso al Kilobyte
|
||||
unsigned long kb = (filesize+1023)/1024;
|
||||
return kb <= os_get_disk_free_space(path, 'K');
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -899,7 +899,7 @@ void TPrefix::reopen() const
|
||||
void TPrefix::set(
|
||||
const char* name, // @parm Nome del direttorio dati da attivare (default NULL)
|
||||
bool force, // @parm Permette di settarla anche se non esiste (default FALSE)
|
||||
TFilelock mode) // @parm Permette di aprire la ditta in modo esclusico (default _manulock)
|
||||
TFilelock mode) // @parm Permette di aprire la ditta in modo esclusivo (default _manulock)
|
||||
|
||||
// @comm Il parametro <p name> puo' assumere i seguenti valori:
|
||||
//
|
||||
@ -1116,7 +1116,7 @@ const char* TPrefix::description(int cod) const
|
||||
const TFirm& TPrefix::firm()
|
||||
{
|
||||
if (_firm == NULL)
|
||||
_firm = new TFirm;
|
||||
_firm = new TFirm;
|
||||
return *_firm;
|
||||
}
|
||||
|
||||
@ -1220,7 +1220,7 @@ bool TPrefix::build_firm_data(long codditta, bool flagcom)
|
||||
rec.zero();
|
||||
}
|
||||
TString mess("Generazione archivi della ditta "); mess << codditta;
|
||||
TProgind p(maxeod0 ? maxeod0 : 1, mess, FALSE, TRUE, 70);
|
||||
TProgind p(maxeod0 ? maxeod0 : 1, mess, FALSE, TRUE);
|
||||
|
||||
for (int i = LF_DIR + 1; i <= maxeod0; i++)
|
||||
{
|
||||
|
@ -30,9 +30,9 @@ real::real (const real& b) : _dec(b._dec)
|
||||
real::real (long double a) : _dec(a)
|
||||
{ }
|
||||
|
||||
void::real set_int64(__int64 b)
|
||||
void real::set_int64(__int64 b)
|
||||
{
|
||||
_dec = b;
|
||||
_dec = (long double)b;
|
||||
}
|
||||
|
||||
bool real::is_real (const char *s)
|
||||
@ -49,7 +49,6 @@ bool real::is_real (const char *s)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
real::real (const char *s)
|
||||
{
|
||||
_dec = (s && *s) ? _atold(s) : 0.0;
|
||||
|
@ -2616,9 +2616,12 @@ TViswin::TViswin(const char *fname,
|
||||
if (_toplevel && alt > maxalt)
|
||||
maxalt = alt;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
_modules.add(new TImage(BMP_MODULE1 + i), i);
|
||||
_modules.add(new TImage(BMP_MODULE), i);
|
||||
for (i = 0; i < _modules.items(); i++)
|
||||
((TImage*)_modules.objptr(i))->convert_transparent_color(MASK_BACK_COLOR);
|
||||
|
||||
long flags = WSF_HSCROLL | WSF_VSCROLL;
|
||||
if (_toplevel)
|
||||
|
299
xvaga/agasys.cpp
299
xvaga/agasys.cpp
@ -42,187 +42,9 @@ void aga_log(const char* fmt, ...)
|
||||
// Unzip support
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
#include <wx/fs_zip.h>
|
||||
#include <wx/wfstream.h>
|
||||
#include <wx/zipstrm.h>
|
||||
|
||||
#include <../src/zlib/zlib.h>
|
||||
#include <../src/common/unzip.h>
|
||||
|
||||
class WXDLLEXPORT wxAgaZipFSHandler : public wxFileSystemHandler
|
||||
{
|
||||
public:
|
||||
wxAgaZipFSHandler();
|
||||
virtual bool CanOpen(const wxString& location);
|
||||
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
|
||||
virtual wxString FindFirst(const wxString& spec, int flags = 0);
|
||||
virtual wxString FindNext();
|
||||
~wxAgaZipFSHandler();
|
||||
|
||||
private:
|
||||
// these vars are used by FindFirst/Next:
|
||||
unzFile m_Archive;
|
||||
wxString m_Pattern, m_BaseDir, m_ZipFile;
|
||||
bool m_AllowDirs, m_AllowFiles;
|
||||
|
||||
wxString DoFind();
|
||||
};
|
||||
|
||||
wxAgaZipFSHandler::wxAgaZipFSHandler() : wxFileSystemHandler()
|
||||
{
|
||||
m_Archive = NULL;
|
||||
m_ZipFile = m_Pattern = m_BaseDir = wxEmptyString;
|
||||
m_AllowDirs = m_AllowFiles = TRUE;
|
||||
}
|
||||
|
||||
wxAgaZipFSHandler::~wxAgaZipFSHandler()
|
||||
{
|
||||
if (m_Archive)
|
||||
unzClose(m_Archive);
|
||||
}
|
||||
|
||||
bool wxAgaZipFSHandler::CanOpen(const wxString& location)
|
||||
{
|
||||
wxString p = GetProtocol(location);
|
||||
return (p == wxT("zip"));
|
||||
}
|
||||
|
||||
wxFSFile* wxAgaZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wxString wxAgaZipFSHandler::FindFirst(const wxString& spec, int flags)
|
||||
{
|
||||
wxString right = GetRightLocation(spec);
|
||||
wxString left = GetLeftLocation(spec);
|
||||
|
||||
if (right.Last() == wxT('/')) right.RemoveLast();
|
||||
|
||||
if (m_Archive)
|
||||
{
|
||||
unzClose(m_Archive);
|
||||
m_Archive = NULL;
|
||||
}
|
||||
|
||||
if (GetProtocol(left) != wxT("file"))
|
||||
return wxEmptyString;
|
||||
|
||||
switch (flags)
|
||||
{
|
||||
case wxFILE:
|
||||
m_AllowDirs = FALSE, m_AllowFiles = TRUE; break;
|
||||
case wxDIR:
|
||||
m_AllowDirs = TRUE, m_AllowFiles = FALSE; break;
|
||||
default:
|
||||
m_AllowDirs = m_AllowFiles = TRUE; break;
|
||||
}
|
||||
|
||||
m_ZipFile = left;
|
||||
m_Archive = (void*) unzOpen(m_ZipFile.mb_str());
|
||||
m_Pattern = right.AfterLast(wxT('/'));
|
||||
m_BaseDir = right.BeforeLast(wxT('/'));
|
||||
|
||||
if (m_Archive)
|
||||
{
|
||||
if (unzGoToFirstFile((unzFile)m_Archive) != UNZ_OK)
|
||||
{
|
||||
unzClose((unzFile)m_Archive);
|
||||
m_Archive = NULL;
|
||||
}
|
||||
else
|
||||
return DoFind();
|
||||
}
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
wxString wxAgaZipFSHandler::FindNext()
|
||||
{
|
||||
if (!m_Archive) return wxEmptyString;
|
||||
return DoFind();
|
||||
}
|
||||
|
||||
wxString wxAgaZipFSHandler::DoFind()
|
||||
{
|
||||
const size_t nBufSize = 1024;
|
||||
char* namebuf = new char[nBufSize]; // char, not wxChar!
|
||||
char *c;
|
||||
wxString fn, dir, name;
|
||||
wxString match = wxEmptyString;
|
||||
bool wasdir;
|
||||
|
||||
while (match == wxEmptyString)
|
||||
{
|
||||
unzGetCurrentFileInfo(m_Archive, NULL, namebuf, nBufSize, NULL, 0, NULL, 0);
|
||||
for (c = namebuf; *c; c++) if (*c == wxT('\\')) *c = wxT('/');
|
||||
fn = namebuf;
|
||||
if (fn.Length() > 0 && fn.Last() == wxT('/'))
|
||||
{
|
||||
fn.RemoveLast();
|
||||
wasdir = TRUE;
|
||||
}
|
||||
else wasdir = FALSE;
|
||||
|
||||
name = fn.AfterLast(wxT('/'));
|
||||
dir = fn.BeforeLast(wxT('/'));
|
||||
|
||||
if (m_AllowDirs || dir == m_BaseDir)
|
||||
{
|
||||
if (m_AllowFiles && !wasdir && wxMatchWild(m_Pattern, name, FALSE))
|
||||
match = m_ZipFile + wxT("#zip:") + fn;
|
||||
if (m_AllowDirs && wasdir && wxMatchWild(m_Pattern, name, FALSE))
|
||||
match = m_ZipFile + wxT("#zip:") + fn;
|
||||
}
|
||||
|
||||
if (unzGoToNextFile(m_Archive) != UNZ_OK)
|
||||
{
|
||||
unzClose(m_Archive);
|
||||
m_Archive = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delete [] namebuf;
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
bool aga_unzip(const char* zipfile, const char* destdir)
|
||||
{
|
||||
wxString str = zipfile;
|
||||
str += "#zip:*";
|
||||
|
||||
wxAgaZipFSHandler fs;
|
||||
wxString strInFile = fs.FindFirst(str, 0);
|
||||
while (!strInFile.IsEmpty())
|
||||
{
|
||||
const int nDiesis = strInFile.Find('#');
|
||||
const wxString strFileName = strInFile.Mid(nDiesis+5);
|
||||
wxZipInputStream fin(zipfile, strFileName);
|
||||
|
||||
wxString strOutFile = destdir;
|
||||
strOutFile += '/';
|
||||
strOutFile += strFileName;
|
||||
|
||||
wxString strPath;
|
||||
::wxSplitPath(strOutFile, &strPath, NULL, NULL);
|
||||
if (!::wxDirExists(strPath))
|
||||
::wxMkdir(strPath);
|
||||
|
||||
wxFFileOutputStream fout(strOutFile);
|
||||
fout.Write(fin);
|
||||
|
||||
strInFile = fs.FindNext();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Zip support
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
#include <wx/zstream.h>
|
||||
|
||||
#pragma pack(2)
|
||||
|
||||
struct ZipLocalFileHeader
|
||||
@ -263,20 +85,102 @@ struct ZipDirectoryEnd
|
||||
|
||||
#pragma pack()
|
||||
|
||||
unsigned int aga_ziplist(const char* zipfile, wxArrayString& aFiles)
|
||||
{
|
||||
const unsigned long dwDirectorySignature = 0x02014B50;
|
||||
const unsigned long dwEndDirectorySignature = 0x06054B50;
|
||||
|
||||
wxFileInputStream fin(zipfile);
|
||||
|
||||
const off_t off = sizeof(ZipDirectoryEnd)+sizeof(dwEndDirectorySignature);
|
||||
fin.SeekI(-off, wxFromEnd);
|
||||
|
||||
unsigned long dwSignature = 0;
|
||||
fin.Read(&dwSignature, sizeof(dwSignature));
|
||||
if (dwSignature != dwEndDirectorySignature)
|
||||
return 0;
|
||||
|
||||
ZipDirectoryEnd zde;
|
||||
fin.Read(&zde, sizeof(zde));
|
||||
if (zde.nThisDisk < zde.nStartDisk || zde.nDiskEntries == 0 || zde.nSize == 0)
|
||||
return 0;
|
||||
|
||||
fin.SeekI(zde.nStartOffset, wxFromStart);
|
||||
|
||||
for (unsigned int f = 0; f < zde.nDiskEntries; f++)
|
||||
{
|
||||
fin.Read(&dwSignature, sizeof(dwSignature));
|
||||
if (dwSignature != dwDirectorySignature)
|
||||
break;
|
||||
|
||||
ZipDirectoryFileHeader zdfh; memset(&zdfh, 0, sizeof(zdfh));
|
||||
fin.Read(&zdfh, sizeof(zdfh));
|
||||
char name[_MAX_PATH]; memset(name, 0, sizeof(name));
|
||||
fin.Read(name, zdfh.zlfh.nNameLength);
|
||||
aFiles.Add(name);
|
||||
}
|
||||
|
||||
return aFiles.GetCount();
|
||||
}
|
||||
|
||||
bool aga_unzip(const char* zipfile, const char* destdir)
|
||||
{
|
||||
wxArrayString aFiles;
|
||||
const unsigned int files = aga_ziplist(zipfile, aFiles);
|
||||
for (unsigned int f = 0; f < files; f++)
|
||||
{
|
||||
const wxString& strFileName = aFiles[f];
|
||||
wxZipInputStream fin(zipfile, strFileName);
|
||||
|
||||
wxString strOutFile = destdir;
|
||||
strOutFile += '/';
|
||||
strOutFile += strFileName;
|
||||
|
||||
wxString strPath;
|
||||
::wxSplitPath(strOutFile, &strPath, NULL, NULL);
|
||||
if (!::wxDirExists(strPath))
|
||||
::wxMkdir(strPath);
|
||||
|
||||
wxFileOutputStream fout(strOutFile);
|
||||
fout.Write(fin);
|
||||
}
|
||||
return files > 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Zip support
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
#include <wx/zstream.h>
|
||||
#include <../src/zlib/zlib.h>
|
||||
|
||||
class AgaZlibOutputStream : public wxZlibOutputStream
|
||||
{
|
||||
enum { AGA_COMPRESSION_LEVEL = 9 };
|
||||
|
||||
public:
|
||||
AgaZlibOutputStream(wxOutputStream& stream, int level);
|
||||
AgaZlibOutputStream(wxOutputStream& stream);
|
||||
};
|
||||
|
||||
AgaZlibOutputStream::AgaZlibOutputStream(wxOutputStream& stream, int level)
|
||||
: wxZlibOutputStream(stream, level)
|
||||
#if wxCHECK_VERSION(2,3,4)
|
||||
|
||||
// Da questa vesrione si deve taroccare il sorgente della deflateInit in zlib
|
||||
AgaZlibOutputStream::AgaZlibOutputStream(wxOutputStream& stream)
|
||||
: wxZlibOutputStream(stream, AGA_COMPRESSION_LEVEL)
|
||||
{ }
|
||||
|
||||
#else
|
||||
|
||||
AgaZlibOutputStream::AgaZlibOutputStream(wxOutputStream& stream)
|
||||
: wxZlibOutputStream(stream, AGA_COMPRESSION_LEVEL)
|
||||
{
|
||||
const int DEF_MEM_LEVEL = 8;
|
||||
deflateInit2_(m_deflate, level, Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL,
|
||||
deflateInit2_(m_deflate, AGA_COMPRESSION_LEVEL, Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL,
|
||||
Z_DEFAULT_STRATEGY, "1.1.2", sizeof(*m_deflate));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int AddFilesToList(const wxString& strBase, const wxString& strMask, wxStringList& aFiles)
|
||||
{
|
||||
int n = 0;
|
||||
@ -298,25 +202,8 @@ static int AddFilesToList(const wxString& strBase, const wxString& strMask, wxSt
|
||||
return n;
|
||||
}
|
||||
|
||||
static unsigned long ComputeCRC(const char* strFile)
|
||||
{
|
||||
const int nSize = 1024*64;
|
||||
wxByte* buffer = new wxByte[nSize];
|
||||
unsigned long dwCrc = 0;
|
||||
|
||||
wxFFileInputStream fin(strFile);
|
||||
unsigned long nLastRead = nSize;
|
||||
while (nLastRead == nSize)
|
||||
{
|
||||
fin.Read(buffer, nSize);
|
||||
nLastRead= fin.LastRead();
|
||||
dwCrc = crc32(dwCrc, buffer, nLastRead);
|
||||
}
|
||||
return dwCrc;
|
||||
}
|
||||
|
||||
static void AddFileToZip(const wxString& strPrefix, const wxString& strFile,
|
||||
wxFFileOutputStream& fout, wxFFileOutputStream& fdir)
|
||||
wxFileOutputStream& fout, wxFileOutputStream& fdir)
|
||||
{
|
||||
if (!wxFileExists(strFile))
|
||||
return;
|
||||
@ -348,8 +235,8 @@ static void AddFileToZip(const wxString& strPrefix, const wxString& strFile,
|
||||
const int nMagicOffset = -4; // Deep hacking :-)
|
||||
|
||||
{
|
||||
wxFFileInputStream fin(strFile);
|
||||
AgaZlibOutputStream zout(fout, 9);
|
||||
wxFileInputStream fin(strFile);
|
||||
AgaZlibOutputStream zout(fout);
|
||||
zout.Write(fin); // Scrivo file compresso
|
||||
zlfh.dwUncompressedSize = fin.TellI();
|
||||
}
|
||||
@ -358,7 +245,7 @@ static void AddFileToZip(const wxString& strPrefix, const wxString& strFile,
|
||||
|
||||
zlfh.dwCompressedSize = fout.TellO();
|
||||
zlfh.dwCompressedSize -= nDataStart;
|
||||
zlfh.dwCRC = ComputeCRC(strFile);
|
||||
zlfh.dwCRC = ComputeFileCRC32(strFile);
|
||||
|
||||
const time_t tMod = ::wxFileModificationTime(strFile);
|
||||
const struct tm* t = localtime(&tMod);
|
||||
@ -393,13 +280,13 @@ static bool AddFilesToZip(const wxString& strBase, wxStringList& aFiles, const c
|
||||
{
|
||||
const char* zipdir = "zipdir.tmp";
|
||||
|
||||
wxFFileOutputStream fout(zipfile);
|
||||
wxFileOutputStream fout(zipfile);
|
||||
|
||||
off_t nDirSize = 0, nDirStart = 0;
|
||||
|
||||
if (aFiles.GetCount() > 0) // Dummy test
|
||||
{
|
||||
wxFFileOutputStream fdir(zipdir);
|
||||
wxFileOutputStream fdir(zipdir);
|
||||
wxStringListNode* node = aFiles.GetFirst();
|
||||
while (node)
|
||||
{
|
||||
@ -413,7 +300,7 @@ static bool AddFilesToZip(const wxString& strBase, wxStringList& aFiles, const c
|
||||
|
||||
if (nDirSize > 0)
|
||||
{
|
||||
wxFFileInputStream fdir(zipdir);
|
||||
wxFileInputStream fdir(zipdir);
|
||||
fout.Write(fdir); // Append central directory
|
||||
|
||||
ZipDirectoryEnd zde; memset(&zde, 0, sizeof(zde));
|
||||
|
@ -11,7 +11,7 @@
|
||||
#define STRICT
|
||||
#endif
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -299,7 +299,7 @@ TDC::TDC(wxWindow* owner) : _dc(NULL)
|
||||
|
||||
_font.SetPointSize(9); // Default font
|
||||
|
||||
SetClippingBox(NULL);
|
||||
SetClippingBox(NULL); // Reset clip area
|
||||
|
||||
_dirty = -1; // Absolutely force setting
|
||||
}
|
||||
@ -463,7 +463,7 @@ void TDC::SetClippingBox(const RCT* pRct)
|
||||
{
|
||||
if (pRct)
|
||||
{
|
||||
#if !wxCHECK_VERSION(2,3,2)
|
||||
#if wxCHECK_VERSION(2,3,0)
|
||||
if (_dc != NULL)
|
||||
_dc->DestroyClippingRegion();
|
||||
#endif
|
||||
@ -476,7 +476,9 @@ void TDC::SetClippingBox(const RCT* pRct)
|
||||
{
|
||||
if (_dc != NULL) // Inutile resettare il nulla!
|
||||
_dc->DestroyClippingRegion();
|
||||
xvt_rect_set_empty(&_clip);
|
||||
// xvt_rect_set_empty(&_clip);
|
||||
_clip.left = _clip.top = 0;
|
||||
_clip.right = _clip.bottom = 32000;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2216,7 +2218,7 @@ void xvt_image_destroy(XVT_IMAGE image)
|
||||
COLOR xvt_image_get_clut(XVT_IMAGE image, short index)
|
||||
{
|
||||
XVT_ASSERT(image != NULL);
|
||||
#if wxCHECK_VERSION(2,3,2)
|
||||
#if wxCHECK_VERSION(2,3,0)
|
||||
if (image)
|
||||
{
|
||||
const wxImage& bmp = ((const TXVT_IMAGE*)image)->Image();
|
||||
@ -2250,7 +2252,7 @@ void xvt_image_get_dimensions(XVT_IMAGE image, short *width, short *height)
|
||||
|
||||
XVT_IMAGE_FORMAT xvt_image_get_format(XVT_IMAGE image)
|
||||
{
|
||||
#if wxCHECK_VERSION(2,3,2)
|
||||
#if wxCHECK_VERSION(2,3,0)
|
||||
const wxImage& img = ((const TXVT_IMAGE*)image)->Image();
|
||||
return img.HasPalette() ? XVT_IMAGE_CL8 : XVT_IMAGE_RGB;
|
||||
#else
|
||||
@ -2260,7 +2262,7 @@ XVT_IMAGE_FORMAT xvt_image_get_format(XVT_IMAGE image)
|
||||
|
||||
short xvt_image_get_ncolors(XVT_IMAGE image)
|
||||
{
|
||||
#if wxCHECK_VERSION(2,3,2)
|
||||
#if wxCHECK_VERSION(2,3,0)
|
||||
int n = 0;
|
||||
if (image)
|
||||
{
|
||||
@ -2322,7 +2324,7 @@ XVT_IMAGE xvt_image_read_bmp(const char *filenamep)
|
||||
void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color)
|
||||
{
|
||||
wxImage& bmp = ((TXVT_IMAGE*)image)->Image();
|
||||
#if wxCHECK_VERSION(2,3,2)
|
||||
#if wxCHECK_VERSION(2,3,0)
|
||||
if (bmp.HasPalette())
|
||||
{
|
||||
const wxPalette& pal = bmp.GetPalette();
|
||||
@ -3302,7 +3304,10 @@ WINDOW xvt_win_create(WIN_TYPE wtype, RCT *rct_p, char *title, int menu_rid, WIN
|
||||
const wxString caption = title;
|
||||
const wxPoint pos(rct_p->left, rct_p->top);
|
||||
const wxSize size(rct_p->right-rct_p->left, rct_p->bottom-rct_p->top);
|
||||
long style = wxNO_3D | wxCLIP_CHILDREN | wxWANTS_CHARS /* | wxCLIP_SIBLINGS */;
|
||||
|
||||
long style = wxNO_3D | wxWANTS_CHARS |
|
||||
wxCLIP_CHILDREN | wxCLIP_SIBLINGS | // Clippa per bene
|
||||
wxPOPUP_WINDOW; // Inizialmente invisibile!
|
||||
|
||||
if (win_flags & WSF_VSCROLL)
|
||||
style |= wxVSCROLL;
|
||||
@ -3379,9 +3384,12 @@ long xvt_win_dispatch_event(WINDOW win, EVENT *event_p)
|
||||
|
||||
void xvt_win_release_pointer(void)
|
||||
{
|
||||
if (_mouse_trapper)
|
||||
if (_mouse_trapper != NULL)
|
||||
{
|
||||
_mouse_trapper->ReleaseMouse();
|
||||
// cap SHOULD be equal to _mouse_trapper :-)
|
||||
wxWindow* cap = _mouse_trapper->GetCapture();
|
||||
if (cap != NULL)
|
||||
cap->ReleaseMouse();
|
||||
_mouse_trapper = NULL;
|
||||
}
|
||||
}
|
||||
@ -3431,8 +3439,7 @@ void xvt_win_set_handler(WINDOW win, EVENT_HANDLER eh)
|
||||
void xvt_win_trap_pointer(WINDOW win)
|
||||
{
|
||||
CAST_WIN(win, w);
|
||||
if (_mouse_trapper != NULL)
|
||||
_mouse_trapper->ReleaseMouse();
|
||||
xvt_win_release_pointer();
|
||||
w.CaptureMouse();
|
||||
_mouse_trapper = &w;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user