Patch level : 10.0

Files correlati     : ba0.exe ba0200a.msk
Ricompilazione Demo : [ ]
Commento            :
Aggiunto supporto per colore primpt


git-svn-id: svn://10.65.10.50/trunk@19844 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-12-24 11:42:20 +00:00
parent 1606f517d3
commit d426afba70
3 changed files with 21 additions and 22 deletions

View File

@ -519,7 +519,7 @@ bool TColor_mask::apply_theme()
{ {
case 1: // Campo default colors case 1: // Campo default colors
{ {
for (short bid = 101; bid <= 113; bid++) for (short bid = 101; bid <= 114; bid++)
{ {
const char* name = cid2name(bid); const char* name = cid2name(bid);
const COLOR color = cid2color(bid); const COLOR color = cid2color(bid);
@ -531,8 +531,8 @@ bool TColor_mask::apply_theme()
break; break;
case 2: // System colors case 2: // System colors
{ {
XVT_COLOR_COMPONENT* cc = (XVT_COLOR_COMPONENT*)xvt_vobj_get_attr(NULL_WIN, ATTR_APP_CTL_COLORS); const XVT_COLOR_COMPONENT* cc = (XVT_COLOR_COMPONENT*)xvt_vobj_get_attr(NULL_WIN, ATTR_APP_CTL_COLORS);
for (short bid = 101; bid <= 113; bid++) for (short bid = 101; bid <= 114; bid++)
{ {
const char* name = cid2name(bid); const char* name = cid2name(bid);
const COLOR color = cid2syscolor(bid, cc); const COLOR color = cid2syscolor(bid, cc);
@ -767,12 +767,13 @@ void TColor_mask::set_font_desc(const TString& fd)
const char* TColor_mask::cid2name(short cid) const const char* TColor_mask::cid2name(short cid) const
{ {
const int colors = 13; const int colors = 14;
const char* name[colors] = { "MaskBack", "MaskLight", "MaskDark", const char* name[colors] = { "MaskBack", "MaskLight", "MaskDark",
"Normal", "NormalBack", "RequiredBack", "Normal", "NormalBack", "RequiredBack",
"Focus", "FocusBack", "Focus", "FocusBack",
"Disabled", "DisabledBack", "Disabled", "DisabledBack",
"ButtonBack", "ButtonLight", "ButtonDark" }; "ButtonBack", "ButtonLight", "ButtonDark",
"Prompt" };
const int i = cid < DLG_USER ? cid : cid - 101; const int i = cid < DLG_USER ? cid : cid - 101;
CHECK(i >= 0 && i < colors, "Invalid color id"); CHECK(i >= 0 && i < colors, "Invalid color id");
return name[i]; return name[i];
@ -784,10 +785,11 @@ COLOR TColor_mask::cid2color(short cid) const
COLOR_BLACK, COLOR_WHITE, blend_colors(COLOR_WHITE, COLOR_YELLOW, 0.60), COLOR_BLACK, COLOR_WHITE, blend_colors(COLOR_WHITE, COLOR_YELLOW, 0.60),
COLOR_BLACK, COLOR_YELLOW, COLOR_BLACK, COLOR_YELLOW,
COLOR_DKGRAY, COLOR_LTGRAY, COLOR_DKGRAY, COLOR_LTGRAY,
COLOR_LTGRAY, COLOR_WHITE, COLOR_GRAY }; COLOR_LTGRAY, COLOR_WHITE, COLOR_GRAY,
COLOR_BLACK };
const int i = cid < DLG_USER ? cid : cid - 101; const int i = cid < DLG_USER ? cid : cid - 101;
CHECK(i >= 0 && i < 13, "Invalid color id"); CHECK(i >= 0 && i < 14, "Invalid color id");
return color[i]; return color[i];
} }
@ -797,7 +799,9 @@ COLOR TColor_mask::cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const
XVT_COLOR_FOREGROUND, XVT_COLOR_BACKGROUND, XVT_COLOR_BACKGROUND, XVT_COLOR_FOREGROUND, XVT_COLOR_BACKGROUND, XVT_COLOR_BACKGROUND,
XVT_COLOR_HIGHLIGHT, XVT_COLOR_SELECT, XVT_COLOR_HIGHLIGHT, XVT_COLOR_SELECT,
XVT_COLOR_BLEND, XVT_COLOR_BORDER, XVT_COLOR_BLEND, XVT_COLOR_BORDER,
XVT_COLOR_BACKGROUND, XVT_COLOR_BLEND, XVT_COLOR_BORDER }; XVT_COLOR_BACKGROUND, XVT_COLOR_BLEND, XVT_COLOR_BORDER,
XVT_COLOR_FOREGROUND
};
const unsigned int component = entry[cid < DLG_USER ? cid : 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) for (int i = 0; cc[i].type != XVT_COLOR_NULL; i++) if (cc[i].type == component)
{ {

View File

@ -300,15 +300,9 @@ void TBook_window::set_logo(const char* logo)
const short h = _logo.height(); const short h = _logo.height();
const short h2 = h/4; const short h2 = h/4;
XVT_IMAGE big = xvt_image_create(XVT_IMAGE_RGB, w, h+h2, 0); XVT_IMAGE big = xvt_image_create(XVT_IMAGE_RGB, w, h+h2, NORMAL_BACK_COLOR);
for (short y = 0; y < h; y++) RCT rct; xvt_rect_set(&rct, 0, 0, w, h);
{ xvt_image_transfer(big, _logo.xvt_image(), &rct, &rct);
for (short x = 0; x < w; x++)
{
const COLOR rgb = _logo.get_pixel(x, y);
xvt_image_set_pixel(big, x, y, rgb);
}
}
for (short y = 0; y < h2; y++) for (short y = 0; y < h2; y++)
{ {
const double weight = 0.5+double(y)/double(2*h2); const double weight = 0.5+double(y)/double(2*h2);
@ -316,13 +310,13 @@ void TBook_window::set_logo(const char* logo)
for (short x = 0; x < w; x++) for (short x = 0; x < w; x++)
{ {
const short sx = x-2*y; const short sx = x-2*y;
COLOR col = MASK_LIGHT_COLOR; COLOR col = MASK_DARK_COLOR;
if (sx >= 0) if (sx >= 0)
{ {
COLOR rgb = xvt_image_get_pixel(big, sx, sy); const COLOR rgb = xvt_image_get_pixel(big, sx, sy);
const int r = XVT_COLOR_GET_RED(rgb); const unsigned char r = XVT_COLOR_GET_RED(rgb);
const int g = XVT_COLOR_GET_GREEN(rgb); const unsigned char g = XVT_COLOR_GET_GREEN(rgb);
const int b = XVT_COLOR_GET_BLUE(rgb); const unsigned char b = XVT_COLOR_GET_BLUE(rgb);
if (r != g || g != b) if (r != g || g != b)
col = blend_colors(col, rgb, weight); col = blend_colors(col, rgb, weight);
} }

View File

@ -23,6 +23,7 @@ BEGIN
ITEM "Testo" COLOR Normal=0,0,0 ITEM "Testo" COLOR Normal=0,0,0
ITEM "Sfondo Normale" COLOR NormalBack=255,255,255 ITEM "Sfondo Normale" COLOR NormalBack=255,255,255
ITEM "Sfondo Obbligatorio" COLOR RequiredBack=128,128,255 ITEM "Sfondo Obbligatorio" COLOR RequiredBack=128,128,255
ITEM "Prompt" COLOR Prompt=0,0,0
ITEM "Campi attivi (focus)" ITEM "Campi attivi (focus)"
ITEM "Testo" COLOR Focus=0,0,0 ITEM "Testo" COLOR Focus=0,0,0
ITEM "Sfondo" COLOR FocusBack=0,0,255 ITEM "Sfondo" COLOR FocusBack=0,0,255