From 953185205d6ee453b2cf721b54ef5a74c52fd21a Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Wed, 7 Oct 2009 22:27:14 +0000 Subject: [PATCH] Internal support for variable-height menu git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1066 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- buttons.c | 2 +- global.h | 4 +++- graph.c | 2 +- main.c | 1 + skins/skin_modern.png | Bin 16553 -> 16553 bytes windows.c | 24 ++++++++++++------------ 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/buttons.c b/buttons.c index 88fd9a7b..10882e5b 100644 --- a/buttons.c +++ b/buttons.c @@ -394,7 +394,7 @@ void Button_Hide_menu(void) { Menu_is_visible=1; Pixel_in_menu=Pixel_in_toolbar; - Menu_Y=Screen_height-(MENU_HEIGHT*Menu_factor_Y); + Menu_Y=Screen_height-(Menu_height*Menu_factor_Y); Compute_magnifier_data(); if (Main_magnifier_mode) diff --git a/global.h b/global.h index 371f198e..b2eef28d 100644 --- a/global.h +++ b/global.h @@ -458,9 +458,11 @@ GFX2_GLOBAL short Brush_rotation_center_Y; /// Boolean, true if the menu has to be displayed. GFX2_GLOBAL byte Menu_is_visible; +/// Height of the menu, when it's displayed +GFX2_GLOBAL word Menu_height; /// /// Y position (in screen coordinates) where the menu begins. -/// This is always either ::Screen_height (when menu is hidden) or (::Screen_height - ::MENU_HEIGHT) +/// This is always either ::Screen_height (when menu is hidden) or (::Screen_height - ::Menu_height) /// As a result, the drawing algoritm always draws the image from 0 to ::Menu_Y-1 GFX2_GLOBAL word Menu_Y; /// Y position of the status bar (in screen coordinates) diff --git a/graph.c b/graph.c index 28ecf755..c996a9ea 100644 --- a/graph.c +++ b/graph.c @@ -530,7 +530,7 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio) Menu_Y = Screen_height; if (Menu_is_visible) - Menu_Y -= MENU_HEIGHT * Menu_factor_Y; + Menu_Y -= Menu_height * Menu_factor_Y; Menu_status_Y = Screen_height-(Menu_factor_Y<<3); Adjust_mouse_sensitivity(fullscreen); diff --git a/main.c b/main.c index af3c342d..818cc650 100644 --- a/main.c +++ b/main.c @@ -457,6 +457,7 @@ int Init_program(int argc,char * argv[]) // Données sur l'état du menu: Pixel_in_menu=Pixel_in_toolbar; Menu_is_visible=1; + Menu_height=MENU_HEIGHT; // Données sur les couleurs et la palette: First_color_in_palette=0; // Données sur le curseur: diff --git a/skins/skin_modern.png b/skins/skin_modern.png index 4247fc1465046c339403cac0cf5c9a288974e065..d6bf97cca04af49f30356bd7f826ae461c43016c 100644 GIT binary patch delta 43 xcmZ44$hfkRaf2YU3u*6vo3RuEdX=j6F>j} delta 43 zcmV+`0M!4ffdQ$30k9DR9K(Hm*L{8KeSQCZeE0 B6xIL$ diff --git a/windows.c b/windows.c index 93d52f02..a22377e1 100644 --- a/windows.c +++ b/windows.c @@ -178,11 +178,11 @@ word Palette_cell_Y(byte index) { if (Config.Palette_vertical) { - return Menu_Y+((2+(((index-First_color_in_palette)/Menu_cells_X)*(32/Menu_cells_Y)))*Menu_factor_Y); + return Menu_Y+((2+(((index-First_color_in_palette)/Menu_cells_X)*((Menu_height-11)/Menu_cells_Y)))*Menu_factor_Y); } else { - return Menu_Y+((2+(((index-First_color_in_palette)%Menu_cells_Y)*(32/Menu_cells_Y)))*Menu_factor_Y); + return Menu_Y+((2+(((index-First_color_in_palette)%Menu_cells_Y)*((Menu_height-11)/Menu_cells_Y)))*Menu_factor_Y); } } @@ -215,7 +215,7 @@ void Frame_menu_color(byte id) { word start_x,start_y,end_x,end_y; word index; - word cell_height=32/Menu_cells_Y; + word cell_height=(Menu_height-11)/Menu_cells_Y; byte color; if (id==Fore_color) @@ -289,12 +289,12 @@ void Frame_menu_color(byte id) void Display_menu_palette(void) { int color; - byte cell_height=32/Menu_cells_Y; + byte cell_height=(Menu_height-11)/Menu_cells_Y; // width: Menu_palette_cell_width if (Menu_is_visible) { - Block(MENU_WIDTH*Menu_factor_X,Menu_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),(MENU_HEIGHT-9)*Menu_factor_Y,MC_Black); + Block(MENU_WIDTH*Menu_factor_X,Menu_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),(Menu_height-11+2)*Menu_factor_Y,MC_Black); if (Config.Separate_colors) for (color=First_color_in_palette;color<256&&(color-First_color_in_palette)