diff --git a/include/about.cpp b/include/about.cpp index 3f979243d..5a75998fc 100755 --- a/include/about.cpp +++ b/include/about.cpp @@ -54,13 +54,15 @@ void history() http_isredirected_server(server, url); http_dir(server, url, txt); - if (txt.empty()) +#ifdef DBG + if (txt.empty()) // Se non trova nulla riprova con la versione precedente { path.format("/release%d0/", --rel); url = path; url << pattern; http_isredirected_server(server, url); http_dir(server, url, txt); } +#endif TFilename tmp; tmp.tempdir(); tmp.add("history.html"); ofstream h(tmp); @@ -441,8 +443,12 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni")) prot = "SSA"; { TString_array ssa; - if (list_files("*.ssa", ssa) > 0) + const int n = list_files("*.ssa", ssa); + if (n > 0) + { prot = ssa.row(0); + if (n > 1) prot << " ?"; + } } break; default: diff --git a/include/brwbut.cpp b/include/brwbut.cpp index 561d23752..7741a29d1 100644 --- a/include/brwbut.cpp +++ b/include/brwbut.cpp @@ -937,34 +937,38 @@ bool TBrowse::do_link(bool insert) } } - TFilename msg; msg.temp("msg"); + TFilename msg; msg.temp("msg", "ini"); app << " /i" << msg; - if (insert) { + bool set_link = true; TConfig ini(msg, "Transaction"); - ini.set("Action", TRANSACTION_RUN); - } - else - { - TConfig ini(msg, "Transaction"); - ini.set("Action", TRANSACTION_LINK); + if (insert) + { + ini.set("Action", TRANSACTION_RUN); + set_link = field().empty() && do_input(false) > 0; + } + else + ini.set("Action", TRANSACTION_LINK); - TString8 paragraph; paragraph << _cursor->file().num(); - ini.set_paragraph(paragraph); + if (set_link) + { + TString8 paragraph; paragraph << _cursor->file().num(); + ini.set_paragraph(paragraph); - // Uso sempre la chiave 1 per collegarmi agli altri programmi - const TRelation& rel = *_cursor->relation(); - const RecDes& recd = rel.curr().rec_des(); // Descrizione del record della testata - const KeyDes& kd = recd.Ky[0]; // Elenco dei campi della chiave 1 - TString inp_val; - for (int i = 0; i < kd.NkFields; i++) - { - const int nf = kd.FieldSeq[i] % MaxFields; - const RecFieldDes& rf = recd.Fd[nf]; - const TFieldref fldref(rf.Name, 0); - inp_val = fldref.read(rel); - fldref.write(ini, paragraph, inp_val); + // Uso sempre la chiave 1 per collegarmi agli altri programmi + const TRelation& rel = *_cursor->relation(); + const RecDes& recd = rel.curr().rec_des(); // Descrizione del record della testata + const KeyDes& kd = recd.Ky[0]; // Elenco dei campi della chiave 1 + TString inp_val; + for (int i = 0; i < kd.NkFields; i++) + { + const int nf = kd.FieldSeq[i] % MaxFields; + const RecFieldDes& rf = recd.Fd[nf]; + const TFieldref fldref(rf.Name, 0); + inp_val = fldref.read(rel); + fldref.write(ini, paragraph, inp_val); + } } } @@ -988,7 +992,7 @@ bool TBrowse::do_link(bool insert) do_output(); } } - ::remove(msg); + msg.fremove(); } return ok; } diff --git a/include/codeb.c b/include/codeb.c index 214742376..43841a488 100755 --- a/include/codeb.c +++ b/include/codeb.c @@ -617,8 +617,8 @@ int DB_packfile(short vis, const char* filename, long eod) long rc = 0L; if (vis) { - char s[_MAX_PATH]; - strcpy(s,"Compattamento "); + char s[_MAX_PATH+32]; + strcpy(s, "Compattamento "); strcat(s, filename); pi = xvt_dm_progress_create(NULL_WIN, s, 1, FALSE); } @@ -651,10 +651,10 @@ int DB_packmemo(short vis, const char * filename) WINDOW pi = NULL_WIN; if (vis) { - char s[_MAX_PATH]; - strcpy(s, "Compattamento memo file : "); + char s[_MAX_PATH+32]; + strcpy(s, "Compattamento memo : "); strcat(s, filename); - xvt_dm_progress_create(NULL_WIN, s, 1, FALSE); + pi = xvt_dm_progress_create(NULL_WIN, s, 1, FALSE); } rt=d4memoCompress(dbdata[handle]); if (pi) diff --git a/include/controls.cpp b/include/controls.cpp index 9a64e6ec6..67f5b183f 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -2385,7 +2385,7 @@ bool TListbox_control::select(int i) { _current = i; xi_set_text(_obj, ""); // Senno' a volte disegna male - xi_set_text(_obj, (char*)_values.get(i)); + xi_set_text(_obj, _values.get(i)); } } return ok; @@ -2393,8 +2393,11 @@ bool TListbox_control::select(int i) bool TListbox_control::select_by_initial(char c) { - int i = _current; const int tot = items(); + if (tot <= 1) + return false; // not changed + + int i = _current; for (i = (i+1)%tot; i != _current; i = (i+1)%tot) { if (toupper(_values.get_char(i)) == toupper(c)) diff --git a/include/dongle.cpp b/include/dongle.cpp index 3027e6e8d..58a8338ac 100755 --- a/include/dongle.cpp +++ b/include/dongle.cpp @@ -402,11 +402,15 @@ const TString& TDongle::short_name() const const TString& TDongle::server_name() const { - if (network() && !xvt_sys_dongle_server_running()) + if (network()) { - if (hardware() == _dongle_ssanet) - return ini_get_string(CONFIG_SSA, NULL, "Port"); - return ini_get_string(CONFIG_INSTALL, "Server", "Dongle"); + const int sr = xvt_sys_dongle_server_running(); + if (sr == 0) + { + if (hardware() == _dongle_ssanet) + return ini_get_string(CONFIG_SSA, NULL, "Port"); + return ini_get_string(CONFIG_INSTALL, "Server", "Dongle"); + } } TString& tmp = get_tmp_string(50); diff --git a/include/mov.h b/include/mov.h index 86a47d186..600379848 100755 --- a/include/mov.h +++ b/include/mov.h @@ -49,6 +49,7 @@ #define MOV_DATAINC "DATAINC" #define MOV_LIQDIFF "LIQDIFF" #define MOV_IVAXCASSA "IVAXCASSA" +#define MOV_SPLITPAY "SPLITPAY" #define MOV_NOLEGGIO "NOLEGGIO" #define MOV_INVIOFE "INVIOFE" #define MOV_CONTSEP "CONTSEP" diff --git a/include/progind.cpp b/include/progind.cpp index aaa566d0f..1bb787596 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -325,6 +325,9 @@ TTimerind::~TTimerind() // TProgress_monitor /////////////////////////////////////////////////////////// +static int _pm_inst = 0; +static WINDOW _pm_parent = NULL_WIN; + bool TProgress_monitor::set_status(long n) { // Aggiusto timer iniziale se necessario @@ -334,7 +337,7 @@ bool TProgress_monitor::set_status(long n) // Se è passato un secondo allora crea la progress dialog if (_pd == NULL_WIN && n > 0 && (clock() - _start) >= CLOCKS_PER_SEC) { - _pd = xvt_dm_progress_create(NULL_WIN/*cur_win()*/, main_app().title(), _total, _cancellable); + _pd = xvt_dm_progress_create(_pm_parent, main_app().title(), _total, _cancellable); if (_txt.full()) xvt_dm_progress_set_text(_pd, _txt); xvt_scr_reset_busy_cursor(); @@ -370,10 +373,27 @@ bool TProgress_monitor::is_cancelled() const TProgress_monitor::TProgress_monitor(long items, const char* txt, bool cancancel) : _total(items), _txt(txt), _status(0), _cancellable(cancancel), _pd(NULL_WIN), _start(clock()), _cancelled(false) -{ xvt_scr_set_busy_cursor(); } +{ + xvt_scr_set_busy_cursor(); + if (_pm_parent == NULL_WIN) + { + _pm_parent = cur_win(); + if (_pm_parent == NULL_WIN) + _pm_parent = TASK_WIN; + xvt_vobj_set_enabled(_pm_parent, false); + _pm_inst = 1; + } + else + _pm_inst++; +} TProgress_monitor::~TProgress_monitor() { + if (--_pm_inst <= 0) + { + xvt_vobj_set_enabled(_pm_parent, true); + _pm_parent = NULL_WIN; + } // Distruggi la TProgind o la clessidra, a seconda del caso if (_pd != NULL_WIN) xvt_dm_progress_destroy(_pd); diff --git a/include/rdoc.h b/include/rdoc.h index e783ceeed..7836a767d 100755 --- a/include/rdoc.h +++ b/include/rdoc.h @@ -55,6 +55,11 @@ #define RDOC_DAPROVV "DAPROVV" #define RDOC_DANDOC "DANDOC" #define RDOC_DAIDRIGA "DAIDRIGA" +#define RDOC_ACODNUM "DACODNUM" +#define RDOC_AANNO "DAANNO" +#define RDOC_APROVV "DAPROVV" +#define RDOC_ANDOC "DANDOC" +#define RDOC_AIDRIGA "DAIDRIGA" #define RDOC_CODCMS "CODCMS" #define RDOC_FASCMS "FASCMS" #define RDOC_CODCOSTO "CODCOSTO" diff --git a/include/relation.cpp b/include/relation.cpp index ca94731d3..6749f22b3 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -2735,9 +2735,9 @@ bool TRelation_description::choose_field( { _cur_field = (int)sht.selected(); _cfield = fd.row(_cur_field); - return TRUE; + return true; } - return FALSE; + return false; } // @doc INTERNAL @@ -2753,12 +2753,12 @@ bool TRelation_description::build_menu( // // @devnote Funzione non implementata. { - return FALSE; + return false; } bool TRelation_description::remove_menu() { - return FALSE; + return false; } bool TRelation_description::set_cur_file(int id) diff --git a/include/relation.h b/include/relation.h index 7a2d8e0ac..32b3e8a89 100755 --- a/include/relation.h +++ b/include/relation.h @@ -238,7 +238,7 @@ class TCursor : public TContainer // @access:(INTERNAL) Private Member { // *** maximum number of elements in a cursor working page - enum {_cmaxelpage=4096}; + enum { _cmaxelpage=16384 }; // @cmember:(INTERNAL) Relazione su cui costruire il cursore TRelation* _if; diff --git a/include/strings.cpp b/include/strings.cpp index ec6093feb..912f3c2ce 100755 --- a/include/strings.cpp +++ b/include/strings.cpp @@ -1253,16 +1253,26 @@ const TFilename& TFilename::tempdir() if (create) { _tempdir.cut(0); - xvt_sys_get_env("TEMP", _tempdir.get_buffer(), _tempdir.size()); - if (_tempdir.empty()) - xvt_sys_get_env("TMP", _tempdir.get_buffer(), _tempdir.size()); + xvt_sys_get_profile_string(NULL, "Main", "Temp", "", _tempdir.get_buffer(), _tempdir.size()); + if (_tempdir.blank()) + { + xvt_sys_get_env("TEMP", _tempdir.get_buffer(), _tempdir.size()); + if (_tempdir.blank()) + xvt_sys_get_env("TMP", _tempdir.get_buffer(), _tempdir.size()); + if (_tempdir.len() > 28) // troppo lunga! + { + _tempdir.currdir(); + _tempdir.add("temp"); + xvt_sys_set_profile_string(NULL, "Main", "Temp", _tempdir); + } + } bool ok = dexist(_tempdir); if (!ok) // Codebase NON funziona senza una temp esistente! { ok = make_dir(_tempdir); if (!ok) - fatal_box("La cartella temporanea '%s' non esiste", (const char*)_tempdir); + cantwrite_box(_tempdir); } const int last = len()-1; @@ -1284,7 +1294,7 @@ const TFilename& TFilename::tempdir() { ok = make_dir(_tempdir); if (!ok) - fatal_box("Impossibile creare la cartella temporanea '%s'", (const char*)_tempdir); + cantwrite_box(_tempdir); } xvt_sys_set_env("TMP", _tempdir); // Usata da _tmpnam @@ -1296,12 +1306,8 @@ const TFilename& TFilename::tempdir() const TFilename& TFilename::currdir() { - DIRECTORY d; - - xvt_fsys_get_dir(&d); // verificare + DIRECTORY d; xvt_fsys_get_dir(&d); xvt_fsys_convert_dir_to_str(&d, get_buffer(), size()); - - return *this; } // Certified 50% diff --git a/include/validate.cpp b/include/validate.cpp index a874b15b7..1fa1b13e8 100755 --- a/include/validate.cpp +++ b/include/validate.cpp @@ -71,8 +71,8 @@ HIDDEN bool _emptycopy_val(TMask_field& f, KEY) HIDDEN bool check_pi_estera(const TString& st, const TString& paiva) { - const int len = paiva.len(); - const char* p = paiva; + const int len = paiva.len(); + const char* p = paiva; const bool nat = real::is_natural(p); if (st == "AT") diff --git a/include/window.cpp b/include/window.cpp index 856885646..7c3aa97d9 100755 --- a/include/window.cpp +++ b/include/window.cpp @@ -346,7 +346,7 @@ bool can_close() bool is_valid_window(WINDOW w) { - bool ok = FALSE; + bool ok = false; if (w != NULL_WIN) ok = (xvt_vobj_get_attr(w, ATTR_NATIVE_WINDOW) != 0L); return ok; @@ -356,20 +356,12 @@ bool is_valid_window(WINDOW w) // // @rdesc Restituisce l'handle della finestra corrente. WINDOW cur_win() - - // @comm Se non esiste una finestra corrente allora ritorna NULL_WIN +// @comm Se non esiste una finestra corrente allora ritorna NULL_WIN { WINDOW win = NULL_WIN; TWindow* w = WinManager.cur_win(); if (w != NULL) - { win = w->win(); - /*if (!is_valid_window(win)) - { - w->stop_run(K_FORCE_CLOSE); - win = NULL_WIN; - }*/ - } return win; } @@ -460,8 +452,8 @@ void TWindow::open() void TWindow::open_modal() { - set_modal(TRUE); - _open = TRUE; + set_modal(true); + _open = true; open(); WinManager.reg(this); @@ -480,14 +472,14 @@ void TWindow::close_modal() { WinManager.unreg(this); close(); - _open = FALSE; - set_modal(FALSE); + _open = false; + set_modal(false); } } bool TWindow::stop_run(KEY key) { - _running = FALSE; + _running = false; _lastkey = key; return true; } @@ -512,7 +504,7 @@ KEY TWindow::run() const bool was_open = is_open(); start_run(); - _running = TRUE; + _running = true; if (!was_open) open_modal(); @@ -666,12 +658,12 @@ void TWindow::force_update() bool TWindow::save_ctools() { - if (_ctools_saved == FALSE) + if (!_ctools_saved) { xvt_dwin_get_draw_ctools(win(), &_ct); - return _ctools_saved = TRUE; + return _ctools_saved = true; } - return FALSE; + return false; } bool TWindow::restore_ctools() @@ -679,10 +671,10 @@ bool TWindow::restore_ctools() if (_ctools_saved) { xvt_dwin_set_draw_ctools(win(), &_ct); - _ctools_saved = FALSE; - return TRUE; + _ctools_saved = false; + return true; } - return FALSE; + return false; } diff --git a/include/window.h b/include/window.h index 4dfa4a6a2..1b9d6d58c 100755 --- a/include/window.h +++ b/include/window.h @@ -250,10 +250,10 @@ public: // @cmember Minimizza (iconizza) la finestra void minimize() const; // @cmember Attiva/disattiva la finestra - virtual void activate(bool = TRUE); + virtual void activate(bool = true); // @cmember Disattiva la finestra (chiama ) void deactivate() - { activate(FALSE); } + { activate(false); } // @cmember Mostra la finestra modale void open_modal();