From 7b3d4963866a710965e488c220bfb5c5b793c772 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 12 Sep 1994 09:34:05 +0000 Subject: [PATCH] Corretta gestione del flag di dirty degli sheet in ambiente Unix git-svn-id: svn://10.65.10.50/trunk@221 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/applicat.cpp | 1 - include/checks.cpp | 416 ++++++++++++++++++++++--------------------- include/isam.cpp | 10 +- include/msksheet.cpp | 7 +- 4 files changed, 219 insertions(+), 215 deletions(-) diff --git a/include/applicat.cpp b/include/applicat.cpp index 5035215e9..4a1895bed 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -284,7 +284,6 @@ TPrinter& TApplication::printer() bool TApplication::create() { - // include_progind(); // TBC da eliminare quando il linker diventa furbo return TRUE; } diff --git a/include/checks.cpp b/include/checks.cpp index 47a44bb14..8fe6204f3 100755 --- a/include/checks.cpp +++ b/include/checks.cpp @@ -1,207 +1,209 @@ -#include -#include -#include - -#ifdef XVT_OS -#include -#if XVT_OS == XVT_OS_WIN -#include -#include -#else -#include -#include -#endif - -#endif // XVT_OS - - -#ifdef FOXPRO -#undef XVT_OS -#include -#endif - -#ifdef XVT_R3_API -#include -#endif - -#include - -#define buildmsg() char msg[256];va_list argptr;va_start(argptr,fmt);vsprintf(msg,fmt,argptr);va_end(argptr) - -#ifdef XVT_OS - -int fatal_box(const char* fmt, ...) -{ - buildmsg(); - -#if XVT_OS == XVT_OS_WIN - MessageBeep(MB_ICONHAND); - MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL); - FatalAppExit(0, "ERRORE FATALE"); -#else - beep(); - if (xvt_running()) xvt_fatal("%s", msg); - else - { - fprintf(stderr, "%s\n", msg); - getchar(); - exit(1); - } -#endif - - return 0; -} - - -int error_box(const char* fmt, ...) -{ - buildmsg(); - -#if XVT_OS == XVT_OS_WIN - MessageBeep(MB_ICONEXCLAMATION); - MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION); -#else - beep(); - if (xvt_running()) xvt_error("%s", msg); - else - { - fprintf(stderr, "%s\n", msg); - getchar(); - } -#endif - - return 0; -} - - -int warning_box(const char* fmt, ...) -{ - buildmsg(); - -#if XVT_OS == XVT_OS_WIN - MessageBeep(MB_ICONQUESTION); - MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION); -#else - beep(); - xvt_note("%s", msg); -#endif - - return 0; -} - - -int message_box(const char* fmt, ...) -{ - buildmsg(); - -#if XVT_OS == XVT_OS_WIN - MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION); -#else - xvt_note("%s", msg); -#endif - - return 0; -} - -int sorry_box(const char* fmt, ...) -{ - buildmsg(); - -#if XVT_OS == XVT_OS_WIN - MessageBeep(MB_OK); - MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION); -#else - xvt_note("%s", msg); -#endif - - return 0; -} - -int yesno_box(const char* fmt, ...) -{ - buildmsg(); - -#if XVT_OS == XVT_OS_WIN - int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION); - return r == IDYES; -#else - ASK_RESPONSE r = xvt_ask((char*) "Si", (char*) "No", NULL, "%s", msg); - return r == RESP_DEFAULT; -#endif -} - - -int yesnofatal_box(const char* fmt, ...) -{ - buildmsg(); - -#ifdef DBG - char s[256]; sprintf(s, "%s\nContinuare ugualmente?", msg); - const int ret = yesno_box("%s", s); - if (!ret) fatal_box(""); -#else - fatal_box("%s", msg); -#endif - - return FALSE; -} - - - -int yesnocancel_box(const char* fmt, ...) -{ - buildmsg(); - -#if XVT_OS == XVT_OS_WIN - 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_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 -} - -#endif // XVT_OS - - -#ifdef FOXPRO - -int error_box(const char* fmt, ...) -{ - buildmsg(); - _UserError(msg); - return 0; -} - -int fatal_box(const char* fmt, ...) -{ - buildmsg(); - _UserError(msg); - return 0; -} - -int message_box(const char* fmt, ...) -{ - buildmsg(); - _UserError(msg); - return 0; -} - -int yesnofatal_box(const char* fmt, ...) -{ - buildmsg(); - _UserError(msg); - return 0; -} -#endif // FOXPRO - +#include +#include +#include + +#ifdef XVT_OS +#include +#if XVT_OS == XVT_OS_WIN +#include +#include +#else +#include +#endif +#include +#endif // XVT_OS + + +#ifdef FOXPRO +#undef XVT_OS +#include +#endif + +#ifdef XVT_R3_API +#include +#endif + +#include + +#define buildmsg() char msg[256];va_list argptr;va_start(argptr,fmt);vsprintf(msg,fmt,argptr);va_end(argptr) + +#ifdef XVT_OS + +int fatal_box(const char* fmt, ...) +{ + buildmsg(); + +#if XVT_OS == XVT_OS_WIN + MessageBeep(MB_ICONHAND); + MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL); + const TApplication* a = MainApp(); + if (a != NULL) + a->wake_up_caller(); + xvt_terminate(); +#else + beep(); + if (xvt_running()) xvt_fatal("%s", msg); + else + { + fprintf(stderr, "%s\n", msg); + getchar(); + exit(1); + } +#endif + + return 0; +} + + +int error_box(const char* fmt, ...) +{ + buildmsg(); + +#if XVT_OS == XVT_OS_WIN + MessageBeep(MB_ICONEXCLAMATION); + MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION); +#else + beep(); + if (xvt_running()) xvt_error("%s", msg); + else + { + fprintf(stderr, "%s\n", msg); + getchar(); + } +#endif + + return 0; +} + + +int warning_box(const char* fmt, ...) +{ + buildmsg(); + +#if XVT_OS == XVT_OS_WIN + MessageBeep(MB_ICONQUESTION); + MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION); +#else + beep(); + xvt_note("%s", msg); +#endif + + return 0; +} + + +int message_box(const char* fmt, ...) +{ + buildmsg(); + +#if XVT_OS == XVT_OS_WIN + MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION); +#else + xvt_note("%s", msg); +#endif + + return 0; +} + +int sorry_box(const char* fmt, ...) +{ + buildmsg(); + +#if XVT_OS == XVT_OS_WIN + MessageBeep(MB_OK); + MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION); +#else + xvt_note("%s", msg); +#endif + + return 0; +} + +int yesno_box(const char* fmt, ...) +{ + buildmsg(); + +#if XVT_OS == XVT_OS_WIN + int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION); + return r == IDYES; +#else + ASK_RESPONSE r = xvt_ask((char*) "Si", (char*) "No", NULL, "%s", msg); + return r == RESP_DEFAULT; +#endif +} + + +int yesnofatal_box(const char* fmt, ...) +{ + buildmsg(); + +#ifdef DBG + char s[256]; sprintf(s, "%s\nContinuare ugualmente?", msg); + const int ret = yesno_box("%s", s); + if (!ret) fatal_box(""); +#else + fatal_box("%s", msg); +#endif + + return FALSE; +} + + + +int yesnocancel_box(const char* fmt, ...) +{ + buildmsg(); + +#if XVT_OS == XVT_OS_WIN + 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_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 +} + +#endif // XVT_OS + + +#ifdef FOXPRO + +int error_box(const char* fmt, ...) +{ + buildmsg(); + _UserError(msg); + return 0; +} + +int fatal_box(const char* fmt, ...) +{ + buildmsg(); + _UserError(msg); + return 0; +} + +int message_box(const char* fmt, ...) +{ + buildmsg(); + _UserError(msg); + return 0; +} + +int yesnofatal_box(const char* fmt, ...) +{ + buildmsg(); + _UserError(msg); + return 0; +} +#endif // FOXPRO + diff --git a/include/isam.cpp b/include/isam.cpp index 40812d415..6ca4b20bd 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -4,6 +4,7 @@ #define __ISAM_CPP #include +#include #include #include @@ -12,8 +13,10 @@ #endif #define NOT_LINKED(i,f) CHECKS(i != NULL, "Record senza tracciato: impossibile eseguire ", f) -#define NOT_OPEN(f) CHECKS(_isamfile != NULL, "File chiuso, impossiibile eseguire ", f) -#define UNKNOWN_FIELD(num, name) yesnofatal_box("Il campo '%s' non appartiene al file %d", name, num) +#define NOT_OPEN(f) CHECKS(_isamfile != NULL, "File chiuso, impossibile eseguire ", f) + +HIDDEN void UNKNOWN_FIELD(int num, const char* name) +{ yesnofatal_box("Il campo '%s' non appartiene al file %d", name, num); } #define NOALLOC (char **) -1 @@ -26,8 +29,7 @@ public: virtual ~TExtrectype(); }; -TExtrectype::TExtrectype(const TTrec& r) -: TRectype(6) +TExtrectype::TExtrectype(const TTrec& r) : TRectype(6) { delete _rec; diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 58b94888c..858a634d6 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -501,12 +501,10 @@ break; if (!ok) { xiev->refused = TRUE; - set_dirty(2); // Set error status } else { xvt_statbar_set(""); - set_dirty(); } _check_enabled = TRUE; } @@ -892,7 +890,10 @@ void TSpreadsheet::str2mask(int riga) // Certified 100% bool TSpreadsheet::notify(int n, KEY k) { - return _notify ? _notify(n, k) : TRUE; + const bool ok = _notify ? _notify(n, k) : TRUE; + if (k == K_ENTER) + set_dirty(ok ? TRUE : 2); + return ok; }