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
This commit is contained in:
guy 2010-02-09 10:11:25 +00:00
parent 6fb77b6d8b
commit fa8ceef324
18 changed files with 112 additions and 92 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -16,6 +16,7 @@ extern "C"
#include <image.h>
#include <mask.h>
#include <urldefid.h>
#include <utility.h>
#include <xvtility.h>
#include <statbar.h>
@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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%

View File

@ -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

View File

@ -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();

View File

@ -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)

View File

@ -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());

View File

@ -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':

View File

@ -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);

View File

@ -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())
{

View File

@ -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 <p fmt>
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
// @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

View File

@ -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));

View File

@ -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;
}

View File

@ -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 */
#endif /* __UTILITY_H */

View File

@ -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)
{