config.h Aggiunto CONFIG_INSTALL
config.cpp Gestito CONFIG_INSTALL e tolto #include <applicat.h> maskfld.cpp Migliorato riconoscimento dei bottonui Elmina e e Conferma msksheet.cpp Corretta gestione focus su campi mancanti stdtypes.cpp Spostato nel prawin il nome del dongle server Eliminata chiamata a DB_Exit xvtility.cpp Riga vuota git-svn-id: svn://10.65.10.50/trunk@5865 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2f0baf5373
commit
b147bb60ed
@ -1,12 +1,13 @@
|
||||
#include <applicat.h>
|
||||
#include <time.h>
|
||||
|
||||
#define XVT_INCL_NATIVE
|
||||
#include <colors.h>
|
||||
#include <config.h>
|
||||
#include <date.h>
|
||||
#include <scanner.h>
|
||||
#include <prefix.h>
|
||||
#include <utility.h>
|
||||
|
||||
extern "C" { int rename(const char*, const char*); };
|
||||
#include <extcdecl.h> // GetPrawinName
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
@ -46,8 +47,15 @@ bool TConfig::_read_paragraph()
|
||||
val = l.mid(ind+1); val.trim();
|
||||
|
||||
if (val[0] == '%')
|
||||
{
|
||||
if (val == "%yr%") val.format("%04d", TDate(TODAY).year()); else
|
||||
{
|
||||
if (val == "%yr%")
|
||||
{
|
||||
// val.format("%04d", TDate(TODAY).year());
|
||||
time_t ora; time(&ora);
|
||||
struct tm * oggi = localtime(&ora);
|
||||
val.format("%04d", 1900 + oggi->tm_year);
|
||||
}
|
||||
else
|
||||
if (val == "%frm%") val.format("%05ld", prefix().get_codditta());
|
||||
}
|
||||
// sostituzione abilitata
|
||||
@ -87,7 +95,6 @@ void TConfig::_write_paragraph(
|
||||
}
|
||||
|
||||
void TConfig::_write_file()
|
||||
|
||||
{
|
||||
ifstream in(_file);
|
||||
TFilename temp;
|
||||
@ -101,7 +108,7 @@ void TConfig::_write_file()
|
||||
|
||||
while (!in.eof())
|
||||
{
|
||||
in.getline((char*)(const char*)l, l.size());
|
||||
in.getline(l.get_buffer(), l.size());
|
||||
l.trim();
|
||||
|
||||
if (cnf == l)
|
||||
@ -369,7 +376,7 @@ bool TConfig::get_bool(
|
||||
{
|
||||
const char* d = def ? "X" : "";
|
||||
const TString& s = get(var, section, index, d).upper();
|
||||
return s != "" && (s == "X" || s == "ON" || s == "YES" || s == "OK" || s == "TRUE");
|
||||
return s != "" && (s == "X" || s == "Y" || s == "1" || s == "ON" || s == "YES" || s == "OK" || s == "TRUE");
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
@ -538,9 +545,13 @@ void TConfig::init(
|
||||
}
|
||||
|
||||
if (_paragraph.blank())
|
||||
{
|
||||
_paragraph = main_app().name();
|
||||
_paragraph.cut(2);
|
||||
{
|
||||
TFilename name;
|
||||
HINSTANCE HInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
GetModuleFileName(HInstance, name.get_buffer(), name.size());
|
||||
_paragraph = name.name();
|
||||
_paragraph.cut(2);
|
||||
_paragraph.lower();
|
||||
}
|
||||
|
||||
_ispresent = _read_paragraph();
|
||||
@ -591,7 +602,8 @@ TConfig::TConfig(int which_config, const char* paragraph)
|
||||
switch (which_config)
|
||||
{
|
||||
case CONFIG_DITTA:
|
||||
_file << main_app().get_firm_dir() << '/' << "prassid.ini";
|
||||
_file = firm2dir(prefix().get_codditta());
|
||||
_file.add("prassid.ini");
|
||||
if (!fexist(_file))
|
||||
fcopy("prassid.ini", _file);
|
||||
break;
|
||||
@ -600,7 +612,7 @@ TConfig::TConfig(int which_config, const char* paragraph)
|
||||
case CONFIG_STAMPE:
|
||||
_file = firm2dir(-1); // Directory dati
|
||||
_file.add("config"); // Directory config
|
||||
if (!fexist(_file)) // Creala se becessario
|
||||
if (!fexist(_file)) // Creala se necessario
|
||||
make_dir(_file);
|
||||
|
||||
switch (which_config)
|
||||
@ -637,8 +649,8 @@ TConfig::TConfig(int which_config, const char* paragraph)
|
||||
case CONFIG_FCONV:
|
||||
_file = "fconv.ini";
|
||||
break;
|
||||
case CONFIG_GOLEM:
|
||||
_file.add("golem.ini");
|
||||
case CONFIG_INSTALL:
|
||||
_file = CGetPrawinName();
|
||||
break;
|
||||
default:
|
||||
_file = "prassi.ini";
|
||||
|
@ -13,18 +13,18 @@ class ofstream;
|
||||
|
||||
// questo sara' il principale, per ora non c'e'
|
||||
#define CONFIG_GENERAL 0
|
||||
// file prawin.ini
|
||||
#define CONFIG_INSTALL 1
|
||||
// file parametri studio (uno per studio, per ora e' il principale)
|
||||
#define CONFIG_STUDIO 1
|
||||
#define CONFIG_STUDIO 2
|
||||
// file parametri ditta (uno per ditta)
|
||||
#define CONFIG_DITTA 2
|
||||
#define CONFIG_DITTA 3
|
||||
// file conversioni archivi
|
||||
#define CONFIG_FCONV 3
|
||||
#define CONFIG_FCONV 4
|
||||
// file parametri utente
|
||||
#define CONFIG_USER 4
|
||||
#define CONFIG_USER 5
|
||||
// file parametri stampe
|
||||
#define CONFIG_STAMPE 5
|
||||
// file parametri golem
|
||||
#define CONFIG_GOLEM 6
|
||||
#define CONFIG_STAMPE 6
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
|
@ -1014,7 +1014,7 @@ void TButton_field::create(WINDOW parent)
|
||||
switch (dlg())
|
||||
{
|
||||
case DLG_OK:
|
||||
if (_ctl_data._prompt.empty())
|
||||
if (_ctl_data._prompt.empty() || _ctl_data._prompt == "Conferma")
|
||||
_ctl_data._prompt = "~Conferma";
|
||||
_virtual_key = 'C';
|
||||
_exit_key = K_ENTER;
|
||||
@ -1029,7 +1029,7 @@ void TButton_field::create(WINDOW parent)
|
||||
_ctl_data._bmp_up = BMP_CANCEL;
|
||||
break;
|
||||
case DLG_DELREC:
|
||||
if (_ctl_data._prompt.empty())
|
||||
if (_ctl_data._prompt.empty() || _ctl_data._prompt == "Elimina")
|
||||
_ctl_data._prompt = "~Elimina";
|
||||
_virtual_key = 'E';
|
||||
_exit_key = K_DEL;
|
||||
@ -1040,7 +1040,7 @@ void TButton_field::create(WINDOW parent)
|
||||
}
|
||||
break;
|
||||
case DLG_PRINT:
|
||||
if (_ctl_data._prompt.empty())
|
||||
if (_ctl_data._prompt.empty() || _ctl_data._prompt == "Stampa")
|
||||
_ctl_data._prompt = "~Stampa";
|
||||
_virtual_key = 'S';
|
||||
_exit_key = K_ENTER;
|
||||
@ -1520,7 +1520,7 @@ void TBoolean_field::set_prompt(const char* p)
|
||||
|
||||
const char* TBoolean_field::reformat(const char* data) const
|
||||
{
|
||||
return (data && *data > ' ') ? "X" : "";
|
||||
return (data && *data > ' ' && *data != '0' && *data != 'N') ? "X" : "";
|
||||
}
|
||||
|
||||
void TBoolean_field::set_window_data(const char* data)
|
||||
|
@ -886,8 +886,7 @@ bool TSpreadsheet::test_focus_change()
|
||||
// Certified 75%
|
||||
bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
{
|
||||
static KEY _lastab = K_TAB;
|
||||
static char tmp[16];
|
||||
// static KEY _lastab = K_TAB;
|
||||
|
||||
BOOLEAN& refused = xiev->refused;
|
||||
|
||||
@ -920,7 +919,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
{
|
||||
const int rec = (int)xiev->v.cell_request.rec;
|
||||
const int maxlen = xiev->v.cell_request.len;
|
||||
|
||||
char numrig[8];
|
||||
const char* src = NULL;
|
||||
int nm;
|
||||
XI_OBJ** obj = xi_get_member_list(xiev->v.cell_request.list, &nm);
|
||||
@ -971,8 +970,8 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(tmp, "%d", rec+1);
|
||||
src = tmp;
|
||||
sprintf(numrig, "%d", rec+1);
|
||||
src = numrig;
|
||||
}
|
||||
|
||||
char* dst = xiev->v.cell_request.s;
|
||||
@ -1079,7 +1078,11 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
|
||||
const int oldrec = _cur_rec;
|
||||
if ( xiev->v.xi_obj != NULL )
|
||||
set_pos(xiev->v.xi_obj->v.cell.row, xiev->v.xi_obj->v.cell.column);
|
||||
{
|
||||
// set_pos(xiev->v.xi_obj->v.cell.row, xiev->v.xi_obj->v.cell.column);
|
||||
const XI_CELL_DATA& cell = xiev->v.xi_obj->v.cell;
|
||||
set_focus_cell(cell.row, cell.column);
|
||||
}
|
||||
|
||||
if (oldrec != _cur_rec || !_row_dirty)
|
||||
{
|
||||
@ -1190,11 +1193,12 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
}
|
||||
if (disabled)
|
||||
{
|
||||
const int dir = _lastab == K_TAB ? +1 : -1;
|
||||
// const int dir = _lastab == K_TAB ? +1 : -1;
|
||||
const int dir = physical_column >= _cur_col ? +1 : -1;
|
||||
const int nex = find_enabled_column(_cur_rec, physical_column, dir);
|
||||
if (nex > 0) // If at least one enabled cell exists
|
||||
set_focus_cell(_cur_row, nex);
|
||||
else
|
||||
// else
|
||||
refused = TRUE;
|
||||
}
|
||||
else
|
||||
@ -1469,7 +1473,8 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
xiev->type = XIE_DBL_CELL;
|
||||
xiev->v.xi_obj = NULL;
|
||||
event_handler(itf, xiev);
|
||||
break;
|
||||
break;
|
||||
/*
|
||||
case K_TAB:
|
||||
case K_BTAB:
|
||||
_lastab = k;
|
||||
@ -1478,6 +1483,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
case K_DOWN:
|
||||
_lastab = (_cur_col == 2) ? K_BTAB : K_TAB;
|
||||
break;
|
||||
*/
|
||||
case K_ENTER:
|
||||
case K_SHIFT+K_ENTER:
|
||||
{
|
||||
@ -2607,6 +2613,13 @@ void TSheet_field::mask2row(int n, TToken_string & rec)
|
||||
yesnofatal_box("Mask2row: Non e' visibile il campo %d", id);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
const int col = cid2index(id);
|
||||
if (!s.column_disabled(col))
|
||||
enable_cell(n, col, FALSE);
|
||||
}
|
||||
|
||||
if (pos < 0)
|
||||
rec.add(firstpos >= 0 ? m.fld(firstpos).get() : " ");
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ int get_serial_number(const char* appname)
|
||||
#ifdef _DEMO_
|
||||
return 0;
|
||||
#else
|
||||
|
||||
if (_login_status == 0)
|
||||
{
|
||||
if (HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY) == STATUS_OK)
|
||||
@ -52,6 +53,7 @@ int get_serial_number(const char* appname)
|
||||
getser();
|
||||
}
|
||||
}
|
||||
|
||||
if (_login_status != 1)
|
||||
{
|
||||
if (_login_status == 2)
|
||||
@ -60,8 +62,8 @@ int get_serial_number(const char* appname)
|
||||
SerNo = 0xFFFF;
|
||||
}
|
||||
|
||||
TConfig ini(CONFIG_STUDIO, "Server");
|
||||
const char* server = ini.get("Name");
|
||||
TConfig ini(CONFIG_INSTALL, "Server");
|
||||
const char* server = ini.get("Dongle");
|
||||
const char* guest = "******";
|
||||
const char* utente = (!xvt_running() && !stricmp(appname, "ba0100")) ? guest : user();
|
||||
|
||||
@ -137,7 +139,7 @@ void free_global_vars()
|
||||
delete ext_files;
|
||||
prefix_destroy();
|
||||
}
|
||||
DB_exit();
|
||||
// DB_exit();
|
||||
}
|
||||
|
||||
#ifndef FOXPRO
|
||||
|
@ -41,6 +41,7 @@ BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR)
|
||||
#ifndef ATTR_WIN_USE_CTL3D
|
||||
#include <ctl3d.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
HIDDEN HINSTANCE HInstance;
|
||||
|
Loading…
x
Reference in New Issue
Block a user