From c9e5acad4222d67d45e06b52f68f0130c53cf1ac Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 14 May 1996 11:11:50 +0000 Subject: [PATCH] Aggiustati messaggi d'errore e update degli sheet git-svn-id: svn://10.65.10.50/trunk@2817 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/controls.cpp | 6 +++--- include/mask.cpp | 2 +- include/maskfld.cpp | 2 +- include/msksheet.cpp | 12 ++++++------ include/prefix.cpp | 7 +++---- include/progind.cpp | 19 +------------------ include/sheet.cpp | 3 +-- include/toolbar.h | 16 ++++++++-------- include/uml.h | 4 ++-- include/xvtility.cpp | 27 ++++++++++++++++++++------- 10 files changed, 46 insertions(+), 52 deletions(-) diff --git a/include/controls.cpp b/include/controls.cpp index d36badc2e..5a3714f2c 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -1612,8 +1612,8 @@ void TDropDownList::open() xi_get_def_rect(lstdef, &l); wr.right = wr.left + (l.right - l.left) -1; // r.right; wr.bottom = wr.top + l.bottom - l.top; - int delta_x = _xi_obj->itf->v.itf->delta_x; - int delta_y = _xi_obj->itf->v.itf->delta_y; + const int delta_x = _xi_obj->itf->v.itf->delta_x; + const int delta_y = _xi_obj->itf->v.itf->delta_y; wr.left -= delta_x; wr.right -= delta_x; wr.top -= delta_y; @@ -1659,7 +1659,7 @@ bool TListbox_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev) case XIE_CHAR_FIELD: { const KEY k = xiev_to_key(xiev); - if (isalnum(k)) + if (k >= ' ' && k <= 'z') _ddl->select_by_initial(k); else if (k == K_F9) _ddl->open(); diff --git a/include/mask.cpp b/include/mask.cpp index 007d4b8b6..ad82ceb51 100755 --- a/include/mask.cpp +++ b/include/mask.cpp @@ -613,7 +613,7 @@ bool TMask::on_key( for (int i = fields()-1; i >= 0; i--) { TMask_field& f = fld(i); - if (f.class_id() == CLASS_BUTTON_FIELD && f.active()) + if (f.active() && f.is_kind_of(CLASS_BUTTON_FIELD)) { TButton_field& b = (TButton_field&)f; if (b.virtual_key() == key) diff --git a/include/maskfld.cpp b/include/maskfld.cpp index c78636849..c9b9a0560 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -3484,7 +3484,7 @@ const char* TList_field::win2raw(const char* data) const int pos = value.get_pos(_ctl_data._park); if (pos < 0 && _ctl_data._park.blank()) { - _ctl_data._park = value.get(0); + _ctl_data._park = codes.get(0); // Uso codes come riferimento per blank if (_ctl_data._park.blank()) pos = 0; } diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 7418c3058..2309766d6 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -259,13 +259,13 @@ TSpreadsheet::TSpreadsheet( { CHECKD(i < MAX_COL, "Tu meni calumns in scit: ", i); - const int cid = FIRST_FIELD+i; // Column & Field ID - const TOperable_field* f = field(cid); // Field on mask + const int cid = FIRST_FIELD+i; // Column & Field ID + const TOperable_field* f = field(cid); // Field on mask CHECKD(f, "The spreadsheet mask needs ALSO field ", cid); TString testa(h); const int at = testa.find('@'); - int m = f->size(); // Memory width + const int m = f->size(); // Memory width int v = m; // Video width if (at >= 0) { @@ -285,7 +285,6 @@ TSpreadsheet::TSpreadsheet( } if (v > 69) v = 69; - m = f->size(); m_width[i] = m+1; // m = number of allowed chars v_width[i] = v+1; // v = width of column @@ -674,7 +673,8 @@ void TSpreadsheet::update( if (scroll) xi_scroll(_obj, XI_SCROLL_FIRST); else - xi_scroll_rec(_obj, handle[first], NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0); +// xi_scroll_rec(_obj, handle[first], NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0); + xi_scroll(_obj, 0); _needs_update = -1; // Clear pending row update } @@ -1099,7 +1099,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) XI_MAKE_CELL(&cell, _obj, _cur_row, _cur_col); TList_field& lst = ((TList_field&)*_edit_field); - if (k < 128 && isalnum(k)) + if (k >= ' ' && k <= 'z') { lst.select_by_initial(k); xi_set_text(&cell, (char*)lst.raw2win(lst.get())); diff --git a/include/prefix.cpp b/include/prefix.cpp index 9b1d0b323..a035bc92d 100755 --- a/include/prefix.cpp +++ b/include/prefix.cpp @@ -14,7 +14,6 @@ #include #include -#include #include extern int get_error(int); @@ -122,7 +121,7 @@ HIDDEN int closeall(bool changestudy, TBit_array& excl, TBit_array& toclose) d.get(i + 1, _nolock, _nordir, _sysdirop); if (toclose[i + 1] || changestudy || !d.is_com()) { - excl.set(i, DB_file_locked(isfd->fhnd) == _excllock); + excl.set(i, DB_file_locked(isfd->fhnd) != 0); err=DB_close(isfd->fhnd); if (err != NOERR) err=get_error(err); if (err != NOERR) fatal_box("Can't close file %d. Error n. %d",isfd->ln,err); @@ -168,7 +167,7 @@ HIDDEN void openall(bool changestudy, TBit_array& excl, int oldmax, TBit_array& *isfd->r = *r.rec(); if (excllock(CInsPref((char*) glockname, NORDIR), FALSE) == -1 && errno == EACCES) fatal_box("Can't reopen file n. %d : file in use", i + 1); - isfd->fhnd = DB_open(isfd->d->SysName,excl[i]==_excllock); + isfd->fhnd = DB_open(isfd->d->SysName, excl[i]); if (isfd->fhnd < 0 ) err=get_error(isfd->fhnd); else err = NOERR; if (err == _islocked) @@ -212,7 +211,7 @@ void TPrefix::set( // @flag COM | Apre il direttorio con i dati comuni // @flag DEF | Riapre la ditta indicata nel file prefix.txt // @flag codice ditta | Apre la ditta indicata -{ +{ if (name == NULL) { CCloseDir(NORDIR); diff --git a/include/progind.cpp b/include/progind.cpp index d2d74bb5f..8bd918be3 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -111,23 +111,6 @@ void TIndwin::update_bar() const int width = r.right - r.left; RCT b = r; - set_pen(COLOR_BLACK); - -/* - set_brush(COLOR_BLUE); - b.right = b.left + int(width*prc); - xvt_dwin_draw_rect(win(), &b); - - set_brush(COLOR_WHITE); - b.left = b.right; b.right = r.right; - xvt_dwin_draw_rect(win(), &b); - - set_mode(M_XOR); - xvt_dwin_set_fore_color(win(), COLOR_BLUE); - char n[8]; sprintf(n, "%d%%", int(100*prc)); - xvt_dwin_draw_text(win(), r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1); - set_mode(M_COPY); -*/ WINDOW w = win(); b.right = b.left + int(width*prc); @@ -135,7 +118,7 @@ void TIndwin::update_bar() set_brush(COLOR_WHITE); b.left = b.right; b.right = r.right; - xvt_dwin_draw_rect(w, &b); + xi_draw_3d_rect(w, &b, TRUE, 2, 0, 0, 0); char n[8]; sprintf(n, "%d%%", int(100*prc)); xvt_dwin_draw_text(w, r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1); diff --git a/include/sheet.cpp b/include/sheet.cpp index 0862364eb..bd7a27400 100755 --- a/include/sheet.cpp +++ b/include/sheet.cpp @@ -307,9 +307,8 @@ void TSheet_control::update(long n) if (scroll_first) xi_scroll(_obj, XI_SCROLL_FIRST); - else + else xi_scroll(_obj, 0); -// xi_scroll_rec(_obj, n, FOCUS_COLOR, XI_ATR_ENABLED, 0); } } diff --git a/include/toolbar.h b/include/toolbar.h index 1655e2ccd..8e33a42a0 100755 --- a/include/toolbar.h +++ b/include/toolbar.h @@ -2,24 +2,24 @@ BUTTON DLG_SAVEREC 10 2 BEGIN PROMPT -16 -1 "~Registra" MESSAGE EXIT,K_SAVE - PICTURE 103 - PICTURE 153 + PICTURE BMP_SAVEREC + PICTURE BMP_SAVERECDN END BUTTON DLG_NEWREC 10 2 BEGIN PROMPT -26 -1 "~Nuovo" MESSAGE EXIT,K_INS - PICTURE 105 - PICTURE 155 + PICTURE BMP_NEWREC + PICTURE BMP_NEWRECDN END BUTTON DLG_DELREC 10 2 BEGIN PROMPT -36 -1 "~Elimina" MESSAGE EXIT,K_DEL - PICTURE 104 - PICTURE 154 + PICTURE BMP_DELREC + PICTURE BMP_DELRECDN END BUTTON DLG_FINDREC 10 2 @@ -40,7 +40,7 @@ BUTTON DLG_QUIT 10 2 BEGIN PROMPT -66 -1 "~Fine" MESSAGE EXIT,K_QUIT - PICTURE 114 - PICTURE 164 + PICTURE BMP_QUIT + PICTURE BMP_QUITDN END diff --git a/include/uml.h b/include/uml.h index 9f208855e..51a6518c6 100755 --- a/include/uml.h +++ b/include/uml.h @@ -1,7 +1,7 @@ -#include -#include #include +#include #include +#include #define FALSE 0 #define TRUE 1 diff --git a/include/xvtility.cpp b/include/xvtility.cpp index ded2d7478..b1705fb1d 100755 --- a/include/xvtility.cpp +++ b/include/xvtility.cpp @@ -27,6 +27,7 @@ BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR) #define STRICT #include +#include extern "C" { WINDOW xvtwi_hwnd_to_window(HWND); @@ -110,18 +111,22 @@ static BOOLEAN event_hook(HWND hwnd, long* ret) { switch(msg) - { + { + case WM_SYSCOLORCHANGE: + Ctl3dColorChange(); + break; case WM_MENUCHAR: if (wparam >= 'A' && wparam <= 'z') { - WINDOW w = cur_win(); - if (w != NULL_WIN) - { + WINDOW win = cur_win(); + if (win != NULL_WIN) + { + TWindow* w = (TWindow*)xvt_vobj_get_data(win); const KEY key = toupper(wparam)+K_CTRL; - dispatch_e_char(w, key); + w->on_key(key); } } - break; + break; default: if (msg == WM_WAKEUP && wparam == main_app().waiting()) main_app().wake_up(); @@ -496,12 +501,20 @@ void customize_controls( xvt_vobj_set_attr(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook); xvt_vobj_set_attr(NULL_WIN,ATTR_ERRMSG_HANDLER, (long)error_hook); allow_another_instance(); + + HINSTANCE hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE); + Ctl3dRegister(hInstance); + Ctl3dAutoSubclass(hInstance); #endif customize_colors(); init_controls(); } else - { + { +#if XVT_OS == XVT_OS_WIN + HINSTANCE _hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE); + Ctl3dUnregister(_hInstance); +#endif free_controls(); } }