Patch level : 10.0 260

Files correlati     : ba0.exe ba0200a.msk
Ricompilazione Demo : [ ]
Commento            :
Aggiunto supporto per le Property Grid


git-svn-id: svn://10.65.10.50/trunk@18532 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-03-17 11:03:10 +00:00
parent 10d04217ca
commit 781b7bda8a
3 changed files with 75 additions and 117 deletions

@ -9,6 +9,7 @@
#include <relation.h>
#include <progind.h>
#include <sheet.h>
#include <treectrl.h>
#include <utility.h>
#include <urldefid.h>
@ -253,6 +254,8 @@ class TColor_mask : public TAutomask
protected: // TMask
virtual bool stop_run(KEY key) { return TWindow::stop_run(key); }
virtual bool on_field_event(TOperable_field& f, TField_event e, long jolly);
void colors2mask();
void mask2colors();
protected:
COLOR get_color_entry(const char* c) const;
@ -396,7 +399,7 @@ void TColor_mask::load_themes()
values.add(row->left(15));
}
TConfig user_themes(CONFIG_GUI);
TConfig user_themes(CONFIG_GUI, "Colors");
user_themes.list_paragraphs(pl);
FOR_EACH_ARRAY_ROW(pl, j, raw)
{
@ -428,6 +431,37 @@ bool TColor_mask::find_themes_ini(TFilename& ininame) const
return ok;
}
void TColor_mask::colors2mask()
{
TProp_field& pg = (TProp_field&)field(212);
pg.freeze(true);
FOR_EACH_ASSOC_STRING(_color, h, key, color)
{
const TFixed_string str(color);
if (str.find(',') > 0) // E' una proprieta' colore?
pg.set_property(key, color);
}
pg.freeze(false);
_preview->force_update();
}
void TColor_mask::mask2colors()
{
const TProp_field& pg = (const TProp_field&)field(212);
FOR_EACH_ASSOC_STRING(_color, h, key, color)
{
const TFixed_string str(color);
if (str.find(',') > 0) // E' una proprieta' colore?
{
const COLOR rgb = pg.get_color_property(key);
if (rgb != COLOR_INVALID)
set_color_entry(key, rgb);
}
}
_preview->force_update();
}
bool TColor_mask::apply_theme()
{
bool applied = false;
@ -514,10 +548,8 @@ bool TColor_mask::apply_theme()
}
if (applied)
{
_preview->force_update();
_cur_theme = theme;
}
colors2mask();
return applied;
}
@ -623,19 +655,13 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
return false;
}
break;
case 212:
if (e == fe_init)
colors2mask(); else
if (e == fe_modify)
mask2colors();
break;
default:
if (e == fe_button && id >= 101 && id <= 113)
{
const char* name = cid2name(f.dlg());
COLOR col = get_color_entry(name);
col = choose_color(col, win());
if (col != COLOR_INVALID)
{
set_color_entry(name, col);
_preview->force_update();
}
return false;
}
break;
}
return ok;
@ -651,7 +677,7 @@ TColor_mask::TColor_mask()
set(215, ADVANCED_GRAPHICS ? "X" : "");
set(216, color.get_int("TreeView"));
_preview = new TPreview_panel(1, 7, 33, 8, this);
_preview = new TPreview_panel(1, 10, -1, 8, this);
_icons = new TPreview_icons(1, 10, -2, -2, this);
const int sz = color.get_int("ToolSize");
@ -728,9 +754,8 @@ const char* TColor_mask::cid2name(short cid) const
"Normal", "NormalBack", "RequiredBack",
"Focus", "FocusBack",
"Disabled", "DisabledBack",
"ButtonBack", "ButtonLight", "ButtonDark"
};
const int i = cid - 101;
"ButtonBack", "ButtonLight", "ButtonDark" };
const int i = cid < DLG_USER ? cid : cid - 101;
CHECK(i >= 0 && i < colors, "Invalid color id");
return name[i];
}
@ -743,19 +768,19 @@ COLOR TColor_mask::cid2color(short cid) const
COLOR_DKGRAY, COLOR_LTGRAY,
COLOR_LTGRAY, COLOR_WHITE, COLOR_GRAY };
const int i = cid - 101;
const int i = cid < DLG_USER ? cid : cid - 101;
CHECK(i >= 0 && i < 13, "Invalid color id");
return color[i];
}
COLOR TColor_mask::cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const
{
int entry[] = { XVT_COLOR_BACKGROUND /*XVT_COLOR_TROUGH*/, XVT_COLOR_BLEND, XVT_COLOR_BORDER,
int entry[] = { XVT_COLOR_BACKGROUND, XVT_COLOR_BLEND, XVT_COLOR_BORDER,
XVT_COLOR_FOREGROUND, XVT_COLOR_BACKGROUND, XVT_COLOR_BACKGROUND,
XVT_COLOR_HIGHLIGHT, XVT_COLOR_SELECT,
XVT_COLOR_BLEND, XVT_COLOR_BORDER,
XVT_COLOR_BACKGROUND, XVT_COLOR_BLEND, XVT_COLOR_BORDER };
const unsigned int component = entry[cid-101];
const unsigned int component = entry[cid < DLG_USER ? cid : cid-101];
for (int i = 0; cc[i].type != XVT_COLOR_NULL; i++) if (cc[i].type == component)
{
switch (cid)

@ -111,7 +111,7 @@ void TBook_window::update()
// Disegno lo sfondo solo se non esiste nessun notebook che occupa tutto lo spazio!
if (_ctrl == NULL_WIN)
{
clear(COLOR_WHITE);
clear(NORMAL_BACK_COLOR);
RCT rctw; xvt_vobj_get_client_rect(win(), &rctw);
if (rctw.right >= 64 && rctw.bottom >= 64)
{

@ -1,103 +1,36 @@
PAGE "Colori" -1 -1 54 19
PAGE "Colori" -1 -1 54 20
GROUPBOX DLG_NULL 16 5
LISTBOX 211 1 25
BEGIN
PROMPT 1 0 "@bMaschera"
END
BUTTON 101 12
BEGIN
PROMPT 2 1 "Normale"
END
BUTTON 102 12
BEGIN
PROMPT 2 2 "Chiaro"
END
BUTTON 103 12
BEGIN
PROMPT 2 3 "Scuro"
END
GROUPBOX DLG_NULL 16 5
BEGIN
PROMPT 19 0 "@bBottoni"
END
BUTTON 111 12
BEGIN
PROMPT 20 1 "Sfondo"
END
BUTTON 112 12
BEGIN
PROMPT 20 2 "Chiaro"
END
BUTTON 113 12
BEGIN
PROMPT 20 3 "Scuro"
END
GROUPBOX DLG_NULL 16 5
BEGIN
PROMPT 37 0 "@bNormale"
END
BUTTON 104 12
BEGIN
PROMPT 38 1 "Testo"
END
BUTTON 105 12
BEGIN
PROMPT 38 2 "Sfondo"
END
BUTTON 106 12
BEGIN
PROMPT 38 3 "Obbligatorio"
END
GROUPBOX DLG_NULL 16 4
BEGIN
PROMPT 37 5 "@bAttivo"
END
BUTTON 107 12
BEGIN
PROMPT 38 6 "Testo"
END
BUTTON 108 12
BEGIN
PROMPT 38 7 "Sfondo"
END
GROUPBOX DLG_NULL 16 4
BEGIN
PROMPT 37 9 "@bDisabilitato"
END
BUTTON 109 12
BEGIN
PROMPT 38 10 "Testo"
END
BUTTON 110 12
BEGIN
PROMPT 38 11 "Sfondo"
END
LISTBOX 211 1 15
BEGIN
PROMPT 1 5 "Temi predefiniti "
PROMPT 1 0 "Temi predefiniti "
ITEM "0|"
ITEM "1|Classico"
ITEM "2|Sistema"
END
PROPERTIES 212 -1 9
BEGIN
PROMPT 1 1 "Colori"
ITEM "Maschera"
ITEM "Sfondo" COLOR MaskBack=192,192,192
ITEM "Chiaro" COLOR MaskLight=255,255,255
ITEM "Scuro" COLOR MaskDark=128,128,128
ITEM "Bottoni"
ITEM "Sfondo" COLOR ButtonBack=192,192,192
ITEM "Chiaro" COLOR ButtonLight=255,255,255
ITEM "Scuro" COLOR ButtonDark=128,128,128
ITEM "Campi di testo"
ITEM "Testo" COLOR Normal=0,0,0
ITEM "Sfondo Normale" COLOR NormalBack=255,255,255
ITEM "Sfondo Obbligatorio" COLOR RequiredBack=128,128,255
ITEM "Campi attivi (focus)"
ITEM "Testo" COLOR Focus=0,0,0
ITEM "Sfondo" COLOR FocusBack=0,0,255
ITEM "Campi disabilitati"
ITEM "Testo" COLOR Disabled=0,0,0
ITEM "Sfondo" COLOR DisabledBack=192,192,192
END
ENDPAGE
PAGE "Avanzate" -1 -1 54 17