From fa8ceef324f97db8fddedcbc10d2d6cb759062fe Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 9 Feb 2010 10:11:25 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : tutti Ricompilazione Demo : [ ] Commento : Migliorata gestione colore dei prompt dei campi git-svn-id: svn://10.65.10.50/trunk@20084 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/about.cpp | 21 +++++++++++-------- include/colors.h | 1 + include/controls.cpp | 5 ++++- include/dongle.cpp | 48 +++++++++++++++++++++++++++++++------------- include/dongle.h | 3 ++- include/image.cpp | 3 ++- include/image.h | 2 +- include/isam.cpp | 4 ++-- include/mask.cpp | 20 ++++++++++++++---- include/msksheet.cpp | 5 ++++- include/printwin.cpp | 32 ----------------------------- include/progind.cpp | 4 ++-- include/relation.cpp | 6 ++++-- include/strings.cpp | 5 +++-- include/treectrl.cpp | 13 ++++++------ include/utility.cpp | 23 ++++++++++++--------- include/utility.h | 7 ++----- include/xvtility.cpp | 2 +- 18 files changed, 112 insertions(+), 92 deletions(-) diff --git a/include/about.cpp b/include/about.cpp index 6f14fbbc1..2a04086de 100755 --- a/include/about.cpp +++ b/include/about.cpp @@ -296,18 +296,17 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni")) if (cmdline.exist()) { const time_t mtime = xvt_fsys_file_attr(cmdline, XVT_FILE_ATTR_MTIME); - const struct tm* data = localtime(&mtime); - if (data != NULL) - datamod.format("%02d-%02d-%04d", data->tm_mday, data->tm_mon+1, data->tm_year+1900); + struct tm data; localtime_s(&data, &mtime); + 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()); TString arg; - for (int a = 0; a < main_app().argc(); a++) - arg << main_app().argv(a) << ' '; - arg.trim(); + for (int a = 0; a < main_app().argc(); a++) + arg << main_app().argv(a) << ' '; + arg.trim(); TConfig campoini(CONFIG_INSTALL, "Main"); TConfig userini(CONFIG_GUI, "Printer"); @@ -318,11 +317,11 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni")) { case _dongle_hardlock: prot = "Hardlock"; break; case _dongle_eutron : prot = "Eutron"; break; - case _dongle_network : prot = campoini.get("Dongle", "Server"); break; + case _dongle_network : prot = dongle().server_name(); break; default : prot = TR("Nessuna"); break; } - const int type = campoini.get_int("Type", "Main"); + int type = campoini.get_int("Type", "Main"); const char* tipo = NULL; switch (type) { @@ -333,12 +332,18 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni")) if (campoini.get_bool("TestDatabase")) { if (dhw == _dongle_network) + { tipo = TR("Server"); + campoini.set("Type", type = 2); + } else tipo = TR("Server o Postazione singola"); } else + { tipo = TR("Client"); + campoini.set("Type", type = 3); + } break; } diff --git a/include/colors.h b/include/colors.h index 7ba9c1320..3b4e46d70 100755 --- a/include/colors.h +++ b/include/colors.h @@ -40,6 +40,7 @@ extern bool TOOL_TEXT; extern bool EASY_RIDER; extern bool ENTER_AS_TAB; extern int INTERLINE; +extern bool ANIMATED_BOXES; const COLOR COLOR_DKCYAN = XVT_MAKE_COLOR(0,128,128); const COLOR COLOR_DKYELLOW = XVT_MAKE_COLOR(128,128, 0); diff --git a/include/controls.cpp b/include/controls.cpp index 2912bd806..0e750f6bb 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -16,6 +16,7 @@ extern "C" #include #include #include +#include #include #include @@ -48,6 +49,7 @@ bool TOOL_TEXT = true; bool EASY_RIDER = true; bool ENTER_AS_TAB = false; int INTERLINE = 0; +bool ANIMATED_BOXES = false; HIDDEN bool _ddl_shown = false; HIDDEN int _last_mouse_button = 0; @@ -362,12 +364,13 @@ void customize_colors() NATIVE_CONTROLS = ADVANCED_GRAPHICS && colors.get_bool("NativeControls", NULL, -1, NATIVE_CONTROLS); xi_set_pref(XI_PREF_NATIVE_CTRLS, NATIVE_CONTROLS); ENTER_AS_TAB = colors.get_bool("EnterAsTab", NULL, -1, ENTER_AS_TAB); + ANIMATED_BOXES = ADVANCED_GRAPHICS && is_power_reseller() && colors.get_bool("AnimatedBoxes", NULL, -1, ANIMATED_BOXES); TOOL_SIZE = colors.get_int("ToolSize", NULL, -1, TOOL_SIZE); TOOL_TEXT = colors.get_bool("ToolText", NULL, -1, TOOL_TEXT); get_background_bitmap(true); // Reload background bitmap - const int SPEECH_MODE = colors.get_int("SpeechMode", NULL, -1, 0); + const int SPEECH_MODE = is_power_reseller() ? colors.get_int("SpeechMode", NULL, -1, 0) : 0; xvt_vobj_set_attr(NULL_WIN, ATTR_SPEECH_MODE, SPEECH_MODE); xi_set_pref(XI_PREF_COLOR_LIGHT, MASK_LIGHT_COLOR); diff --git a/include/dongle.cpp b/include/dongle.cpp index 7885230b9..afd992ed2 100755 --- a/include/dongle.cpp +++ b/include/dongle.cpp @@ -455,9 +455,15 @@ bool TDongle::network_login(bool test_all_keys) int TDongle::can_try_server() const { + // Se authoriz sta andando sono obbligato ad usarlo if (xvt_sys_dongle_server_is_running()) return 3; + + // Se sono un client ed ho l'indirizzo di authoriz sono obbligato ad usarlo const TString& dongle = ini_get_string(CONFIG_INSTALL, "Server", "Dongle"); + if (dongle.full() && ini_get_int(CONFIG_INSTALL, "Main", "Type") == 3) + return 3; + return dongle.full(); } @@ -494,8 +500,8 @@ bool TDongle::login(bool test_all_keys) if (!ok) { // retry login for various dongles ... - const int use_server = can_try_server(); - if (use_server != 3) // Non sono obbligato ad usare il Dongle Server + const int should_use_server = can_try_server(); + if (should_use_server != 3) // Non sono obbligato ad usare il Dongle Server { if (!ok && hw != _dongle_eutron) ok = eutron_login(test_all_keys); @@ -705,13 +711,24 @@ const TString& TDongle::product() const return _product; } -const TString& TDongle::shortname() const +const TString& TDongle::short_name() const { if (_shortname.empty()) oem(); return _shortname; } +const TString& TDongle::server_name() const +{ + if (network()) + return ini_get_string(CONFIG_INSTALL, "Server", "Dongle"); + + TString& tmp = get_tmp_string(32); + xvt_sys_get_host_name(tmp.get_buffer(), tmp.size()); + return tmp; +} + + bool TDongle::active(word module) const { const bool yes = (module < ENDAUT) && _module[module] && shown(module); @@ -1164,18 +1181,21 @@ int Tdninst::test_cmdline(const TString& cmdline, bool key_must_exist, TString& } const TString4 strmod = cmdline.left(2); - const int space_pos = cmdline.find(' '); - if (space_pos < 0 || space_pos == 3) - { - const word codmod = don.module_name2code(strmod); - if (codmod == BAAUT) - return 0; + if (!key_must_exist) // Le personalizzazioni non hanno un modulo vero e proprio + { + const int space_pos = cmdline.find(' '); + if (space_pos < 0 || space_pos == 3) + { + const word codmod = don.module_name2code(strmod); + if (codmod == BAAUT) + return 0; - /*if (!don.active(codmod)) - { - msg << TR("Modulo non attivo sulla chiave: ") << strmod; - return 2; - }*/ + /*if (!don.active(codmod)) + { + msg << TR("Modulo non attivo sulla chiave: ") << strmod; + return 2; + }*/ + } } const TDate oggi(TODAY); diff --git a/include/dongle.h b/include/dongle.h index 4b525a3b4..fa0e67734 100755 --- a/include/dongle.h +++ b/include/dongle.h @@ -91,7 +91,8 @@ public: int oem() const; const TString& reseller() const; const TString& product() const; - const TString& shortname() const; + const TString& short_name() const; + const TString& server_name() const; word module_name2code(const char* module) const; // Converte un nome di due lettere in numero const TString& module_code2name(word module) const; // ... e viceversa diff --git a/include/image.cpp b/include/image.cpp index 056b12e5c..af0d691de 100755 --- a/include/image.cpp +++ b/include/image.cpp @@ -198,10 +198,11 @@ void TImage::draw(WINDOW win, const RCT& dst, const RCT& src) const } // Certified 99% -void TImage::draw(WINDOW win, const RCT& dst, char halign, char valign, char grow) const +const RCT& TImage::draw(WINDOW win, const RCT& dst, char halign, char valign, char grow) const { const RCT& rct = xvtil_align_rect(_src, dst, halign, valign, grow); draw(win, rct); + return rct; } // Certified 100% diff --git a/include/image.h b/include/image.h index 75467be84..1f97ed1e4 100755 --- a/include/image.h +++ b/include/image.h @@ -43,7 +43,7 @@ public: void draw(WINDOW w, int x, int y) const; // @cmember Disegna/modifica l'immagine sullo schermo void draw(WINDOW w, const RCT& dst) const; - void draw(WINDOW win, const RCT& dst, char halign, char valign, char grow) const; + const RCT& draw(WINDOW win, const RCT& dst, char halign, char valign, char grow) const; // @cmember Disegna l'immagine sulla finestra void draw(WINDOW w, const RCT& dst, const RCT& src) const; // @cmember Setta un pixel diff --git a/include/isam.cpp b/include/isam.cpp index add272c52..ed2a2a7dd 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -58,7 +58,7 @@ int hashfun(const char *s) temp ^= *pw; pw++; } - if (ODD(l)) + if (l & 1) temp ^= (unsigned short ) (8192 + s[l - 1]); l = (short) (temp % (MaxFields - 3)); CHECKS(l >= 0, "Negative remainder on ", s); @@ -2464,7 +2464,7 @@ int TSystemisamfile::load( p.set_text(s1); } - if (!p.setstatus(f.tellg())) + if (!p.setstatus((long)f.tellg())) break; zero(); diff --git a/include/mask.cpp b/include/mask.cpp index 701ed6071..2f08df239 100755 --- a/include/mask.cpp +++ b/include/mask.cpp @@ -1875,11 +1875,23 @@ void TMask::on_idle() const int es = _error_severity; // Memorizzo per azzerare subito _error_severity = 0; set_focus(); - switch(es) + if (ANIMATED_BOXES) { - case 2: xvt_dm_popup_warning(_error_message); break; - case 3: xvt_dm_popup_error (_error_message); break; - default: xvt_dm_popup_message(_error_message); break; + switch(es) + { + case 2: xvt_dm_popup_warning(_error_message); break; + case 3: xvt_dm_popup_error (_error_message); break; + default: xvt_dm_popup_message(_error_message); break; + } + } + else + { + switch(es) + { + case 2: xvt_dm_post_warning(_error_message); break; + case 3: xvt_dm_post_error (_error_message); break; + default: xvt_dm_post_message(_error_message); break; + } } } if (_test_fld >= 0) diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 04e607fbd..ab82cffc8 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -2563,7 +2563,10 @@ bool TSpreadsheet::error_box(const char* msg) const int r = _cur_row; const int c = _cur_col; - xvt_dm_popup_error(msg); // was xvt_dm_post_error(msg); + if (ANIMATED_BOXES) + xvt_dm_popup_error(msg); + else + xvt_dm_post_error(msg); TMask& m = owner().mask(); m.set_focus_field(owner().dlg()); diff --git a/include/printwin.cpp b/include/printwin.cpp index 3675622e2..087f54f3a 100755 --- a/include/printwin.cpp +++ b/include/printwin.cpp @@ -101,37 +101,6 @@ void TPrintwin::paint_background(long j) y2 = (byte)(rwd[cnt++]); // Altezza destinazione (in caratteri) if (id >= 0) { -#ifndef XVAGA - // Ai tempi non veniva in mente un modo peggiore - const short width = LEN_SPACES(win(), x2); // Larghezza in pixel - - TImage* i = (TImage*)_images.objptr(id); - if (i == NULL) - { - const TString_array& a = printer().image_names(); - const TImage src(a.row(id)); - if (src.ok()) - { - // memorizzo l'immagine in risoluzione di stampa! Visto che ho RAM da buttare. - i = new TImage(src, width, _chary*y2); - _images.add(i, id); - } - } - - if (i && i->ok()) - { - RCT src; xvt_rect_set(&src, 0, int(_chary*y1), - width, min(int(_chary*(y1+1)), i->height())); - if (src.top < i->height()) - { - PNT p; - p.h = LEN_SPACES(win(), x1) + _hofs; - p.v = _chary*rw + _vofs; - RCT dst = src; xvt_rect_set_pos(&dst, p); - i->draw(win(), dst, src); - } - } -#else if (y1 == 0) // Disegno solo una volta per tutte alla prima fetta! { TImage* i = (TImage*)_images.objptr(id); @@ -152,7 +121,6 @@ void TPrintwin::paint_background(long j) i->draw(win(), dst); } } -#endif } break; case 'W': diff --git a/include/progind.cpp b/include/progind.cpp index fda777b3d..779d92bab 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -181,7 +181,7 @@ void TIndwin::update_bar() xvt_dwin_set_std_cpen(w, TL_PEN_HOLLOW); xvt_dwin_draw_rect(w, &b); xvt_dwin_set_clip(w, NULL); - set_color(NORMAL_COLOR, MASK_BACK_COLOR); + set_color(PROMPT_COLOR, MASK_BACK_COLOR); set_opaque_text(TRUE); set_font(); xvt_dwin_draw_text(w, b.left, b.bottom-1, n, -1); @@ -199,7 +199,7 @@ void TIndwin::update_txt() xvt_dwin_set_std_cpen(w, TL_PEN_HOLLOW); xvt_dwin_draw_rect(w, &r); xvt_dwin_set_clip(w, NULL); - set_color(NORMAL_COLOR, MASK_BACK_COLOR); + set_color(PROMPT_COLOR, MASK_BACK_COLOR); set_opaque_text(TRUE); set_font(); advanced_draw_paragraph(w, _text, r, 'L', 'C', CHARY); diff --git a/include/relation.cpp b/include/relation.cpp index 132308e16..a76841393 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -1913,9 +1913,11 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp) s.rtrim(1); TFieldref f(s,0); // Il controllo del file e' automatico in f.len() - const TString & id = f.id(); + const TString& id = f.id(); const TRectype& r = relation()->lfile(id).curr(); - const int flen = f.len(r); + int flen = f.len(r); + if (flen == 0) // Campo virtuale + flen = 50; if (id.full()) { diff --git a/include/strings.cpp b/include/strings.cpp index a0965d7ad..bf7c03304 100755 --- a/include/strings.cpp +++ b/include/strings.cpp @@ -877,17 +877,18 @@ int TString::strncpy(const char* s, int n) // @mfunc Manda un output formattato alla stringa oggetto TString& TString::format( const char* fmt, // @parm Stringa da formattare - ...) // @parmvar Uno o piu' parametri corrispondenti ai codici in

