Patch level :AGA 2.0 362

Files correlati     :librerie
Ricompilazione Demo : [ ]
Commento            :corretti errori di compilazione nelle librerie


git-svn-id: svn://10.65.10.50/trunk@10689 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2002-12-18 10:56:10 +00:00
parent 10aff8021c
commit 20e9d80cde
23 changed files with 307 additions and 872 deletions

View File

@ -48,7 +48,7 @@ bool xvt_running()
{ return _xvt_running; }
// Ritorna il nome della ditta che vende il programma attuale
HIDDEN const char* prassi_spa(TString& firm)
HIDDEN const char* producer_name(TString& firm)
{
TConfig ini("install.ini", "Main");
firm = ini.get("Producer");
@ -176,7 +176,7 @@ void TBanner::handler(WINDOW win, EVENT* ep)
set_font(XVT_FFN_TIMES);
TString spa;
t = (char*)prassi_spa(spa);
t = (char*)producer_name(spa);
w = xvt_dwin_get_text_width(win, t, -1);
x = (r.right-r.left-w)>>1; y = BIGY;
xvt_dwin_draw_text(win, x, y, t, -1);
@ -243,7 +243,7 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
// Setta la caption della task window
TString cap;
TString firm;
cap << _application->get_module_name() << " - " << prassi_spa(firm);
cap << _application->get_module_name() << " - " << producer_name(firm);
TTemp_window tw(win);
tw.set_caption(cap);
@ -320,7 +320,16 @@ long TApplication::handler(WINDOW win, EVENT* ep)
case M_HELP_CONTENTS:
case M_HELP_SEARCH:
case M_HELP_HELPONHELP:
os_exec_help_command(ep->v.cmd.tag, name());
{
TFilename n = "campo";
TString16 module = name(); module.cut(2);
if (module != "ba")
n.insert(module);
FILE_SPEC fs; memset(&fs, 0, sizeof(FILE_SPEC));
strcpy(fs.name, n);
XVT_HELP_INFO hi = xvt_help_open_helpfile(&fs, 0);
xvt_help_process_event(hi, win, ep);
}
break;
default:
if (ep->v.cmd.tag > MAX_MENU_TAG)
@ -479,6 +488,8 @@ void TApplication::terminate()
dictionary_close();
xvt_help_close_helpfile(NULL_HELP_INFO);
customize_controls(FALSE); // Rilascio eventuali DLL
}
@ -492,7 +503,7 @@ const char* TApplication::get_module_name() const
bool ok = FALSE;
for (int aut = 0; scanner.line() != ""; aut++)
if (strncmp(scanner.token(), (const char *)_name, 2) == 0)
if (strncmp(scanner.token(), _name, 2) == 0)
{ ok = TRUE; break; }
module = scanner.token().mid(3);
if (ok && check_autorization())
@ -751,13 +762,12 @@ void TApplication::enable_menu_item(
bool TApplication::has_module(int module, int checktype) const
{
bool ok = TRUE;
#ifndef _DEMO_
// Ignora i bit di attivazione della chiave programmatori (sempre attivati)
if (get_serial_number() == 0)
checktype = CHK_USER;
if (checktype == CHK_ALL || checktype == CHK_DONGLE)
ok = dongle().active(module);
#endif
@ -1083,4 +1093,4 @@ bool TSkeleton_application::menu(MENU_TAG tag)
if (tag == BAR_ITEM(1))
main_loop();
return FALSE;
}
}

View File

@ -12,7 +12,7 @@ ai Archiviazione Immagini
ce Cespiti
ad Anagrafici Dichiarazioni
sc Saldaconto
mu Multiutenza
sr Servers multiutenza
cm Gestione Commesse
73 Modello 730
at AVIS Provinciale

View File

