diff --git a/include/applicat.cpp b/include/applicat.cpp index b49e65031..dcaff371c 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -11,11 +10,11 @@ #include #include #include -#include #include #include #include +// Maschera scelta ditta #include /////////////////////////////////////////////////////////// @@ -402,10 +401,6 @@ long TApplication::handler(WINDOW win, EVENT* ep) case M_FILE_NEW: set_firm(); break; - case M_FILE_REVERT: - if (config()) - on_config_change(); - break; case (M_FILE_ABOUT+1): about(); break; @@ -1050,78 +1045,6 @@ bool TApplication::set_firm(long newfirm) return TRUE; } -// @doc INTERNAL - -// @mfunc Gestisce le voci di configurazione -// -// @rdesc Ritorna TRUE se sono state cambiate delle voci -bool TApplication::config() - -// @comm Le si passa il file in cui cercare il proprio paragrafo (comunque relativo -// alla ditta) se non c'e', viene creato copiando il default la variabile EdMask -// di quel paragrafo specifica la maschera da usare. - -{ - bool ok = FALSE; - - TConfig conf(CONFIG_STUDIO); - TFilename name = conf.get("EdApp"); - if (name.not_empty()) - { - TExternal_app app(name); - ok = app.run() == 0; - return ok; - } - - TConfig cnf(CONFIG_DITTA); - name = cnf.get("EdMask"); - if (name.empty()) - return warning_box("Nessun parametro da configurare"); - - TMask* msk = new TMask(name); // Evito problemi di stack - TMask& m = *msk; - - // carica campi - for (int i = 0; i < m.fields(); i++) - { - TEditable_field& f = (TEditable_field&)m.fld(i); - const TFieldref* fref = f.field(); - if (fref != NULL) - { - const char* fname = fref->name(); - if (fname != NULL) - { - const TString& oldvl = cnf.get(fname); - if (!oldvl.empty()) - f.set(oldvl); - } - } - } - - // run mask - disable_menu_item(M_FILE_REVERT); - - if (m.run() == K_ENTER && m.dirty()) - { - // aggiusta campi - for (i = 0; i < m.fields(); i++) - { - TEditable_field& f = (TEditable_field&)m.fld(i); - if (f.dirty()) - { - const TFieldref* fref = f.field(); - if (fref != NULL) - cnf.set(fref->name(), f.get(), NULL, TRUE); - } - } - ok = TRUE; - } - - delete msk; - enable_menu_item(M_FILE_REVERT); - return ok; -} - // @doc EXTERNAL // @mfunc Controlla se al programma corrente e' concesso cambiare ditta da menu. @@ -1135,9 +1058,9 @@ bool TApplication::firm_change_enabled() const // @comm Praticamente controlla se e' stato lanciato da ba0 o dal program manager { #ifdef _DEMO_ - return FALSE; + return FALSE; #else - return ::os_spawn_by_menu(); + return ::os_spawn_by_menu(); #endif } diff --git a/include/applicat.h b/include/applicat.h index 62c27dc89..e9346e6c4 100755 --- a/include/applicat.h +++ b/include/applicat.h @@ -66,8 +66,6 @@ class TApplication void terminate(); // @cmember:(INTERNAL) Cambia il cursore del mouse void set_cursor(bool w); - // @cmember:(INTERNAL) Gestisce le voci di configurazione - bool config(); // @cmember:(INTERNAL) About box: risposta alla opzione Informazioni del menu File void about() const; diff --git a/include/checks.cpp b/include/checks.cpp index 76e029931..927f4fea2 100755 --- a/include/checks.cpp +++ b/include/checks.cpp @@ -1,28 +1,12 @@ #include #include -#include -#ifdef XVT -#define XVT_INCL_NATIVE -#define STRICT -#include - -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 -#include -#else -#include -#endif #include +#include #include -#endif /* XVT */ - - -#include #define buildmsg() char msg[256];va_list argptr;va_start(argptr,fmt);vsprintf(msg,fmt,argptr);va_end(argptr) -#ifndef FOXPRO - // @doc EXTERNAL // @msg fatal_box | Crea una finestra di ERRORE FATALE con il relativo messaggio @@ -35,14 +19,12 @@ bool fatal_box( // l'errore. { buildmsg(); - xvt_dm_post_fatal_exit(msg); if (xvt_running()) main_app().stop_run(); else exit(1); - - return 0; + return false; } // @doc EXTERNAL @@ -57,21 +39,8 @@ bool error_box( // e l'icona punto esclamativo. { buildmsg(); - -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 - MessageBeep(MB_ICONEXCLAMATION); - MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION); -#else - beep(); - if (xvt_running()) xvt_dm_post_error("%s", msg); - else - { - fprintf(stderr, "%s\n", msg); - getchar(); - } -#endif - - return 0; + xvt_dm_post_error(msg); + return false; } // @doc EXTERNAL @@ -85,15 +54,7 @@ bool warning_box( // e l'icona punto di domanda. { buildmsg(); - -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 - MessageBeep(MB_ICONQUESTION); - MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION); -#else - beep(); - xvt_dm_post_note("%s", msg); -#endif - + xvt_dm_post_note(msg); return 0; } @@ -108,14 +69,8 @@ bool message_box( // e l'icona informazioni. { buildmsg(); - -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 - MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION); -#else - xvt_dm_post_note("%s", msg); -#endif - - return 0; + xvt_dm_post_message(msg); + return false; } // @doc EXTERNAL @@ -129,38 +84,18 @@ bool sorry_box( // e l'icona informazioni. { buildmsg(); - -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 - MessageBeep(MB_ICONINFORMATION); - MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION); -#else - xvt_dm_post_note("%s", msg); -#endif - - return 0; + xvt_dm_post_note(msg); + return false; } -// @doc EXTERNAL - // @msg yesno_box | Crea una finestra di RICHIESTA con il relativo messaggio bool noyes_box( const char* fmt, // @parm Messaggio da stampare nella finestra ...) // @parmvar Uno o piu' parametri corrispondenti ai codici in

