maskfld.cpp La TBrowse::do_clear non deve cancellare i propri input

printapp.cpp	Tolto doppio ; (punto e virgola)
printer.cpp     Corrette indentazioni varie
relapp.h	Aggiunta variabile booleana _autodelete
relapp.cpp	Gestione cancellazione veloce
viswin.cpp	Corretta visualizzazione collegamenti multipli (es. piano conti)


git-svn-id: svn://10.65.10.50/trunk@4321 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1997-05-06 10:26:19 +00:00
parent 41904da109
commit 8df6da4e55
6 changed files with 143 additions and 93 deletions

View File

@ -414,8 +414,8 @@ void TMask_field::set_dirty(bool d)
return; return;
} }
#ifdef DBG #ifdef DBG
if (d == 3) if (d == 3)
_flags.dirty = d; // Riga per breakpoint _flags.dirty = d; // Riga per breakpoint
#endif #endif
_flags.dirty = d; _flags.dirty = d;
set_focusdirty(d); set_focusdirty(d);
@ -2079,6 +2079,22 @@ void TBrowse::do_output(CheckTime t)
void TBrowse::do_clear(CheckTime t) void TBrowse::do_clear(CheckTime t)
{ {
const bool master = s_checking == 0;
if (master)
{
s_checking = field().dlg();
s_checked.reset();
// Rendo intoccabili i campi del MIO input
for (const char* fld = _inp_id.get(0); fld && *fld; fld = _inp_id.get())
{
if (isdigit(*fld))
{
const short id = field().atodlg(fld);
s_checked.set(id);
}
}
}
for (TString16 fld = _out_id.get(0); fld.not_empty(); fld = _out_id.get()) for (TString16 fld = _out_id.get(0); fld.not_empty(); fld = _out_id.get())
{ {
const short id = field().atodlg(fld); const short id = field().atodlg(fld);
@ -2092,6 +2108,9 @@ void TBrowse::do_clear(CheckTime t)
f.check(t); f.check(t);
} }
} }
if (master)
s_checking = 0;
} }
@ -2594,11 +2613,11 @@ bool TEdit_field::parse_item(TScanner& scanner)
{ {
if (what == "US" || what == "AL") if (what == "US" || what == "AL")
{ {
if (_browse == NULL) if (_browse == NULL)
_browse = new TBrowse(this, b->cursor()); _browse = new TBrowse(this, b->cursor());
else else
NFCHECK("COPY USE e USE nel campo %d", _ctl_data._dlg); NFCHECK("COPY USE e USE nel campo %d", _ctl_data._dlg);
} }
if (_browse) if (_browse)
{ {

View File

@ -1059,7 +1059,7 @@ void TPrint_application::print()
if (_prind) if (_prind)
{ {
delete _prind;; delete _prind;
_prind = NULL; _prind = NULL;
} }
} }

View File

@ -1770,10 +1770,10 @@ else
} }
#endif #endif
_currentrow = 1; _currentrow = 1;
_currentpage = 1; _currentpage = 1;
return _isopen = TRUE; return _isopen = TRUE;
} }
@ -2003,7 +2003,6 @@ void TPrinter::close ()
const KEY key = _vf->run (); const KEY key = _vf->run ();
if (_vf->is_open ()) _vf->close_modal (); if (_vf->is_open ()) _vf->close_modal ();
_bookmarks.destroy(); _bookmarks.destroy();
freeze (FALSE);
if (key == K_CTRL+'S') if (key == K_CTRL+'S')
{ {
@ -2025,45 +2024,48 @@ void TPrinter::close ()
} }
} }
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
else if (_printertype == winprinter && _txt.lines() > 0L) else if (_printertype == winprinter && _txt.lines() > 0L)
{
print_txt(_txt);
}
else if (_printertype == fileprinter)
{
FILE* fp = fopen(_printerfile, "w");
if (fp == NULL)
{ {
error_box("Impossibile aprire il file %s", (const char*)_printerfile); print_txt(_txt);
return;
} }
for (long i = 0; i < _txt.lines(); i++) else if (_printertype == fileprinter)
fprintf(fp,"%s\n", _txt.line(i));
fclose(fp);
message_box("Stampa su file terminata. Nome archivio: %s",(const char *)_printerfile);
}
#endif
else if (_printertype == localprinter)
{
#if XVT_OS == XVT_OS_SCOUNIX
TFilename s1 = tmpnam (NULL);
switch (fork ())
{ {
case -1: FILE* fp = fopen(_printerfile, "w");
break; if (fp == NULL)
case 0: {
execlp ("localprint", "localprint", (const char *) s1, NULL); error_box("Impossibile aprire il file %s", (const char*)_printerfile);
default: return;
wait ((int *) NULL); }
for (long i = 0; i < _txt.lines(); i++)
fprintf(fp,"%s\n", _txt.line(i));
fclose(fp);
message_box("Stampa su file terminata. Nome archivio: %s",(const char *)_printerfile);
} }
remove (s1);
#endif #endif
} else if (_printertype == localprinter)
if (_finker) {
{ #if XVT_OS == XVT_OS_SCOUNIX
delete _finker; TFilename s1 = tmpnam (NULL);
_finker = NULL; switch (fork ())
} {
case -1:
break;
case 0:
execlp ("localprint", "localprint", (const char *) s1, NULL);
default:
wait ((int *) NULL);
}
remove (s1);
#endif
}
if (_finker)
{
delete _finker;
_finker = NULL;
}
freeze (FALSE);
_isopen = FALSE; _isopen = FALSE;
WriteProfileString("windows", "device", defPrinter); WriteProfileString("windows", "device", defPrinter);
} }
@ -2192,40 +2194,40 @@ const char* TPrinter::background_chars(int l) const
struct font_data struct font_data
{ {
TString _name; TString _name;
int _size; int _size;
int _columns; int _columns;
}; };
BOOLEAN XVT_CALLCONV1 calc_font_callback(long data) BOOLEAN XVT_CALLCONV1 calc_font_callback(long data)
{ {
font_data& fd = *(font_data*)data; font_data& fd = *(font_data*)data;
// Create pint window // Create print window
WINDOW win = xvt_print_create_win(printer().get_printrcd(), "Calcolo font"); WINDOW win = xvt_print_create_win(printer().get_printrcd(), "Calcolo font");
if (win != NULL_WIN) if (win != NULL_WIN)
{ {
long pw, ph, phr, pvr; // Printer width, height, horizontal and vertical resolution long pw, ph, phr, pvr; // Printer width, height, horizontal and vertical resolution
xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, printer().get_printrcd(), &ph, &pw, &pvr, &phr); xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, printer().get_printrcd(), &ph, &pw, &pvr, &phr);
TString test(fd._columns); TString test(fd._columns);
test.fill('M', fd._columns); test.fill('M', fd._columns);
for (int size = fd._size; size > 0; size--) for (int size = fd._size; size > 0; size--)
{ {
// Set print font // Set print font
xvt_set_font(win, fd._name, XVT_FS_NONE, size); xvt_set_font(win, fd._name, XVT_FS_NONE, size);
const int w = xvt_dwin_get_text_width(win, (char*)(const char*)test, fd._columns); const int w = xvt_dwin_get_text_width(win, (char*)(const char*)test, fd._columns);
if (w <= ph) if (w <= ph)
break; break;
} }
if (size > 0) if (size > 0)
fd._size = size; fd._size = size;
xvt_vobj_destroy(win); xvt_vobj_destroy(win);
} }
return win != NULL_WIN; return win != NULL_WIN;
} }

