Patch level : 10.0
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@16763 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ada374ec6a
commit
bc2ef579d7
122
ba/ba0100.cpp
122
ba/ba0100.cpp
@ -316,6 +316,8 @@ protected:
|
||||
const char* cid2name(short cid) const;
|
||||
COLOR cid2color(short cid) const;
|
||||
COLOR cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const;
|
||||
void load_themes();
|
||||
bool apply_theme();
|
||||
|
||||
public:
|
||||
void save_colors();
|
||||
@ -404,6 +406,96 @@ TColor_mask::TPreview_icons::TPreview_icons(short x, short y, short dx, short dy
|
||||
: _owner(owner)
|
||||
{ create(x, y, dx, dy, "", 0, W_PLAIN, owner->page_win(1)); }
|
||||
|
||||
void TColor_mask::load_themes()
|
||||
{
|
||||
TList_field& fl = lfield(211);
|
||||
TToken_string codes = fl.get_codes();
|
||||
int k = codes.items();
|
||||
if (k <= 2)
|
||||
{
|
||||
TConfig themes("themes.ini");
|
||||
TString_array pl; themes.list_paragraphs(pl);
|
||||
if (!pl.empty())
|
||||
{
|
||||
TToken_string values = fl.get_values();
|
||||
FOR_EACH_ARRAY_ROW(pl, i, row)
|
||||
{
|
||||
codes.add(k++);
|
||||
values.add(*row);
|
||||
}
|
||||
fl.replace_items(codes, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TColor_mask::apply_theme()
|
||||
{
|
||||
bool applied = false;
|
||||
|
||||
const int theme = get_int(211);
|
||||
if (theme > 1)
|
||||
{
|
||||
TList_field& fl = lfield(211);
|
||||
TToken_string codes = fl.get_codes();
|
||||
TToken_string values = fl.get_values();
|
||||
const int pos = codes.get_pos(theme);
|
||||
TConfig themes("themes.ini", values.get(pos));
|
||||
TAssoc_array& colors = themes.list_variables();
|
||||
if (!colors.empty())
|
||||
{
|
||||
TToken_string rgb(15, ',');
|
||||
FOR_EACH_ASSOC_STRING(colors, obj, key, value)
|
||||
{
|
||||
rgb = value;
|
||||
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));
|
||||
}
|
||||
applied = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!applied)
|
||||
{
|
||||
switch (theme)
|
||||
{
|
||||
case 1: // System colors
|
||||
{
|
||||
XVT_COLOR_COMPONENT* cc = (XVT_COLOR_COMPONENT*)xvt_vobj_get_attr(NULL_WIN, ATTR_APP_CTL_COLORS);
|
||||
for (short bid = 101; bid <= 113; bid++)
|
||||
{
|
||||
const char* name = cid2name(bid);
|
||||
const COLOR color = cid2syscolor(bid, cc);
|
||||
set_color_entry(name, color);
|
||||
}
|
||||
xvt_mem_free((DATA_PTR)cc);
|
||||
applied = true;
|
||||
}
|
||||
break;
|
||||
default: // Default colors
|
||||
{
|
||||
for (short bid = 101; bid <= 113; bid++)
|
||||
{
|
||||
const char* name = cid2name(bid);
|
||||
const COLOR color = cid2color(bid);
|
||||
set_color_entry(name, color);
|
||||
}
|
||||
TConfig font(CONFIG_GUI, "Font");
|
||||
font.set("FontDesc", ""); // Azzera font e lo ricarica alla prossima
|
||||
xvt_load_default_font();
|
||||
applied = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (applied)
|
||||
_preview->force_update();
|
||||
|
||||
return applied;
|
||||
}
|
||||
|
||||
bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||||
{
|
||||
const short id = f.dlg();
|
||||
@ -412,33 +504,12 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||||
switch (id)
|
||||
{
|
||||
case 211:
|
||||
if (e == fe_button)
|
||||
{
|
||||
for (short bid = 101; bid <= 113; bid++)
|
||||
{
|
||||
const char* name = cid2name(bid);
|
||||
const COLOR color = cid2color(bid);
|
||||
set_color_entry(name, color);
|
||||
}
|
||||
TConfig font(CONFIG_GUI, "Font");
|
||||
font.set("FontDesc", ""); // Azzera font e lo ricarica alla prossima
|
||||
xvt_load_default_font();
|
||||
update();
|
||||
}
|
||||
if (e == fe_init)
|
||||
load_themes();
|
||||
break;
|
||||
case 212:
|
||||
if (e == fe_button)
|
||||
{
|
||||
XVT_COLOR_COMPONENT* cc = (XVT_COLOR_COMPONENT*)xvt_vobj_get_attr(NULL_WIN, ATTR_APP_CTL_COLORS);
|
||||
for (short bid = 101; bid <= 113; bid++)
|
||||
{
|
||||
const char* name = cid2name(bid);
|
||||
const COLOR color = cid2syscolor(bid, cc);
|
||||
set_color_entry(name, color);
|
||||
}
|
||||
xvt_mem_free((DATA_PTR)cc);
|
||||
update();
|
||||
}
|
||||
apply_theme();
|
||||
break;
|
||||
case 217:
|
||||
if (e == fe_init || e == fe_modify)
|
||||
@ -490,7 +561,7 @@ TColor_mask::TColor_mask()
|
||||
set(215, ADVANCED_GRAPHICS ? "X" : "");
|
||||
set(216, color.get_int("TreeView"));
|
||||
|
||||
_preview = new TPreview_panel(1, 5, 33, 8, this);
|
||||
_preview = new TPreview_panel(1, 8, 33, 8, this);
|
||||
_icons = new TPreview_icons(1, 10, -2, -2, this);
|
||||
|
||||
const int sz = color.get_int("ToolSize");
|
||||
@ -513,6 +584,7 @@ void TColor_mask::save_colors()
|
||||
TConfig colors(CONFIG_GUI, "Colors");
|
||||
FOR_EACH_ASSOC_STRING(_color, obj, key, str)
|
||||
colors.set(key, str);
|
||||
|
||||
colors.set("Campi3D", get_bool(213) ? "X" : "");
|
||||
colors.set("NativeControls", get_bool(214) ? "X" : "");
|
||||
colors.set("AdvancedGraphics", get_bool(215) ? "X" : "");
|
||||
|
@ -92,17 +92,19 @@ END
|
||||
|
||||
GROUPBOX DLG_NULL 32 3
|
||||
BEGIN
|
||||
PROMPT 1 14 "@bTemi predefiniti"
|
||||
PROMPT 1 5 "@bTemi predefiniti"
|
||||
END
|
||||
|
||||
BUTTON 211 12
|
||||
LISTBOX 211 1 12
|
||||
BEGIN
|
||||
PROMPT 2 15 "Campo"
|
||||
PROMPT 2 6 "Tema "
|
||||
ITEM "0|Campo"
|
||||
ITEM "1|Sistema"
|
||||
END
|
||||
|
||||
BUTTON 212 12
|
||||
BUTTON 212 8 1
|
||||
BEGIN
|
||||
PROMPT 18 15 "Sistema"
|
||||
PROMPT 22 6 "Applica"
|
||||
END
|
||||
|
||||
BUTTON DLG_USER 12 2
|
||||
|
Loading…
x
Reference in New Issue
Block a user