{ buildmsg(); - -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 - MessageBeep(MB_ICONQUESTION); - int r = MessageBox(GetFocus(), msg, "RICHIESTA", - MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2); - return r == IDYES; -#else - ASK_RESPONSE r = xvt_dm_post_ask((char*) "No", (char*) "Si", NULL, "%s", msg); - if (r == RESP_DEFAULT) r = K_NO; - else - if (r == RESP_2) r = K_YES; - return r == K_YES; -#endif + ASK_RESPONSE r = xvt_dm_post_ask("No", "Si", NULL, msg); + return r == RESP_2; } @@ -183,15 +118,8 @@ bool yesno_box( // @xref { buildmsg(); - -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 - MessageBeep(MB_ICONQUESTION); - int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION); - return r == IDYES; -#else - ASK_RESPONSE r = xvt_dm_post_ask((char*) "Si", (char*) "No", NULL, "%s", msg); + ASK_RESPONSE r = xvt_dm_post_ask("Si", "No", NULL, msg); return r == RESP_DEFAULT; -#endif } // @doc EXTERNAL @@ -219,10 +147,9 @@ bool yesnofatal_box( #ifdef DBG char s[256]; sprintf(s, "%s\nContinuare ugualmente?", msg); const bool ret = yesno_box("%s", s); - if (!ret) fatal_box(msg); -#else - fatal_box("%s", msg); + if (!ret) #endif + fatal_box(msg); return FALSE; } @@ -246,24 +173,8 @@ int yesnocancel_box( // @xref { buildmsg(); - -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 - int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNOCANCEL | MB_ICONQUESTION); - if (r == IDYES) r = K_YES; - else - if (r == IDNO) r = K_NO; - else - r = K_ESC; - return r; -#else - ASK_RESPONSE r = xvt_dm_post_ask((char*) "Si", (char*) "No", (char*) "Annulla", "%s", msg); - if (r == RESP_DEFAULT) r = K_YES; - else - if (r == RESP_2) r = K_NO; - else - r = K_ESC; - return r; -#endif + ASK_RESPONSE r = xvt_dm_post_ask("Si", "No", "Annulla", msg); + return r == RESP_DEFAULT ? K_YES : (r == RESP_2 ? K_NO : K_ESC); } // @doc EXTERNAL @@ -297,44 +208,3 @@ bool __tracemem(const char* msg) return __trace("%5lu Kb - %s", mem, msg); } - -#else // FOXPRO - -#include -#include - -bool error_box(const char* fmt, ...) -{ - buildmsg(); - MessageBeep(MB_ICONEXCLAMATION); - _UserError(msg); - return 0; -} - -bool fatal_box(const char* fmt, ...) -{ - buildmsg(); - MessageBeep(MB_ICONHAND); - MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL); - _UserError(msg); - return 0; -} - -bool message_box(const char* fmt, ...) -{ - buildmsg(); - MessageBeep(MB_ICONINFORMATION); - _UserError(msg); - return 0; -} - -bool yesnofatal_box(const char* fmt, ...) -{ - buildmsg(); - MessageBeep(MB_ICONHAND); - MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL); - _UserError(msg); - return 0; -} -#endif // FOXPRO - diff --git a/include/controls.cpp b/include/controls.cpp index e03b6ecb9..bbaf6bb30 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -483,9 +483,14 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, void attach_interface(WINDOW win, COLOR back) { xvt_win_set_handler(win, (EVENT_HANDLER)xi_event); + +/* xvt_vobj_translate_points NON funziona! Ma qui non serve. RCT rc; xvt_vobj_get_client_rect(win, &rc); WINDOW wp = xvt_vobj_get_parent(win); xvt_vobj_translate_points(win, wp, (PNT*)&rc, 2); +*/ + RCT rc; xvt_vobj_get_outer_rect(win, &rc); + char caption[80]; xvt_vobj_get_title(win, caption, 80); TWindow* parent = (TWindow*)xvt_vobj_get_data(win); XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XinRect *) &rc, caption, (long)parent); diff --git a/include/golem.cpp b/include/golem.cpp index ef9a6a47e..8c8943cbc 100755 --- a/include/golem.cpp +++ b/include/golem.cpp @@ -186,7 +186,7 @@ bool goto_url(const char* url) app = link.get(ext); if (app.not_empty()) { - app << ' ' << url; + app << " \"" << url << '"'; UINT error = WinExec(app, SW_SHOWNORMAL); if (error > 32) return TRUE; @@ -195,7 +195,7 @@ bool goto_url(const char* url) } bool retflag = FALSE; - + HINSTANCE hinst = ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL); DWORD winst = DWORD((DWORD*)hinst); UINT error = UINT(winst); // Tutto 'sto giro per evitare un warning @@ -203,7 +203,7 @@ bool goto_url(const char* url) { if (file2app(".htm", app)) { - app << ' ' << url; + app << " \"" << url << '"'; error = WinExec(app, SW_SHOWNORMAL); if (error > 32) retflag = TRUE; @@ -218,37 +218,31 @@ bool goto_url(const char* url) bool edit_url(const char* url) { bool retflag = FALSE; - + HINSTANCE hinst = ShellExecute(NULL, "edit", url, NULL, NULL, SW_SHOWNORMAL); DWORD winst = DWORD((DWORD*)hinst); UINT error = UINT(winst); // Tutto 'sto giro per evitare un warning if (error <= 32) - { - TFilename app; - if (fexist(url) && file2app(".wri", app)) - { - app << ' ' << url; - error = WinExec(app, SW_SHOWNORMAL); - if (error > 32) - retflag = TRUE; - } - else - retflag = goto_url(url); - } + retflag = goto_url(url); else retflag = TRUE; return retflag; } - - bool print_url(const char* url) { + bool retflag = FALSE; + HINSTANCE hinst = ShellExecute(NULL, "print", url, NULL, NULL, SW_SHOWNORMAL); DWORD winst = DWORD((DWORD*)hinst); UINT error = UINT(winst); // Tutto 'sto giro per evitare un warning - return error >= 32; + if (error <= 32) + retflag = goto_url(url); + else + retflag = TRUE; + + return retflag; } /////////////////////////////////////////////////////////// @@ -420,7 +414,7 @@ bool TGolem_mask::ole_handler(TMask_field& f, KEY k) sheet.force_update(); TFilename app; file2app(ext, app); - app << ' ' << file; + app << " \"" << file << '"'; WinExec(app, SW_SHOWNORMAL); } } @@ -925,6 +919,8 @@ class TMAPI_session : public TObject LHANDLE _hSession; LONG _hWnd; + TFilename m_strBaseDir; // Directory iniziale + protected: bool load_mapi(); void unload_mapi(); @@ -1076,10 +1072,18 @@ bool TMAPI_session::remove(const TString& id) TMAPI_session::TMAPI_session() : _hlibMAPI(NULL), _hSession(NULL), _hWnd(NULL) -{ } +{ + // Memorizza directory base + GetCurrentDirectory(_MAX_PATH, m_strBaseDir.get_buffer(_MAX_PATH)); +} TMAPI_session::~TMAPI_session() -{ close(); } +{ + close(); + + // Ripristina directory base + SetCurrentDirectory(m_strBaseDir); +} /////////////////////////////////////////////////////////// // TMail_message diff --git a/include/mailbox.cpp b/include/mailbox.cpp index c77e21c18..9da08ffb1 100755 --- a/include/mailbox.cpp +++ b/include/mailbox.cpp @@ -200,7 +200,7 @@ TMailbox::TMailbox(const char* appname) : _msgs(DEF_MSGS_CAPACITY) appname = main_app().name(); // myself; must be global _path.tempdir(); - _path << "/" << appname << ".mbx"; + _path << SLASH << appname << ".mbx"; _lastread =0; _lastpos = 0l; n_new = 0; diff --git a/include/mask.cpp b/include/mask.cpp index ece7e16ca..56b9b388a 100755 --- a/include/mask.cpp +++ b/include/mask.cpp @@ -856,18 +856,20 @@ bool TMask::on_key( case K_CTRL+'+': if (is_running()) { - for (int fire = _focus+1; fire >= _focus-1; fire--) + // Cerco nella pagina corrente il primo spreadsheet a partire dal campo col focus + if (_focus < 0) _focus = 0; + const WINDOW myparent = fld(_focus).parent(); + for (int fire = _focus; fire < fields(); fire++) { - if (fire >= 0 && fire < fields()) + TMask_field& f = fld(fire); + if (f.parent() != myparent) + break; + if (f.is_kind_of(CLASS_SHEET_FIELD)) { - TMask_field& f = fld(fire); - if (f.is_kind_of(CLASS_SHEET_FIELD)) - { - TSheet_field& s = (TSheet_field&)f; - const int newrow = s.append() ? -1 : 0; - notify_focus_field(s.dlg()); - s.insert(newrow, TRUE, TRUE); - } + TSheet_field& s = (TSheet_field&)f; + const int newrow = s.append() ? -1 : 0; + notify_focus_field(s.dlg()); + s.insert(newrow, TRUE, TRUE); } } } diff --git a/include/maskfld.cpp b/include/maskfld.cpp index 34bae74f7..722c7d429 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -2337,29 +2337,24 @@ bool TBrowse::do_link(bool insert) TConfig ini(msg, "Transaction"); ini.set("Action", "MODIFY"); - TString paragraph; paragraph << _cursor->file().num(); + TString8 paragraph; paragraph << _cursor->file().num(); ini.set_paragraph(paragraph); _inp_fn.restart(); - for (const char* i = _inp_id.get(0); i; i = _inp_id.get()) - { - TString inp_id(i); - TString s(_inp_fn.get()); - const int pos = s.find(","); - if (pos >= 0) - s.cut(pos); - if (inp_id[0] == '"') + TString inp_val; + FOR_EACH_TOKEN(_inp_id, i) + { + inp_val = i; + TFieldref fldref(_inp_fn.get(), 0); + if (inp_val[0] == '"') { - inp_id.ltrim(1); - inp_id.rtrim(1); + inp_val.rtrim(1); + inp_val.ltrim(1); } else - { - TFieldref fldref(s, 0); - inp_id = fldref.read(*_cursor->relation()); - } - ini.set(s, inp_id); + inp_val = fldref.read(*_cursor->relation()); + fldref.write(ini, paragraph, inp_val); } } diff --git a/include/relapp.cpp b/include/relapp.cpp index 94780073f..a5e66c4c1 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -1254,8 +1254,6 @@ void TRelation_application::main_loop() const bool change = firm_change_enabled(); // Dis/abilita cambio ditta enable_menu_item(M_FILE_NEW, change); - // Dis/abilita cambio parametri - enable_menu_item(M_FILE_REVERT, change); if (_mask->edit_mode()) { @@ -1650,7 +1648,7 @@ bool TRelation_application::load_transaction() _curr_transaction.upper(); _curr_trans_mode = toupper(cnf.get("Mode")[0]); _curr_trans_from = cnf.get("From"); - long firm = cnf.get_long("Firm"); + const long firm = cnf.get_long("Firm"); if (firm > 0) { diff --git a/include/strings.cpp b/include/strings.cpp index b8cf9a014..24a0d19aa 100755 --- a/include/strings.cpp +++ b/include/strings.cpp @@ -1116,9 +1116,9 @@ const TFilename& TFilename::tempdir() { _tempdir = getenv("TEMP"); if (_tempdir.empty()) - _tempdir = getenv("TMP"); + _tempdir = getenv("TMP"); if (_tempdir.empty()) - _tempdir << SLASH << "tmp"; + _tempdir << SLASH << "temp"; const int last = len()-1; if (!is_not_slash(_str[last])) @@ -1147,12 +1147,13 @@ const TFilename& TFilename::tempdir() if (!ok) fatal_box("Impossibile creare la directory '%s' per i file temporanei", (const char*)_tempdir); - - _tempdir.insert("TMP=", 0); - putenv(_tempdir); + + TString tmp = _tempdir; + tmp.insert("TMP=", 0); + putenv(tmp); } - set(_tempdir.mid(4)); + set(_tempdir); return *this; } diff --git a/include/viswin.cpp b/include/viswin.cpp index 0f7ca3bc1..3faaa6be6 100755 --- a/include/viswin.cpp +++ b/include/viswin.cpp @@ -2304,7 +2304,7 @@ bool TViswin::call_editor() xvt_fsys_convert_str_to_dir(newfilename.get_buffer(), &fs.dir); strcpy (fs.type, "txt"); strcpy (fs.name, "tmp"); - strcpy (fs.creator, "PRINT"); + strcpy (fs.creator, "CAMPO"); xvt_fsys_save_dir (); bool ok = xvt_dm_post_file_save (&fs, "Salva il file con il nome:") == FL_OK; diff --git a/include/window.cpp b/include/window.cpp index eb52f053f..b27cbcef0 100755 --- a/include/window.cpp +++ b/include/window.cpp @@ -219,13 +219,11 @@ void TWindow_manager::reg(TWindow* m) { const bool on = main_app().firm_change_enabled(); xvt_menu_set_item_enabled(TASK_WIN, M_FILE_NEW, on); - xvt_menu_set_item_enabled(TASK_WIN, M_FILE_REVERT, on); } break; case 1 : xvt_menu_set_item_enabled(TASK_WIN, M_FILE_QUIT, FALSE); xvt_menu_set_item_enabled(TASK_WIN, M_FILE_NEW, FALSE); - xvt_menu_set_item_enabled(TASK_WIN, M_FILE_REVERT, FALSE); default: _window[_current-1]->deactivate(); break; } @@ -258,7 +256,6 @@ void TWindow_manager::unreg(const TWindow* m) const bool cf = _current == 0 && main_app().firm_change_enabled(); xvt_menu_set_item_enabled(TASK_WIN, M_FILE_NEW, cf); - xvt_menu_set_item_enabled(TASK_WIN, M_FILE_REVERT, cf); xvt_menu_update(TASK_WIN); cur_win()->set_focus();