@ -510,9 +510,9 @@ bool TDongle::network_login(bool test_all_keys)
TConfig ini(CONFIG_INSTALL, "Server");
const char* server = ini.get("Dongle");
const char* guest = "******";
const TString appname = main_app().name();
const TString16 appname = main_app().name();
const char* utente = (!xvt_running() && appname == "ba0100") ? guest : user();
const bool ok = rpc_UserLogin(server, utente, "******", appname);
if (ok)
{
@ -559,7 +559,7 @@ bool TDongle::login(bool test_all_keys)
TDongleHardware hw = _hardware;
if (hw == _dongle_unknown)
{
if (os_dongle_server_running())
if (can_try_server())
{
hw = _dongle_network;
}
@ -588,16 +588,15 @@ bool TDongle::login(bool test_all_keys)
{
// retry login for various dongles ...
const int use_server = can_try_server();
if (hw != _dongle_network && use_server)
ok = network_login(test_all_keys);
if (!ok && use_server != 3)
if (use_server != 3) // Non sono obbligato ad usare il Dongle Server
{
if (!ok && hw != _dongle_eutron)
ok = eutron_login(test_all_keys);
if (!ok && hw != _dongle_hardlock)
ok = hardlock_login(test_all_keys);
}
if (ok)
if (ok)
{
TConfig ini(CONFIG_INSTALL, "Main");
ini.set("Donglehw",(int)_hardware);

View File

@ -6,11 +6,14 @@
void fraction::simplify()
{
__int64 div = mcd(_num, _den);
if (div > 1)
if (_den > 1 && _num > 1)
{
_num /= div;
_den /= div;
__int64 div = mcd(_num, _den);
if (div > 1)
{
_num /= div;
_den /= div;
}
}
if (_den < 0)
{
@ -97,7 +100,7 @@ void fraction::build_fraction (const char *s)
}
}
n.strip(",.-+/[]");
sscanf(n, "%Ld", &_num);
sscanf(n, "%I64d", &_num);
if (len_periodo > 0)
{
_den = 9;
@ -133,6 +136,15 @@ fraction::fraction(const fraction & b)
_den = b._den;
}
int fraction::sign() const
{
if ( _num == 0 || _den == 0)
return 0;
if ( _num < 0)
return _den < 0 ? 1 : -1;
return _den < 0 ? -1 : 1;
}
fraction& fraction::operator =(const fraction & b)
{
_num = b._num;
@ -239,16 +251,16 @@ fraction operator - (
// @doc EXTERNAL
// @func real | operator * | Moltiplica due numeri reali
// @func real | operator * | Moltiplica due frazioni
//
// @rdesc Ritorna il valore della moltiplicazione
fraction operator *(
const fraction & a, // @parm Prima frazione da moltiplicare
const fraction & b) // @parm Seconda frazione da moltiplicare
// @syntax operator *(const real &a, const real &b);
// @syntax operator *(double a, const real &b);
// @syntax operator *(const real &a, double b);
// @syntax operator *(const fraction & a, const fraction & b);
// @syntax operator *(const real & a, const fraction & b);
// @syntax operator *(const fraction & a, const real & b);
{
fraction f = a;
@ -258,22 +270,79 @@ fraction operator *(
// @doc EXTERNAL
// @func real | operator / | Divide due numeri reali
// @func real | operator * | Moltiplica una frazione e un intero
//
// @rdesc Ritorna il valore della moltiplicazione
fraction operator *(
const fraction & a, // @parm frazione da moltiplicare
__int64 b) // @parm intero da moltiplicare
// @syntax operator -(__int64 a, const fraction & b);
// @syntax operator -(const fraction & a, __int64 b);
{
fraction f;
f._num = a._num * b;
f._den = a._den;
f.simplify();
return f;
}
// @doc EXTERNAL
// @func real | operator / | Divide due frazioni
//
// @rdesc Ritorna il valore della divisione
fraction operator / (
const fraction & a, // @parm Prima frazione da dividere
const fraction & b) // @parm Seconda frazione da dividere
// @syntax operator /(const real &a, const real &b);
// @syntax operator /(double a, const real &b);
// @syntax operator /(const real &a, double b);
// @syntax operator /(const fraction & a, const fraction & b);
// @syntax operator /(const real & a, const fraction & b);
// @syntax operator /(const fraction & a, const real & b);
{
fraction f = a;
f /= b;
return f;
}
// @doc EXTERNAL
// @func real | operator * | Divide una frazione per un intero
//
// @rdesc Ritorna il valore della divisione
fraction operator /(
const fraction & a, // @parm frazione da dividere
__int64 b) // @parm intero divisore
// @syntax operator /(const fraction & a, __int64 b);
{
fraction f;
f._num = a._num;
f._den = a._den * b;
f.simplify();
return f;
}
// @doc EXTERNAL
// @func real | operator * | Divide una frazione per un intero
//
// @rdesc Ritorna il valore della divisione
fraction operator /(
__int64 a, // @parm intero da dividere
const fraction & b) // @parm frazione divisore
// @syntax operator /(__int64 a, const fraction & b);
{
fraction f;
f._num = b._den * a;
f._den = b._num ;
f.simplify();
return f;
}
// @doc EXTERNAL
// @func bool | operator <gt> | Controlla se un reale e' maggiore di un altro

View File

@ -25,7 +25,10 @@ class fraction : public TObject
{
// @access:(INTERNAL) Private Member
// @cmember:(INTERNAL) Numero fractione
friend fraction operator *(const fraction & a, __int64 b);
friend fraction operator /(const fraction & a, __int64 b);
friend fraction operator /(__int64 a, const fraction & b);
__int64 _num;
__int64 _den;
@ -41,8 +44,8 @@ protected:
public:
// @cmember Controlla se si tratta di un fractione uguale 0 (TRUE se 0)
bool is_zero() const { return _num == 0;}
// @cmember Ritorna il segno del fractione
int sign() const { return (_num > 0) * (_den > 0);}
// @cmember Ritorna il segno del fraction
int sign() const ;
// @cmember Trasforma il fractione in intero (operator int era troppo pericoloso)
__int64 integer() const { return _num / _den;}
@ -67,7 +70,8 @@ public:
// @cmember Costruttore
fraction();
// @cmember Costruttore
fraction(const real & b) { build_fraction(b.string()); }
fraction(const real & b) { build_fraction(b.stringa()); }
fraction(__int64 num, __int64 den = 1) : _num(num), _den(den) { simplify();}
// @cmember Costruttore
fraction(const fraction& b) ;
// @cmember Costruttore
@ -84,15 +88,23 @@ public:
fraction operator +(const fraction& a, const fraction& b) ;
inline fraction operator +(const real& a, const fraction& b) { return ::operator +((fraction)a, b);}
inline fraction operator +(const fraction& a, const real& b) { return ::operator +(b, a);}
inline fraction operator +(const fraction& a, __int64 b) { return ::operator +(a, (fraction)b);}
inline fraction operator +(__int64 a, const fraction& b) { return ::operator +(b, a);}
fraction operator -(const fraction& a, const fraction& b) ;
inline fraction operator -(const real& a, const fraction& b) { return ::operator -((fraction)a, b);}
inline fraction operator -(const fraction& a, const real& b) { return ::operator -(a, (fraction)b);}
inline fraction operator -(const fraction& a, __int64 b) { return ::operator -(a, (fraction)b);}
inline fraction operator -(__int64 a, const fraction& b) { return ::operator -((fraction)a, b);}
fraction operator *(const fraction& a, const fraction& b) ;
inline fraction operator *(const real& a, const fraction& b) { return ::operator *((fraction)a, b);}
inline fraction operator *(const fraction& a, const real& b) { return ::operator *(b, a);}
fraction operator *(const fraction& a, __int64 b);
inline fraction operator *(__int64 a, const fraction& b) { return ::operator *(b, a);}
fraction operator /(const fraction& a, const fraction& b) ;
inline fraction operator /(const real& a, const fraction& b) { return ::operator /((fraction)a, b);}
inline fraction operator /(const fraction& a, const real& b) { return ::operator /(a, (fraction)b);}
fraction operator /(const fraction& a, __int64 b);
fraction operator /(__int64 a, const fraction& b);
bool operator <(const fraction& a, const fraction& b) ;
inline bool operator <(const real& a, const fraction& b) { return ::operator < (a, (real)b);}

View File

@ -12,14 +12,15 @@
#include <execp.h>
#include <expr.h>
#include <extcdecl.h>
#include <mailbox.h>
#include <mailbox.h>
#include <memo.h>
#include <postman.h>
#include <prefix.h>
#include <progind.h>
#include <relation.h>
#include <scanner.h>
#include <utility.h>
#include <memo.h>
#include <tabutil.h>
#include <varrec.h>
@ -1356,7 +1357,7 @@ int TBaseisamfile::_close()
return err;
}
int TBaseisamfile::is_valid()
int TBaseisamfile::is_valid(bool exclusive)
{ // Ritorna NOERR se il file puo' essere aperto senza errori
CHECKD(_isam_handle == 0, "Can't reopen file ", _logicnum);
TFilename filename;

View File

@ -410,7 +410,7 @@ public:
int status() const
{ return _lasterr; }
// @cmember Controlla se il file e' valido (ritorna 0 se il file e' valido)
int is_valid();
int is_valid(bool exclusive);
// @cmember Restituisce se il file è ordinato con indice esterno (default:FALSE)
virtual bool is_sorted()
{return FALSE;}

View File

@ -1,3 +1,4 @@
#include <stdlib.h>
#include <time.h>
#include <checks.h>
@ -210,8 +211,34 @@ unsigned rpc_DongleYear()
return (unsigned)IntCall();
}
static unsigned int CreatePassword(TString& pass)
{
const int BASE = 19;
srand(clock());
unsigned int num = 0;
do
{
num = 883*rand();
while (num % 883 != 0) // Possible overflow
num++;
pass.cut(0);
char str[2] = { '\0', '\0' };
while (num > 0)
{
unsigned int k = num % BASE;
if (k < 10)
str[0] = '0'+k;
else
str[0] = 'A'+k-10;
num /= BASE;
pass.insert(str);
}
} while (pass.len() < 6);
return num;
}
bool rpc_UserLogin(const char* server, const char* user,
const char* password, const char* application)
const char* dummy_password, const char* application)
{
if (_client == NULL)
{
@ -236,14 +263,15 @@ bool rpc_UserLogin(const char* server, const char* user,
if (_connection)
{
TString cmd(32);
cmd << "UserLogin(" << user << ")";
TString16 password;
CreatePassword(password);
_rpc_call.format("UserLogin(%s,%s,%s)", user, password, application);
bool logged = FALSE;
bool connected = _client->RequestBool(_connection, _rpc_call, logged) != 0;
_rpc_call.format("UserLogin(%s,%s,%s)", user, (const char*)password, application);
long answer = 0;
bool connected = _client->RequestInteger(_connection, _rpc_call, answer) != 0;
if (connected)
{
const bool logged = (answer == 1) || ((answer % 883 == 0) && (answer != 0));
if (!logged)
{
connected = FALSE;
@ -276,7 +304,8 @@ bool rpc_UserLogout()
{
if (_connection)
{
rpc_Call("UserLogout()");
_rpc_call.format("UserLogout(%s)", (const char*)user());
rpc_Call(_rpc_call);
_client->RemoveConnection(_connection);
_connection = 0;
}

View File

@ -828,9 +828,22 @@ bool TMask::on_key(
break;
case K_F1:
{
char key[32];
char key[_MAX_FNAME];
_splitpath(source_file(), NULL, NULL, key, NULL);
os_exec_help_command(M_HELP_ONCONTEXT, key);
EVENT e; memset(&e, 0, sizeof(e));
e.type = E_HELP;
e.v.help.tag = M_HELP_ONCONTEXT;
e.v.help.obj = win();
e.v.help.tid = (long)key;
TFilename n = "campo";
TString16 module = key; module.cut(2);
if (module != "ba")
n.insert(module);
FILE_SPEC fs; memset(&fs, 0, sizeof(FILE_SPEC));
strcpy(fs.name, n);
XVT_HELP_INFO hi = xvt_help_open_helpfile(&fs, 0);
xvt_help_process_event(hi, win(), &e);
}
break;
case K_F12:

View File

@ -4123,7 +4123,7 @@ const char* TCurrency_field::win2raw(const char* data) const
num = e.as_real();
}
else
num = real::ita2eng(str);
num = real(str);
if (num.is_zero())
str.cut(0);
else

View File

@ -1599,8 +1599,8 @@ protected: // TObject
bool is_kind_of(word cid) const;
protected: // TWindowed_field
virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent);
virtual TField_window* create_window(int x, int y, int dx, int dy,
WINDOW parent);
public:
TTree* tree() const;
void set_tree(TTree* t);
@ -1609,7 +1609,8 @@ public:
void show_leaves(bool yes = TRUE) { hide_leaves(!yes); }
bool select_current();
bool goto_selected();
void set_header(const char* header);
void set_header(const char* head);
TTree_field(TMask* m) : TWindowed_field(m) { }
virtual ~TTree_field() { }

View File

@ -15,7 +15,7 @@
#define CEAUT 11
#define ADAUT 12
#define SCAUT 13
#define MUAUT 14
#define SRAUT 14
#define CMAUT 15
#define M73AUT 16
#define ATAUT 17

View File

@ -24,7 +24,6 @@ bool os_test_disk_free_space(const char* path, unsigned long filesize);
unsigned long os_get_disk_size(const char* path);
COLOR os_choose_color(COLOR col, WINDOW win);
void os_exec_help_command(MENU_TAG tag, const char* key);
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild);
unsigned long os_execute_in_window(const TFilename& path, WINDOW win);
bool os_file_exist(const char* path);
@ -49,7 +48,6 @@ bool os_open_spool_row(const char* device);
bool os_spool_row(const char* str);
bool os_close_spool_row();
bool os_get_image_editor_path(TFilename& name);
bool os_dongle_server_running();
bool os_test_network_version();

View File

@ -1,733 +0,0 @@
#define XVT_INCL_NATIVE
#define XI_INTERNAL
#include <xi.h>
#include <os_dep.h>
#include <commdlg.h>
#include <toolhelp.h>
#include <spool.h>
#include <ver.h>
#ifndef ATTR_WIN_USE_CTL3D
#include <ctl3d.h>
#endif
#include <ctype.h>
#include <dos.h>
#include <applicat.h>
#include <colors.h>
#include <config.h>
#include <mask.h>
extern "C" { WINDOW xvtwi_hwnd_to_window(HWND); }
///////////////////////////////////////////////////////////
// Win16 event hook
///////////////////////////////////////////////////////////
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
HTASK _waiting_for = 0xFFFF;
extern "C" { WINDOW xvtwi_hwnd_to_window(HWND); }
HIDDEN BOOLEAN event_hook(HWND hwnd,
UINT msg,
UINT wparam,
ULONG lparam,
long* ret)
{
switch(msg)
{
#ifndef ATTR_WIN_USE_CTL3D
case WM_SYSCOLORCHANGE:
Ctl3dColorChange();
break;
#endif
case WM_MENUCHAR:
if (wparam > ' ' && wparam <= 'z')
{
WINDOW win = cur_win();
if (win != NULL_WIN)
{
const KEY key = toupper(wparam)+K_CTRL;
dispatch_e_char(win, key);
*ret = 2 << 16;
}
}
break;
case WM_KEYDOWN:
if (wparam == VK_F1)
{
if ((lparam & (1<<29)) == 0) // Il tasto alt non e' premuto
{
KEY k = K_F1;
int sc = GetAsyncKeyState(VK_CONTROL); // Stato del tasto control
if (sc & 0x8000) k += K_CTRL;
int ss = GetAsyncKeyState(VK_SHIFT); // Stato del tasto shift
if (ss & 0x8000) k += K_SHIFT;
WINDOW win = cur_win();
if (win != NULL_WIN)
dispatch_e_char(win, k);
}
}
break;
case WM_DROPFILES:
if (cur_win() != NULL_WIN)
{
WINDOW win = xvtwi_hwnd_to_window(hwnd);
if (win != NULL)
{
EVENT e;
e.type = E_USER;
e.v.user.id = E_DROP_FILES;
e.v.user.ptr = (void*)wparam;
xvt_win_dispatch_event(win, &e);
}
}
break;
default:
if (msg == WM_WAKEUP)
{
if (wparam == _waiting_for)
_waiting_for = 0xFFFF;
}
break;
}
return TRUE; // Continua col processo normale
}
///////////////////////////////////////////////////////////
// Operating system dependent functions
///////////////////////////////////////////////////////////
bool os_allow_another_instance()
{
NFCHECK("Bisogna implementare la allow_another_instance");
return TRUE;
}
COLOR os_choose_color(COLOR col, WINDOW win)
{
CHOOSECOLOR cc;
memset(&cc, 0, sizeof(cc)); // Azzera struttura
if (win == NULL_WIN) win = TASK_WIN; // Sceglie una finestra valida
HWND hwnd = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
HDC hdc = GetDC(hwnd);
// Legge la palette di sistema
PALETTEENTRY* pe = NULL;
int max_entries = 0;
if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
{
max_entries = GetDeviceCaps(hdc, SIZEPALETTE);
pe = new PALETTEENTRY[max_entries];
GetSystemPaletteEntries(hdc, 0, max_entries, pe);
}
ReleaseDC(hwnd, hdc);
// Definisce i 16 colori customizzabili
unsigned long custom_colors[16];
for (int c = 0; c < 16; c++)
{
if (pe)
{
const PALETTEENTRY& e = pe[c < 8 ? c : max_entries - 16 + c];
custom_colors[c] = RGB(e.peRed, e.peGreen, e.peBlue);
}
else
{
const unsigned char val = (c & 0x8) ? 255 : 127;
const unsigned char red = (c & 0x1) ? val : 0;
const unsigned char green = (c & 0x2) ? val : 0;
const unsigned char blue = (c & 0x4) ? val : 0;
custom_colors[c] = RGB(red, green, blue);
}
}
if (pe)
{
delete pe;
pe = NULL;
}
cc.lStructSize = sizeof(cc); // Setta dimensioni
cc.hwndOwner = hwnd; // Setta finestra padre
cc.rgbResult = RGB(XVT_COLOR_GET_RED(c), XVT_COLOR_GET_GREEN(c), XVT_COLOR_GET_BLUE(c));
cc.lpCustColors = custom_colors; // Fissa colori custom
cc.Flags = CC_RGBINIT; // Usa col come primo colore
if (ChooseColor(&cc) != 0)
col = RGB2COLOR(GetRValue(cc.rgbResult), GetGValue(cc.rgbResult), GetBValue(cc.rgbResult));
else
col = COLOR_INVALID;
return col;
}
bool os_deny_another_instance()
{
return TRUE;
}
bool os_destroy_native_icon(unsigned icon)
{
return DestroyIcon((HICON)icon) != 0;
}
void os_draw_native_icon(WINDOW win, const RCT& rct, unsigned icon)
{
HDC hdc = (HDC)xvt_vobj_get_attr(win, ATTR_NATIVE_GRAPHIC_CONTEXT);
int x = (rct.right + rct.left - 32) / 2;
int y = (rct.bottom + rct.top - 32) / 2;
DrawIcon(hdc, x, y, (HICON)icon);
}
unsigned long os_get_free_memory()
{
return GetFreeSpace(0);
}
bool os_is_removable_drive(const char* path)
{
bool yes = isalpha(path[0]) && path[1] == ':';
if (yes)
yes = GetDriveType(toupper(path[0]) - 'A') == DRIVE_REMOVABLE;
return yes;
}
bool os_is_network_drive(const char* path)
{
bool yes = isalpha(path[0]) && path[1] == ':';
if (yes)
yes = GetDriveType(toupper(path[0]) - 'A') == DRIVE_REMOTE;
return yes;
}
bool os_is_fixed_drive(const char* path)
{
bool yes = isalpha(path[0]) && path[1] == ':';
if (yes)
yes = GetDriveType(toupper(path[0]) - 'A') == DRIVE_FIXED;
return yes;
}
bool os_test_disk_free_space(const char* path, unsigned long filesize)
{
int disk = 0;
if (path && *path && path[1] == ':')
{
const char letter = toupper(path[0]);
disk = letter - 'A' + 1;
}
bool space_ok = FALSE;
struct _diskfree_t drive;
if (_dos_getdiskfree(disk, &drive) == 0)
{
const unsigned requested_clusters = unsigned(filesize / drive.sectors_per_cluster / drive.bytes_per_sector) + 1;
space_ok = requested_clusters <= drive.avail_clusters;
}
return space_ok;
}
unsigned long os_get_disk_size(const char* path)
{
int disk = 0;
if (path && *path && path[1] == ':')
{
const char letter = toupper(path[0]);
disk = letter - 'A' + 1;
}
unsigned long bytes = 0;
struct _diskfree_t drive;
if (_dos_getdiskfree(disk, &drive) == 0)
{
bytes = drive.total_clusters;
bytes *= drive.sectors_per_cluster;
bytes *= drive.bytes_per_sector;
}
return bytes;
}
void os_exec_help_command(MENU_TAG tag, const char* key)
{
TFilename hlp("prassi.hlp");
TString mod(key);
if (mod.not_empty())
{
mod.cut(2); mod.lower();
if (mod != "ba")
hlp.insert(mod, 0);
}
else
{
if (tag == M_HELP_ONCONTEXT)
tag = M_HELP_CONTENTS;
}
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
switch(tag)
{
case M_HELP_CONTENTS: WinHelp(hwnd, hlp, HELP_CONTENTS, 0); break;
case M_HELP_SEARCH: WinHelp(hwnd, hlp, HELP_PARTIALKEY, (DWORD)""); break;
case M_HELP_HELPONHELP: WinHelp(hwnd, hlp, HELP_HELPONHELP, 0); break;
case M_HELP_ONCONTEXT:
if (hlp.exist())
{
struct MULTIGUY
{
UINT mkSize;
BYTE mkKeylist;
char mkKeyphrase[16];
} mk;
mk.mkSize = sizeof(MULTIGUY);
mk.mkKeylist = 'M';
strcpy(mk.mkKeyphrase, key);
WinHelp(hwnd, hlp, HELP_MULTIKEY, (DWORD)&mk);
}
break;
default: break;
}
}
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild)
{
word exitcode = ::WinExec(path, showchild ? SW_SHOWNORMAL : SW_HIDE);
if (exitcode < 32)
{
switch (exitcode)
{
case 0:
exitcode = 8;
case 8:
error_box("Memoria o risorse insufficienti per eseguire '%s'", (const char*)path); break;
default:
error_box("Impossibile eseguire '%s': %d", (const char*)path, exitcode); break;
}
return exitcode;
}
if (sync)
{
bool was_maximized = FALSE;
if (iconizetask)
{
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
if (hwnd)
{
was_maximized = IsZoomed(hwnd);
TTemp_window tw(TASK_WIN);
tw.iconize();
tw.deactivate();
}
}
const char* szModule = path.name();
HTASK child = NULL;
TASKENTRY te; te.dwSize = sizeof(TASKENTRY);
for (bool ok = TaskFirst(&te); ok; ok = TaskNext(&te))
if (te.hInst == (HINSTANCE)exitcode ||
stricmp(te.szModule, szModule) == 0)
{
child = te.hTask;
break;
}
// Warning! child could be NULL if you run that beast called Foxpro
_waiting_for = child;
for (byte i = 0; _waiting_for == child; i++)
{
// Esegue il controllo solo ogni 256 cicli
if (i == 0 && ok && TaskFindHandle(&te, child) == FALSE)
{
_waiting_for = 0xFFFF; // Annulla attesa del processo
break;
}
xvt_app_process_pending_events();
}
if (iconizetask && TASK_WIN)
{
TTemp_window tw(TASK_WIN);
if (was_maximized)
tw.maximize(); // Non e' piu' detto che sia massimizzata!
else
os_restore_window(tw.win());
tw.activate();
}
xvt_app_process_pending_events();
}
xvt_statbar_refresh();
return 0;
}
bool os_spawn_by_menu()
{
TASKENTRY te; te.dwSize = sizeof(TASKENTRY);
HTASK ct = GetCurrentTask();
TaskFindHandle(&te, ct);
TaskFindHandle(&te, te.hTaskParent);
bool yes = stricmp(te.szModule, "BA0") == 0 ||
#ifdef DBG
stricmp(te.szModule, "CVW4") == 0 ||
stricmp(te.szModule, "MSVC") == 0 ||
#endif
stricmp(te.szModule, "Explorer") == 0 ||
stricmp(te.szModule, "PROGMAN") == 0;
return yes;
}
int os_get_printer_names(TToken_string& t)
{
char* buf = t.get_buffer(4096); // ammazzao'
GetProfileString ("devices", NULL, "", buf, t.size());
for (int i = 0; i < t.size(); i++)
{
if (buf[i] == '\0')
{
if (buf[i+1] != '\0') buf[i] = '|';
else break;
}
}
return t.items();
}
bool os_set_default_printer(const char* name)
{
CHECK(name && *name > ' ', "Null printer name");
TString pdev(name);
if (pdev.find(',') < 0)
{
TString szDevice(256);
GetProfileString ("devices", pdev, "", szDevice.get_buffer(), szDevice.size());
pdev << ',' << szDevice;
}
bool ok = WriteProfileString("windows", "device", pdev) != 0;
return ok;
}
bool os_get_default_printer(TString& name)
{
char* buf = name.get_buffer(128);
bool ok = GetProfileString ("windows", "device", ",,,", buf, name.size()) != 0;
return ok;
}
bool os_get_image_editor_path(TFilename& name)
{
// where is EasyDoc installed?
GetPrivateProfileString("Easydoc", "Path", "\\EASYDOC",
name.get_buffer(), name.size(),
"EasyDoc.ini");
// You're unlucky there is no EasyDoc
if (name.empty())
return FALSE;
// paste EasyDoc path
name.add("easydoc.exe");
// is EasyDoc present?
bool ok = name.exist();
return ok;
}
os_type os_get_type()
{
const DWORD winflags = GetWinFlags();
if (winflags & 0x4000)
return os_WindowsNT;
const DWORD osver = GetVersion();
const DWORD winver = LOWORD(osver);
const BYTE majwinver = LOBYTE(winver);
const BYTE minwinver = HIBYTE(winver);
if (majwinver == 3 && minwinver == 95)
{
const DWORD dosver = HIWORD(osver);
const BYTE majdosver = LOBYTE(dosver); // Should be 7 anyway
const BYTE mindosver = HIBYTE(dosver);
return (majdosver > 7 || (majdosver == 7 && mindosver >= 10)) ? os_Windows98 : os_Windows95;
}
else
{
if (majwinver == 4)
return os_WindowsME;
}
return os_Windows;
}
void os_post_menu_event(WINDOW win, MENU_TAG tag)
{
HWND w = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
PostMessage(w, WM_COMMAND, tag, 0L);
}
void os_set_event_hook()
{
xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, (long)event_hook);
#ifdef ATTR_WIN_USE_CTL3D
xvt_vobj_set_attr(NULL_WIN, ATTR_WIN_USE_CTL3D, TRUE);
#endif
long twin_style = WSF_ICONIZABLE | WSF_CLOSE | WSF_SIZE;
const int scx = GetSystemMetrics(SM_CXSCREEN);
const int scy = GetSystemMetrics(SM_CYSCREEN);
static RCT rct;
if (scx <= 640 && os_get_type() >= os_Windows95)
{
const int bcx = GetSystemMetrics(SM_CXFRAME);
const int bcy = GetSystemMetrics(SM_CYFRAME);
rct.left = -bcx;
rct.top = GetSystemMetrics(SM_CYCAPTION)-bcy-1;
rct.right = scx+bcx;
rct.bottom = scy+bcy;
xvt_vobj_set_attr(NULL_WIN, ATTR_WIN_PM_TWIN_STARTUP_RCT, long(&rct));
}
else
{
TConfig cfg(CONFIG_USER, "Colors");
const int res = cfg.get_int("Resolution");
if (res >= 640 && res < scx)
{
const int width = res + 2*GetSystemMetrics(SM_CXFRAME);
const int height = (res * 3) / 4 + 2*GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYCAPTION) - 1;
const int deltax = (scx - width) / 2;
const int deltay = (scy - height) / 2;
rct.left = deltax;
rct.top = deltay;
rct.right = deltax + width;
rct.bottom = deltay + height;
xvt_vobj_set_attr(NULL_WIN, ATTR_WIN_PM_TWIN_STARTUP_RCT, long(&rct));
}
else
twin_style |= WSF_MAXIMIZED;
}
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE, twin_style);
}
void os_wake_up_caller()
{
const HTASK ht = GetCurrentTask();
// SendMessage(HWND_BROADCAST, WM_WAKEUP, (WPARAM)ht, 0L);
PostMessage(HWND_BROADCAST, WM_WAKEUP, (WPARAM)ht, 0L);
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
WinHelp(hwnd, "prassi.hlp", HELP_QUIT, 0L);
// do_events(); non si puo' fare qui
}
bool os_file_exist(const char* file)
{
HFILE hf = _lopen(file, READ);
bool ok = hf != HFILE_ERROR;
if (ok)
_lclose(hf);
return ok;
}
bool os_open_spool_row(const char* device)
{
return TRUE;
}
bool os_spool_row(const char* str)
{
return SpoolRow((char*)str, strlen(str)) != 0;
}
bool os_close_spool_row()
{
return TRUE;
}
void os_iconize_window(WINDOW win)
{
HWND hwnd = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
ShowWindow(hwnd, SW_MINIMIZE);
}
void os_maximize_window(WINDOW win)
{
HWND hwnd = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
HWND twin = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
if (hwnd != twin)
{
HWND pare = GetParent(hwnd);
RECT rct; GetClientRect(pare, &rct);
if (pare == twin)
rct.bottom -= 24;
SetWindowPos(hwnd, pare,
rct.left, rct.top, rct.right, rct.bottom,
SWP_NOZORDER);
}
else
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
}
void os_restore_window(WINDOW win)
{
HWND hwnd = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
ShowWindow(hwnd, SW_NORMAL);
}
bool os_dongle_server_running()
{
ATOM a = GlobalFindAtom("DONGLE_SERVER_ATOM");
return a != 0;
}
HIDDEN const char* _file_to_find = NULL;
struct TFindWindowInfo
{
HINSTANCE _instance;
TFilename _file;
HWND _hwnd;
TFindWindowInfo() : _instance(NULL), _hwnd(NULL) { }
};
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
TFindWindowInfo* w = (TFindWindowInfo*)lParam;
HINSTANCE inst = GetWindowWord(hwnd, GWW_HINSTANCE);
if (inst == w->_instance)
{
const LONG style = GetWindowLong(hwnd, GWL_STYLE);
if ((style & WS_CAPTION) != 0) // Ha la caption?
{
w->_hwnd = hwnd;
return FALSE;
}
return TRUE;
}
TString256 str;
GetWindowText(hwnd, str.get_buffer(), str.size());
str.upper();
if (str.find(w->_file) >= 0)
{
w->_hwnd = hwnd;
return FALSE;
}
return TRUE;
}
unsigned long os_execute_in_window(const TFilename& path, WINDOW win)
{
const word exitcode = WinExec(path, SW_SHOWNORMAL);
if (exitcode < 32)
return 0;
TFindWindowInfo w;
w._instance = exitcode;
const int space = path.find(' ');
if (space > 0)
w._file = path.mid(space+1);
else
w._file = path;
w._file = w._file.name();
w._file.ext("");
w._file.upper();
const clock_t start = clock();
while (w._hwnd == NULL && (clock() - start) < 10*CLOCKS_PER_SEC)
{
xvt_app_process_pending_events();
FARPROC farproc = MakeProcInstance(FARPROC(EnumWindowsProc), NULL);
EnumWindows(farproc, LPARAM(&w));
FreeProcInstance(farproc);
}
if (w._hwnd != NULL) // L'ho trovata!
{
RCT rct; xvt_vobj_get_client_rect(win, &rct);
HWND nat = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
SetParent(w._hwnd, nat);
// LONG style = GetWindowLong(w._hwnd, GWL_STYLE);
// style |= WS_CHILD;
// SetWindowLong(w._hwnd, GWL_STYLE, style);
const int fx = GetSystemMetrics(SM_CXFRAME);
const int fy = GetSystemMetrics(SM_CYFRAME);
int cy = GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYBORDER);
if (GetMenu(w._hwnd) != NULL)
cy += GetSystemMetrics(SM_CYMENU);
SetWindowPos(w._hwnd, nat, -fx, -fy-cy, rct.right+2*fx, rct.bottom+cy+2*fy, SWP_NOZORDER);
}
return w._hwnd;
}
bool os_test_network_version()
{
if (os_get_type() == os_Windows95)
{
const char* VREDIRNAME = "vredir.vxd";
DWORD handle;
const DWORD dwSize = GetFileVersionInfoSize(VREDIRNAME,&handle);
if (dwSize)
{
BYTE infoBuffer[512];
GetFileVersionInfo(VREDIRNAME,handle,dwSize,infoBuffer);
long *language;
void * lpBuffer;
char szName[128];
UINT Size;
if (VerQueryValue(infoBuffer, "\\VarFileInfo\\Translation", (void **)&language, &Size) && Size!=0)
{
sprintf(szName, "\\StringFileInfo\\%04x%04x\\FileVersion",LOWORD(*language), HIWORD(*language));
if (VerQueryValue(infoBuffer, szName, &lpBuffer, &Size) && Size!=0)
{
TToken_string v((const char *)lpBuffer,'.');
int subver=atoi(v.get(2));
if (subver >=1111 && subver <=1115)
return error_box("La versione %s del driver di rete '%s' contiene un errore riconosciuto da Microsoft.\nConsultare il vostro tecnico per aggiornare il sistema operativo.",(const char *)lpBuffer, VREDIRNAME);
else
return TRUE;
}
}
}
//VREDIR.VXD puo' non esistere; inutile la segnalazione seguente.
//message_box("Impossibile determinare la versione del driver di rete '%s'",VREDIRNAME);
}
return TRUE;
}
void os_sleep(long m)
{
clock_t fine = ((m * CLOCKS_PER_SEC)/1000) + clock();
while (fine > clock())
do_events();
}
void os_beep(int severity)
{
switch (severity)
{
case 0: MessageBeep(MB_OK); break;
case 1: MessageBeep(MB_ICONEXCLAMATION); break;
default: MessageBeep(MB_ICONSTOP); break;
}
}

View File

@ -172,47 +172,37 @@ bool os_is_fixed_drive(const char* path)
return dt == DRIVE_FIXED;
}
bool os_test_disk_free_space(const char* path, unsigned long filesize)
{
/*
Works on WinNT and Win95 OSR2 Only!
ULARGE_INTEGER nRequired;
ULARGE_INTEGER nAvailable;
nRequired.QuadPart = filesize;
GetDiskFreeSpaceEx(path, &nAvailable, NULL, NULL);
return nRequired.QuadPart <= nAvailable.QuadPart;
*/
// On Win95 may fail for disks > 2GB
DWORD nSecPerClust, nBytePerSec, nFreeClust;
bool ok = GetDiskFreeSpace(path, &nSecPerClust, &nBytePerSec, &nFreeClust, NULL) != 0;
if (ok && nBytePerSec >= 512)
{
__int64 nFree = nFreeClust;
nFree *= nSecPerClust;
nFree *= nBytePerSec;
ok = nFree > filesize;
}
else
ok = TRUE;
return ok;
}
unsigned long os_get_disk_size(const char* path)
{
char drive[_MAX_DRIVE+1];
_splitpath(path, drive, NULL, NULL, NULL);
strcat(drive, "/");
DWORD nSecPerClust, nBytePerSec, nFreeClust, nTotalClust;
GetDiskFreeSpace(path, &nSecPerClust, &nBytePerSec, &nFreeClust, &nTotalClust);
::GetDiskFreeSpace(drive, &nSecPerClust, &nBytePerSec, &nFreeClust, &nTotalClust);
__int64 nFree = nTotalClust;
nFree *= nSecPerClust;
nFree *= nBytePerSec;
unsigned long nVal = nFree > INT_MAX ? (unsigned long)INT_MAX
unsigned long nVal = nFree > ULONG_MAX ? (unsigned long)ULONG_MAX
: (unsigned long)nFree;
return nVal;
}
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;
}
/*
void os_exec_help_command(MENU_TAG tag, const char* key)
{
TFilename hlp("prassi.hlp");
@ -260,6 +250,7 @@ void os_exec_help_command(MENU_TAG tag, const char* key)
default: break;
}
}
*/
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild)
{
@ -394,26 +385,6 @@ bool os_spawn_by_menu()
return ok;
}
bool os_get_image_editor_path(TFilename& name)
{
// where is EasyDoc installed?
GetPrivateProfileString("Easydoc", "Path", "\\EASYDOC",
name.get_buffer(), name.size(),
"EasyDoc.ini");
// You're unlucky there is no EasyDoc
if (name.empty())
return FALSE;
// paste EasyDoc path
name.add("easydoc.exe");
// is EasyDoc present?
bool ok = name.exist();
return ok;
}
os_type os_get_type()
{
os_type t = os_Unknown;
@ -422,20 +393,20 @@ os_type os_get_type()
{
switch (ovi.dwPlatformId)
{
case VER_PLATFORM_WIN32s : t = os_Win32s; break;
case VER_PLATFORM_WIN32_NT :
{
t = os_WindowsNT;
}
case VER_PLATFORM_WIN32s:
t = os_Win32s;
break;
case VER_PLATFORM_WIN32_NT:
t = os_WindowsNT;
break;
case VER_PLATFORM_WIN32_WINDOWS:
{
t = os_Windows95;
if (ovi.dwMajorVersion == 4 || (ovi.dwMajorVersion > 4 && ovi.dwMinorVersion > 0))
t = os_Windows98;
}
t = os_Windows95;
if (ovi.dwMajorVersion == 4 || (ovi.dwMajorVersion > 4 && ovi.dwMinorVersion > 0))
t = os_Windows98;
break;
default:
t = os_Unknown;
break;
default : t = os_Unknown; break; //Windows ME / 98 qui
}
}
return t;
@ -491,7 +462,6 @@ void os_set_event_hook()
void os_wake_up_caller()
{
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
WinHelp(hwnd, "prassi.hlp", HELP_QUIT, 0L);
}
bool os_file_exist(const char* file)

View File

@ -923,7 +923,6 @@ void TPrefix::set(
return;
if (!force && !test(name))
return;
if (_prefix != ".")
{
_manager.close_all();
@ -1267,3 +1266,4 @@ bool TPrefix::build_firm_data(long codditta, bool flagcom)
return TRUE;
}

View File

@ -165,10 +165,9 @@ void TIndwin::update_bar()
b.right = b.left + int((b.right-b.left)*prc);
set_brush(cBar, PAT_SOLID);
xvt_dwin_draw_rect(w, &b);
set_pen(BTN_BACK_COLOR);
const int nStep = b.bottom-b.top;
const int nStep = 2*(b.bottom-b.top)/3;
for (int x = b.left+nStep; x < b.right; x += nStep)
{
for (int i = 0; i < 1; i++) // for (int i = 0; i < 2; i++)
@ -349,3 +348,4 @@ void timerind_destroy()
delete __indwin__p;
__indwin__p = NULL;
}

View File

@ -399,9 +399,10 @@ real::real (double a)
void real::set_int64(__int64 b)
{
dzero (ptr ());
trail();
memcpy(ptr()->ls.lsl, &b, sizeof(b));
TString80 s; s.format("%I64d", b);
atod (ptr (), (char *) (const char *) s);
trail();
}
void real::trail( )

View File

@ -480,9 +480,7 @@ void TRelation_application::insert_mode()
// ....possibilmente spostare questa chiamata .....
if (_curr_transaction == TRANSACTION_INSERT)
ini2insert_mask();
_mask->load_profile(0, FALSE);
ini2insert_mask();
}
bool TRelation_application::modify_mode()
@ -1648,12 +1646,11 @@ bool TRelation_application::load_transaction()
long firm = cnf.get_long("Firm");
if (firm > 0 && firm != get_firm())
{
if (set_firm(firm))
bool ok = set_firm(firm);
if (ok)
_mask->on_firm_change();
else
error_box("Ditta inesistente: %ld", firm);
else
error_box("La ditta %ld non esiste", firm);
}
@ -1890,3 +1887,4 @@ bool TRelation_application::mask2mail(const TMask& m)
}
return ok;
}

View File

@ -13,7 +13,7 @@ TScanner::TScanner(const char* filename)
: _pushed(FALSE), _line(0),
_token(128), _key(2), _buffer(1024*16), _tmp(1024*8)
{
setbuf((char*)(const char*)_buffer, _buffer.size());
// setbuf((char*)(const char*)_buffer, _buffer.size());
open(filename, ios::in | ios::nocreate, filebuf::sh_read);
if (fail())
fatal_box("Impossibile leggere il file '%s'", filename);
@ -21,8 +21,8 @@ TScanner::TScanner(const char* filename)
TScanner::~TScanner()
{
close();
setbuf(NULL, 0); // Altrimenti si incasina col buffer!
// close();
// setbuf(NULL, 0); // Altrimenti si incasina col buffer!
}

View File

@ -205,3 +205,68 @@ const char* TTable::description()
return _description;
}
struct TCallbackTableinfo
{
TString16 _var1, _var2, _var3;
TString4 _module;
TFilename _tabapp, _relapp;
};
HIDDEN int find_relapp(TConfig& cfg, void* jolly)
{
TCallbackTableinfo& info = *((TCallbackTableinfo*)jolly);
if (cfg.exist(info._var1))
{
info._tabapp = cfg.get(info._var1);
if (info._tabapp.not_empty())
return 1;
}
if (cfg.get_paragraph().compare(info._module, 2, TRUE) == 0)
{
if (cfg.exist(info._var2))
{
info._relapp = cfg.get(info._var2);
if (info._relapp.not_empty())
return 2;
}
if (cfg.exist(info._var3))
{
info._relapp = cfg.get(info._var3);
if (info._relapp.not_empty())
return 3;
}
}
return 0;
}
bool TTable::get_relapp(TString& app) const
{
TConfig ini("install.ini");
TCallbackTableinfo fi;
fi._var1.format("Edit_%s", (const char*)_tabname);
fi._var2.format("Edit_%d", num());
fi._var3.format("Edit_%d", num() == LF_TAB ? LF_TABCOM : LF_TAB);
fi._module = ((TTable*)this)->module();
ini.for_each_paragraph(find_relapp, &fi);
app = fi._tabapp;
if (app.empty())
app = fi._relapp;
if (app.empty())
{
app = "ba3 -0";
if (fi._module.compare("ba", 2, TRUE) != 0)
{
TConfig c(CONFIG_STUDIO, fi._module);
if (c.exist("TabPrg"))
app = c.get("TabPrg");
}
}
app << ' ';
if (num() == LF_TABCOM)
app << '%';
app << _tabname;
return app.not_empty();
}

View File

@ -55,10 +55,9 @@ public:
// @cmember Ritorna la relapp che gestisce la tabella
virtual bool get_relapp(TString& app) const;
// @cmember Ritorna il numero logico della tabella <p tabname>
static int name2log(const char* tabname);
};
#endif // __TABUTIL_H
#endif // __TABUTIL_H

View File

@ -159,16 +159,19 @@ HIDDEN bool _pi_val(TMask_field& f, KEY)
const TString& stato = m.get(atoi(get_val_param(0)));
const TString& pi = f.get();
bool ok = pi_check(stato, pi);
bool ok = pi_check (stato, pi);
if (!ok)
{
if (f.dirty())
{
ok = f.yesno_box("Partita IVA errata, la accetto ugualmente?");
bool len_error = TRUE;
if (stato.blank() || stato == "IT")
len_error = pi.len() != 11;
const char* msg = len_error ? "Lunghezza p" : "P";
ok = f.yesno_box("%sartita IVA errata, la accetto ugualmente?", msg);
if (ok) f.set_dirty(FALSE);
}
else
ok = TRUE; // Era gia' errata e la ho accettata
else ok = TRUE; // Era gia' errata e la ho accettata
}
return ok;
}