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
This commit is contained in:
guy 1994-09-12 09:34:05 +00:00
parent 2442a6edf3
commit 7b3d496386
4 changed files with 219 additions and 215 deletions

View File

@ -284,7 +284,6 @@ TPrinter& TApplication::printer()
bool TApplication::create() bool TApplication::create()
{ {
// include_progind(); // TBC da eliminare quando il linker diventa furbo
return TRUE; return TRUE;
} }

View File

@ -1,207 +1,209 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef XVT_OS #ifdef XVT_OS
#include <xvt_os.h> #include <xvt_os.h>
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#include <windows.h> #include <windows.h>
#include <keys.h> #include <keys.h>
#else #else
#include <xvtility.h> #include <xvtility.h>
#include <applicat.h> #endif
#endif #include <applicat.h>
#endif // XVT_OS
#endif // XVT_OS
#ifdef FOXPRO
#ifdef FOXPRO #undef XVT_OS
#undef XVT_OS #include <pro_ext.h>
#include <pro_ext.h> #endif
#endif
#ifdef XVT_R3_API
#ifdef XVT_R3_API #include <windows.h>
#include <windows.h> #endif
#endif
#include <checks.h>
#include <checks.h>
#define buildmsg() char msg[256];va_list argptr;va_start(argptr,fmt);vsprintf(msg,fmt,argptr);va_end(argptr)
#define buildmsg() char msg[256];va_list argptr;va_start(argptr,fmt);vsprintf(msg,fmt,argptr);va_end(argptr)
#ifdef XVT_OS
#ifdef XVT_OS
int fatal_box(const char* fmt, ...)
int fatal_box(const char* fmt, ...) {
{ buildmsg();
buildmsg();
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN MessageBeep(MB_ICONHAND);
MessageBeep(MB_ICONHAND); MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL);
MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL); const TApplication* a = MainApp();
FatalAppExit(0, "ERRORE FATALE"); if (a != NULL)
#else a->wake_up_caller();
beep(); xvt_terminate();
if (xvt_running()) xvt_fatal("%s", msg); #else
else beep();
{ if (xvt_running()) xvt_fatal("%s", msg);
fprintf(stderr, "%s\n", msg); else
getchar(); {
exit(1); fprintf(stderr, "%s\n", msg);
} getchar();
#endif exit(1);
}
return 0; #endif
}
return 0;
}
int error_box(const char* fmt, ...)
{
buildmsg(); int error_box(const char* fmt, ...)
{
#if XVT_OS == XVT_OS_WIN buildmsg();
MessageBeep(MB_ICONEXCLAMATION);
MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION); #if XVT_OS == XVT_OS_WIN
#else MessageBeep(MB_ICONEXCLAMATION);
beep(); MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION);
if (xvt_running()) xvt_error("%s", msg); #else
else beep();
{ if (xvt_running()) xvt_error("%s", msg);
fprintf(stderr, "%s\n", msg); else
getchar(); {
} fprintf(stderr, "%s\n", msg);
#endif getchar();
}
return 0; #endif
}
return 0;
}
int warning_box(const char* fmt, ...)
{
buildmsg(); int warning_box(const char* fmt, ...)
{
#if XVT_OS == XVT_OS_WIN buildmsg();
MessageBeep(MB_ICONQUESTION);
MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION); #if XVT_OS == XVT_OS_WIN
#else MessageBeep(MB_ICONQUESTION);
beep(); MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION);
xvt_note("%s", msg); #else
#endif beep();
xvt_note("%s", msg);
return 0; #endif
}
return 0;
}
int message_box(const char* fmt, ...)
{
buildmsg(); int message_box(const char* fmt, ...)
{
#if XVT_OS == XVT_OS_WIN buildmsg();
MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION);
#else #if XVT_OS == XVT_OS_WIN
xvt_note("%s", msg); MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION);
#endif #else
xvt_note("%s", msg);
return 0; #endif
}
return 0;
int sorry_box(const char* fmt, ...) }
{
buildmsg(); int sorry_box(const char* fmt, ...)
{
#if XVT_OS == XVT_OS_WIN buildmsg();
MessageBeep(MB_OK);
MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION); #if XVT_OS == XVT_OS_WIN
#else MessageBeep(MB_OK);
xvt_note("%s", msg); MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION);
#endif #else
xvt_note("%s", msg);
return 0; #endif
}
return 0;
int yesno_box(const char* fmt, ...) }
{
buildmsg(); int yesno_box(const char* fmt, ...)
{
#if XVT_OS == XVT_OS_WIN buildmsg();
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION);
return r == IDYES; #if XVT_OS == XVT_OS_WIN
#else int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION);
ASK_RESPONSE r = xvt_ask((char*) "Si", (char*) "No", NULL, "%s", msg); return r == IDYES;
return r == RESP_DEFAULT; #else
#endif ASK_RESPONSE r = xvt_ask((char*) "Si", (char*) "No", NULL, "%s", msg);
} return r == RESP_DEFAULT;
#endif
}
int yesnofatal_box(const char* fmt, ...)
{
buildmsg(); int yesnofatal_box(const char* fmt, ...)
{
#ifdef DBG buildmsg();
char s[256]; sprintf(s, "%s\nContinuare ugualmente?", msg);
const int ret = yesno_box("%s", s); #ifdef DBG
if (!ret) fatal_box(""); char s[256]; sprintf(s, "%s\nContinuare ugualmente?", msg);
#else const int ret = yesno_box("%s", s);
fatal_box("%s", msg); if (!ret) fatal_box("");
#endif #else
fatal_box("%s", msg);
return FALSE; #endif
}
return FALSE;
}
int yesnocancel_box(const char* fmt, ...)
{
buildmsg(); int yesnocancel_box(const char* fmt, ...)
{
#if XVT_OS == XVT_OS_WIN buildmsg();
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNOCANCEL | MB_ICONQUESTION);
if (r == IDYES) r = K_YES; #if XVT_OS == XVT_OS_WIN
else int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNOCANCEL | MB_ICONQUESTION);
if (r == IDNO) r = K_NO; if (r == IDYES) r = K_YES;
else else
r = K_ESC; if (r == IDNO) r = K_NO;
return r; else
#else r = K_ESC;
ASK_RESPONSE r = xvt_ask((char*) "Si", (char*) "No", (char*) "Annulla", "%s", msg); return r;
if (r == RESP_DEFAULT) r = K_YES; #else
else ASK_RESPONSE r = xvt_ask((char*) "Si", (char*) "No", (char*) "Annulla", "%s", msg);
if (r == RESP_2) r = K_NO; if (r == RESP_DEFAULT) r = K_YES;
else else
r = K_ESC; if (r == RESP_2) r = K_NO;
return r; else
#endif r = K_ESC;
} return r;
#endif
#endif // XVT_OS }
#endif // XVT_OS
#ifdef FOXPRO
int error_box(const char* fmt, ...) #ifdef FOXPRO
{
buildmsg(); int error_box(const char* fmt, ...)
_UserError(msg); {
return 0; buildmsg();
} _UserError(msg);
return 0;
int fatal_box(const char* fmt, ...) }
{
buildmsg(); int fatal_box(const char* fmt, ...)
_UserError(msg); {
return 0; buildmsg();
} _UserError(msg);
return 0;
int message_box(const char* fmt, ...) }
{
buildmsg(); int message_box(const char* fmt, ...)
_UserError(msg); {
return 0; buildmsg();
} _UserError(msg);
return 0;
int yesnofatal_box(const char* fmt, ...) }
{
buildmsg(); int yesnofatal_box(const char* fmt, ...)
_UserError(msg); {
return 0; buildmsg();
} _UserError(msg);
#endif // FOXPRO return 0;
}
#endif // FOXPRO

