From 250b26fcf1fc8ecb10923bace7ac85f9b975cd7f Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 23 Nov 2009 15:42:18 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : ba0 lv3 Ricompilazione Demo : [ ] Commento : Migliorata gestione schermi molto piccoli (240x320) git-svn-id: svn://10.65.10.50/trunk@19664 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/about.cpp | 13 ++++++++++--- include/config.cpp | 4 +--- include/controls.cpp | 31 ++++++------------------------- include/scanner.cpp | 18 +++++++++--------- include/xvtility.cpp | 33 ++++++++++++++++++++++++++------- include/xvtility.h | 1 + 6 files changed, 53 insertions(+), 47 deletions(-) diff --git a/include/about.cpp b/include/about.cpp index f04918b6f..97cfe2e8c 100755 --- a/include/about.cpp +++ b/include/about.cpp @@ -290,6 +290,10 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni")) if (main_app().get_version_info(year, release, tag, patch)) versione.format("%d.%02d.%02d Patch %d", year, release, tag, patch); + const time_t mtime = xvt_fsys_file_attr(main_app().argv(0), XVT_FILE_ATTR_MTIME); + const struct tm* data = localtime(&mtime); + TString16 datamod; datamod.format("%02d-%02d-%04d", data->tm_mday, data->tm_mon+1, data->tm_year+1900); + TString80 stros, strwx, strcpu; xvt_sys_get_version(stros.get_buffer(), strwx.get_buffer(), stros.size()); xvt_sys_get_host_name(strcpu.get_buffer(), strcpu.size()); @@ -345,13 +349,16 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni")) add_cat(TR("Programma")); add_prop(TR("Versione"), versione); + add_prop(TR("Data"), datamod); + add_prop(TR("Linea di Comando"), arg); + add_prop(TR("Utente"), user()); + + add_cat(TR("Licenza")); + add_prop(TR("Installazione"), tipo); add_prop(TR("Protezione"), prot); add_prop(TR("N. di serie"), ser_no); if (ser_no > 0) add_prop(TR("Assistenza"), dongle().year_assist()); - add_prop(TR("Installazione"), tipo); - add_prop(TR("Utente"), user()); - add_prop(TR("Linea di Comando"), arg); add_cat(TR("Area dati")); TFilename study = firm2dir(-1); diff --git a/include/config.cpp b/include/config.cpp index f27c68cd2..4d51450dc 100755 --- a/include/config.cpp +++ b/include/config.cpp @@ -114,9 +114,7 @@ void TConfig::_write_file() if (_file.exist()) { - - ifstream in(_file, ios::in); - + ifstream in(_file); if (in.good()) { TString l(1024); diff --git a/include/controls.cpp b/include/controls.cpp index 15827058f..8d0d75779 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -181,20 +181,6 @@ HIDDEN XVT_FNTID FAT_FONT = NULL; HIDDEN XVT_FNTID BIG_FONT = NULL; HIDDEN XVT_FNTID BIGFAT_FONT = NULL; -HIDDEN void get_taskwin_size(XinPoint& pnt) -{ - RCT max_rct; xvt_vobj_get_client_rect(TASK_WIN, &max_rct); - pnt.h = max_rct.right; - pnt.v = max_rct.bottom; - - int sbh = xvtil_statbar_height(); - if (sbh <= 0) sbh = 24; - pnt.v -= sbh; // Tolgo lo spazio occupato dalla status bar - pnt.v -= sbh; // Tolgo lo spazio occupato dai tab buttons - pnt.v -= TOOL_SIZE + 8; // Tolgo lo spazio occupato dalle icone della toolbar - pnt.v -= TOOL_TEXT ? 12 : 0; // Tolgo lo spazio occupato dal testo della toolbar -} - bool is_xvt_font(const char * nome_font) { const int max_fonts = 1024; @@ -260,17 +246,11 @@ XVT_FNTID xvtil_default_font(bool bold, bool big) BASEY = ascent; // Compute suitable text size - XinPoint pnt; get_taskwin_size(pnt); - ROWY = pnt.v / 23; - - if (CHARY > ROWY-2) - CHARY = ROWY-2; + const PNT pnt = xvtil_taskwin_size(); + ROWY = pnt.v / min(23, pnt.v / CHARY); - const int COLX = pnt.h / 80; TString str(80, 'M'); CHARX = xvt_dwin_get_text_width(TASK_WIN, str, str.size()) / str.size(); - if (CHARX > COLX) - CHARX = COLX; } XVT_FNTID f = NULL; @@ -505,10 +485,11 @@ HIDDEN void xi_event_handler(XI_OBJ *itf, XI_EVENT *xiev); HIDDEN void init_fu_multiple(XI_OBJ* itf) { - XinPoint pnt; get_taskwin_size(pnt); + const PNT p = xvtil_taskwin_size(); + XinPoint pnt = { p.v, p.h }; xi_pu_to_fu(itf, &pnt, 1); - X_FU_MULTIPLE = pnt.h / 80; - Y_FU_MULTIPLE = pnt.v / 23; + X_FU_MULTIPLE = CHARX; + Y_FU_MULTIPLE = pnt.v / min(pnt.v/CHARY, 23); } WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, diff --git a/include/scanner.cpp b/include/scanner.cpp index 0867f1130..8a0b19fae 100755 --- a/include/scanner.cpp +++ b/include/scanner.cpp @@ -10,7 +10,7 @@ inline char match(char c) TScanner::TScanner(const char* filename) : _token(128), _key(2), - _tmp(1024*8), _pushed(FALSE), _line(0) + _tmp(1024*8), _pushed(false), _line(0) { open(filename, ios::in); @@ -46,7 +46,7 @@ const TString& TScanner::pop() } } while (_token.empty() && good() && !eof()); - _pushed = FALSE; + _pushed = false; _token.upper(); _key = _token.left(2); @@ -70,7 +70,7 @@ TString& TScanner::line( _token.trim(); } while (_token.empty() && good() && !eof()); - _pushed = FALSE; + _pushed = false; return _token; } @@ -93,7 +93,7 @@ const TString& TScanner::string() } } - _pushed = FALSE; + _pushed = false; return _token; } @@ -133,7 +133,7 @@ const TString& TScanner::operand() return pop(); } - _pushed = FALSE; + _pushed = false; return _token; } @@ -142,13 +142,13 @@ void TScanner::push(const char* s) CHECK(!_pushed, "You are pushing back two values to the parser"); if (s != NULL) _token = s; - _pushed = TRUE; + _pushed = true; } // Certified 100% // @doc EXTERNAL // @mfunc Va al paragrafo

