From 0216f2cbf91d09760b1f86239bfd863fa3fdc087 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 4 Apr 2008 16:04:15 +0000 Subject: [PATCH] Patch level :10.0 patch 24 Files correlati : tutte le librerie Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@16463 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/applicat.cpp | 19 +- include/automask.cpp | 5 +- include/bagn008.uml | 29 +- include/classes.h | 3 + include/colors.h | 1 + include/controls.cpp | 27 +- include/controls.h | 2 +- include/defmask.h | 2 + include/execp.cpp | 24 +- include/execp.h | 7 +- include/files.cpp | 82 ++--- include/files.h | 4 +- include/isam.cpp | 22 +- include/mask.cpp | 694 ++++++++++++++++++++++++------------------- include/mask.h | 55 ++-- include/maskfld.cpp | 20 +- include/msksheet.cpp | 47 +++ include/msksheet.h | 2 + include/prefix.cpp | 15 +- include/progind.cpp | 2 +- include/real.cpp | 10 + include/real.h | 7 +- include/recset.cpp | 33 +- include/relapp.cpp | 6 + include/reprint.cpp | 116 ++++---- include/reprint.h | 2 +- include/sheet.cpp | 291 ++++++++++++------ include/sheet.h | 3 +- include/treectrl.cpp | 15 +- include/urldefid.h | 30 ++ include/window.cpp | 2 - include/xvtility.cpp | 27 +- 32 files changed, 962 insertions(+), 642 deletions(-) diff --git a/include/applicat.cpp b/include/applicat.cpp index 5d2937370..cca869937 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -329,7 +329,7 @@ long TApplication::handler(WINDOW win, EVENT* ep) case M_FILE_NEW: set_firm(); break; - case (M_FILE_ABOUT+1): + case M_FILE_ABOUT: about(); break; case M_HELP_CONTENTS: @@ -639,14 +639,9 @@ void TApplication::run( CGetPref(); const int sn = get_serial_number(); - if (sn < 0) + if (sn > 0 && !test_assistance_year()) { - error_box(TR("Probabilmente non e' inserita la chiave di protezione\noppure mancano i relativi driver.")); - return; - } - if (!test_assistance_year()) - { - error_box(TR("Probabilmente e' necessario attivare il contratto di assistenza per l'anno in corso")); + error_box(TR("E' necessario attivare il contratto di assistenza per l'anno in corso")); return; } @@ -671,10 +666,7 @@ void TApplication::run( bool TApplication::get_version_info(int& year, int& release, int& tag, int& patch) { - //Commentato per la 10.0! Non cancellare!! - //const char* const VERSIONANDPATCH = "Don't cry for me Argentina.2008.10.00.0000.2018"; - - const char* const VERSIONANDPATCH = "Don't cry for me Argentina.2008.04.00.0001.2013"; + const char* const VERSIONANDPATCH = "Don't cry for me Argentina.2008.10.00.0000.2018"; TToken_string vep(VERSIONANDPATCH, '.'); year = vep.get_int(1); @@ -683,9 +675,6 @@ bool TApplication::get_version_info(int& year, int& release, int& tag, int& patc patch = vep.get_int(); int checksum = vep.get_int(); - //Commentato per la 10.0! Non cancellare!! - //bool valid = year >= 2008 && release > 0 && tag >= 0 && patch >= 0 && - bool valid = year >= 2008 && release > 0 && tag >= 0 && patch >= 0 && checksum == (year + release + tag + patch); diff --git a/include/automask.cpp b/include/automask.cpp index 8e677e8c4..f9a0cd35c 100755 --- a/include/automask.cpp +++ b/include/automask.cpp @@ -20,8 +20,7 @@ bool TAutomask::error_box(const char* fmt, ...) { post_error_message(msg, 3); } - - return FALSE; + return false; } TField_event TAutomask::key2event(TMask_field& f, KEY key) const @@ -61,7 +60,7 @@ TField_event TAutomask::key2event(TMask_field& f, KEY key) const if (!f.is_edit()) { const TMask& wm = f.mask(); - if (f.is_kind_of(CLASS_BUTTON_FIELD)) + if (f.is_kind_of(CLASS_BUTTON_FIELD) || f.is_kind_of(CLASS_BUTTON_TOOL)) fe = fe_button; else if (f.is_kind_of(CLASS_TREE_FIELD)) fe = wm.is_running() ? fe_modify : fe_init; diff --git a/include/bagn008.uml b/include/bagn008.uml index 2122eb86b..1d1a1a0d1 100755 --- a/include/bagn008.uml +++ b/include/bagn008.uml @@ -1,4 +1,4 @@ -TOOLBAR "Toolbar" 0 -2 0 2 +TOOLBAR "Toolbar" 0 0 0 2 BUTTON DLG_PRINT 10 2 BEGIN @@ -9,39 +9,38 @@ END BUTTON DLG_SAVEREC 10 2 BEGIN - PROMPT -24 -1 "~Registra" + PROMPT -24 -1 "Esporta" MESSAGE EXIT,K_SAVE PICTURE BMP_SAVEREC - PICTURE BMP_SAVERECDN -END - -BUTTON DLG_PREVREC 3 -BEGIN - PROMPT -34 -2 "" - PICTURE 122 END BUTTON DLG_FIRSTREC 3 BEGIN - PROMPT -34 -1 "" + PROMPT -34 -1 "Prima pagina" PICTURE 121 END +BUTTON DLG_PREVREC 3 +BEGIN + PROMPT -34 -2 "Pagina Precedente" + PICTURE 122 +END + BUTTON DLG_FINDREC 10 2 BEGIN - PROMPT -34 -1 "" + PROMPT -34 -1 "Ricerca Pagina" PICTURE 166 END BUTTON DLG_NEXTREC 3 BEGIN - PROMPT -34 -2 "" + PROMPT -34 -2 "Prossima pagina" PICTURE 124 END BUTTON DLG_LASTREC 3 BEGIN - PROMPT -34 -1 "" + PROMPT -34 -1 "Ultima Pagina" PICTURE 125 END @@ -53,9 +52,9 @@ END ENDPAGE -PAGE "Anteprima" -1 -1 60 13 +PAGE "Anteprima" 0 0 0 0 -PREVIEW DLG_USER -3 -1 +PREVIEW DLG_USER BEGIN PROMPT 0 0 "" END diff --git a/include/classes.h b/include/classes.h index aaa402e1c..c3cc6c930 100755 --- a/include/classes.h +++ b/include/classes.h @@ -54,6 +54,9 @@ #define CLASS_GOLEM_CLIENT_FIELD 252 #define CLASS_OUTLOOK_FIELD 253 +#define CLASS_TOOL_FIELD 280 +#define CLASS_BUTTON_TOOL 281 + #define CLASS_BASEISAMFILE 300 #define CLASS_ISAMFILE 301 #define CLASS_SYSTEMISAMFILE 302 diff --git a/include/colors.h b/include/colors.h index ccda9a65a..fd17d2049 100755 --- a/include/colors.h +++ b/include/colors.h @@ -36,6 +36,7 @@ extern bool ADVANCED_GRAPHICS; extern bool AUTOSELECT; extern bool AUTOZOOM; extern bool AUTOEND; +extern int TOOL_SIZE; const COLOR COLOR_DKCYAN = MAKE_COLOR(0,128,128); const COLOR COLOR_DKYELLOW = MAKE_COLOR(128,128, 0); diff --git a/include/controls.cpp b/include/controls.cpp index e712fade7..e86f1dcb4 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -40,7 +40,7 @@ bool ADVANCED_GRAPHICS = true; bool AUTOZOOM = false; bool AUTOEND = false; bool NATIVE_CONTROLS = false; -bool USE_NOTEBOOK = false; // NATIVE_CONTROLS +int TOOL_SIZE = 24; HIDDEN bool _button_blocked = false; HIDDEN int _last_mouse_button = 0; @@ -326,6 +326,7 @@ void customize_colors() xi_set_pref(XI_PREF_NATIVE_CTRLS, NATIVE_CONTROLS); } } + TOOL_SIZE = colors.get_int("ToolSize", NULL, -1, TOOL_SIZE); const int SPEECH_MODE = colors.get_int("SpeechMode", NULL, -1, 0); xvt_vobj_set_attr(NULL_WIN, ATTR_SPEECH_MODE, SPEECH_MODE); @@ -464,7 +465,8 @@ HIDDEN void init_fu_multiple(XI_OBJ* itf) Y_FU_MULTIPLE = max_rct.bottom / 25; } -#define MASK_RECT_ID -883 +// OBSOLETE +// #define MASK_RECT_ID -883 HIDDEN XI_BITMAP* get_background_bitmap() { @@ -484,7 +486,7 @@ HIDDEN XI_BITMAP* get_background_bitmap() } WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, - const char* caption, TWindow* msk, bool orecchie) + const char* caption, TWindow* msk/*, bool orecchie*/) { if (parent == NULL_WIN) parent = TASK_WIN; @@ -524,17 +526,8 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, const WIN_TYPE wt = (dx == 0) ? W_PLAIN : W_DOC; long wsf = WSF_INVISIBLE | WSF_NO_MENUBAR; - WINDOW win = NULL_WIN; - if (USE_NOTEBOOK && orecchie && parent != NULL_WIN) - { - const short tab_no = xvt_notebk_get_num_tabs(parent); - xvt_notebk_add_tab(parent, tab_no, caption, NULL); - xvt_notebk_add_page(parent, tab_no, 0, caption, (long)msk); - win = xvt_notebk_create_face(parent, tab_no, 0, EM_ALL, xi_event, (long)msk); - } - else - win = xvt_win_create(wt, &r, caption, 0L, parent, wsf, - EM_ALL, (EVENT_HANDLER)xi_event, (long)msk); + WINDOW win = xvt_win_create(wt, &r, caption, 0L, parent, wsf, + EM_ALL, (EVENT_HANDLER)xi_event, (long)msk); CHECK(win, "Can't create an XVT window for an interface"); xvtil_set_font(win, NULL, 0, 0); @@ -574,6 +567,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, xvt_vobj_move(win, &r); } + /* OBSOLETE // Aggiunge rettangolo di cornice per pagine con orecchie if (!USE_NOTEBOOK && orecchie) { @@ -598,6 +592,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, xi_dequeue(); xi_tree_free(def); } + */ return win; } @@ -914,6 +909,7 @@ void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, RCT & if (Y_FU_MULTIPLE == 0) // Puo' succedere che non sia ancora inizializzato init_fu_multiple(itf); +/* OBSOLETE // Se ci sono i tab controls sulla pagina salta una riga if (y >= 0) { @@ -922,6 +918,7 @@ void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, RCT & if (num > 0 && child[0]->cid == MASK_RECT_ID) y++; } +*/ RCT max_rct; xvt_vobj_get_client_rect(win, &max_rct); xi_pu_to_fu(itf, (XinPoint *)&max_rct, 2); @@ -1409,7 +1406,7 @@ void TField_control::create(WINDOW win, short cid, { f->button = true; f->pixel_button_distance = 1; - f->button_width = 16; + f->button_width = 18; } } else // E' un multiline, quindi setto il rettangolo diff --git a/include/controls.h b/include/controls.h index c3ab35d3c..e80d787c5 100755 --- a/include/controls.h +++ b/include/controls.h @@ -24,7 +24,7 @@ XVT_FNTID xvt_default_font(bool bold = false, bool big = false); XVT_FNTID xvt_load_default_font(); WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, - const char* caption, TWindow* mask, bool tags); + const char* caption, TWindow* mask /*, bool tags*/); void attach_interface(WINDOW win, COLOR back); short low_get_focus_id(WINDOW win); diff --git a/include/defmask.h b/include/defmask.h index 3c2ad63fb..07b184f1f 100755 --- a/include/defmask.h +++ b/include/defmask.h @@ -34,6 +34,8 @@ #define DLG_PROFILE 30 /* TAG del campo */ #define DLG_PDF 31 /* TAG del bottone Stampa PDF */ #define DLG_ARCHIVE 32 /* TAG del bottone Archiviazione */ +#define DLG_INFO 33 /* TAG del bottone Informazioni */ +#define DLG_HELP 34 /* TAG del bottone Informazioni */ #define DLG_USER 100 /* TAG del primo controllo definito dall'utente */ /* @M diff --git a/include/execp.cpp b/include/execp.cpp index 2835998d1..29fd18aab 100755 --- a/include/execp.cpp +++ b/include/execp.cpp @@ -5,6 +5,13 @@ #include #include +static bool is_outlook_menu() +{ + const int dw = xvt_vobj_get_attr(NULL_WIN, ATTR_SCREEN_WIDTH); + RCT rct; xvt_vobj_get_outer_rect(TASK_WIN, &rct); + return rct.left > 0 && rct.right < dw-1; +} + // @doc EXTERNAL // @mfunc Esegue il processo @@ -65,6 +72,9 @@ long TExternal_app::run( xvt_fsys_set_dir(&d); } } + + // Vecchio titolo della finestra principale + TString256 old_title; const bool close_all = !async && _path.starts_with("ba1 -0") && prefix_valid(); if (!async) @@ -76,11 +86,21 @@ long TExternal_app::run( if (dongle().local()) dongle().logout(); + + if (iconize && utente && is_outlook_menu()) + { + xvt_vobj_get_title(TASK_WIN, old_title.get_buffer(), old_title.size()); + xvt_vobj_set_title(TASK_WIN, __MAGIC_CAPTION__); + iconize = false; + } } - // iconize &= !async && show; - // _exitcode = os_execute(path, !async, iconize, show); _exitcode = xvt_sys_execute(path, !async, iconize); + + if (old_title.full()) // Rimetto le cose a posto + { + xvt_vobj_set_title(TASK_WIN, old_title); + } // restore cwd xvt_fsys_set_dir(&oldir); diff --git a/include/execp.h b/include/execp.h index 5f3686e9f..12a974a5f 100755 --- a/include/execp.h +++ b/include/execp.h @@ -5,6 +5,9 @@ #include #endif +// Nome segreto per la finestra che deve ospitare un programma +#define __MAGIC_CAPTION__ "__CAMPO_HOST_WINDOW__" + // @doc EXTERNAL // @class TExternal_app | Classe per l'esecuzione di oggetti esterni @@ -14,10 +17,8 @@ class TExternal_app : public TObject // @author:(INTERNAL) Villa -// @comm Gli oggetti eseguiti dalla presente classe possono essere eseguiti +// @comm Gli oggetti della presente classe possono essere eseguiti // in background in tutti gli ambienti, oppure in modo sincrono. -// Non sono implementate linee di comando; si suppone che l'utente -// utilizzi la mailbox per questo. // @access:(INTERNAL) Private Member { diff --git a/include/files.cpp b/include/files.cpp index cf4c6a819..89ddd7f2d 100755 --- a/include/files.cpp +++ b/include/files.cpp @@ -299,7 +299,6 @@ void TDir::zero () } void TDir::print_on (ostream & out) const - { CHECK(_dir,"Can't print a NULL _dir"); out << _num << '\n'; @@ -523,20 +522,16 @@ void TTrec::zero () } int TTrec::status (TDirtype dirop) const - { return rdir[dirop].IOR; } -int TTrec ::field (const char *name) const - +int TTrec::field(const char *name) const { - return findfld (_rec, (char *) name); - + return findfld(_rec, name); } const char *TTrec ::fielddef (int fld) const - { sprintf (_files_tmp_string, "%s|%d|%d|%d", _rec->Fd[fld].Name, (int) _rec->Fd[fld].TypeF, (int) _rec->Fd[fld].Len, @@ -545,7 +540,6 @@ const char *TTrec ::fielddef (int fld) const } const char *TTrec ::keydef (int key) const - { TFixed_string s (_files_tmp_string, 128); @@ -584,26 +578,23 @@ bool TDir::is_active () const return main_app().has_module(module, CHK_DONGLE); } -void TTrec::update_fielddef (int nfld, const char *desc) - +void TTrec::update_fielddef (int nfld, TToken_string& s) { - TToken_string s (desc); - strcpy (_rec->Fd[nfld].Name, s.get ()); - _rec->Fd[nfld].TypeF = s.get_int (); - _rec->Fd[nfld].Len = s.get_int (); - _rec->Fd[nfld].Dec = s.get_int (); + RecFieldDes& rfd = _rec->Fd[nfld]; + strcpy (rfd.Name, s.get(0)); + rfd.TypeF = s.get_int (); + rfd.Len = s.get_int (); + rfd.Dec = s.get_int (); } -void TTrec::update_keydef (int key, const char *desc) - +void TTrec::update_keydef (int key, TToken_string& s) { TExpression expr ("", _strexpr); - TToken_string s (desc); - TString ke (s.get ()); + TString ke (s.get(0)); - if (expr.set ((const char *) ke, _strexpr)) + if (expr.set(ke, _strexpr)) { - const char * dup = s.get(); + const char* dup = s.get(); _rec->Ky[key].DupKeys = (dup && *dup != ' '); TCodearray & c = expr.code (); c.begin (); @@ -645,8 +636,7 @@ void TTrec::update_keydef (int key, const char *desc) } } -void TTrec::print_on (ostream & out) const - +void TTrec::print_on(ostream & out) const { const int n = num(); out << n; @@ -676,52 +666,46 @@ void TTrec::print_on (ostream & out) const } } -void TTrec::read_from (istream & in) - +void TTrec::read_from(istream & in) { const int n = num(); - in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); - if (_des && n>=LF_TABGEN && n<=LF_TAB) + TToken_string t(256); + in.getline (t.get_buffer(), t.size(), '\n'); + if (_des && n >= LF_TABGEN && n <= LF_TAB) { - const TFixed_string t(_files_tmp_string); if (t.find('|') >= 0) { const TString4 tabname(t.right(3)); - strcpy(_files_tmp_string,t.left(t.len()-4)); // Toglie il nome della tabella - if (_tab != tabname && !yesno_box("Descrizione relativa alla tabella %s.\n Continuo ?",(const char*) tabname)) + t.rtrim(4); // Toglie il nome della tabella + if (_tab != tabname && !yesno_box("Descrizione relativa alla tabella %s.\n Continuare?",(const char*) tabname)) return; } } - const int ln = atoi (_files_tmp_string); - if (n > 0 && ln != n && !yesno_box ("Descrizione relativa al file n.ro %d.\n Continuo ?", ln)) + const int ln = t.get_int(0); + if (n > 0 && ln != n && !yesno_box ("Descrizione relativa al file n.ro %d.\n Continuare?", ln)) return; - in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); - const int nfields = atoi (_files_tmp_string); + in.getline (t.get_buffer(), t.size(), '\n'); + const int nfields = t.get_int(0); set_fields (nfields); - TToken_string t; - int i; - for (i = 0; i < nfields; i++) + for (int i = 0; i < nfields; i++) { - in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); - t = _files_tmp_string; + in.getline (t.get_buffer(), t.size(), '\n'); + update_fielddef (i, t); const int itms = t.items(); - - update_fielddef (i, _files_tmp_string); - if (_des && itms == 5) // La descrizione viene caricata solo se esiste - _des->set(_rec->Fd[i].Name, t.get(itms-1)); + if (_des && itms >= 5) // La descrizione viene caricata solo se esiste + _des->set(_rec->Fd[i].Name, t.get(4)); } - int nkeys; - in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); - nkeys = atoi (_files_tmp_string); + in.getline (t.get_buffer(), t.size(), '\n'); + const int nkeys = t.get_int(0); set_keys (nkeys); - for (i = 0; i < nkeys; i++) + for (int i = 0; i < nkeys; i++) { - in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n'); - update_keydef (i, _files_tmp_string); + in.getline (t.get_buffer(), t.size(), '\n'); + update_keydef (i, t); } rehash (); _des = NULL; diff --git a/include/files.h b/include/files.h index 7fd206d03..31fd3069b 100755 --- a/include/files.h +++ b/include/files.h @@ -245,9 +245,9 @@ public: #ifndef FOXPRO // @cmember Aggiorna la chiave.

e' una token string - void update_keydef(int key, const char* desc); + void update_keydef(int key, TToken_string& desc); // @cmember Aggiorna il campo.

e' una token string - void update_fielddef(int nfld, const char* desc); + void update_fielddef(int nfld, TToken_string& desc); // @cmember Stampa il tracciato record sull'output selezionato virtual void print_on(ostream& out) const; // @cmember Legge il tracciato record da input selezionato diff --git a/include/isam.cpp b/include/isam.cpp index 7edff9d49..a24fa90a9 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include @@ -27,8 +27,7 @@ #include #include - - +#include #ifdef JOURNAL #include @@ -2126,16 +2125,16 @@ int TSystemisamfile::update( if (newfields < MaxFields) { wrec.update_fielddef(newfields++, def); - wrec.set_fields(newfields); + wrec.set_fields(newfields); wrec.rehash(); - } + } else + { if(!yesno_box("Il campo %s non verra' preservato, devo continuare?", (const char*)fname)) return NOERR; + } } - - } } if (wfields < newfields) @@ -2462,14 +2461,9 @@ int TSystemisamfile::load( if (extended) { TDate d(TODAY); - TLocalisamfile ditte(LF_NDITTE); - - firm.format("%05ld", prefix().get_codditta()); year.format("%04d", d.year()); - ditte.zero(); - ditte.put("CODDITTA", firm); - if (ditte.read() == NOERR) - attprev = ditte.get("CODATTPREV"); + firm.format("%05ld", prefix().get_codditta()); + attprev = cache().get(LF_NDITTE, firm, NDT_CODATTPREV); } fseek(fl, 0L, SEEK_END); diff --git a/include/mask.cpp b/include/mask.cpp index 60687277e..ada65744f 100755 --- a/include/mask.cpp +++ b/include/mask.cpp @@ -8,56 +8,16 @@ #include #include #include +#include +#include #include #include #include #include -#define DLG_PAGETAGS 31000 - HIDDEN const char* const MASK_EXT = "msk"; -/////////////////////////////////////////////////////////// -// PAGE BUTTONS -/////////////////////////////////////////////////////////// - -class TPage_field : public TRadio_field -{ - byte _def; - -protected: - virtual void current(int) { } // Evita il reset - virtual int current() const { return _def; } - virtual bool is_loadable() const { return false; } - virtual bool is_editable() const { return false; } - -public: - virtual void set_prompt(const char* p); - void create(WINDOW parent); - void set_default(byte d) { _def = d; } - void show_button(int i, bool on); - - TPage_field(TMask* m) : TRadio_field(m) { } - virtual ~TPage_field() { } -}; - -void TPage_field::create(WINDOW parent) -{ - _ctl = new TTagbutton_control(parent, _ctl_data._dlg, 0, 0, 80, 1, "", _values, _def); -} - -void TPage_field::set_prompt(const char* p) -{ - _ctl->set_caption(p); -} - -void TPage_field::show_button(int i, bool on) -{ - TTagbutton_control* tag = (TTagbutton_control*)_ctl; - tag->show_button(i, on); -} - /////////////////////////////////////////////////////////// // TMask methods /////////////////////////////////////////////////////////// @@ -84,21 +44,47 @@ void TMask::init_mask() _test_fld = -1; _last_test = -1; - memset(_pagewin, 0, sizeof(_pagewin)); + _toolwin = _toolbar = _notebook = _single = NULL_WIN; + memset(_pagewin, 0, sizeof(_pagewin)); // Azzero lista pagine } -TMask::TMask() - : _mask_num(0) +WINDOW TMask::page_win(int p) const +{ + if (p >= MAX_PAGES) + return p == MAX_PAGES ? toolwin() : toolbar(); + if (p >= 0 && p < _pages) + return _pagewin[p]; + return p <= 0 ? win() : NULL_WIN; +} + +WINDOW TMask::curr_win() const +{ + return page_win(_page > 0 && _page < _pages ? _page : 0); +} + +TMask::TMask() : _mask_num(0) { init_mask(); } TMask::TMask(const char* title, int pages, int cols, int rows, - int xpos, int ypos, WINDOW parent) - : _mask_num(0) + int xpos, int ypos, WINDOW parent) : _mask_num(0) { init_mask(); - for (_pages = 0; _pages < pages; _pages++) - _pagewin[_pages] = create_interface(parent, xpos, ypos, - cols, rows, title, this, pages > 1); + if (pages > 1) + { + WINDOW w = create_interface(parent, xpos, ypos, cols, rows, title, this); + set_win(w); // Crea la pagina principale che ospitera' il notebook + create_book(false); // Crea il notebook che ospitera' le pagine + for (int p = 1; p <= pages; p++) + { + WINDOW w = create_interface(notebook(), 0, 0, 0, 0, title, this); + insert_page(w, -1); // Aggiunge nuova pagina in fondo + } + } + else + { + WINDOW w = create_interface(parent, xpos, ypos, cols, rows, title, this); + insert_page(w, 0); + } } void TMask::set_locking(TBit_array& read_only, TToken_string& list, bool on) @@ -155,6 +141,7 @@ void TMask::read_mask( if (num != 0) _mask_num = num; + // Salta la maschera principale e quelle degli sheet precedenti a pie' pari for (int i = 0; i < num; i++) { while (scanner.ok()) @@ -163,41 +150,27 @@ void TMask::read_mask( init_mask(); - TToken_string captions(80); - while (scanner.ok() && scanner.popkey() != "EN") { if (scanner.key() == "PA") { - CHECKD(_pages < MAX_PAGES, "Maschera con troppe pagine: ", _pages); - WINDOW w = read_page(scanner, false); - - TString80 title; - xvt_vobj_get_title(w, title.get_buffer(), title.size()); - captions.add(title); - - _pagewin[_pages++] = w; + read_page(scanner, false); if (_pages >= max) break; - } else + } + else + { if (scanner.key() == "TO") - { - CHECK(toolwin() == NULL_WIN, "La maschera puo' avere una sola TOOLBAR"); - _pagewin[MAX_PAGES] = read_page(scanner, true); - } + read_page(scanner, true); + } } if (_pages <= 0) fatal_box("Impossibile leggere la maschera %s : %d", (const char*)_source_file, num); - if (_pages > 1 || toolwin()) - add_tag_buttons(captions); - if (num == 0) { - TFilename prof; make_profile_name(prof); - if (prof.exist()) { // Costruisce la lista dei gruppi di appartenenza dell'utente @@ -242,6 +215,18 @@ void TMask::add_field(TMask_field* f) const short id = f->dlg(); if (id > 0 && id < 512) { + if (f->is_sheet()) + { + for (short cid = 101; cid <= 110; cid++) + { + if (_position.objptr(cid) && f->parent() == field(cid).parent()) + { + NFCHECK("Lo sheet %d mal sopporta la convivenza col campo %d", id, cid); + break; + } + } + } + if (_position.objptr(id)) { if (id > DLG_QUIT) @@ -252,31 +237,32 @@ void TMask::add_field(TMask_field* f) } } -void TMask::add_tag_button(byte pag, TToken_string& tags, byte sel) -{ - TPage_field* pf = new TPage_field(this); - pf->_ctl_data._dlg = DLG_PAGETAGS + 100 * pag; - pf->replace_items("1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16", tags); - pf->set_default(sel); - pf->create(_pagewin[pag]); - add_field(pf); -} - -void TMask::add_tag_buttons(TToken_string& tags) +void TMask::set_tab_buttons(TToken_string& tabs) { - for (byte p = 0; p < _pages; p++) - add_tag_button(p, tags, p); -} + int tab = 0; -void TMask::add_default_tag_buttons() -{ - TToken_string tags(_pages * 6); - for (int p = 1; p <= _pages; p++) + WINDOW nb = notebook(); + if (nb == NULL_WIN) + nb = create_book(false); + FOR_EACH_TOKEN(tabs, title) { - tags.add(TR("Pag.")); - tags << p; + if (tab >= _pages) // Se devo creare piu' orecchie che pagine... + insert_page(page_win(_pages-1), -1); // ... ripeto l'ultima pagina + xvt_notebk_set_tab_title(nb, tab, title); + tab++; } - add_tag_buttons(tags); +} + +void TMask::set_default_tab_buttons() +{ + TToken_string tabs; + TString16 pag; + for (int i = 1; i <= _pages; i++) + { + pag.format(FR("Pag.%d"), i); + tabs.add(pag); + } + set_tab_buttons(tabs); } TMask::TMask(const char* maskname, int num, int max) @@ -290,13 +276,8 @@ TMask::TMask(const char* maskname, int num, int max) TMask::~TMask() { _field.destroy(); - for (int p = MAX_PAGES; p >= 0; p--) - if (_pagewin[p]) - { - if (xvt_vobj_get_attr(_pagewin[p], ATTR_NATIVE_WINDOW) != 0) - xvt_vobj_destroy(_pagewin[p]); - _pagewin[p] = NULL_WIN; - } + xvt_vobj_destroy(_toolwin); + xvt_vobj_destroy(_notebook); } word TMask::class_id() const @@ -312,11 +293,11 @@ bool TMask::is_kind_of(word c) const void TMask::open() { if (!_open || _page != 0) - { _open = true; - if (toolwin()) - xvt_vobj_set_visible(toolwin(), true); - } + + if (toolbar() != NULL_WIN) + xvt_toolbar_realize(toolbar()); // Non si capisce perche' ce ne sia bisogno, ma tant'e' + _focus = first_focus(0); set_focus_field(fld(_focus).dlg()); } @@ -351,7 +332,7 @@ int TMask::first_focus(short id) { if (f < 0 || !fld(f).active()) { - f = find_first_active(_pagewin[0]); + f = find_first_active(curr_win()); if (f < 0 && toolwin()) f = find_first_active(toolwin()); } @@ -376,7 +357,7 @@ TOperable_field& TMask::focus_field() const { if (is_open()) { - const short focus = low_get_focus_id(win()); + const short focus = low_get_focus_id(curr_win()); if (focus > 0 ) ((TMask *)this)->notify_focus_field(focus); } @@ -392,9 +373,13 @@ void TMask::set_focus_field(short id) if (is_open()) { const TMask_field& f = field(id); - int p = find_parent_page(f); - if (p < 0 || p >= _pages || !page_enabled(p)) - p = 0; + int p = _page > 0 ? _page : 0; + if (f.parent() != curr_win()) // Controllo se devo cambiar pagina + { + p = find_parent_page(f); + if (p < 0 || p >= _pages || !page_enabled(p)) + p = 0; + } show_page(p); } } @@ -424,8 +409,7 @@ void TMask::close() { _open = false; _page = -1; - for (int p = 0; p <= MAX_PAGES; p++) - if (_pagewin[p]) xvt_vobj_set_visible(_pagewin[p], false); + xvt_vobj_set_visible(win(), false); } short TMask::dirty() const @@ -465,31 +449,44 @@ void TMask::enable_page( byte page, // @parm Pagina da abilitare/disabilitare bool on) // @parm Operazione da svolgere: // - // @flag true | Abilita la pagina

(default) - // @flag false | Disabilita la pagina

+ // @flag true | Abilita la pagina

(default) + // @flag false | Disabilita la pagina

{ - CHECK(page > 0, "Can't enable/disable first page"); - - if (_enabled[page] != on) + if (page > 0 && page < _pages) // Non posso spegnere la prima pagina { - for (byte i = page; i < _pages; i++) + if (_enabled[page] != on) { - _enabled.set(i, on); - for (byte b = 0; b < _pages; b++) + CHECK(_notebook, "Can't find an useful notebook"); + const short tabs = xvt_notebk_get_num_tabs(_notebook); + if (on) { - TPage_field& pf = (TPage_field&)field(DLG_PAGETAGS + 100 * b); - pf.show_button(i, on); + // Riaggiungo i tab buttons (normalmente tabs == page) + for (short i = tabs; i < _pages; i++) + { + _enabled.set(i, true); + xvt_notebk_add_page(_notebook, _pagewin[i], NULL, NULL, i); + } + } + else + { + // Elimino i tab buttons (normalmente tabs == _pages) + for (short i = tabs-1; i >= page; i--) + { + _enabled.set(i, false); + xvt_notebk_rem_tab(_notebook, i); + } + _page = -1; } } } } // Controlla lo stato di abilitazione di una pagina -// Certified 100% +// Certified 99% bool TMask::page_enabled(byte p) const { - CHECKD(p <= MAX_PAGES, "Page too high ", (int)p); - const bool on = _pagewin[p] != NULL_WIN && _enabled[p]; + // First page and toolbars are always enabled + const bool on = p == 0 || p >= MAX_PAGES || _enabled[p]; return on; } @@ -511,8 +508,10 @@ void TMask::start_run() if (f.dirty() <= 1) // Attenzione puo' valere anche 3 per i very dirty! { f.set_dirty(false); - const bool op = f.is_operable() && !f.is_kind_of(CLASS_BUTTON_FIELD); - if (op && (f.active() || f.ghost())) + const bool op = f.is_operable() && (f.active() || f.ghost()) && + !f.is_kind_of(CLASS_BUTTON_FIELD) && + !f.is_kind_of(CLASS_BUTTON_TOOL); + if (op) f.on_hit(); // Lancia messaggio di inizializzazione } } @@ -645,6 +644,12 @@ int TMask::field2pos(const char* fieldname) const return i; } +TMask_field* TMask::find_by_id(short id) const +{ + const int i = id2pos(id); + return i >= 0 ? &fld(i) : NULL; +} + TMask_field* TMask::find_by_fieldname(const char* fieldname) const { const int i = field2pos(fieldname); @@ -683,10 +688,7 @@ TTree_field& TMask::tfield(short id) const int TMask::find_parent_page(const TMask_field& f) const { - const WINDOW pw = f.parent(); - for (int p = 0; p < _pages; p++) - if (pw == _pagewin[p]) return p; - return MAX_PAGES; // Toolbar button + return win2page(f.parent()); } // @mfunc Forza la chiusura della maschera @@ -705,15 +707,24 @@ bool TMask::stop_run( { const int last = fields(); int i; - + // Cerca se esiste un bottone avente come exit_key() il tasto key for (i = 0; i < last; i++) { const TMask_field& f = fld(i); - if (f.active() && f.is_kind_of(CLASS_BUTTON_FIELD)) + if (f.active()) { - const TButton_field& b = (const TButton_field&)f; - if (b.exit_key() == key) - break; + if (f.is_kind_of(CLASS_BUTTON_FIELD)) + { + const TButton_field& b = (const TButton_field&)f; + if (b.exit_key() == key) + break; + } else + if (f.is_kind_of(CLASS_BUTTON_TOOL)) + { + const TButton_tool& b = (const TButton_tool&)f; + if (b.exit_key() == key) + break; + } } } if (i >= last) @@ -757,6 +768,7 @@ void TMask::handler(WINDOW win, EVENT* ep) if (ep->type == E_MOUSE_DOWN && ep->v.mouse.button == 1) { _last_sheet = NULL; + win = curr_win(); for (int f = fields()-1; f >= 0; f--) { TMask_field& cur_fld = fld(f); @@ -793,6 +805,7 @@ void TMask::handler(WINDOW win, EVENT* ep) case BROWSE_BAR+1: _last_sheet->save_columns_order(); break; case BROWSE_BAR+2: _last_sheet->reset_columns_order(); break; case BROWSE_BAR+3: _last_sheet->on_key(K_F11); break; + case BROWSE_BAR+4: _last_sheet->esporta(); break; default: break; } return; @@ -816,6 +829,31 @@ void TMask::handler(WINDOW win, EVENT* ep) } } + if (ep->type == E_CONTROL) + { + if (is_running()) + { + switch (ep->v.ctl.ci.type) + { + case WC_NOTEBK: + if (ep->v.ctl.ci.win == _notebook) + { + const int new_page = ep->v.ctl.ci.v.notebk.tab_no; + if (new_page != _page && new_page < _pages) + show_page(new_page); + } + break; + case WC_PUSHBUTTON: + if (ep->v.ctl.ci.win == _toolbar) + field(ep->v.ctl.id).on_key(K_SPACE); + break; + default: + break; + } + } + return; + } + TWindow::handler(win, ep); } @@ -941,10 +979,15 @@ bool TMask::on_dirty(TMask_field&) int TMask::win2page(WINDOW w) const { - for (int p = MAX_PAGES; p >= 0; p--) - if (w == _pagewin[p]) - return p; - return -1; + if (w == toolwin()) + return MAX_PAGES; + if (w == toolbar()) + return MAX_PAGES+1; + int p; + for (p = _pages-1; p >= 0; p--) + if (w == page_win(p)) + break; + return p; } TMask_field* TMask::parse_field(TScanner& scanner) @@ -970,6 +1013,13 @@ TMask_field* TMask::parse_field(TScanner& scanner) return NULL; } +TMask_field* TMask::parse_tool(TScanner& scanner) +{ + const TString& k = scanner.key(); + if (k == "BU") return new TButton_tool(this); + return NULL; +} + int TMask::sheets() const { int count = 0; @@ -986,101 +1036,106 @@ int TMask::sheets() const // @mfunc Legge la pagina dal file // // @rdesc Ritorna l'handle della finestra creata -WINDOW TMask::read_page( +void TMask::read_page( TScanner& scanner, // @parm File dal quale leggere la pagina - bool toolbar) // @parm Indica se e' la toolbar + bool is_toolbar) // @parm Indica se e' la toolbar // @comm Il parametro

e' utilizzato per indicare se la pagina deve essere visualizzata // a tutto schermo (true) oppure no { - static int tooly; - static RCT rect; - const TString title = dictionary_translate(scanner.string()); RCT r; - if (toolwin()) // Pagina successiva ad una toolbar + if (!is_toolbar && notebook() != NULL_WIN) // Pagina oltre la prima { - scanner.line(); - xvt_rect_set(&r, 0, 0, 0, tooly); + scanner.line(); // Scarto rettangolo inutile + xvt_rect_set(&r, 0, 0, 0, 0); } else { scanner.rectangle(r.left, r.top, r.right, r.bottom); - if (toolbar) + if (is_toolbar) { if (r.top > 15) // Rendi negative le coordinate delle toolbar per ... r.top -= 23; // ... ottimizzare l'uso dello schermo ad alta risoluzione - tooly = r.top; - } - else - { - if (_pages == 0) - { - if (!is_sheetmask()) - rect = r; - } - else - r = rect; } } - bool orecchie = _pagewin[0] != NULL_WIN || toolwin(); - if (!orecchie && !toolbar) // Controlla se la maschera ha piu' di una pagina - { + if (_notebook == NULL_WIN && _single == NULL) // Controlla se la maschera ha piu' di una pagina ... + { // ... nel caso serva un notebook per le prossime const streampos pos = scanner.tellg(); // Memorizza posizione dello scanner while (true) { const TString& l = scanner.line(); - if (l.empty() || l == "ENDMASK") // Fine maschera - break; - - if (l.compare("PA", 2, true) == 0) // Ho trovato un'altra pagina! + break; + if (l.starts_with("PA") || l.starts_with("TO")) // Ho trovato un'altra pagina! { - orecchie = true; // Quindi devo metterci le orecchie + if (is_toolbar) + create_book(false); // Crea notebook + else + create_book(l.starts_with("TO")); // Crea pagina singola break; } } scanner.seekg(pos); // Ripristina posizione dello scanner } - WINDOW w; - if (toolbar || toolwin()) - { - if (toolbar) - w = create_interface(NULL_WIN, 0, r.top, 0, 0, title, this, false); - else - w = create_interface(NULL_WIN, 0, r.top, 0, tooly, title, this, orecchie); + WINDOW w = NULL_WIN; + if (is_toolbar) + { + if (r.top == 0) + w = create_bar(1); + else + { + CHECKD(r.top < 0, "Bad bottom bar height ", r.top); + w = create_bar(r.top); + } } else { - w = create_interface(NULL_WIN, r.left, r.top, r.right, r.bottom, title, this, orecchie); + if (notebook() != NULL_WIN) + w = create_page(title, -1); + else + { + if (_single != NULL_WIN) + w = _single; + else + { + CHECK(win() == NULL_WIN, "bad page sequence"); + w = create_interface(NULL_WIN, r.left, r.top, r.right, r.bottom, title, this); + insert_page(w, 0); + } + } } - while (scanner.popkey() != "EN") { - TMask_field* f = parse_field(scanner); + TMask_field* f = NULL; + if (is_toolbar && r.top == 0) + f = parse_tool(scanner); + else + f = parse_field(scanner); if (f == NULL) { #ifdef DBG - const int f = fields(); + const int pf = fields(); TString e; - e << "Campo non riconosciuto alla posizione " << f; - if (f > 0) - e << ".\nL'ultimo riconosciuto e' " << fld(f-1).dlg() << ": " << fld(f-1).prompt(); + e << "Campo non riconosciuto alla posizione " << pf; + if (pf > 0) + e << "\nL'ultimo riconosciuto e' " << fld(pf-1).dlg() << ": " << fld(pf-1).prompt(); error_box(e); #endif while (scanner.popkey() != "EN"); } else { - const long start = clock(); f->construct(scanner, w); add_field(f); } } - return w; + + if (is_toolbar && r.top ==0 && _toolbar != NULL_WIN) + xvt_toolbar_realize(_toolbar); } bool TMask::check_current_field() const @@ -1095,71 +1150,123 @@ bool TMask::check_current_field() const return ok; } -WINDOW TMask::insert_page(const char* title, int dove) +WINDOW TMask::create_book(bool single) +{ + CHECK(_notebook == NULL_WIN, "One single notebook, please!"); + + WINDOW parent = win(); + if (parent == NULL_WIN) + { + parent = create_interface(NULL_WIN, 0, 0, 0, 0, "", this); + set_win(parent); + } + if (single) + { + CHECK(_single == NULL_WIN, "One single page pane, please!"); + _single = create_interface(parent, 0, 0, 0, 0, "", this); + xvt_pane_add(parent, _single, "_MainSingle_", 0, 0); + _pagewin[0] = _single; + _pages = 1; + } + else + { + WIN_DEF wd; memset(&wd, 0, sizeof(wd)); + wd.wtype = WC_NOTEBK; + xvt_vobj_get_client_rect(parent, &wd.rct); + _notebook = xvt_ctl_create_def(&wd, parent, long(this)); + xvt_pane_add(parent, _notebook, "_MainNoteBook_", 0, 0); + + if (_single != NULL) // Bello ... se solo andasse! + { + xvt_pane_detach(_single); + insert_page(_single, 0); + _single = NULL_WIN; + } + } + + return single ? _single : _notebook; +} + +void TMask::insert_bar(WINDOW page) +{ + WINDOW parent = win(); + + CHECK(page != NULL_WIN, "Invalid toolbar"); + CHECK(parent != NULL_WIN, "Invalid main window for toolbar"); + + if (_notebook == NULL_WIN && _single == NULL_WIN) + create_book(true); // In assenza di notebook crea un pane a pagina singola + + RCT rct; xvt_vobj_get_outer_rect(page, &rct); + if (rct.top > 0) // BottomBar + { + CHECK(_toolwin == NULL_WIN, "One single bottom bar, please!"); + _toolwin = page; + xvt_pane_add(parent, _toolwin, "_BottomBar_", 4, 0); + // Ammazza la caption e ne blocca le dimensioni + xvt_pane_change_flags(page, 0, 1 <<10); // No caption + xvt_pane_change_flags(page, 0, 1 << 8); // No resize + } + else // TopBar + { + CHECK(_toolbar == NULL_WIN, "One single top bar, please!"); + _toolbar = page; + xvt_pane_add(parent, _toolbar, "_TopBar_", 62, 0); + } +} + +WINDOW TMask::create_bar(int height) { WINDOW w = NULL_WIN; - - if (dove < 0 || dove >= MAX_PAGES) - { - CHECK(toolwin() == NULL_WIN, "One single toolbar, please!"); - const int nHeight = atoi(title); - w = create_interface(NULL_WIN, 0, -nHeight, 0, 0, "", this, false); - _pagewin[MAX_PAGES] = w; - - if (_pages > 0) - { - RCT rctool; xvt_vobj_get_client_rect(w, &rctool); - RCT rctask; xvt_vobj_get_client_rect(TASK_WIN, &rctask); - rctask.bottom -= rctool.bottom; - for (int i = 0; i < _pages; i++) - xvt_vobj_move(win(i), &rctask); - } - } else - if (_pages < MAX_PAGES) - { - w = create_interface(NULL_WIN, 0, 0, 0, 0, title, this, true); - - if (toolwin() != NULL_WIN) - { - RCT rctool; xvt_vobj_get_outer_rect(toolwin(), &rctool); - RCT rctwin; xvt_vobj_get_outer_rect(w, &rctwin); - rctwin.bottom = rctool.top-1; - xvt_vobj_move(w, &rctwin); - } - - int i; - for (i = _pages; i > dove; i--) - _pagewin[i] = _pagewin[i-1]; - _pagewin[dove] = w; - _pages++; - - TToken_string tags; - for (i = 0; i < _pages; i++) - { - char str[80]; - tags.add(xvt_vobj_get_title(_pagewin[i], str, sizeof(str))); - } - - // Kill page tags - for (i = fields()-1; i > 0; i--) - { - TMask_field& tag = fld(i); - if (tag.dlg() >= DLG_PAGETAGS) - { - tag.destroy(); - _field.destroy(i); - } - else - break; - } - // Create page tags - add_tag_buttons(tags); - } + if (height < 0) + w = create_interface(win(), 0, height, 0, 0, "", this); // Bottom bar + else + w = xvt_toolbar_create(-1, 0, 0, -1, TOOL_SIZE, 0, win()); // Top bar + insert_bar(w); // Inserisce toolbar e crea notebook, se necessario return w; } -// @doc EXTERNAL +void TMask::insert_page(WINDOW page, int dove) +{ + CHECKD(dove >= -1 && dove <= _pages, "Invalid page position:", dove); + // Per le pagine dopo la prima devo creare il notebook + if (_pages == 1 && _notebook == NULL_WIN) + create_book(false); + memset(_pagewin, 0, sizeof(_pagewin)); // Azzero lista pagine + if (_notebook != NULL_WIN) // property sheet + { + xvt_notebk_add_page(_notebook, page, NULL, NULL, dove); + _pages = xvt_notebk_get_num_tabs(_notebook); + // Ricostruisco lista pagine + for (short p = 0; p < _pages; p++) + _pagewin[p] = xvt_notebk_get_page(_notebook, p); + } + else // single page + { + CHECK(win() == NULL_WIN, "One single main page, please!"); + set_win(page); + _pagewin[0] = page; // Assegno la prima ed unica pagina + _pages = 1; + } +} + +WINDOW TMask::create_page(const char* title, int dove) +{ + CHECKD(dove < 0 || dove < MAX_PAGES, "invalid page position ", dove); + WINDOW w = create_interface(notebook(), 0, 0, 0, 0, title, this); + insert_page(w, dove); + return w; +} + +void TMask::set_focus() +{ + TWindow::set_focus(); + if (_notebook != NULL_WIN) + xvt_scr_set_focus_vobj(curr_win()); +} + +// @doc EXTERNAL // @mfunc Mostra la prossima/precedente pagina void TMask::next_page( int p) // @parm Pagina alla quale saltare @@ -1191,19 +1298,20 @@ void TMask::next_page( if (_page != prev) { xvt_vobj_set_visible(win(), true); - if (prev >= 0) - xvt_vobj_set_visible(_pagewin[prev], false); + if (notebook() != NULL) + xvt_notebk_set_front_page(notebook(), _page); } - TMask_field& ff = fld(_focus); - if (ff.parent() != win() || !ff.active()) + if (_focus < 0 || fld(_focus).parent() != curr_win() || !fld(_focus).active()) { - _focus = find_first_active(win()); + _focus = find_first_active(curr_win()); if (_focus < 0 && toolwin() != NULL_WIN) _focus = find_first_active(toolwin()); + if (_focus < 0 && toolbar() != NULL_WIN) + _focus = find_first_active(toolbar()); } - TWindow::set_focus(); + set_focus(); if (_focus >= 0) { @@ -1376,7 +1484,7 @@ void TMask::set(short fld_id, const TCurrency& n, byte hit) // @doc EXTERNAL -// @mfunc Permette di attivare/disattivare tutta la pagina +// @mfunc Permette di attivare/disattivare tutta la maschera void TMask::activate( bool on) // @parm Indica l'operazione da svolgere sul campo: // @@ -1384,7 +1492,9 @@ void TMask::activate( // @flag false | Disattiva la pagina { TWindow::activate(on); - if (toolwin() != NULL_WIN) + + // Maschera vecchia e decrepita senza toolbar: nascondo i bottoni + if (toolwin() != NULL_WIN && toolbar() == NULL_WIN) xvt_vobj_set_visible(toolwin(), on); } @@ -1669,7 +1779,7 @@ void TMask::send_key( { if (to == 0) { - WINDOW w = from ? from->parent() : _pagewin[0]; + WINDOW w = from ? from->parent() : win(); dispatch_e_char(w, key); return; } @@ -1755,7 +1865,7 @@ TMask_field& TMask::add_static ( // { TText_field* f = new TText_field(this); - f->construct(id, prompt, x, y, 0, _pagewin[page], flags); + f->construct(id, prompt, x, y, 0, page_win(page), flags); add_field(f); return *f; } @@ -1779,7 +1889,7 @@ TEdit_field& TMask::add_string ( // { TEdit_field* f = new TEdit_field(this); - f->construct(id, prompt, x, y, dim, win(page), flags, width); + f->construct(id, prompt, x, y, dim, page_win(page), flags, width); add_field(f); return *f; } @@ -1805,7 +1915,7 @@ TButton_field& TMask::add_button ( // { TButton_field* f = new TButton_field(this); - f->construct(id, prompt, x, y, dy, win(page), flags, dx, bmpup, bmpdn); + f->construct(id, prompt, x, y, dy, page_win(page), flags, dx, bmpup, bmpdn); add_field(f); return *f; } @@ -1827,7 +1937,7 @@ TBoolean_field& TMask::add_boolean ( // { TBoolean_field* f = new TBoolean_field(this); - f->construct(id, prompt, x, y, strlen(prompt), _pagewin[page], flags); + f->construct(id, prompt, x, y, strlen(prompt), page_win(page), flags); add_field(f); return *f; } @@ -1848,7 +1958,7 @@ TCheckbutton_field& TMask::add_checkbutton ( // { TCheckbutton_field* f = new TCheckbutton_field(this); - f->construct(id, prompt, x, y, dy, _pagewin[page], flags, dx); + f->construct(id, prompt, x, y, dy, page_win(page), flags, dx); if (bmpup > 0) ((TCheckbutton_control*)f->_ctl)->set_icon(bmpup, bmpdn); add_field(f); @@ -1875,7 +1985,7 @@ TReal_field& TMask::add_number ( // { TReal_field* f = new TReal_field(this); - f->construct(id, prompt, x, y, dim, _pagewin[page], flags, ndec); + f->construct(id, prompt, x, y, dim, page_win(page), flags, ndec); add_field(f); return *f; } @@ -1899,7 +2009,7 @@ TCurrency_field& TMask::add_currency ( // { TCurrency_field* f = new TCurrency_field(this); - f->construct(id, prompt, x, y, dim, _pagewin[page], flags, 0); + f->construct(id, prompt, x, y, dim, page_win(page), flags, 0); if (driver != 0) f->add_driver(driver); add_field(f); @@ -1923,7 +2033,7 @@ TDate_field& TMask::add_date ( // { TDate_field* f = new TDate_field(this); - f->construct(id, prompt, x, y, 10, _pagewin[page], flags); + f->construct(id, prompt, x, y, 10, page_win(page), flags); add_field(f); return *f; } @@ -1948,7 +2058,7 @@ TList_field& TMask::add_list ( // { TList_field* f = new TList_field(this); - f->construct(id, prompt, x, y, dim, _pagewin[page], flags); + f->construct(id, prompt, x, y, dim, page_win(page), flags); f->replace_items(codes,items); add_field(f); return *f; @@ -1975,7 +2085,7 @@ TRadio_field& TMask::add_radio( { TRadio_field* f = new TRadio_field(this); f->replace_items(codes, items); - f->construct(id, prompt, x, y, dx, _pagewin[page], flags, dx); + f->construct(id, prompt, x, y, dx, page_win(page), flags, dx); add_field(f); return *f; } @@ -2000,7 +2110,7 @@ TZoom_field& TMask::add_zoom ( // { TZoom_field* f = new TZoom_field(this); - f->construct(id, prompt, x, y, dim, _pagewin[page], flags, width); + f->construct(id, prompt, x, y, dim, page_win(page), flags, width); add_field(f); return *f; } @@ -2024,7 +2134,7 @@ TMemo_field& TMask::add_memo( // { TMemo_field* f = new TMemo_field(this); - f->construct(id, prompt, x, y, dy, _pagewin[page], flags, dx); + f->construct(id, prompt, x, y, dy, page_win(page), flags, dx); add_field(f); return *f; } @@ -2039,7 +2149,7 @@ TTree_field& TMask::add_tree ( const char* flags)// @parm Flag di controllo del campo (default "") { TTree_field* f = new TTree_field(this); - f->construct(id, "", x, y, dy, _pagewin[page], flags, dx); + f->construct(id, "", x, y, dy, page_win(page), flags, dx); add_field(f); return *f; } @@ -2055,11 +2165,21 @@ TGroup_field& TMask::add_groupbox ( const char* flags)// @parm Flag di controllo del campo (default "") { TGroup_field* f = new TGroup_field(this); - f->construct(id, prompt, x, y, dy, _pagewin[page], flags, dx); + f->construct(id, prompt, x, y, dy, page_win(page), flags, dx); add_field(f); return *f; } +TButton_tool& TMask::add_button_tool(short id, const char* prompt, short bmpup) +{ + if (toolbar() == NULL_WIN) // Se non c'e' ancora la toolbar, me l'invento adesso + create_bar(1); + CHECKD(bmpup > 0, "Toolbar button needs a wonderful icon ", id); + TButton_tool* t = new TButton_tool(this); + t->construct(id, prompt, 0, 0, 0, toolbar(), "", 0, bmpup, 0); + add_field(t); + return *t; +} // @doc EXTERNAL @@ -2115,8 +2235,6 @@ bool TMask::load( TToken_string t(256); char* buffer = t.get_buffer(); while (fgets(buffer, t.size(), f) != NULL && t != "[EOM]") - - { if (t.not_empty()) { @@ -2299,51 +2417,25 @@ bool TMask::kill_profile(int num) const char* TMask::get_caption(TString& str) const { char* title = str.get_buffer(128); - xvt_vobj_get_title(_pagewin[0], title, str.size()); + xvt_vobj_get_title(win(), title, str.size()); return title; } void TMask::set_caption(const char* c) { TToken_string captions(c); - - bool bTags = false; - // Kill any page tags - for (int i = fields()-1; i > 0; i--) + if (_notebook != NULL_WIN) { - TMask_field& tag = fld(i); - if (tag.dlg() >= DLG_PAGETAGS) - { - tag.destroy(); - _field.destroy(i); - bTags = true; - } - else - break; - } - - if (bTags) - { - byte p; - for (p = 1; p <_pages; p++) - if (!page_enabled(p)) - break; - while (captions.items() < p) + for (int p = 0; p < _pages; p++) { - const char* k = captions.get(0); - captions.add(k); + const char* title = captions.get(); + if (title == NULL) + title = captions.get(0); + xvt_notebk_set_tab_title(_notebook, p, title); } - add_tag_buttons(captions); // Create page tags } else - { - for (byte p = 0; p < _pages; p++) - { - const char* k = captions.get(p); - if (k == NULL) k = captions.get(0); - xvt_vobj_set_title(_pagewin[p], k); - } - } + xvt_vobj_set_title(win(), captions.get(0)); } void TMask::post_error_message(const char* msg, int sev) @@ -2393,7 +2485,7 @@ TTimed_box::~TTimed_box() } TTimed_breakbox::TTimed_breakbox(const char * message,int seconds,int x,int y) - : TTimed_box("Richiesta di interruzione",message,seconds,DLG_OK,x,y) + : TTimed_box(TR("Richiesta di interruzione"),message,seconds,DLG_OK,x,y) { add_button(DLG_CANCEL, 0, TR("Interrompi"), -22, -1, 12, 2,"",0); add_button(DLG_OK, 0, TR("Riprova"), -12, -1, 12, 2,"",0); @@ -2406,7 +2498,7 @@ TTimed_breakbox::~TTimed_breakbox() // @mfunc costruttore di copia TYesnoallnone_box::TYesnoallnone_box(const char * message, int default_key) - : TMask("Richiesta",1,40,8) + : TMask(TR("Richiesta"),1,40,8) { // costruisce una maschera run time diff --git a/include/mask.h b/include/mask.h index ef3a9a894..c8f7b11e9 100755 --- a/include/mask.h +++ b/include/mask.h @@ -8,13 +8,13 @@ class TSheet_field; class TTree_field; class TCurrency; +class TButton_tool; // @doc EXTERNAL // @type MASK_HANDLER | Prototipo funzione per gestire i tasti speciali all'interno di una maschera. typedef bool (*MASK_HANDLER)(TMask& mask, KEY key); - // @doc EXTERNAL // @enum Modalita' di utilizzo della maschera corrente @@ -47,7 +47,8 @@ class TMask : public TWindow private: // @cmember:(INTERNAL) Windows delle pagine - WINDOW _pagewin[MAX_PAGES+1]; + WINDOW _toolwin, _notebook, _single, _toolbar; + WINDOW _pagewin[MAX_PAGES]; // @cmember:(INTERNAL) Numero della maschera all'interno del file sorgente int _mask_num; @@ -108,17 +109,20 @@ protected: // @cmember Inizializza la maschera (Chiamata quando la maschera parte) virtual void start_run(); + // @cmember Aggiunge una toolbar alla maschera (top or bottom only) + void insert_bar(WINDOW bar); + WINDOW create_book(bool single); + WINDOW create_bar(int height); // if height < 0 then BottomBar else TopBar + // @cmember Aggiunge una pagina alla maschera + void insert_page(WINDOW page, int pos); + WINDOW create_page(const char* title, int pos); // -1 <= pos < MAX_PAGES // @cmember Inizializza la maschera void init_mask(); // @cmember Legge la pagina da file - WINDOW read_page(TScanner& scanner, bool toolbar = false); - WINDOW insert_page(const char* title, int pos); - - // @cmember Aggiunge i tags ad una pagina - void add_tag_button(byte pag, TToken_string& tags, byte sel); + void read_page(TScanner& scanner, bool toolbar); // @cmember Aggiunge alla maschera tutti i bottoni per la navigazione tra le pagine - void add_tag_buttons(TToken_string& tags); + void set_tab_buttons(TToken_string& tabs); // @cmember Ritorna il numero del primo campo attivo della pagina con finestra

int find_first_active(WINDOW w) const; @@ -126,11 +130,12 @@ protected: int find_parent_page(const TMask_field& f) const; // @cmember Esegue i check del campo corrente bool check_current_field() const; + // @cmember Mostra la prossima/precedente pagina virtual void next_page(int p); // @cmember Cambia arbitrariamente il nome del file (uso molto raro) void set_source_file(const char* name) { _source_file = name; } - + WINDOW notebook() const { return _notebook; } // @access Public Member public: // @cmember Costruttore (crea la maschera leggendo la descrizione dal file .msk) @@ -151,6 +156,8 @@ public: // @cmember Legge il campo da file virtual TMask_field* parse_field(TScanner& scanner); + // @cmember Legge il bottone della toolbar da file + virtual TMask_field* parse_tool(TScanner& scanner); // Aggiunge un campo all'array _field void add_field(TMask_field* f); @@ -164,23 +171,19 @@ public: // @cmember Ritorna il numero della pagina corrente int curr_page() const { return _page; } - // @cmember Ritorna la finestra della pagina corrente (Usare con attenzione) - WINDOW win() const - { return _page < 0 ? _pagewin[0] : _pagewin[_page]; } - // @cmember Ritorna la finestra della pagina

(Usare con attenzione) - WINDOW win(int p) const - { return p < 0 ? toolwin() : _pagewin[p]; } + WINDOW page_win(int p) const; + // @cmember Ritorna la finestra della pagina corrente + WINDOW curr_win() const; + // @cmember Ritorna il nome del file contentente la maschera - const TFilename& source_file() const - { return _source_file; } + const TFilename& source_file() const { return _source_file; } // @cmember Ritorna il numero della maschera nel file (> 0 se spreadsheet) - int number() const - { return _mask_num; } + int number() const { return _mask_num; } - // @cmember Aggiunge alla maschera tutti i bottoni Pag. n - void add_default_tag_buttons(); + // @cmember Aggiunge alla maschera tutti i bottoni Pag.n + void set_default_tab_buttons(); // @cmember Aggiunge runtime un campo testo alla maschera TMask_field& add_static (short id, int page, const char* prompt, int x, int y, const char* flags = ""); @@ -211,6 +214,9 @@ public: // @cmember Aggiunge runtime un group box alla maschera TGroup_field& add_groupbox (short id, int page, const char* prompt, int x, int y, int dx = 78, int dy = 3, const char* flags = ""); + // @cmember Aggiunge runtime un bottone alla toolbar + TButton_tool& add_button_tool(short id, const char* prompt, short bmpup); + // @cmember Ritorna il numero di campi della maschera int fields() const { return _field.items(); } @@ -246,6 +252,7 @@ public: virtual void close(); // @cmember Permette di attivare/disattivare tutta la pagina virtual void activate(bool on = TRUE); + virtual void set_focus(); // @cmember Converte un identificatore di campo nella sua posizione int id2pos(short id) const; @@ -256,6 +263,8 @@ public: { return (TMask_field&)_field[i]; } // @cmember Ritorna il campo contraddistinto dall'identificatore passato TMask_field& field(short id) const; + // @cmember Ritorna il campo corrispondente ad id se c'e' + TMask_field* find_by_id(short id) const; // @cmember Ritorna il campo corrispondente al FIELD fieldname TMask_field* find_by_fieldname(const char* fieldname) const; // @cmember Ritorna il campo di edit contraddistinto dall'identificatore passato @@ -437,7 +446,9 @@ public: int win2page(WINDOW p) const ; // @cmember Ritorna la finestra della toolbar WINDOW toolwin() const - { return _pagewin[MAX_PAGES]; } + { return _toolwin; } + WINDOW toolbar() const + { return _toolbar; } }; // @doc EXTERNAL diff --git a/include/maskfld.cpp b/include/maskfld.cpp index 367e5d794..e525d8bce 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -111,8 +111,6 @@ char TMask_field::TField_Flags::update(const char* f, bool reset) return *s; } - - /////////////////////////////////////////////////////////// // TMask_field /////////////////////////////////////////////////////////// @@ -271,6 +269,7 @@ void TMask_field::construct( _ctl_data._width = len; break; case CLASS_BUTTON_FIELD: + case CLASS_BUTTON_TOOL: _ctl_data._height = len; _ctl_data._width = width <= 0 ? 12 : width; _ctl_data._bmp_up = bmp_up; @@ -334,7 +333,8 @@ void TMask_field::construct(TScanner& scanner, WINDOW parent) void TMask_field::destroy() { - _ctl->destroy(); + if (_ctl != NULL) + _ctl->destroy(); } void TMask_field::set_group(byte group) @@ -345,7 +345,6 @@ void TMask_field::set_group(byte group) _groups->set(0L); } - bool TMask_field::parse_item(TScanner& scanner) { if (scanner.key() == "PR") // PROMPT @@ -569,7 +568,10 @@ bool TMask_field::on_key(KEY key) return TRUE; } -#define build_msg() char* _msg = (char*)(const char*)_ctl_data._park;va_list argptr;va_start(argptr,fmt);vsprintf(_msg,fmt,argptr);va_end(argptr) +#define build_msg() \ +char* _msg = _ctl_data._park.get_buffer(256); \ +va_list argptr; va_start(argptr,fmt); \ +vsprintf(_msg,fmt,argptr);va_end(argptr) // @doc EXTERNAL @@ -1157,7 +1159,7 @@ void TButton_field::create(WINDOW parent) if (mess) { TToken_string msg(mess->get(0), ','); - const TString m(msg.get(0)); + const TFixed_string m = msg.get(0); if (m == "EXIT") { _exit_key = msg.get_int(); @@ -4548,10 +4550,8 @@ void TCurrency_field::create(WINDOW w) TEdit_field::create(w); } -TCurrency_field::TCurrency_field(TMask* m) - : TEdit_field(m) -{ -} +TCurrency_field::TCurrency_field(TMask* m) : TEdit_field(m) +{ } /////////////////////////////////////////////////////////// // List_field diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 1c5e4b41c..4339679ff 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -3290,3 +3290,50 @@ void TSheet_field::set_userput(SHEET_USERGETPUT handler) { _userput = handler; } + +bool TSheet_field::esporta() const +{ + TFilename name("tabella.xls"); + FILE_SPEC fs; + xvt_fsys_convert_str_to_fspec(name, &fs); + if (xvt_dm_post_file_save(&fs, TR("Selezionare il file di destinazione"))) + xvt_fsys_convert_fspec_to_str(&fs, name.get_buffer(), name.size()); + + if (name.full()) + { + ofstream xls(name); + const char sep = '\t'; + TToken_string tab(128, sep); + + TString str; + int columns = 0; + for (columns = 0; ; columns++) + { + str = get_column_header(columns); + if (str.not_empty()) + tab.add(str); + else + break; + } + xls << tab << endl; + + for (long n = 0; n < items(); n++) + { + const TToken_string& r = ((TSheet_field*)this)->row(n); + tab = r; + tab.replace(r.separator(), sep); + tab.separator(sep); + for (int c = 0; tab.get(c, str); c++) + { + if (real::is_real(str)) + { + xvt_str_number_format(str.get_buffer(), str.size()); + tab.add(str, c); + } + } + xls << tab << endl; + } + } + + return true; +} diff --git a/include/msksheet.h b/include/msksheet.h index 7366b710f..2f49c3d7a 100755 --- a/include/msksheet.h +++ b/include/msksheet.h @@ -269,6 +269,8 @@ public: // @cmember Trasferisce i valori dalla riga alla maschera

void update_mask(int n) { row2mask(n, row(n)); } + bool esporta() const; + // @cmember Costruttore TSheet_field(TMask* m); // @cmember Distruttore diff --git a/include/prefix.cpp b/include/prefix.cpp index 492910718..2678a676a 100755 --- a/include/prefix.cpp +++ b/include/prefix.cpp @@ -450,8 +450,6 @@ void TFile_info::auto_close() const bool yes = is_open() && !(is_locked() || is_exclusive()); if (yes) close_low(); - else - NFCHECK("Can't auto_close file '%s'", (const char*)_name); } int TFile_info::auto_open(int key) @@ -807,7 +805,7 @@ int TFile_manager::close_closeable() TFile_info& i = fileinfo(n); if (i.is_open()) { - if (!i.is_exclusive()) + if (!i.is_locked() && !i.is_exclusive()) { cache().discard(i.num()); i.auto_close(); @@ -826,7 +824,7 @@ void TFile_manager::close_all() const int zoccolo_duro = close_closeable(); #ifdef DBG if (zoccolo_duro > 0) - NFCHECK("%d files refuse can't be closed!", zoccolo_duro); + NFCHECK("%d files refuse to be closed!", zoccolo_duro); #endif for (int n = _recinfo.last(); n > 0; n = _recinfo.pred(n)) @@ -933,14 +931,13 @@ const TString& TFirm::codice_valuta() const } const TString& TFirm::ragione_sociale() const -{ - return get(NDT_RAGSOC); +{ + return get(NDT_RAGSOC); } - TFirm::TFirm(long code) -{ - read(code); +{ + read(code); } /////////////////////////////////////////////////////////// diff --git a/include/progind.cpp b/include/progind.cpp index 5c4493265..c5d964a1f 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -35,7 +35,7 @@ TIndwin::TIndwin(long tot, const char* txt, bool cancel, bool bar, int div) const int y = _indwin_count == 0 ? 3 : 12; - set_win(create_interface(TASK_WIN, -1, y, hor, ver, TR("Elaborazione in corso"), this, FALSE)); + set_win(create_interface(TASK_WIN, -1, y, hor, ver, TR("Elaborazione in corso"), this/*, FALSE*/)); _text = new TMultiline_control(win(), DLG_NULL, 1, 0, hor-2, lines+1, 512, "CD", ""); _text->set_read_only(); diff --git a/include/real.cpp b/include/real.cpp index 4ca8c1f56..2546bb116 100755 --- a/include/real.cpp +++ b/include/real.cpp @@ -1613,6 +1613,16 @@ const char* real::stringa (int len, int dec, char pad) const return str; } +// Certified 99% +const char* real::stringe(int len, int dec, char pad) const +{ + char* str = (char*)string(len, dec, pad); + if (dec > 0 || dec == UNDEFINED) + xvt_str_number_format(str, len > 0 ? len+1 : 50); + return str; +} + + void real::print_on(ostream& out) const { out << string(); diff --git a/include/real.h b/include/real.h index bb65a12e8..3a620a3ae 100755 --- a/include/real.h +++ b/include/real.h @@ -61,9 +61,12 @@ public: static bool is_null(const char* n); // @cmember Trasforma un reale in stringa const char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const; - // @cmember Trasforma un reale in stringa (chiama ), ma - // ritorna il formato italiano + // @cmember Trasforma un reale in stringa (chiama ), + // ma ritorna il formato italiano const char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const; + // @cmember Trasforma un reale in stringa (chiama ), + // ma ritorna il formato atteso da Excel + const char* stringe(int len = 0, int dec = UNDEFINED, char pad = ' ') const; // @cmember Ritorna la stringa con il formato passato const char* string(const char* picture) const; // @cmember Ritorna la stringa con il formato passato diff --git a/include/recset.cpp b/include/recset.cpp index 354387a17..b74f6d32f 100755 --- a/include/recset.cpp +++ b/include/recset.cpp @@ -34,6 +34,17 @@ static bool is_numeric(const char* str) return true; } +static void num_reformat(TString& val) +{ + xvt_str_number_format(val.get_buffer(), val.size()); + const int comma = val.find(','); + const int point = val.find('.'); + if (comma >= 0 && comma < point) + val.strip(","); else + if (point >= 0 && point < comma) + val.strip("."); +} + /////////////////////////////////////////////////////////// // TRecordset /////////////////////////////////////////////////////////// @@ -170,14 +181,20 @@ bool TRecordset::save_as_silk(const char* path) { out << ";X" << (c+1) << ";K"; var.as_string(val); - if (var.type() == _alfafld || var.type() == _datefld) + switch (var.type()) { - val.rtrim(); - val.replace('"', '\''); - out << '"' << val << '"'; - } - else + case _alfafld: + case _datefld: + { + val.rtrim(); + val.replace('"', '\''); + out << '"' << val << '"'; + } + break; + default: out << val; + break; + } } out << endl; } @@ -209,7 +226,11 @@ bool TRecordset::save_as_text(const char* path) if (val.find('\n') >= 0 || val.find('\t') >= 0) out << unesc(val); // Evitiamo doppi separatori di campo e record else + { + if (var.type() == _realfld) + num_reformat(val); out << val; + } } } out << endl; diff --git a/include/relapp.cpp b/include/relapp.cpp index c35aac77b..716027765 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -1325,6 +1325,12 @@ void TRelation_application::main_loop() if (!save(TRUE)) k = K_ENTER; break; + case K_F1: + dispatch_e_menu(M_HELP_CONTENTS); + break; + case K_F2: + dispatch_e_menu(M_FILE_ABOUT); + break; case K_ENTER: if (_lnflag && _curr_transaction != TRANSACTION_RUN) { diff --git a/include/reprint.cpp b/include/reprint.cpp index eb6e1aed6..25121791f 100755 --- a/include/reprint.cpp +++ b/include/reprint.cpp @@ -19,12 +19,6 @@ static bool _print_aborted = false; -#if _MSC_VER >= 1400 - #define SAFE_SCAN sscanf_s -#else - #define SAFE_SCAN sscanf -#endif - /////////////////////////////////////////////////////////// // Utility /////////////////////////////////////////////////////////// @@ -361,6 +355,13 @@ void TPrint_preview_window::update() TString80 str; str.format(FR("Pagina %u di %u"), _page, _book->pages()); statbar_set_title(TASK_WIN, str); + + TMask& m = owner().mask(); + m.enable(DLG_FIRSTREC, _page > 1); + m.enable(DLG_PREVREC, _page > 1); + m.enable(DLG_FINDREC, _book->pages() > 1); + m.enable(DLG_NEXTREC, _page < _book->pages()); + m.enable(DLG_LASTREC, _page < _book->pages()); } #define POPUP_FIRST 20883 @@ -697,6 +698,7 @@ TPreview_mask::TPreview_mask(TBook* book) : _book(book) read_mask("bagn008", 0, -1); set_handlers(); +/* Roba obsoleta con le moderne toolbar int pos = id2pos(DLG_FINDREC); if (pos >= 0 && id2pos(DLG_FIRSTREC) >= 0) //se e' un bottone pentapartito... { @@ -740,6 +742,7 @@ TPreview_mask::TPreview_mask(TBook* book) : _book(book) } } } +*/ } /////////////////////////////////////////////////////////// @@ -1222,9 +1225,7 @@ bool TBook::print_page(TWindow& win, size_t page) pw.alinks().destroy(); } - const int buffer_size = 1024; - TString str(buffer_size); - char* buffer = str.get_buffer(); + TToken_string str(1024, '='); TString_array paragrafo; // Testo completo di un campo @@ -1247,7 +1248,7 @@ bool TBook::print_page(TWindow& win, size_t page) while (!ifs.eof()) { - ifs.getline(buffer, str.size()); + ifs.getline(str.get_buffer(), str.size()); if (str.starts_with("", &col, &pat); + // + COLOR col = str.get_long(1); + PAT_STYLE pat = (PAT_STYLE)str.get_long(); if (pat <= PAT_HOLLOW) win.hide_brush(); else @@ -1346,8 +1347,11 @@ bool TBook::print_page(TWindow& win, size_t page) } if (str.starts_with("", &x, &y, &dx, &dy); + // + const long x = str.get_long(1); + const long y = str.get_long(); + const long dx= str.get_long(); + const long dy= str.get_long(); _rect.set(x, y, dx, dy); win.log2dev(_rect, rct); continue; @@ -1398,10 +1402,10 @@ bool TBook::print_page(TWindow& win, size_t page) } if (str.starts_with("", &col, &width, &style); + // + COLOR col = str.get_long(1); + int width = str.get_int(); + PEN_STYLE style = (PEN_STYLE)str.get_int(); if (width < 0) win.hide_pen(); else @@ -1433,7 +1437,7 @@ bool TBook::print_page(TWindow& win, size_t page) paragrafo.destroy(); while (!ifs.eof()) { - ifs.getline(buffer, str.size()); + ifs.getline(str.get_buffer(), str.size()); if (str == "") break; paragrafo.add(str); @@ -1446,21 +1450,17 @@ bool TBook::print_page(TWindow& win, size_t page) } if (str.starts_with("= 1400 - sscanf_s(str, "", - &_horizontal_alignment, sizeof(_horizontal_alignment), - &_vertical_alignment, sizeof(_vertical_alignment)); -#else - sscanf(str, "", - &_horizontal_alignment, &_vertical_alignment); -#endif + // + _horizontal_alignment = str.get_char(1); + _vertical_alignment = str.get_char(); continue; } if (str.starts_with("", &fore, &back, &opaque); + // + const COLOR fore = str.get_long(1); + const COLOR back = str.get_long(); + const int opaque = str.get_int(); win.set_color(fore, back); win.set_opaque_text(opaque != 0); continue; @@ -1494,8 +1494,7 @@ bool TBook::export_text(const TFilename& fname) if (fname.ends_with(".pdf", true)) return export_pdf(fname); - TString str(1024); - char* buffer = str.get_buffer(); + TToken_string str(1024, '='); ifstream ifs(_file); ofstream ofs(fname); @@ -1507,12 +1506,15 @@ bool TBook::export_text(const TFilename& fname) while (!ifs.eof()) { - ifs.getline(buffer, str.size()); + ifs.getline(str.get_buffer(), str.size()); if (str.starts_with("", &x, &y, &dx, &dy); + // + const long x = str.get_long(1); + const long y = str.get_long(); + const long dx= str.get_long(); + const long dy= str.get_long(); row = y * lpi() / res.y; col = x * cpi() / res.x; wid = dx * cpi() / res.x; @@ -1595,7 +1597,7 @@ bool TBook::export_text(const TFilename& fname) TString stringona; while (!ifs.eof()) { - ifs.getline(buffer, str.size()); + ifs.getline(str.get_buffer(), str.size()); if (str == "") break; stringona << str << '\n'; @@ -1619,14 +1621,9 @@ bool TBook::export_text(const TFilename& fname) } else if (str.starts_with("= 1400 - sscanf_s(str, "", - &_horizontal_alignment, sizeof(_horizontal_alignment), - &_vertical_alignment, sizeof(_vertical_alignment)); -#else - sscanf(str, "", - &_horizontal_alignment, &_vertical_alignment); -#endif + // + _horizontal_alignment = str.get_char(1); + _vertical_alignment = str.get_char(); } } @@ -1676,8 +1673,7 @@ void TBook::split_file(int colonne) close_output(); // Chiudo file di stampa eventualmente aperto ifstream ifs(_file); // Apro file di stampa da splittare - TString str(1024); - char* buffer = str.get_buffer(); + TToken_string str(1024, '='); for (unsigned int page = 1; page <= pages(); page++) { if (!pi.setstatus(page)) @@ -1690,7 +1686,7 @@ void TBook::split_file(int colonne) ifs.seekg(pos); while (!ifs.eof()) { - ifs.getline(buffer, str.size()); + ifs.getline(str.get_buffer(), str.size()); if (str.starts_with("", &x, &y, &dx, &dy); + // + const long x = str.get_long(1); + const long y = str.get_long(); + const long dx= str.get_long(); + const long dy= str.get_long(); str.format("", x-rct_page.x, y, dx, dy); } else if (str.starts_with(" 45 * XI_FU_MULTIPLE) // Deve contenere almeno 4 bottoni - { - xi_get_rect(_obj, (XinRect *) &rct); + xi_get_rect(_obj, (XinRect*)&rct); - const int width = (rct.right-rct.left) + 2*XI_FU_MULTIPLE; - if (width < cli.right) - { - RCT out; xvt_vobj_get_outer_rect(parent, &out); - RCT rct; - rct.left = out.left + (cli.right - width) / 2; - rct.right = rct.left + width; - rct.top = out.top; // cli had left = 0 and top = 0 - rct.bottom = rct.top + cli.bottom; - xvt_vobj_move(parent, &rct); - } - } - + const int extra = (cli.right - (rct.right-rct.left+2*XI_FU_MULTIPLE)) / 2; + if (extra > XI_FU_MULTIPLE) + { + WINDOW main_win = _sheet->win(); + xvt_vobj_get_outer_rect(main_win, &cli); + cli.left += extra; + cli.right -= extra; + xvt_vobj_move(main_win, &cli); + xvt_vobj_get_client_rect(parent, &cli); + } + int num; XI_OBJ** column = xi_get_member_list(_obj, &num); for (i = 0; i < num; i++) @@ -315,7 +313,6 @@ int TSheet_control::rec2row(long record) const return r; } - // Converts a row number in the correspondig record number long TSheet_control::row2rec(int row) const { @@ -462,7 +459,15 @@ XI_OBJ* TSheet_control::find_column( return c >= 0 ? column[c] : NULL; } - +bool TSheet_control::head(int c, TString& str) const +{ + XI_OBJ* col = find_column(c); + if (col != NULL) + xi_get_text(col, str.get_buffer(80), 80); + else + str.cut(0); + return col != NULL; +} void TSheet_control::enable_check(bool on) { @@ -670,7 +675,7 @@ void TSheet_control::set_columns_order(TToken_string* order) if (col) { xi_move_column(col, index); - RCT rct; xi_get_rect(col, (XinRect *) &rct); + RCT rct; xi_get_rect(col, (XinRect*)&rct); if (_default_width[index] != rct.right - rct.left) xi_column_set_pixel_width(col, _default_width[index]-offset); } @@ -724,13 +729,13 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev) break; case XIE_GET_PREV: case XIE_GET_NEXT: - { - const long n = xiev->v.rec_request.spec_rec + (xiev->type == XIE_GET_NEXT ? +1 : -1) ; - if (n < 0 || n >= items()) - refused = TRUE; - else - xiev->v.rec_request.data_rec = n; - } + { + const long n = xiev->v.rec_request.spec_rec + (xiev->type == XIE_GET_NEXT ? +1 : -1) ; + if (n < 0 || n >= items()) + refused = TRUE; + else + xiev->v.rec_request.data_rec = n; + } break; case XIE_CELL_REQUEST: { @@ -778,7 +783,7 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev) if (_disabled[rec]) { - xiev->v.cell_request.color = NORMAL_COLOR; + xiev->v.cell_request.color = DISABLED_COLOR; xiev->v.cell_request.back_color = DISABLED_BACK_COLOR; } else @@ -975,11 +980,10 @@ void TQuery_field::create(WINDOW parent) { _ctl = new TSheet_control(parent, dlg(), _ctl_data._x, _ctl_data._y, - _ctl_data._width, _ctl_data._size, + _ctl_data._width, (int)_ctl_data._size, _ctl_data._flags, _ctl_data._prompt); } - /////////////////////////////////////////////////////////// // TSheet /////////////////////////////////////////////////////////// @@ -989,26 +993,42 @@ void TQuery_field::create(WINDOW parent) TSheet::TSheet(short x, short y, short dx, short dy, const char* title, const char* head, byte buttons, short sht_y, WINDOW parent) - : TMask(title, sht_y == 0 ? 1 : 2, dx, dy, x, y, parent), + : TMask(title, 1, dx, dy, x, y, parent), _sheet(NULL), _select_row(-1), _parked(-1) -{ +{ + if (sht_y > 0) // Crea notebook se TBrowse_sheet + { + create_book(false); // Crea notebook e poi ... + create_page(title, 0); // ... la sua prima pagina + } + create_bar(1); // Crea toolbar in alto + TQuery_field* qf = new TQuery_field(this); - qf->construct(DLG_QUERY, head, 1, sht_y, -3, win(), "", -1); + qf->construct(DLG_QUERY, head, 1, sht_y, 0, page_win(0), "", 0); fields_array().add(qf); _sheet = qf->sheet(); - if (!(buttons & 0x10)) add_button(DLG_SELECT, TR("~Selezione"), K_ENTER); + if (!(buttons & 0x10)) + add_button(DLG_SELECT, TR("~Selezione"), K_ENTER, BMP_OK); + if (check_enabled()) { - add_button(DLG_USER, TR("~Tutti"), 0); + add_button(DLG_USER, TR("~Tutti"), 0, BMP_SELECT); set_handler(DLG_USER, tutti_handler); } if (buttons & 0x01) add_button(DLG_LINK, TR("Colle~ga"), K_CTRL+'G', BMP_LINK); - if (buttons & 0x02) add_button(DLG_NEWREC, TR("~Nuovo"), K_INS, BMP_NEWREC, BMP_NEWRECDN); - if (buttons & 0x04) add_button(DLG_DELREC, "", K_DEL); - if (buttons & 0x08) add_button(DLG_QUIT, "", K_ESC); - else add_button(DLG_CANCEL, "", K_ESC); + if (buttons & 0x02) add_button(DLG_NEWREC, TR("~Nuovo"), K_INS, BMP_NEWREC); + if (buttons & 0x04) add_button(DLG_DELREC, "~Elimina", K_DEL, BMP_DELREC); + if (!check_enabled()) + { + add_button(DLG_SAVEREC, TR("~Esporta"), 0, BMP_SAVEREC); + set_handler(DLG_SAVEREC, export_handler); + } + if (buttons & 0x08) add_button(DLG_QUIT, "Fine", K_ESC, BMP_QUIT); + else add_button(DLG_CANCEL, "Annulla", K_ESC, BMP_CANCEL); + + xvt_toolbar_realize(toolbar()); // Necessario per calcolare dimensioni corrette dello sheet } TSheet::~TSheet() @@ -1046,14 +1066,27 @@ void TSheet::add_button( short bmp_up, // @parm Bitmap normale short bmp_dn) // @parm Bitmap premuta { - TButton_field& butt = TMask::add_button(id, 0, caption, 0, -1, 11, 2, - "", bmp_up, bmp_dn); - butt.set_exit_key(key); + if (bmp_up <= 0) + { + if (toolwin() == NULL_WIN) + create_bar(-2); // Forza la creazione della bottom bar + TButton_field& butt = TMask::add_button(id, MAX_PAGES, caption, 0, -1, 11, 2); + butt.set_exit_key(key); + } + else + { + if (toolbar() == NULL_WIN) + create_bar(1); // Forza la creazione della top bar + TButton_tool& butt = add_button_tool(id, caption, bmp_up); + butt.set_exit_key(key); + } } bool TSheet::get_cell_colors(int row, int col, COLOR& fore, COLOR& back) const { fore = back = 0; // Default colors + if (row & 1) + back = REQUIRED_BACK_COLOR; return false; // Not assigned } @@ -1062,40 +1095,50 @@ void TSheet::repos_buttons() const if (_sheet == NULL) return; // Sono ancora in fase di creazione: aspetta! - RCT br; - int buttons = 0, f; - for (f = fields()-1; f >= 0; f--) - { - TMask_field& c = fld(f); - if (c.is_kind_of(CLASS_BUTTON_FIELD)) + WINDOW btnwin = toolwin(); // was win() + RCT br, wr; + int buttons = 0; + FOR_EACH_MASK_FIELD((*this), f, c) + { + if (c->parent() == btnwin && c->is_kind_of(CLASS_BUTTON_FIELD)) { if (buttons == 0) - c.get_rect(br); + c->get_rect(br); buttons++; } } - RCT wr; xvt_vobj_get_client_rect(win(), &wr); - const short width = br.right - br.left; - const short height = br.bottom - br.top; - - int space = (wr.right - buttons * width) / (buttons+1); - if (space < 0) space = 0; - int x = space; - const int y = wr.bottom - height - XI_FU_MULTIPLE; + if (buttons > 0) + { + xvt_vobj_get_client_rect(btnwin, &wr); + const short width = br.right - br.left; + const short height = br.bottom - br.top; + + int space = (wr.right - buttons * width) / (buttons+1); + if (space < 0) space = 0; + int x = space; + const int y = (wr.bottom - height) / 2; - for (f = 0; buttons > 0; f++) - { - TMask_field& c = fld(f); - if (c.is_kind_of(CLASS_BUTTON_FIELD)) - { - buttons--; - const PNT p = { y, x }; - xvt_rect_set_pos(&br, p); - c.set_rect(br); - x += space+width; + FOR_EACH_MASK_FIELD((*this), f, c) + { + if (c->parent() == btnwin && c->is_kind_of(CLASS_BUTTON_FIELD)) + { + buttons--; + const PNT p = { y, x }; + xvt_rect_set_pos(&br, p); + c->set_rect(br); + x += space+width; + } } - } + } + + // Aggiusta anche lo spreadsheet + TMask_field& s = field(DLG_QUERY); + xvt_vobj_get_client_rect(s.parent(), &wr); + s.get_rect(br); +// br.right = wr.right - br.left + 2*CHARX; + br.bottom = wr.bottom - br.left; + s.set_rect(br); } void TSheet::force_update(int r) @@ -1210,6 +1253,9 @@ bool TSheet::on_key(KEY key) { switch(key) { + case K_CTRL+'E': + export_handler(field(DLG_SAVEREC), K_SPACE); + break; case K_CTRL+'T': tutti_handler(field(DLG_USER), K_SPACE); break; @@ -1265,7 +1311,8 @@ TToken_string& TSheet::row( // @comm Se viene passato un numero di riga minore di 1 viene ritornato il contenuto della riga // selezionata. { - if (n < 0) n = selected(); + if (n < 0) + n = selected(); if (n != _parked) get_row(_parked = n, _park); return _park; @@ -1282,6 +1329,56 @@ bool TSheet::tutti_handler(TMask_field& f, KEY k) return true; } +bool TSheet::export_handler(TMask_field& f, KEY k) +{ + if (k == K_SPACE) + { + TSheet& s = (TSheet&)f.mask(); + FILE_SPEC fs; + TFilename name; + s.get_caption(name); name.ext("xls"); + xvt_fsys_convert_str_to_fspec(name, &fs); + if (xvt_dm_post_file_save(&fs, TR("Selezionare il file di destinazione"))) + { + xvt_fsys_convert_fspec_to_str(&fs, name.get_buffer(), name.size()); + ofstream xls(name); + const char sep = '\t'; + TToken_string tab(128, sep); + + TString80 str; + int columns = 0; + for (columns = 0; ; columns++) + { + if (s._sheet->head(columns, str)) + tab.add(str); + else + break; + } + xls << tab << endl; + + for (long n = 0; n < s.items(); n++) + { + const TToken_string& r = s.row(n); + tab = r; + tab.replace(r.separator(), sep); + tab.separator(sep); + for (int c = 0; c < columns; c++) + { + const char ct = s._sheet->column_type(c); + if (ct == 'P' || ct == 'V') + { + tab.get(c, str); + xvt_str_number_format(str.get_buffer(), str.size()); + tab.add(str, c); + } + } + xls << tab << endl; + } + } + } + return true; +} + void TSheet::save_columns_order(const TEdit_field& field) { sheet().save_columns_order(field); } @@ -1291,7 +1388,6 @@ void TSheet::set_columns_order(TToken_string* col) void TSheet::load_columns_order(const TEdit_field& field) { sheet().load_columns_order(field); } - /////////////////////////////////////////////////////////// // TArray_sheet /////////////////////////////////////////////////////////// @@ -1300,11 +1396,13 @@ TArray_sheet::TArray_sheet(short x, short y, short dx, short dy, const char* cap const char* head, byte buttons, short sht_y) : TSheet(x, y, dx, dy, caption, head, buttons, sht_y) { - if (dx == 0) + TToken_string cap(caption); + if (cap.items() > 1) { - TToken_string cap(caption); - add_tag_buttons(cap); - } + cap.get(0); + FOR_EACH_TOKEN(cap, tok) + create_page(tok, 0); + } } // Certified 99% @@ -1351,7 +1449,6 @@ long TArray_sheet::insert(const TToken_string& s, long n) return n; } - /////////////////////////////////////////////////////////// // TCursor_sheet /////////////////////////////////////////////////////////// @@ -1380,7 +1477,7 @@ bool TCursor_sheet::in_key(const TFieldref& fr) const TCursor_sheet::TCursor_sheet(TCursor* cursor, const char* fields, const char* title, const char* head, byte buttons, short sht_y, WINDOW parent) - : TSheet(sht_y ? 3 : 0, sht_y ? 3 : 0, sht_y ? -3 : 0, sht_y ? -3 : 0, + : TSheet(sht_y ? 2 : 0, sht_y ? 2 : 0, sht_y ? -2 : 0, sht_y ? -2 : 0, title, head, buttons, sht_y, parent), _cursor(cursor) { TToken_string fldlst(fields); @@ -1442,13 +1539,12 @@ bool TCursor_sheet::get_cell_colors(int row, int col, COLOR& fore, COLOR& back) if (_key_cols[col]) { fore = 0; - back = REQUIRED_BACK_COLOR; + back = REQUIRED_BACK_COLOR; // Evidenzia i campi chiave return true; } return TSheet::get_cell_colors(row, col, fore, back); } - /////////////////////////////////////////////////////////// // TBrowse_sheet /////////////////////////////////////////////////////////// @@ -1592,9 +1688,9 @@ void TBrowse_sheet::handler( WINDOW win, // @parm Finestra da gestire EVENT* ep) // @parm Evento da gestire nella finestra { - if (ep->type == E_MOUSE_DOWN) - { - TSheet_control& sht = sheet(); + switch (ep->type) + { + case E_MOUSE_DOWN: switch (ep->v.mouse.button ) { case 1: @@ -1602,7 +1698,7 @@ void TBrowse_sheet::handler( MENU_ITEM* menu = xvt_res_get_menu(BROWSE_BAR); if (menu) { - dictionary_translate_menu(menu); + dictionary_translate_menu(menu); const PNT& p = ep->v.mouse.where; RCT cr; xvt_vobj_get_client_rect(win, &cr); XVT_POPUP_ALIGNMENT pa = XVT_POPUP_CENTER; @@ -1620,7 +1716,7 @@ void TBrowse_sheet::handler( break; default: { - RCT r; sht.get_rect(r); + RCT r; sheet().get_rect(r); if (xvt_rect_has_point(&r, ep->v.mouse.where) && _rec_to_select >= 0) { post_select(_rec_to_select); @@ -1629,15 +1725,13 @@ void TBrowse_sheet::handler( } break; } - } - else - if (ep->type == E_COMMAND) - { + break; + case E_COMMAND: switch (ep->v.cmd.tag) { case BROWSE_BAR + 1: save_columns_order(field()); - return; + return; case BROWSE_BAR + 2: set_columns_order(NULL); return; @@ -1647,6 +1741,17 @@ void TBrowse_sheet::handler( default: break; } + break; + case E_CONTROL: + if (ep->v.ctl.ci.type == WC_NOTEBK) + { + const int new_search = ep->v.ctl.ci.v.notebk.tab_no; + on_key(K_CTRL+K_F1+new_search); + return; + } + break; + default: + break; } TCursor_sheet::handler(win, ep); @@ -1678,9 +1783,9 @@ TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields, { ca = f.prompt(); if (ca.blank()) - ca = PR("Codice"); + ca = TR("Codice"); } - add_tag_button(0, ca, _sel); + set_tab_buttons(ca); TToken_string tids = head; TToken_string tfns = fields; @@ -1800,10 +1905,8 @@ bool TBrowse_sheet::on_key(KEY k) KEY TBrowse_sheet::run() { _cur_browse = this; - + show_page(_sel); const KEY key = TCursor_sheet::run(); _cur_browse = NULL; return key; } - - diff --git a/include/sheet.h b/include/sheet.h index f5e5c6ad0..132a67273 100755 --- a/include/sheet.h +++ b/include/sheet.h @@ -30,7 +30,8 @@ protected: // TMask virtual void on_idle(); static bool tutti_handler(TMask_field& f, KEY k); - + static bool export_handler(TMask_field& f, KEY k); + protected: void reset_parked() { _parked = -1; } virtual void get_row(long r, TToken_string& row) { row.cut(0); } diff --git a/include/treectrl.cpp b/include/treectrl.cpp index 39b3f853a..2122bba85 100755 --- a/include/treectrl.cpp +++ b/include/treectrl.cpp @@ -952,14 +952,17 @@ bool TTree_window::add_child(XVT_TREEVIEW_NODE parent) XVT_IMAGE ii = NULL, ic = NULL, ie = NULL; TImage* im_nor = _tree->image(false); - if (type == XVT_TREEVIEW_NODE_NONTERMINAL) + if (im_nor != NULL) { - TImage* im_sel = _tree->image(true); - ic = im_nor->xvt_image(); - ie = im_sel->xvt_image(); + if (type == XVT_TREEVIEW_NODE_NONTERMINAL) + { + TImage* im_sel = _tree->image(true); + ic = im_nor->xvt_image(); + ie = im_sel->xvt_image(); + } + else + ii = im_nor->xvt_image(); } - else - ii = im_nor->xvt_image(); XVT_TREEVIEW_NODE child = xvt_treeview_add_child_node(_ctrl, parent, type, ii, ic, ie, desc, NULL, id); if (child != NULL && type == XVT_TREEVIEW_NODE_NONTERMINAL && _tree->expanded()) { diff --git a/include/urldefid.h b/include/urldefid.h index 04ff696f0..ab130dab6 100755 --- a/include/urldefid.h +++ b/include/urldefid.h @@ -88,6 +88,8 @@ #define BMP_SAVERECDN 153 #define BMP_DELRECDN 154 #define BMP_NEWRECDN 155 +#define BMP_INFO 162 +#define BMP_HELP 163 #define BMP_QUITDN 164 #define BMP_SETPRINT 165 #define BMP_LENTE 166 @@ -101,6 +103,34 @@ #define BMP_PDF 174 #define BMP_ARCHIVE 175 #define BMP_PROGRAM 176 + +#define TOOL_OK 101 +#define TOOL_CANCEL 102 +#define TOOL_SAVEREC 103 +#define TOOL_DELREC 104 +#define TOOL_NEWREC 105 +#define TOOL_CONFIG 107 +#define TOOL_QUIT 114 +#define TOOL_SELECT 115 +#define TOOL_EDIT 116 +#define TOOL_LINK 117 +#define TOOL_PRINT 118 +#define TOOL_RECALC 119 +#define TOOL_ELABORA 120 +#define TOOL_FIRSTREC 121 +#define TOOL_PREVREC 122 +#define TOOL_STOPREC 123 +#define TOOL_NEXTREC 124 +#define TOOL_LASTREC 125 +#define TOOL_FINDREC 126 +#define TOOL_EMAIL 139 +#define TOOL_INFO 162 +#define TOOL_HELP 163 +#define TOOL_SETPRINT 165 +#define TOOL_LENTE 166 +#define TOOL_PREF 204 +#define TOOL_ADDPREF 205 + #endif /* @END */ \ No newline at end of file diff --git a/include/window.cpp b/include/window.cpp index 8a3c830d5..3b799c874 100755 --- a/include/window.cpp +++ b/include/window.cpp @@ -471,7 +471,6 @@ void TWindow::open_modal() WinManager.reg(this); } - void TWindow::close() { CHECK(_win != NULL_WIN, "Can't close a NULL window"); @@ -479,7 +478,6 @@ void TWindow::close() xvt_vobj_set_visible(_win, _open = FALSE); } - void TWindow::close_modal() { if (is_modal()) diff --git a/include/xvtility.cpp b/include/xvtility.cpp index dfc031a2c..d22fc2a7b 100755 --- a/include/xvtility.cpp +++ b/include/xvtility.cpp @@ -54,7 +54,7 @@ RCT& resize_rect( { if (xvt_vobj_get_type(parent) == W_PLAIN) // Mask with Toolbar { - if (y >= 0) + /* if (y >= 0) { const TWindow* w = (const TWindow*)xvt_vobj_get_data(parent); if (w->is_kind_of(CLASS_MASK)) @@ -63,7 +63,7 @@ RCT& resize_rect( if (parent != m->toolwin()) y++; } - } + } */ if (x > 0 || (wt != WO_TE && wt != W_PLAIN && x == 0)) { RCT pc; xvt_vobj_get_client_rect(parent, &pc); // Get parent window size @@ -72,13 +72,13 @@ RCT& resize_rect( if (width > tot) x += (width-tot) / (CHARX<<1); } } - wt = WC_TEXTEDIT; + wt = WC_TEXTEDIT; // Campo di maschera } else { if (ROWY <= 0) // Not yet initialized { - RCT pc; xvt_vobj_get_client_rect(TASK_WIN, &pc); + RCT pc; xvt_vobj_get_client_rect(parent, &pc); ROWY = (pc.bottom - pc.top) / 23; } } @@ -86,12 +86,19 @@ RCT& resize_rect( switch (wt) { case WC_TEXTEDIT : - r.left = (x+1)*CHARX; - r.top = y*ROWY; - r.right = dx*CHARX; - r.bottom = (CHARY << 1) - BASEY; - if (dy > 1) - r.bottom += ROWY*(dy-1); + if (x == 0 && dx == 0 && y == 0 && dy == 0) // Campo a tutta pagina! + { + xvt_vobj_get_client_rect(parent, &r); + } + else + { + r.left = (x+1)*CHARX; + r.top = y*ROWY; + r.right = dx*CHARX; + r.bottom = (CHARY << 1) - BASEY; + if (dy > 1) + r.bottom += ROWY*(dy-1); + } break; case W_DOC: r.left = x * CHARX;