diff --git a/include/maskfld.cpp b/include/maskfld.cpp index 284aee393..168786dd2 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -414,8 +414,8 @@ void TMask_field::set_dirty(bool d) return; } #ifdef DBG - if (d == 3) - _flags.dirty = d; // Riga per breakpoint + if (d == 3) + _flags.dirty = d; // Riga per breakpoint #endif _flags.dirty = d; set_focusdirty(d); @@ -2006,7 +2006,7 @@ void TBrowse::do_output(CheckTime t) { if (t == FINAL_CHECK) return; - + const bool master = s_checking == 0; if (master) { @@ -2071,14 +2071,30 @@ void TBrowse::do_output(CheckTime t) } } } - + if (master) s_checking = 0; } 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()) { const short id = field().atodlg(fld); @@ -2092,6 +2108,9 @@ void TBrowse::do_clear(CheckTime 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 (_browse == NULL) - _browse = new TBrowse(this, b->cursor()); + if (_browse == NULL) + _browse = new TBrowse(this, b->cursor()); 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) { diff --git a/include/printapp.cpp b/include/printapp.cpp index 61c2667fc..fe53230ea 100755 --- a/include/printapp.cpp +++ b/include/printapp.cpp @@ -1059,7 +1059,7 @@ void TPrint_application::print() if (_prind) { - delete _prind;; + delete _prind; _prind = NULL; } } diff --git a/include/printer.cpp b/include/printer.cpp index 56d184b22..9c6b92b8e 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -1770,10 +1770,10 @@ else } #endif -_currentrow = 1; -_currentpage = 1; + _currentrow = 1; + _currentpage = 1; -return _isopen = TRUE; + return _isopen = TRUE; } @@ -2003,7 +2003,6 @@ void TPrinter::close () const KEY key = _vf->run (); if (_vf->is_open ()) _vf->close_modal (); _bookmarks.destroy(); - freeze (FALSE); if (key == K_CTRL+'S') { @@ -2025,45 +2024,48 @@ void TPrinter::close () } } #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT -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); - return; + else if (_printertype == winprinter && _txt.lines() > 0L) + { + print_txt(_txt); } - 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); -} -#endif -else if (_printertype == localprinter) -{ -#if XVT_OS == XVT_OS_SCOUNIX - TFilename s1 = tmpnam (NULL); - switch (fork ()) + else if (_printertype == fileprinter) { - case -1: - break; - case 0: - execlp ("localprint", "localprint", (const char *) s1, NULL); - default: - wait ((int *) NULL); + FILE* fp = fopen(_printerfile, "w"); + if (fp == NULL) + { + error_box("Impossibile aprire il file %s", (const char*)_printerfile); + return; + } + 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 -} -if (_finker) -{ - delete _finker; - _finker = NULL; -} + else if (_printertype == localprinter) + { + #if XVT_OS == XVT_OS_SCOUNIX + TFilename s1 = tmpnam (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; WriteProfileString("windows", "device", defPrinter); } @@ -2192,40 +2194,40 @@ const char* TPrinter::background_chars(int l) const struct font_data { - TString _name; - int _size; - int _columns; + TString _name; + int _size; + int _columns; }; 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"); if (win != NULL_WIN) { - 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); - - TString test(fd._columns); - test.fill('M', fd._columns); - for (int size = fd._size; size > 0; size--) - { - // Set print font - xvt_set_font(win, fd._name, XVT_FS_NONE, size); + 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); + + TString test(fd._columns); + test.fill('M', fd._columns); + for (int size = fd._size; size > 0; size--) + { + // Set print font + 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); - if (w <= ph) - break; - } - - if (size > 0) - fd._size = size; - - xvt_vobj_destroy(win); - } + const int w = xvt_dwin_get_text_width(win, (char*)(const char*)test, fd._columns); + if (w <= ph) + break; + } + + if (size > 0) + fd._size = size; + + xvt_vobj_destroy(win); + } return win != NULL_WIN; } @@ -2236,11 +2238,11 @@ int TPrinter::calc_font_size(int columns) const fd._name = fontname(); fd._size = get_char_size(); fd._columns = columns; - + xvt_print_open(); xvt_print_start_thread(calc_font_callback, (long)&fd); xvt_print_close(); - + return fd._size; } diff --git a/include/relapp.cpp b/include/relapp.cpp index 96f201779..cd2b545c9 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -13,7 +13,8 @@ /////////////////////////////////////////////////////////// TRelation_application::TRelation_application() - : _mask(NULL), _search_id(-1), _lnflag(FALSE) + : _mask(NULL), _search_id(-1), _lnflag(FALSE), + _autodelete(FALSE) { } TRelation_application::~TRelation_application() @@ -179,8 +180,8 @@ void TRelation_application::set_toolbar(bool all) pos = _mask->id2pos(DLG_DELREC); if (pos >= 0) { - bool enabdel = mode == MODE_MOD; - if (enabdel) + bool enabdel = mode != MODE_INS; + if (mode == MODE_MOD) { TRelation& r = *get_relation(); const TRecnotype oldpos = r.lfile().recno(); @@ -719,8 +720,11 @@ bool TRelation_application::main_loop() { if (_transaction == "INSERT") _mask->send_key(K_CTRL+'N', 0); - else + else + { + _autodelete = _transaction == "DELETE"; _mask->send_key(K_AUTO_ENTER, 0); + } } do @@ -731,8 +735,15 @@ bool TRelation_application::main_loop() // Dis/abilita cambio parametri enable_menu_item(M_FILE_REVERT, change); - if (_mask->edit_mode() && _transaction == "DELETE") - _mask->send_key(K_CTRL+'E', 0); + if (_mask->edit_mode() && _autodelete) + { + 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(); @@ -798,14 +809,22 @@ bool TRelation_application::main_loop() } break; case K_DEL: - if (relation_remove()) + if (_mask->query_mode()) + { + if (search_mode()) + _autodelete = TRUE; + } + else { - query_mode(); - if (_autoins_caller.not_empty() || _transaction.not_empty()) - { - if (_lnflag) _recins = 0; - k = K_QUIT; - } + if (relation_remove()) + { + query_mode(); + if (_autoins_caller.not_empty() || _transaction.not_empty()) + { + if (_lnflag) _recins = 0; + k = K_QUIT; + } + } } break; case K_F9: diff --git a/include/relapp.h b/include/relapp.h index 659711fb2..3358751e5 100755 --- a/include/relapp.h +++ b/include/relapp.h @@ -50,6 +50,8 @@ class TRelation_application : public TApplication TString _ini; // @cmember:(INTERNAL) Azione della transazione corrente TString _transaction; + // @cmember:(INTERNAL) Flag di cancellazione automatica veloce + bool _autodelete; // @cmember:(INTERNAL) Setta i campi fissati da bool filter(); diff --git a/include/viswin.cpp b/include/viswin.cpp index ac6c382f4..5b2b60f7d 100755 --- a/include/viswin.cpp +++ b/include/viswin.cpp @@ -405,7 +405,7 @@ bool TViswin::check_link ( TToken_string & ttt = (TToken_string &) (*_links)[id]; ttt.restart (); strcpy (descr, ttt.get ()); - strcat (descr, t.get (3)); +// strcat (descr, t.get (3)); _linktxt = t.get(3); if (_multiple) { @@ -413,14 +413,22 @@ bool TViswin::check_link ( const char *cp; _txt.read_line (ty); _multiple_link = ""; - + + const char fg = *ttt.get(1); + const char bg = *ttt.get(2); while (cp = _txt.piece ()) { - if (_txt.get_foreground () == *(ttt.get (1)) && - _txt.get_background () == *(ttt.get (2))) + if (_txt.get_foreground() == fg && _txt.get_background() == bg) + { _multiple_link.add (cp); + strcat(descr, " "); + strcat(descr, cp); + } } - } + } + else + strcat(descr, _linktxt); + old_id = _linkID = id; y = ty; x1 = tx1;