-// @rdesc Ritorna TRUE se il paragrafo esiste +// @rdesc Ritorna true se il paragrafo esiste bool TScanner::paragraph(const char* name) { TString256 p = name; @@ -163,8 +163,8 @@ bool TScanner::paragraph(const char* name) while (line().not_empty()) { if (token() == p) - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/include/xvtility.cpp b/include/xvtility.cpp index 0b228ff24..f4cf7f4c2 100755 --- a/include/xvtility.cpp +++ b/include/xvtility.cpp @@ -37,6 +37,21 @@ HIDDEN BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR) #endif } +PNT xvtil_taskwin_size() +{ + RCT max_rct; xvt_vobj_get_client_rect(TASK_WIN, &max_rct); + PNT pnt = { max_rct.bottom, max_rct.right }; + + int sbh = xvtil_statbar_height(); + if (sbh <= 0) sbh = 24; + pnt.v -= sbh; // Tolgo lo spazio occupato dalla status bar + pnt.v -= sbh; // Tolgo lo spazio occupato dai tab buttons + pnt.v -= TOOL_SIZE + 8; // Tolgo lo spazio occupato dalle icone della toolbar + pnt.v -= TOOL_TEXT ? 12 : 0; // Tolgo lo spazio occupato dal testo della toolbar + return pnt; +} + + // @doc INTERNAL // @func Calcola dimensioni e posizione di un controllo contenuto nella finestra @@ -80,8 +95,8 @@ RCT& resize_rect( { if (ROWY <= 0) // Not yet initialized { - RCT pc; xvt_vobj_get_client_rect(parent, &pc); - ROWY = (pc.bottom - pc.top) / 23; + const PNT tws = xvtil_taskwin_size(); + ROWY = tws.v / min(23, tws.v / CHARY); } } @@ -443,18 +458,22 @@ void set_xvt_hooks() long twin_style = xvt_vobj_get_attr(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE); twin_style |= WSF_ICONIZABLE | WSF_CLOSE; // WSF_SIZE pare azzardato - TConfig cfg(CONFIG_GUI, "Colors"); - const int res = cfg.get_int("Resolution"); const int scx = xvt_vobj_get_attr(NULL_WIN, ATTR_SCREEN_WIDTH); const int scy = xvt_vobj_get_attr(NULL_WIN, ATTR_SCREEN_HEIGHT); - if (res >= 640 && res < scx) + TToken_string stres(ini_get_string(CONFIG_GUI, "Colors", "Resolution"), 'x'); + const int resx = stres.get_int(0); + int resy = stres.get_int(); + if (resy <= 0) + resy = scy*resx/scx; + + if (resx >= 240 && resx < scx) { const int fx = xvt_vobj_get_attr(NULL_WIN, ATTR_FRAME_WIDTH); const int fy = xvt_vobj_get_attr(NULL_WIN, ATTR_FRAME_HEIGHT); const int cy = xvt_vobj_get_attr(NULL_WIN, ATTR_TITLE_HEIGHT); - const int width = res + 2*fx; - const int height = (res * scy) / scx + 2*fy + cy; + const int width = resx + 2*fx; + const int height = resy+ 2*fy + cy; const int deltax = (scx - width) / 2; const int deltay = (scy - height) / 2; diff --git a/include/xvtility.h b/include/xvtility.h index b2b164680..9bf116365 100755 --- a/include/xvtility.h +++ b/include/xvtility.h @@ -17,6 +17,7 @@ const long E_DROP_FILES = 883L; const long E_ADDLINE_ONSCREEN = 467L; const long E_ADDLINE = 488L; +PNT xvtil_taskwin_size(); RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW parent); // align='L|T','C','R|B' grow= '+','=','-'