From 3be2f51b01a384f937c792d5a6eb9f25c830cc4b Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 3 Jun 2003 12:58:47 +0000 Subject: [PATCH] Patch level : 2.0 488 Files correlati : librerie Ricompilazione Demo : [ ] Commento : Correzione di errori gia' segnalati nei rispettivi moduli git-svn-id: svn://10.65.10.50/trunk@11206 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/checks.cpp | 2 -- include/filetext.cpp | 2 +- include/mask.cpp | 44 ++++++++------------------------------------ include/msksheet.cpp | 2 +- include/relapp.cpp | 7 ++----- include/relation.cpp | 14 ++++++++++---- include/viswin.cpp | 2 +- include/window.cpp | 26 ++++++++++++++++---------- 8 files changed, 39 insertions(+), 60 deletions(-) diff --git a/include/checks.cpp b/include/checks.cpp index 1396c5447..92cf7bcf0 100755 --- a/include/checks.cpp +++ b/include/checks.cpp @@ -93,8 +93,6 @@ bool yesno_box( // // @flag 1 | Se viene premuto il taso SI // @flag 0 | Se viene premuto il taso NO - // - // @xref { buildmsg(); ASK_RESPONSE r = xvt_dm_post_ask("Si", "No", NULL, msg); diff --git a/include/filetext.cpp b/include/filetext.cpp index 6be7cd0d5..7f9347e92 100755 --- a/include/filetext.cpp +++ b/include/filetext.cpp @@ -678,7 +678,7 @@ bool TFile_text::_autoload(TRecord_text& rec, TCursor& cur , TTracciato_record& { TTracciato_campo& tc = tr.get(i); const TFieldref& field = tc.field(); - if (field.name().empty()) + if (field.name().not_empty()) campo = field.read(rel); const TString& message = tc.message(); diff --git a/include/mask.cpp b/include/mask.cpp index e4910d438..87feca93b 100755 --- a/include/mask.cpp +++ b/include/mask.cpp @@ -1,5 +1,4 @@ -#include -#include +#include #include #include @@ -724,51 +723,24 @@ void TMask::handler(WINDOW win, EVENT* ep) if (_last_sheet) { - TSheet_field& sht = (TSheet_field&)*_last_sheet; -#if (XVT_PTK_VERSION_MAJOR > 4) || (XVT_PTK_VERSION_MAJOR == 4 && XVT_PTK_VERSION_MINOR >= 50) MENU_ITEM* menu = xvt_res_get_menu(BROWSE_BAR); - if (menu) + if (menu != NULL) { const PNT& p = ep->v.mouse.where; - RCT cr; xvt_vobj_get_client_rect(win, &cr); - XVT_POPUP_ALIGNMENT pa = XVT_POPUP_CENTER; - if (p.h < cr.right / 3) - pa = XVT_POPUP_LEFT_ALIGN; - else - if (p.h > 2 * cr.right / 3) - pa = XVT_POPUP_RIGHT_ALIGN; - - xvt_menu_popup(menu->child, win, p, pa, NULL); + xvt_menu_popup(menu->child, win, p, XVT_POPUP_CENTER, NULL); xvt_res_free_menu_tree(menu); } -#else - ASK_RESPONSE r = xvt_dm_post_ask("Annulla", "Ripristina", "Salva", - "Ordinamento delle colonne"); - if (r == RESP_2) - sht.reset_columns_order(); - if (r == RESP_2 || r == RESP_3) - sht.save_columns_order(); -#endif } return; } - if (ep->type == E_COMMAND) + if (ep->type == E_COMMAND && _last_sheet != NULL) { switch (ep->v.cmd.tag) { - case M_EDIT_UNDO: - if (_last_sheet) - _last_sheet->reset_columns_order(); - case M_EDIT_CLIPBOARD: - if (_last_sheet) - _last_sheet->save_columns_order(); - break; - case M_EDIT_SEARCH: - if (_last_sheet) - _last_sheet->on_key(K_F11); - break; - default: - break; + case BROWSE_BAR+1: _last_sheet->save_columns_order(); break; + case BROWSE_BAR+2: _last_sheet->reset_columns_order(); break; + case BROWSE_BAR+3: _last_sheet->on_key(K_F11); break; + default: break; } return; } diff --git a/include/msksheet.cpp b/include/msksheet.cpp index d9f566535..43503d479 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -2587,7 +2587,7 @@ void TSheet_field::force_update( int TSheet_field::items() const { TSpreadsheet* s = (TSpreadsheet*)_ctl; - return (int)s->items(); + return (int)s->items(); } int TSheet_field::selected() const diff --git a/include/relapp.cpp b/include/relapp.cpp index 030950a9c..706de20a2 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -1312,14 +1312,11 @@ void TRelation_application::main_loop() const bool trovato = _mask->query_mode() && test_key(1, FALSE) && find(1); if (trovato) { - modify_mode(); if (is_transaction()) - { _curr_transaction=TRANSACTION_MODIFY; - // _curr_trans_mode = TM_INTERACTIVE; // Siamo sicuri??? - } else - warning_box("Elemento gia' presente"); + warning_box(TR("Elemento gia' presente")); + modify_mode(); } else insert_mode(); diff --git a/include/relation.cpp b/include/relation.cpp index 93a413785..0e536550f 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -1095,12 +1095,13 @@ bool TCursor::filtercursor(TRecnotype recno) file().readat(recno); if (update_relation()) { - const int handle = file().handle(); - const char *s0 = DB_index_getkey(handle); + // memorizzo la chiave prima di eventuali spostamenti + const TString s0(DB_index_getkey(file().handle())); _if->update(-filter_limit()); - if (_nkey != DB_tagget(handle)) - DB_tagselect(handle, _nkey); + + // ripristino la chiave dopo eventuali spostamenti + const int handle = file().handle(); if (recno != DB_index_recno(handle)) DB_index_go(handle, s0, recno); } @@ -1200,7 +1201,12 @@ bool TCursor::ok() const } if (update_relation()) + { + const TRecnotype old = file().recno(); _if->update(); + if (DB_recno(file().handle()) != old) + file().readat(old); + } if ((_filterfunction ? _filterfunction(_if) : TRUE ) && (_fexpr ? __evalcondition(*_if, _fexpr, _frefs) : TRUE)) diff --git a/include/viswin.cpp b/include/viswin.cpp index 7d7eea5bc..62178838e 100755 --- a/include/viswin.cpp +++ b/include/viswin.cpp @@ -982,7 +982,7 @@ void TViswin::paint_row (long j) { set_font(PRINT_FONT, st, PRINT_HEIGHT); set_color(fg, bg); - printat (X_OFFSET+pos, row, "%s", cp); + stringat(X_OFFSET+pos, row, cp); } pos += strlen (cp); } diff --git a/include/window.cpp b/include/window.cpp index 5779fcf98..0deaaad34 100755 --- a/include/window.cpp +++ b/include/window.cpp @@ -759,7 +759,6 @@ PNT TWindow::log2dev(long x, long y) const pnt.v = (int)y; if (!_pixmap) { -// pnt.h *= CHARX; pnt.h = char2pixel(pnt.h); pnt.v *= CHARY; } @@ -781,8 +780,7 @@ void TWindow::stringat(short x, short y, const char* str) { PNT pnt = log2dev(x,y); pnt.v += BASEY; - - xvt_dwin_draw_text(win(), pnt.h, pnt.v, (char *)str, -1); + xvt_dwin_draw_text(win(), pnt.h, pnt.v, str, -1); } // @doc EXTERNAL @@ -794,13 +792,21 @@ void TWindow::printat( const char* fmt, // @parm Formato che deve essere dato al testo ...) // @parmvar Uno o piu' parametri corrispondenti ai codici in

{ - TString str(256); - char* tmp = str.get_buffer(); - va_list argptr; - va_start(argptr, fmt); - vsprintf(tmp, fmt, argptr); - va_end(argptr); - stringat(x, y, tmp); + if (fmt && *fmt) + { + if (strchr(fmt, '%') != NULL) + { + TString256 str; // TString str(256); + char* tmp = str.get_buffer(); + va_list argptr; + va_start(argptr, fmt); + vsprintf(tmp, fmt, argptr); + va_end(argptr); + stringat(x, y, tmp); + } + else + stringat(x, y, fmt); + } } void TWindow::line(short x0, short y0, short x1, short y1)