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:
guy 2009-01-19 17:46:07 +00:00
parent 319d8f8ca0
commit c03bdf4380
3 changed files with 77 additions and 45 deletions

View File

@ -297,7 +297,6 @@ class TColor_mask : public TAutomask
int _cur_theme;
TAssoc_array _color;
TString256 _font_desc;
protected: // TMask
virtual bool stop_run(KEY key) { return TWindow::stop_run(key); }
@ -306,11 +305,13 @@ protected: // TMask
protected:
COLOR get_color_entry(const char* c) const;
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;
COLOR cid2color(short cid) const;
COLOR cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const;
bool find_themes_ini(TFilename& ininame) const;
void load_themes();
bool apply_theme();
@ -417,7 +418,7 @@ void TColor_mask::load_themes()
TToken_string codes = fl.get_codes();
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)
if (codes.items() > default_items)
{
@ -432,7 +433,9 @@ void TColor_mask::load_themes()
}
int k = codes.items();
TConfig default_themes("res/themes.ini");
TFilename ininame; find_themes_ini(ininame);
TConfig default_themes(ininame);
TString_array pl;
default_themes.list_paragraphs(pl);
FOR_EACH_ARRAY_ROW(pl, i, row)
@ -456,6 +459,18 @@ void TColor_mask::load_themes()
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 applied = false;
@ -467,7 +482,9 @@ bool TColor_mask::apply_theme()
TToken_string values = fl.get_values();
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();
name.insert("Theme_");
@ -477,22 +494,7 @@ bool TColor_mask::apply_theme()
TAssoc_array& colors = usr_colors.empty() ? def_colors : usr_colors;
if (!colors.empty())
{
TToken_string rgb(15, ',');
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;
}
}
_color = colors;
applied = true;
}
}
@ -509,7 +511,7 @@ bool TColor_mask::apply_theme()
const COLOR color = cid2color(bid);
set_color_entry(name, color);
}
_font_desc.cut(0);
set_font_desc("");
applied = true;
}
break;
@ -527,8 +529,10 @@ bool TColor_mask::apply_theme()
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_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
set(213, "X"); // Campi 3D
set(214, "X"); // System buttons
applied = true;
}
@ -537,7 +541,6 @@ bool TColor_mask::apply_theme()
{
TConfig color(CONFIG_GUI, "Colors");
_color = color.list_variables();
xvt_font_serialize(xvtil_default_font(), _font_desc.get_buffer(), _font_desc.size());
}
break;
}
@ -638,13 +641,15 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
if (e == fe_button)
{
XVT_FNTID fontid = xvt_font_create();
if (_font_desc.full())
xvt_font_deserialize(fontid, _font_desc);
TString256 fd = get_font_desc();
if (fd.full())
xvt_font_deserialize(fontid, fd);
else
xvt_font_copy(fontid, xvtil_default_font(), XVT_FA_ALL);
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();
}
xvt_font_destroy(fontid);
@ -688,8 +693,6 @@ TColor_mask::TColor_mask()
set(218, EASY_RIDER ? "X" : "");
set(219, TOOL_TEXT ? "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)
@ -706,11 +709,6 @@ void TColor_mask::save_colors(TConfig& colors)
colors.set("EasyRider", get_bool(218) ? "X" : "");
colors.set("ToolText", get_bool(219) ? "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()
@ -719,6 +717,12 @@ void TColor_mask::save_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 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));
}
void TColor_mask::set_font_desc(const TString& fd)
{
_color.add("FontDesc", fd, true);
}
const char* TColor_mask::cid2name(short cid) const
{
const int colors = 13;

View File

@ -1259,20 +1259,36 @@ const TString& get_logo()
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)
// Controllo se il cliente ha un menulogo,jpg nella cartella custom
currlogo = "menulogo.jpg";
if (currlogo.custom_path())
{
TString8 para; para << "OEM_" << oem;
currlogo = oemini.get("Logo", para);
if (currlogo.full())
currlogo.insert("setup/");
currlogo.lower();
if (currlogo.find("custom") < 0)
currlogo.cut(0);
}
//se non trova il logo del producer usa il logo standard
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";
}
}
return currlogo;

View File

@ -94,7 +94,7 @@ LISTBOX 211 1 15
BEGIN
PROMPT 1 5 "Temi predefiniti "
ITEM "0|"
ITEM "1|Campo"
ITEM "1|Tradizionale"
ITEM "2|Sistema"
END
@ -105,31 +105,37 @@ PAGE "Avanzate" -1 -1 54 17
BOOLEAN 213
BEGIN
PROMPT 1 1 "Campi 3D"
FIELD Campi3D
END
BOOLEAN 214
BEGIN
PROMPT 1 2 "Bottoni di sistema"
FIELD NativeControls
END
BOOLEAN 215
BEGIN
PROMPT 1 3 "Grafica avanzata"
FIELD AdvancedGraphics
END
BOOLEAN 218
BEGIN
PROMPT 1 4 "Griglie a lettura facilitata"
FIELD EasyRider
END
BOOLEAN 219
BEGIN
PROMPT 1 5 "Mostra il testo degli strumenti"
FIELD ToolText
END
BOOLEAN 220
BEGIN
PROMPT 1 6 "Considera 'Invio' come 'Tab' nelle griglie"
FIELD EnterAsTab
END
RADIOBUTTON 216 1 16
@ -139,6 +145,7 @@ BEGIN
ITEM "1|Albero"
ITEM "2|Explorer"
ITEM "3|Outlook"
FIELD TreeView
END
TEXT DLG_NULL