View File

@ -13,7 +13,8 @@
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
TRelation_application::TRelation_application() TRelation_application::TRelation_application()
: _mask(NULL), _search_id(-1), _lnflag(FALSE) : _mask(NULL), _search_id(-1), _lnflag(FALSE),
_autodelete(FALSE)
{ } { }
TRelation_application::~TRelation_application() TRelation_application::~TRelation_application()
@ -179,8 +180,8 @@ void TRelation_application::set_toolbar(bool all)
pos = _mask->id2pos(DLG_DELREC); pos = _mask->id2pos(DLG_DELREC);
if (pos >= 0) if (pos >= 0)
{ {
bool enabdel = mode == MODE_MOD; bool enabdel = mode != MODE_INS;
if (enabdel) if (mode == MODE_MOD)
{ {
TRelation& r = *get_relation(); TRelation& r = *get_relation();
const TRecnotype oldpos = r.lfile().recno(); const TRecnotype oldpos = r.lfile().recno();
@ -720,7 +721,10 @@ bool TRelation_application::main_loop()
if (_transaction == "INSERT") if (_transaction == "INSERT")
_mask->send_key(K_CTRL+'N', 0); _mask->send_key(K_CTRL+'N', 0);
else else
{
_autodelete = _transaction == "DELETE";
_mask->send_key(K_AUTO_ENTER, 0); _mask->send_key(K_AUTO_ENTER, 0);
}
} }
do do
@ -731,8 +735,15 @@ bool TRelation_application::main_loop()
// Dis/abilita cambio parametri // Dis/abilita cambio parametri
enable_menu_item(M_FILE_REVERT, change); enable_menu_item(M_FILE_REVERT, change);
if (_mask->edit_mode() && _transaction == "DELETE") if (_mask->edit_mode() && _autodelete)
_mask->send_key(K_CTRL+'E', 0); {
const int pos = _mask->id2pos(DLG_DELREC);
if (pos >= 0 && _mask->fld(pos).active())
_mask->send_key(K_CTRL+'E', 0);
else
error_box("Documento non eliminabile.");
_autodelete = FALSE;
}
k = _mask->run(); k = _mask->run();
@ -798,13 +809,21 @@ bool TRelation_application::main_loop()
} }
break; break;
case K_DEL: case K_DEL:
if (relation_remove()) if (_mask->query_mode())
{ {
query_mode(); if (search_mode())
if (_autoins_caller.not_empty() || _transaction.not_empty()) _autodelete = TRUE;
}
else
{
if (relation_remove())
{ {
if (_lnflag) _recins = 0; query_mode();
k = K_QUIT; if (_autoins_caller.not_empty() || _transaction.not_empty())
{
if (_lnflag) _recins = 0;
k = K_QUIT;
}
} }
} }
break; break;

