Patch level : 10.0

Files correlati     : ba0.exe ba0200a.msk
Ricompilazione Demo : [ ]
Commento            :
Corretta gestione grafica avanzata


git-svn-id: svn://10.65.10.50/trunk@20119 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-02-15 12:13:00 +00:00
parent 9e59e97970
commit 031b00e220
3 changed files with 134 additions and 122 deletions

View File

@ -8,7 +8,6 @@
#include <progind.h> #include <progind.h>
#include <sheet.h> #include <sheet.h>
#include <toolfld.h> #include <toolfld.h>
#include <treectrl.h>
#include <utility.h> #include <utility.h>
#include <urldefid.h> #include <urldefid.h>
@ -265,8 +264,15 @@ class TColor_mask : public TAutomask
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); }
virtual bool on_field_event(TOperable_field& f, TField_event e, long jolly); virtual bool on_field_event(TOperable_field& f, TField_event e, long jolly);
TProp_field& colors_field() const;
TProp_field& options_field() const;
void colors2mask(); void colors2mask();
void mask2colors(); void mask2colors();
void options2mask();
void mask2options();
void enable_options();
protected: protected:
COLOR get_color_entry(const char* c) const; COLOR get_color_entry(const char* c) const;
@ -327,35 +333,41 @@ void TColor_mask::TPreview_panel::update()
xvt_dwin_set_font(win(), xvtil_default_font()); xvt_dwin_set_font(win(), xvtil_default_font());
set_opaque_text(false); set_opaque_text(false);
p = get_color_entry("Prompt");
b = get_color_entry("MaskBack");
set_color(p, b);
stringat(x+4, y+0, TR("Prompt"));
set_pen(p = get_color_entry("Normal")); set_pen(p = get_color_entry("Normal"));
set_brush(b = get_color_entry("NormalBack")); set_brush(b = get_color_entry("NormalBack"));
frame(x+3, y+1, x+w-3, y+2, 0); frame(x+3, y+1, x+w-3, y+2, 0);
set_color(p, b); set_color(p, b);
stringat(x+4, y+1, "Campo normale"); stringat(x+4, y+1, TR("Campo normale"));
set_pen(p = get_color_entry("Normal")); // Stesso inchiostro del normale set_pen(p = get_color_entry("Normal")); // Stesso inchiostro del normale
set_brush(b = get_color_entry("RequiredBack")); set_brush(b = get_color_entry("RequiredBack"));
frame(x+3, y+2, x+w-3, y+3, 0); frame(x+3, y+2, x+w-3, y+3, 0);
set_color(p, b); set_color(p, b);
stringat(x+4, y+2, "Campo obbligatorio"); stringat(x+4, y+2, TR("Campo obbligatorio"));
set_pen(p = get_color_entry("Focus")); set_pen(p = get_color_entry("Focus"));
set_brush(b = get_color_entry("FocusBack")); set_brush(b = get_color_entry("FocusBack"));
frame(x+3, y+3, x+w-3, y+4, 0); frame(x+3, y+3, x+w-3, y+4, 0);
set_color(p, b); set_color(p, b);
stringat(x+4, y+3, "Campo attivo"); stringat(x+4, y+3, TR("Campo attivo"));
set_pen(p = get_color_entry("Disabled")); set_pen(p = get_color_entry("Disabled"));
set_brush(b = get_color_entry("DisabledBack")); set_brush(b = get_color_entry("DisabledBack"));
frame(x+3, y+4, x+w-3, y+5, 0); frame(x+3, y+4, x+w-3, y+5, 0);
set_color(p, b); set_color(p, b);
stringat(x+4, y+4, "Campo disabilitato"); stringat(x+4, y+4, TR("Campo disabilitato"));
set_pen(p = get_color_entry("ButtonLight")); set_pen(p = get_color_entry("ButtonLight"));
set_brush(b = get_color_entry("ButtonBack")); set_brush(b = get_color_entry("ButtonBack"));
frame(x+3, y+5, x+w-3, y+6, 0); frame(x+3, y+5, x+w-3, y+6, 0);
set_color(get_color_entry("Normal"), b); set_color(get_color_entry("Normal"), b);
stringat(x+4, y+5, "Bottone normale"); stringat(x+4, y+5, TR("Bottone normale"));
} }
void TColor_mask::TPreview_icons::update() void TColor_mask::TPreview_icons::update()
@ -365,7 +377,7 @@ void TColor_mask::TPreview_icons::update()
set_pen(MASK_DARK_COLOR); set_pen(MASK_DARK_COLOR);
xvt_dwin_draw_rect(win(), &rct); xvt_dwin_draw_rect(win(), &rct);
const int s = _owner->get_int(217); const int s = _owner->get_int(218);
const int sz = 16 + s*8; const int sz = 16 + s*8;
const int y = (rct.bottom - sz)/2; const int y = (rct.bottom - sz)/2;
int x = (rct.right - 3*sz)/2; int x = (rct.right - 3*sz)/2;
@ -444,7 +456,7 @@ bool TColor_mask::find_themes_ini(TFilename& ininame) const
void TColor_mask::colors2mask() void TColor_mask::colors2mask()
{ {
TProp_field& pg = (TProp_field&)field(212); TProp_field& pg = colors_field();
pg.freeze(true); pg.freeze(true);
FOR_EACH_ASSOC_STRING(_color, h, key, color) FOR_EACH_ASSOC_STRING(_color, h, key, color)
{ {
@ -458,7 +470,7 @@ void TColor_mask::colors2mask()
void TColor_mask::mask2colors() void TColor_mask::mask2colors()
{ {
const TProp_field& pg = (const TProp_field&)field(212); const TProp_field& pg = colors_field();
FOR_EACH_ASSOC_STRING(_color, h, key, color) FOR_EACH_ASSOC_STRING(_color, h, key, color)
{ {
const TFixed_string str(color); const TFixed_string str(color);
@ -472,6 +484,11 @@ void TColor_mask::mask2colors()
_preview->force_update(); _preview->force_update();
} }
TProp_field& TColor_mask::colors_field() const
{ return (TProp_field&)field(212); }
TProp_field& TColor_mask::options_field() const
{ return (TProp_field&)field(213); }
bool TColor_mask::apply_theme() bool TColor_mask::apply_theme()
{ {
@ -544,8 +561,10 @@ bool TColor_mask::apply_theme()
TString256 fd; xvt_font_serialize(fontid, fd.get_buffer(), fd.size()); TString256 fd; xvt_font_serialize(fontid, fd.get_buffer(), fd.size());
set_font_desc(fd); 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 TProp_field& pf = options_field();
pf.set_property("Campi3D", true);
pf.set_property("NativeControls", true);
applied = true; applied = true;
} }
break; break;
@ -582,10 +601,6 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
apply_theme(); apply_theme();
} }
break; break;
case 217:
if (e == fe_init || e == fe_modify)
_icons->force_update();
break;
case DLG_OK: case DLG_OK:
if (e == fe_button) if (e == fe_button)
{ {
@ -672,80 +687,112 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
if (e == fe_modify) if (e == fe_modify)
mask2colors(); mask2colors();
break; break;
case 213:
if (e == fe_init)
options2mask(); else
if (e == fe_modify)
{
mask2options();
enable_options();
}
break;
case 218:
if (e == fe_init || e == fe_modify)
_icons->force_update();
break;
default: default:
break; break;
} }
return ok; return ok;
} }
void TColor_mask::enable_options()
{
TProp_field& pf = options_field();
pf.freeze(true);
const bool ag = pf.get_bool_property("AdvancedGraphics");
pf.enable_property("Campi3D", ag);
pf.enable_property("NativeControls", ag);
if (is_power_reseller())
pf.enable_property("AnimatedBoxes", ag);
else
pf.remove_property("AnimatedBoxes");
pf.freeze(false);
}
void TColor_mask::options2mask()
{
TProp_field& pf = options_field();
pf.freeze(true);
FOR_EACH_ASSOC_STRING(_color, obj, key, str) if (pf.has_property(key))
pf.set_property(key, str);
pf.freeze(false);
set(216, _color.get_int("TreeView"));
set(217, _color.get_int("Interline"));
const int sz = _color.get_int("ToolSize");
set(218, (sz-16)/8);
enable_options();
}
void TColor_mask::mask2options()
{
TString4 val;
TProp_field& pf = options_field();
TVariant var;
FOR_EACH_ASSOC_STRING(_color, obj, key, str) if (pf.get_var_property(key, var))
{
if (var.is_bool())
{
val = var.as_bool() ? "X" : "";
_color.add(key, val, true);
}
}
val.cut(0) << get_int(216);
_color.add("TreeView", val, true);
val.cut(0) << get_int(217);
_color.add("Interline", val, true);
val.cut(0) << (16+get_int(218)*8);
_color.add("ToolSize", val, true);
}
TColor_mask::TColor_mask() TColor_mask::TColor_mask()
: TAutomask("ba0200a"), _cur_theme(0) : TAutomask("ba0200a"), _cur_theme(0)
{ {
TConfig color(CONFIG_GUI, "Colors"); TConfig color(CONFIG_GUI, "Colors");
_color = color.list_variables(); _color = color.list_variables();
set(213, CAMPI_SCAVATI ? "X" : "");
set(214, NATIVE_CONTROLS ? "X" : "");
set(215, ADVANCED_GRAPHICS ? "X" : "");
set(216, color.get_int("TreeView"));
_preview = new TPreview_panel(1, 12, -1, -1, this); _preview = new TPreview_panel(1, 12, -1, -1, this);
_icons = new TPreview_icons(1, 13, -2, -1, this); _icons = new TPreview_icons(1, 14, -2, -1, this);
const int sz = color.get_int("ToolSize");
set(217, (sz-16)/8);
set(218, EASY_RIDER ? "X" : "");
set(219, TOOL_TEXT ? "X" : "");
set(220, ENTER_AS_TAB ? "X" : "");
set(221, TMenuitem::always_run_fullscreen() ? "X" : "");
set(222, INTERLINE);
if (is_power_reseller())
{
show(223); // Hidden by default
set(223, ANIMATED_BOXES ? "X" : "");
}
} }
void TColor_mask::save_colors(TConfig& colors) void TColor_mask::save_colors(TConfig& colors)
{ {
FOR_EACH_ASSOC_STRING(_color, obj, key, str) FOR_EACH_ASSOC_STRING(_color, obj, key, str)
colors.set(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" : "");
colors.set("TreeView", get_int(216));
const int sz = get_int(217);
colors.set("ToolSize", 16+sz*8);
colors.set("EasyRider", get_bool(218) ? "X" : "");
colors.set("ToolText", get_bool(219) ? "X" : "");
colors.set("EnterAsTab", get_bool(220) ? "X" : "");
colors.set("RunModal", get_bool(221) ? "X" : "");
colors.set("InterLine", get_int(222));
colors.set("AnimatedBoxes", get_bool(223) ? "X" : "");
} }
void TColor_mask::save_colors() void TColor_mask::save_colors()
{ {
TConfig colors(CONFIG_GUI, "Colors"); TConfig colors(CONFIG_GUI, "Colors");
save_colors(colors); save_colors(colors);
TMenuitem::always_run_fullscreen(get_bool(221)); TMenuitem::always_run_fullscreen(colors.get_bool("RunModal"));
} }
const TString& TColor_mask::get_font_desc() const const TString& TColor_mask::get_font_desc() const
{ { return _color.get_str("FontDesc"); }
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;
const TObject* s = ((TColor_mask*)this)->_color.objptr(name); const TString& s = _color.get_str(name);
if (s) if (s.full())
{ {
TToken_string colore(*(TString*)s, ','); TToken_string colore(s, ',');
const byte r = (byte)colore.get_int(); const byte r = (byte)colore.get_int();
const byte g = (byte)colore.get_int(); const byte g = (byte)colore.get_int();
const byte b = (byte)colore.get_int(); const byte b = (byte)colore.get_int();
@ -766,9 +813,7 @@ void TColor_mask::set_color_entry(const char* name, COLOR col)
} }
void TColor_mask::set_font_desc(const TString& fd) void TColor_mask::set_font_desc(const TString& fd)
{ { _color.add("FontDesc", fd, true); }
_color.add("FontDesc", fd, true);
}
const char* TColor_mask::cid2name(short cid) const const char* TColor_mask::cid2name(short cid) const
{ {

View File

@ -26,6 +26,7 @@ protected:
virtual bool can_be_closed() const; virtual bool can_be_closed() const;
TBook_field& book_field() const; TBook_field& book_field() const;
short add_page(const TMenuitem& mi); short add_page(const TMenuitem& mi);
void set_page_caption(short page, const TString& caption, int icon); void set_page_caption(short page, const TString& caption, int icon);

View File

@ -1,4 +1,4 @@
PAGE "Colori" -1 -1 58 20 PAGE "Colori" -1 -1 64 20
LISTBOX 211 1 30 LISTBOX 211 1 30
BEGIN BEGIN
@ -34,60 +34,39 @@ END
ENDPAGE ENDPAGE
PAGE "Avanzate" -1 -1 54 17 PAGE "Avanzate" -1 -1 64 20
BOOLEAN 213 PROPERTIES 213 41 10
BEGIN BEGIN
PROMPT 1 1 "Campi 3D" PROMPT 1 0 "Opzioni"
FIELD Campi3D ITEM "Grafica"
ITEM "Grafica Avanzata" BOOLEAN AdvancedGraphics=1
ITEM "Campi 3D" BOOLEAN Campi3D=1
ITEM "Bottoni di sistema" BOOLEAN NativeControls=0
ITEM "Messaggi animati" BOOLEAN AnimatedBoxes=0
ITEM "Griglie"
ITEM "Lettura facilitata" BOOLEAN EasyRider=1
ITEM "Considerare 'Invio'='Tab'" BOOLEAN EnterAsTab=0
ITEM "Selezione testo automatica" BOOLEAN AutoSelect=1
ITEM "Barra degli strumenti"
ITEM "Mostra il testo" BOOLEAN ToolText=1
ITEM "Applicazioni"
ITEM "Schermo intero" BOOLEAN RunModal=0
END END
BOOLEAN 214 RADIOBUTTON 216 1 16
BEGIN BEGIN
PROMPT 1 2 "Bottoni di sistema" PROMPT 44 0 "Tipo di Menu"
FIELD NativeControls ITEM "0|Classico"
//ITEM "1|Albero" **ATTENZIONE!!**Dalla 10.0 in avanti lasciare commentato!!!
ITEM "2|Explorer"
ITEM "3|Outlook"
FIELD TreeView
END END
BOOLEAN 215 RADIOBUTTON 217 1 16
BEGIN BEGIN
PROMPT 1 3 "Grafica avanzata" PROMPT 44 5 "Interlinea "
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
BOOLEAN 221
BEGIN
PROMPT 1 7 "Applicazioni singole a schermo intero"
FIELD AlwaysFullScreen
END
BOOLEAN 223
BEGIN
PROMPT 1 8 "Messaggi d'errore animati"
FIELD AnimatedBoxes
FLAGS "H" // OEM=0 Only
END
LIST 222 2 10
BEGIN
PROMPT 1 9 "Interlinea "
ITEM "-1|Automatica" ITEM "-1|Automatica"
ITEM "0|Minima" ITEM "0|Minima"
ITEM "4|Normale" ITEM "4|Normale"
@ -95,27 +74,14 @@ BEGIN
FIELD InterLine FIELD InterLine
END END
RADIOBUTTON 216 1 16
BEGIN
PROMPT 38 0 "Tipo di Menu"
ITEM "0|Classico"
MESSAGE CLEAR,221
//ITEM "1|Albero" **ATTENZIONE!!**Dalla 10.0 in avanti lasciare commentato!!!
ITEM "2|Explorer"
MESSAGE CLEAR,221
ITEM "3|Outlook"
MESSAGE ENABLE,221
FIELD TreeView
END
TEXT DLG_NULL TEXT DLG_NULL
BEGIN BEGIN
PROMPT -11 10 "Dimensione barra degli strumenti" PROMPT -11 11 "Dimensione barra degli strumenti"
END END
SLIDER 217 -1 1 SLIDER 218 -1 1
BEGIN BEGIN
PROMPT 1 11 "Dimensione icone" PROMPT 1 12 "Dimensione icone"
RANGE 0 14 RANGE 0 14
END END