Patch level :2.1 042

Files correlati     :ba0.exe
Ricompilazione Demo : [ ]
Commento            :sistemato il problema del ridimensionamento logo a 800x600;alzata la voce
di menu corrente in explorer mode (1 riga); staccato il logo dall'immagine in std mode


git-svn-id: svn://10.65.10.50/trunk@12079 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2004-05-17 15:39:53 +00:00
parent 1b725fe198
commit 746ba52727
2 changed files with 49 additions and 22 deletions

View File

@ -147,34 +147,46 @@ void TPicture_mask::update()
TImage& image = _submenu->image(); TImage& image = _submenu->image();
if (image.ok()) if (image.ok())
{ {
int x = 1, y = 1, maxx = 640, maxy = 480; // Default values int x = 1, y = 1, imgx = 640, imgy = 480; // Default values
RCT client; xvt_vobj_get_client_rect(win(), &client); RCT client; xvt_vobj_get_client_rect(win(), &client);
const bool tree_view = id2pos(DLG_TREE) >= 0; const bool tree_view = id2pos(DLG_TREE) >= 0;
int lx = 1, ly = ROWY, logx = 320, logy = 120;
if (tree_view) // TreeView == 1 if (tree_view) // TreeView == 1
{ {
RCT rctree; field(DLG_TREE).get_rect(rctree); RCT rctree; field(DLG_TREE).get_rect(rctree);
maxx = client.right - rctree.right - 12; const int maxx = client.right - rctree.right - 2 * CHARX;
maxy = client.bottom - 8 * ROWY; const int maxy = client.bottom - 8 * ROWY;
const double ratiox = double(maxx) / image.width(); const double ratiox = double(maxx) / image.width();
const double ratioy = double(maxy) / image.height(); const double ratioy = double(maxy) / image.height();
const double ratio = min(ratiox, ratioy); const double ratio = min(ratiox, ratioy);
maxx = int(ratio * image.width()); imgx = int(ratio * image.width());
maxy = int(ratio * image.height()); imgy = int(ratio * image.height());
x = client.right - maxx - 4; x = client.right - maxx - 4;
y = (client.bottom - maxy) / 2; y = (client.bottom - maxy) / 2;
//stabilisce la dimensione del logo
if (_logo != NULL)
{
lx = rctree.right + CHARX;
const double ratio = (double)maxx / _logo->width();
logx = int(ratio * _logo->width());
logy = int(ratio * _logo->height());
}
} }
else else
{ {
RCT rctbut; field(101).get_rect(rctbut); RCT rctbut; field(101).get_rect(rctbut);
maxx = rctbut.left - CHARX; int maxx = rctbut.left - CHARX;
maxy = client.bottom - 4 * ROWY; int maxy = client.bottom - 5 * ROWY; //il logo va staccato dall'immagine
if (_logo != NULL) if (_logo != NULL)
maxy -= _logo->height(); maxy -= _logo->height();
@ -182,23 +194,31 @@ void TPicture_mask::update()
const double ratioy = double(maxy) / image.height(); const double ratioy = double(maxy) / image.height();
const double ratio = min(ratiox, ratioy); const double ratio = min(ratiox, ratioy);
maxx = int(ratio * image.width()); imgx = int(ratio * image.width());
maxy = int(ratio * image.height()); imgy = int(ratio * image.height());
x = 1; x = 1;
y = (client.bottom - maxy) / 2; y = (client.bottom - maxy) / 2;
//stabilisce la dimensione del logo
if (_logo != NULL)
{
const double ratio = (double)maxx / _logo->width();
logx = int(ratio * _logo->width());
logy = int(ratio * _logo->height());
}
} }
RCT dst; RCT dst;
::xvt_rect_set(&dst, x, y, x+maxx, y+maxy);
if (::xvt_dwin_is_update_needed(win(), &dst))
image.draw(win(), dst);
if (_logo != NULL) if (_logo != NULL)
{ {
const int lx = tree_view ? dst.right-_logo->width()-1 : x; ::xvt_rect_set(&dst, lx, ly, lx+logx, ly+logy);
const int ly = ROWY; if (::xvt_dwin_is_update_needed(win(), &dst))
_logo->draw(win(), lx, ly); _logo->draw(win(), dst);
} }
::xvt_rect_set(&dst, x, y, x+imgx, y+imgy);
if (::xvt_dwin_is_update_needed(win(), &dst))
image.draw(win(), dst);
} }
} }
@ -257,14 +277,21 @@ TPicture_mask::TPicture_mask(const char* name, int dx, int dy,
TImage logo(logoname); TImage logo(logoname);
if(logo.ok()) if(logo.ok())
{ {
RCT rct; xvt_vobj_get_client_rect(win(), &rct); /* RCT rct; xvt_vobj_get_client_rect(win(), &rct);
const double ratio = rct.right / logo.width() / 2.0; const bool is_tree = dx == 0 && dy == 0;
double screen_width = 50*CHARX;
const double ratio = screen_width / logo.width();
const int maxx = int(ratio * logo.width()); const int maxx = int(ratio * logo.width());
const int maxy = int(ratio * logo.height()); const int maxy = int(ratio * logo.height());
if (can_be_transparent(logo)) if (can_be_transparent(logo))
logo.convert_transparent_color(MASK_BACK_COLOR); logo.convert_transparent_color(MASK_BACK_COLOR);
_logo = new TImage(logo, maxx, maxy); _logo = new TImage(logo, maxx, maxy);*/
if (can_be_transparent(logo))
logo.convert_transparent_color(MASK_BACK_COLOR);
_logo = new TImage(logo);
} }
} }
@ -1691,7 +1718,7 @@ int TMenu_application::do_tree()
_mask = &mask; _mask = &mask;
const int margin = (mask.columns()-80) / 2; const int margin = (mask.columns()-80) / 2;
const int twidth = margin + 40; const int twidth = mask.columns() - 51;
const int bwidth = (mask.columns() - twidth - 8); const int bwidth = (mask.columns() - twidth - 8);
TMenu_tree tree(_menu); TMenu_tree tree(_menu);

View File

@ -552,12 +552,12 @@ void TMenulist_window::draw_menu_caption(COLOR rgb)
{ {
const TImage* logo = _images.image("logo"); const TImage* logo = _images.image("logo");
if (logo != NULL) if (logo != NULL)
y -= logo->height(); y -= logo->height() + ROWY; //+ROWY per staccare scritta dal logo
} }
XVT_FNTID font_menu = xvt_font_create(); XVT_FNTID font_menu = xvt_font_create();
xvt_font_copy(font_menu, xvt_default_font(true), XVT_FA_ALL); xvt_font_copy(font_menu, xvt_default_font(true), XVT_FA_ALL);
const int size = xvt_font_get_size(font_menu); const int size = xvt_font_get_size(font_menu);
xvt_font_set_size(font_menu, 130 * size / 100); xvt_font_set_size(font_menu, 130 * size / 100); //altezza font il 30% maggiore di quello di menu
xvt_dwin_set_font(win(), font_menu); xvt_dwin_set_font(win(), font_menu);
set_color(rgb, NORMAL_BACK_COLOR); set_color(rgb, NORMAL_BACK_COLOR);