View File

@ -50,6 +50,8 @@ class TRelation_application : public TApplication
TString _ini; TString _ini;
// @cmember:(INTERNAL) Azione della transazione corrente // @cmember:(INTERNAL) Azione della transazione corrente
TString _transaction; TString _transaction;
// @cmember:(INTERNAL) Flag di cancellazione automatica veloce
bool _autodelete;
// @cmember:(INTERNAL) Setta i campi fissati da <md TRelation_application::_fixed> // @cmember:(INTERNAL) Setta i campi fissati da <md TRelation_application::_fixed>
bool filter(); bool filter();

View File

@ -405,7 +405,7 @@ bool TViswin::check_link (
TToken_string & ttt = (TToken_string &) (*_links)[id]; TToken_string & ttt = (TToken_string &) (*_links)[id];
ttt.restart (); ttt.restart ();
strcpy (descr, ttt.get ()); strcpy (descr, ttt.get ());
strcat (descr, t.get (3)); // strcat (descr, t.get (3));
_linktxt = t.get(3); _linktxt = t.get(3);
if (_multiple) if (_multiple)
{ {
@ -414,13 +414,21 @@ bool TViswin::check_link (
_txt.read_line (ty); _txt.read_line (ty);
_multiple_link = ""; _multiple_link = "";
const char fg = *ttt.get(1);
const char bg = *ttt.get(2);
while (cp = _txt.piece ()) while (cp = _txt.piece ())
{ {
if (_txt.get_foreground () == *(ttt.get (1)) && if (_txt.get_foreground() == fg && _txt.get_background() == bg)
_txt.get_background () == *(ttt.get (2))) {
_multiple_link.add (cp); _multiple_link.add (cp);
strcat(descr, " ");
strcat(descr, cp);
}
} }
} }
else
strcat(descr, _linktxt);
old_id = _linkID = id; old_id = _linkID = id;
y = ty; y = ty;
x1 = tx1; x1 = tx1;