Patch level : 10.0
Files correlati : ba0.exe ba0200a.msk Ricompilazione Demo : [ ] Commento : Migliorata gestione temi predefiniti git-svn-id: svn://10.65.10.50/trunk@18045 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
319d8f8ca0
commit
c03bdf4380
@ -297,7 +297,6 @@ class TColor_mask : public TAutomask
|
|||||||
|
|
||||||
int _cur_theme;
|
int _cur_theme;
|
||||||
TAssoc_array _color;
|
TAssoc_array _color;
|
||||||
TString256 _font_desc;
|
|
||||||
|
|
||||||
protected: // TMask
|
protected: // TMask
|
||||||
virtual bool stop_run(KEY key) { return TWindow::stop_run(key); }
|
virtual bool stop_run(KEY key) { return TWindow::stop_run(key); }
|
||||||
@ -306,11 +305,13 @@ protected: // TMask
|
|||||||
protected:
|
protected:
|
||||||
COLOR get_color_entry(const char* c) const;
|
COLOR get_color_entry(const char* c) const;
|
||||||
void set_color_entry(const char* name, COLOR col);
|
void set_color_entry(const char* name, COLOR col);
|
||||||
const TString& get_font_desc() const { return _font_desc; }
|
const TString& get_font_desc() const;
|
||||||
|
void set_font_desc(const TString& fd);
|
||||||
const char* cid2name(short cid) const;
|
const char* cid2name(short cid) const;
|
||||||
COLOR cid2color(short cid) const;
|
COLOR cid2color(short cid) const;
|
||||||
COLOR cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const;
|
COLOR cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const;
|
||||||
|
|
||||||
|
bool find_themes_ini(TFilename& ininame) const;
|
||||||
void load_themes();
|
void load_themes();
|
||||||
bool apply_theme();
|
bool apply_theme();
|
||||||
|
|
||||||
@ -417,7 +418,7 @@ void TColor_mask::load_themes()
|
|||||||
TToken_string codes = fl.get_codes();
|
TToken_string codes = fl.get_codes();
|
||||||
TToken_string values = fl.get_values();
|
TToken_string values = fl.get_values();
|
||||||
|
|
||||||
const int default_items = 3; // Corrente, Campo, Sistema
|
const int default_items = 3; // Corrente, Tradizionale, Sistema
|
||||||
// Elimina tutti gli elementi non standard (oltre il terzo)
|
// Elimina tutti gli elementi non standard (oltre il terzo)
|
||||||
if (codes.items() > default_items)
|
if (codes.items() > default_items)
|
||||||
{
|
{
|
||||||
@ -432,7 +433,9 @@ void TColor_mask::load_themes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int k = codes.items();
|
int k = codes.items();
|
||||||
TConfig default_themes("res/themes.ini");
|
|
||||||
|
TFilename ininame; find_themes_ini(ininame);
|
||||||
|
TConfig default_themes(ininame);
|
||||||
TString_array pl;
|
TString_array pl;
|
||||||
default_themes.list_paragraphs(pl);
|
default_themes.list_paragraphs(pl);
|
||||||
FOR_EACH_ARRAY_ROW(pl, i, row)
|
FOR_EACH_ARRAY_ROW(pl, i, row)
|
||||||
@ -456,6 +459,18 @@ void TColor_mask::load_themes()
|
|||||||
fl.replace_items(codes, values);
|
fl.replace_items(codes, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TColor_mask::find_themes_ini(TFilename& ininame) const
|
||||||
|
{
|
||||||
|
ininame = get_oem_info("Themes");
|
||||||
|
bool ok = ininame.exist();
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
ininame = "res/themes.ini";
|
||||||
|
ok = ininame.exist();
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
bool TColor_mask::apply_theme()
|
bool TColor_mask::apply_theme()
|
||||||
{
|
{
|
||||||
bool applied = false;
|
bool applied = false;
|
||||||
@ -467,7 +482,9 @@ bool TColor_mask::apply_theme()
|
|||||||
TToken_string values = fl.get_values();
|
TToken_string values = fl.get_values();
|
||||||
|
|
||||||
TString name = values.get(theme);
|
TString name = values.get(theme);
|
||||||
TConfig def_themes("res/themes.ini", name);
|
|
||||||
|
TFilename thini; find_themes_ini(thini);
|
||||||
|
TConfig def_themes(thini, name);
|
||||||
TAssoc_array& def_colors = def_themes.list_variables();
|
TAssoc_array& def_colors = def_themes.list_variables();
|
||||||
|
|
||||||
name.insert("Theme_");
|
name.insert("Theme_");
|
||||||
@ -477,22 +494,7 @@ bool TColor_mask::apply_theme()
|
|||||||
TAssoc_array& colors = usr_colors.empty() ? def_colors : usr_colors;
|
TAssoc_array& colors = usr_colors.empty() ? def_colors : usr_colors;
|
||||||
if (!colors.empty())
|
if (!colors.empty())
|
||||||
{
|
{
|
||||||
TToken_string rgb(15, ',');
|
_color = colors;
|
||||||
FOR_EACH_ASSOC_STRING(colors, obj, key, value)
|
|
||||||
{
|
|
||||||
rgb = value;
|
|
||||||
if (rgb.items() == 3) // Trattasi di colore
|
|
||||||
{
|
|
||||||
const byte r = (byte)rgb.get_int(0);
|
|
||||||
const byte g = (byte)rgb.get_int();
|
|
||||||
const byte b = (byte)rgb.get_int();
|
|
||||||
set_color_entry(key, XVT_MAKE_COLOR(r,g,b));
|
|
||||||
} else
|
|
||||||
if (xvt_str_compare_ignoring_case(key, "FontDesc") == 0)
|
|
||||||
{
|
|
||||||
_font_desc = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
applied = true;
|
applied = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -509,7 +511,7 @@ bool TColor_mask::apply_theme()
|
|||||||
const COLOR color = cid2color(bid);
|
const COLOR color = cid2color(bid);
|
||||||
set_color_entry(name, color);
|
set_color_entry(name, color);
|
||||||
}
|
}
|
||||||
_font_desc.cut(0);
|
set_font_desc("");
|
||||||
applied = true;
|
applied = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -527,8 +529,10 @@ bool TColor_mask::apply_theme()
|
|||||||
XVT_FNTID defont = xvtil_default_font(false, false); // Legge il font standard
|
XVT_FNTID defont = xvtil_default_font(false, false); // Legge il font standard
|
||||||
XVT_FNTID fontid = xvt_res_get_font(0); // Legge il font di sistema
|
XVT_FNTID fontid = xvt_res_get_font(0); // Legge il font di sistema
|
||||||
xvt_font_set_size(fontid, xvt_font_get_size(defont)); // Forza l'altezza standard
|
xvt_font_set_size(fontid, xvt_font_get_size(defont)); // Forza l'altezza standard
|
||||||
xvt_font_serialize(fontid, _font_desc.get_buffer(), _font_desc.size());
|
TString256 fd; xvt_font_serialize(fontid, fd.get_buffer(), fd.size());
|
||||||
|
set_font_desc(fd);
|
||||||
xvt_font_destroy(fontid); // Rilascia il font di sistema
|
xvt_font_destroy(fontid); // Rilascia il font di sistema
|
||||||
|
set(213, "X"); // Campi 3D
|
||||||
set(214, "X"); // System buttons
|
set(214, "X"); // System buttons
|
||||||
applied = true;
|
applied = true;
|
||||||
}
|
}
|
||||||
@ -537,7 +541,6 @@ bool TColor_mask::apply_theme()
|
|||||||
{
|
{
|
||||||
TConfig color(CONFIG_GUI, "Colors");
|
TConfig color(CONFIG_GUI, "Colors");
|
||||||
_color = color.list_variables();
|
_color = color.list_variables();
|
||||||
xvt_font_serialize(xvtil_default_font(), _font_desc.get_buffer(), _font_desc.size());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -638,13 +641,15 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
|||||||
if (e == fe_button)
|
if (e == fe_button)
|
||||||
{
|
{
|
||||||
XVT_FNTID fontid = xvt_font_create();
|
XVT_FNTID fontid = xvt_font_create();
|
||||||
if (_font_desc.full())
|
TString256 fd = get_font_desc();
|
||||||
xvt_font_deserialize(fontid, _font_desc);
|
if (fd.full())
|
||||||
|
xvt_font_deserialize(fontid, fd);
|
||||||
else
|
else
|
||||||
xvt_font_copy(fontid, xvtil_default_font(), XVT_FA_ALL);
|
xvt_font_copy(fontid, xvtil_default_font(), XVT_FA_ALL);
|
||||||
if (xvt_dm_post_font_sel(win(), fontid, NULL, 0))
|
if (xvt_dm_post_font_sel(win(), fontid, NULL, 0))
|
||||||
{
|
{
|
||||||
xvt_font_serialize(fontid, _font_desc.get_buffer(), _font_desc.size());
|
xvt_font_serialize(fontid, fd.get_buffer(), fd.size());
|
||||||
|
set_font_desc(fd);
|
||||||
_preview->force_update();
|
_preview->force_update();
|
||||||
}
|
}
|
||||||
xvt_font_destroy(fontid);
|
xvt_font_destroy(fontid);
|
||||||
@ -688,8 +693,6 @@ TColor_mask::TColor_mask()
|
|||||||
set(218, EASY_RIDER ? "X" : "");
|
set(218, EASY_RIDER ? "X" : "");
|
||||||
set(219, TOOL_TEXT ? "X" : "");
|
set(219, TOOL_TEXT ? "X" : "");
|
||||||
set(220, ENTER_AS_TAB ? "X" : "");
|
set(220, ENTER_AS_TAB ? "X" : "");
|
||||||
|
|
||||||
xvt_font_serialize(xvtil_default_font(), _font_desc.get_buffer(), _font_desc.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TColor_mask::save_colors(TConfig& colors)
|
void TColor_mask::save_colors(TConfig& colors)
|
||||||
@ -706,11 +709,6 @@ void TColor_mask::save_colors(TConfig& colors)
|
|||||||
colors.set("EasyRider", get_bool(218) ? "X" : "");
|
colors.set("EasyRider", get_bool(218) ? "X" : "");
|
||||||
colors.set("ToolText", get_bool(219) ? "X" : "");
|
colors.set("ToolText", get_bool(219) ? "X" : "");
|
||||||
colors.set("EnterAsTab", get_bool(220) ? "X" : "");
|
colors.set("EnterAsTab", get_bool(220) ? "X" : "");
|
||||||
|
|
||||||
if (colors.get_paragraph() == "Colors") // nel caso di default CONFIG_GUI
|
|
||||||
colors.set("FontDesc", _font_desc, "Font"); // per tradizione e' nel paragrafo Font
|
|
||||||
else
|
|
||||||
colors.set("FontDesc", _font_desc); // il font e' insieme al resto
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TColor_mask::save_colors()
|
void TColor_mask::save_colors()
|
||||||
@ -719,6 +717,12 @@ void TColor_mask::save_colors()
|
|||||||
save_colors(colors);
|
save_colors(colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TString& TColor_mask::get_font_desc() const
|
||||||
|
{
|
||||||
|
const TObject* s = ((TColor_mask*)this)->_color.objptr("FontDesc");
|
||||||
|
return s != NULL ? *(TString*)s : (const TString&)EMPTY_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
COLOR TColor_mask::get_color_entry(const char* name) const
|
COLOR TColor_mask::get_color_entry(const char* name) const
|
||||||
{
|
{
|
||||||
COLOR c = COLOR_INVALID;
|
COLOR c = COLOR_INVALID;
|
||||||
@ -745,6 +749,11 @@ void TColor_mask::set_color_entry(const char* name, COLOR col)
|
|||||||
s->format("%d,%d,%d", XVT_COLOR_GET_RED(col), XVT_COLOR_GET_GREEN(col), XVT_COLOR_GET_BLUE(col));
|
s->format("%d,%d,%d", XVT_COLOR_GET_RED(col), XVT_COLOR_GET_GREEN(col), XVT_COLOR_GET_BLUE(col));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TColor_mask::set_font_desc(const TString& fd)
|
||||||
|
{
|
||||||
|
_color.add("FontDesc", fd, true);
|
||||||
|
}
|
||||||
|
|
||||||
const char* TColor_mask::cid2name(short cid) const
|
const char* TColor_mask::cid2name(short cid) const
|
||||||
{
|
{
|
||||||
const int colors = 13;
|
const int colors = 13;
|
||||||
|
@ -1259,20 +1259,36 @@ const TString& get_logo()
|
|||||||
|
|
||||||
if (currlogo.blank())
|
if (currlogo.blank())
|
||||||
{
|
{
|
||||||
//seleziona il logo da usare in base al producer!!
|
// Controllo se il cliente ha un menulogo,jpg nella cartella custom
|
||||||
TConfig oemini(CONFIG_OEM, "MAIN");
|
currlogo = "menulogo.jpg";
|
||||||
const int oem = oemini.get_int("OEM", NULL, -1, -1);
|
if (currlogo.custom_path())
|
||||||
|
|
||||||
if (oem >= 0)
|
|
||||||
{
|
{
|
||||||
TString8 para; para << "OEM_" << oem;
|
currlogo.lower();
|
||||||
currlogo = oemini.get("Logo", para);
|
if (currlogo.find("custom") < 0)
|
||||||
if (currlogo.full())
|
currlogo.cut(0);
|
||||||
currlogo.insert("setup/");
|
|
||||||
}
|
}
|
||||||
//se non trova il logo del producer usa il logo standard
|
|
||||||
if (currlogo.blank())
|
if (currlogo.blank())
|
||||||
|
{
|
||||||
|
//seleziona il logo da usare in base al producer!!
|
||||||
|
TConfig oemini(CONFIG_OEM, "MAIN");
|
||||||
|
const int oem = oemini.get_int("OEM", NULL, -1, -1);
|
||||||
|
|
||||||
|
if (oem >= 0)
|
||||||
|
{
|
||||||
|
TString8 para; para << "OEM_" << oem;
|
||||||
|
currlogo = oemini.get("Logo", para);
|
||||||
|
currlogo.insert("setup/");
|
||||||
|
if (!currlogo.exist())
|
||||||
|
currlogo.cut(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currlogo.blank())
|
||||||
|
{
|
||||||
|
//se non trova il logo del producer usa il logo standard
|
||||||
currlogo = "menulogo.jpg";
|
currlogo = "menulogo.jpg";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return currlogo;
|
return currlogo;
|
||||||
|
@ -94,7 +94,7 @@ LISTBOX 211 1 15
|
|||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 5 "Temi predefiniti "
|
PROMPT 1 5 "Temi predefiniti "
|
||||||
ITEM "0|"
|
ITEM "0|"
|
||||||
ITEM "1|Campo"
|
ITEM "1|Tradizionale"
|
||||||
ITEM "2|Sistema"
|
ITEM "2|Sistema"
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -105,31 +105,37 @@ PAGE "Avanzate" -1 -1 54 17
|
|||||||
BOOLEAN 213
|
BOOLEAN 213
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 1 "Campi 3D"
|
PROMPT 1 1 "Campi 3D"
|
||||||
|
FIELD Campi3D
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN 214
|
BOOLEAN 214
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 2 "Bottoni di sistema"
|
PROMPT 1 2 "Bottoni di sistema"
|
||||||
|
FIELD NativeControls
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN 215
|
BOOLEAN 215
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 3 "Grafica avanzata"
|
PROMPT 1 3 "Grafica avanzata"
|
||||||
|
FIELD AdvancedGraphics
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN 218
|
BOOLEAN 218
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 4 "Griglie a lettura facilitata"
|
PROMPT 1 4 "Griglie a lettura facilitata"
|
||||||
|
FIELD EasyRider
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN 219
|
BOOLEAN 219
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 5 "Mostra il testo degli strumenti"
|
PROMPT 1 5 "Mostra il testo degli strumenti"
|
||||||
|
FIELD ToolText
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN 220
|
BOOLEAN 220
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 6 "Considera 'Invio' come 'Tab' nelle griglie"
|
PROMPT 1 6 "Considera 'Invio' come 'Tab' nelle griglie"
|
||||||
|
FIELD EnterAsTab
|
||||||
END
|
END
|
||||||
|
|
||||||
RADIOBUTTON 216 1 16
|
RADIOBUTTON 216 1 16
|
||||||
@ -139,6 +145,7 @@ BEGIN
|
|||||||
ITEM "1|Albero"
|
ITEM "1|Albero"
|
||||||
ITEM "2|Explorer"
|
ITEM "2|Explorer"
|
||||||
ITEM "3|Outlook"
|
ITEM "3|Outlook"
|
||||||
|
FIELD TreeView
|
||||||
END
|
END
|
||||||
|
|
||||||
TEXT DLG_NULL
|
TEXT DLG_NULL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user