View File

@ -4,6 +4,7 @@
#define __ISAM_CPP #define __ISAM_CPP
#include <isam.h> #include <isam.h>
#include <execp.h>
#include <extcdecl.h> #include <extcdecl.h>
#include <utility.h> #include <utility.h>
@ -12,8 +13,10 @@
#endif #endif
#define NOT_LINKED(i,f) CHECKS(i != NULL, "Record senza tracciato: impossibile eseguire ", f) #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 NOT_OPEN(f) CHECKS(_isamfile != NULL, "File chiuso, impossibile eseguire ", f)
#define UNKNOWN_FIELD(num, name) yesnofatal_box("Il campo '%s' non appartiene al file %d", name, num)
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 #define NOALLOC (char **) -1
@ -26,8 +29,7 @@ public:
virtual ~TExtrectype(); virtual ~TExtrectype();
}; };
TExtrectype::TExtrectype(const TTrec& r) TExtrectype::TExtrectype(const TTrec& r) : TRectype(6)
: TRectype(6)
{ {
delete _rec; delete _rec;

View File

@ -501,12 +501,10 @@ break;
if (!ok) if (!ok)
{ {
xiev->refused = TRUE; xiev->refused = TRUE;
set_dirty(2); // Set error status
} }
else else
{ {
xvt_statbar_set(""); xvt_statbar_set("");
set_dirty();
} }
_check_enabled = TRUE; _check_enabled = TRUE;
} }
@ -892,7 +890,10 @@ void TSpreadsheet::str2mask(int riga)
// Certified 100% // Certified 100%
bool TSpreadsheet::notify(int n, KEY k) 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;
} }