+ ...) // @parmvar Uno o piu' parametri corrispondenti ai codici in

// @comm Funziona come la funzione "sprintf" standard del C e ritorna la // stringa formattata con i parametri passati. { char spark[512]; + memset(spark, 0, sizeof(spark)); va_list pars; va_start(pars, fmt); #ifdef WIN32 - const unsigned int tot = _vsnprintf(spark, sizeof(spark)+1, fmt, pars); + const unsigned int tot = _vsnprintf(spark, sizeof(spark)-1, fmt, pars); #else const unsigned int tot = vsprintf(spark, fmt, pars); #endif diff --git a/include/treectrl.cpp b/include/treectrl.cpp index 7345358ca..cc667c6ff 100755 --- a/include/treectrl.cpp +++ b/include/treectrl.cpp @@ -925,12 +925,13 @@ TProp_window::TProp_window(int x, int y, int dx, int dy, WINDOW parent, TProp_fi : TField_window(0, 0, 0, 0, NULL, NULL) { XVT_COLOR_COMPONENT xcc[8]; memset(xcc, 0, sizeof(xcc)); - xcc[0].type = XVT_COLOR_BACKGROUND; xcc[0].color = NORMAL_BACK_COLOR; - xcc[1].type = XVT_COLOR_FOREGROUND; xcc[1].color = NORMAL_COLOR; - xcc[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = FOCUS_BACK_COLOR; - xcc[3].type = XVT_COLOR_SELECT; xcc[3].color = FOCUS_COLOR; - xcc[4].type = XVT_COLOR_BLEND; xcc[4].color = MASK_BACK_COLOR; - xcc[5].type = XVT_COLOR_TROUGH; xcc[5].color = DISABLED_BACK_COLOR; + xcc[0].type = XVT_COLOR_BACKGROUND; xcc[0].color = NORMAL_BACK_COLOR; + xcc[1].type = XVT_COLOR_FOREGROUND; xcc[1].color = NORMAL_COLOR; + xcc[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = FOCUS_BACK_COLOR; + xcc[3].type = XVT_COLOR_SELECT; xcc[3].color = FOCUS_COLOR; + xcc[4].type = XVT_COLOR_BLEND; xcc[4].color = MASK_BACK_COLOR; + xcc[5].type = XVT_COLOR_TROUGH; xcc[5].color = DISABLED_BACK_COLOR; + xcc[6].type = XVT_COLOR_CAPTIONTEXT; xcc[6].color = PROMPT_COLOR; set_owner(owner); WIN_DEF wd; memset(&wd, 0, sizeof(wd)); diff --git a/include/utility.cpp b/include/utility.cpp index bbeece603..a4dc90088 100755 --- a/include/utility.cpp +++ b/include/utility.cpp @@ -588,21 +588,26 @@ long daytime() return timeloc->tm_sec + timeloc->tm_min * 100L + timeloc->tm_hour * 10000L; } +static bool is_aga_station(const char* hostname) +{ + const char* const ranger[] = { "ANTARES", "ARCHIMEDE", "BATMOBILE", "KIRK", + "MOBILE", "PICARD", "SPOCK", "SULU", "UHURA", NULL }; + for (int i = 0; ranger[i]; i++) + if (xvt_str_compare_ignoring_case(hostname, ranger[i]) == 0) + return true; + return false; +} + bool is_power_station() { static BOOLEAN ps = -1; if (ps < 0) { - ps = FALSE; const TDongle& d = dongle(); - if (d.number() == 0) - { - const char* const ranger[] = { "ANTARES", "ARCHIMEDE", "BATMOBILE", "KIRK", - "MOBILE", "PICARD", "SPOCK", "SULU", "UHURA", NULL }; - const TString& hostname = get_hostname(); - for (int i = 0; ranger[i] && !ps; i++) - ps = hostname.compare(ranger[i], -1, true) == 0; - } + if ((d.local() && d.number() == 0) || (d.network() && is_aga_station(d.server_name()))) + ps = is_aga_station(get_hostname()); + else + ps = FALSE; } return ps != 0; } diff --git a/include/utility.h b/include/utility.h index 1732d29c2..e04f801b0 100755 --- a/include/utility.h +++ b/include/utility.h @@ -26,7 +26,7 @@ char* format (const char* fmt, ...); const char* cmd2name(const char* argv0, const char* argv1 = ""); int rtoi(const char * roman); const char* itor(int i); -bool fcopy(const char* orig, const char* dest, bool append=FALSE); +bool fcopy(const char* orig, const char* dest, bool append = false); bool fexist(const char* file); long fsize(const char* file); @@ -55,7 +55,4 @@ bool is_power_reseller(bool power_user_only = false); long daytime(); bool expand_sys_vars(TString& str); -#define ODD(x) (x & 1) -#define EVEN(x) !(x & 1) - -#endif /* __UTILITY_H */ \ No newline at end of file +#endif /* __UTILITY_H */ diff --git a/include/xvtility.cpp b/include/xvtility.cpp index 51fbacf9a..460ded28c 100755 --- a/include/xvtility.cpp +++ b/include/xvtility.cpp @@ -681,7 +681,7 @@ int xvtil_statbar_height() static bool xvtil_popup_something(int severity, const char* msg) { - if (is_power_reseller()) + if (ANIMATED_BOXES && is_power_reseller()) { switch (severity) {