Internal support for variable-height menu
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1066 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
6f8223b09b
commit
953185205d
@ -394,7 +394,7 @@ void Button_Hide_menu(void)
|
|||||||
{
|
{
|
||||||
Menu_is_visible=1;
|
Menu_is_visible=1;
|
||||||
Pixel_in_menu=Pixel_in_toolbar;
|
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();
|
Compute_magnifier_data();
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
|
|||||||
4
global.h
4
global.h
@ -458,9 +458,11 @@ GFX2_GLOBAL short Brush_rotation_center_Y;
|
|||||||
|
|
||||||
/// Boolean, true if the menu has to be displayed.
|
/// Boolean, true if the menu has to be displayed.
|
||||||
GFX2_GLOBAL byte Menu_is_visible;
|
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.
|
/// 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
|
/// As a result, the drawing algoritm always draws the image from 0 to ::Menu_Y-1
|
||||||
GFX2_GLOBAL word Menu_Y;
|
GFX2_GLOBAL word Menu_Y;
|
||||||
/// Y position of the status bar (in screen coordinates)
|
/// Y position of the status bar (in screen coordinates)
|
||||||
|
|||||||
2
graph.c
2
graph.c
@ -530,7 +530,7 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
|
|||||||
|
|
||||||
Menu_Y = Screen_height;
|
Menu_Y = Screen_height;
|
||||||
if (Menu_is_visible)
|
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);
|
Menu_status_Y = Screen_height-(Menu_factor_Y<<3);
|
||||||
|
|
||||||
Adjust_mouse_sensitivity(fullscreen);
|
Adjust_mouse_sensitivity(fullscreen);
|
||||||
|
|||||||
1
main.c
1
main.c
@ -457,6 +457,7 @@ int Init_program(int argc,char * argv[])
|
|||||||
// Données sur l'état du menu:
|
// Données sur l'état du menu:
|
||||||
Pixel_in_menu=Pixel_in_toolbar;
|
Pixel_in_menu=Pixel_in_toolbar;
|
||||||
Menu_is_visible=1;
|
Menu_is_visible=1;
|
||||||
|
Menu_height=MENU_HEIGHT;
|
||||||
// Données sur les couleurs et la palette:
|
// Données sur les couleurs et la palette:
|
||||||
First_color_in_palette=0;
|
First_color_in_palette=0;
|
||||||
// Données sur le curseur:
|
// Données sur le curseur:
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
24
windows.c
24
windows.c
@ -178,11 +178,11 @@ word Palette_cell_Y(byte index)
|
|||||||
{
|
{
|
||||||
if (Config.Palette_vertical)
|
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
|
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 start_x,start_y,end_x,end_y;
|
||||||
word index;
|
word index;
|
||||||
word cell_height=32/Menu_cells_Y;
|
word cell_height=(Menu_height-11)/Menu_cells_Y;
|
||||||
byte color;
|
byte color;
|
||||||
|
|
||||||
if (id==Fore_color)
|
if (id==Fore_color)
|
||||||
@ -289,12 +289,12 @@ void Frame_menu_color(byte id)
|
|||||||
void Display_menu_palette(void)
|
void Display_menu_palette(void)
|
||||||
{
|
{
|
||||||
int color;
|
int color;
|
||||||
byte cell_height=32/Menu_cells_Y;
|
byte cell_height=(Menu_height-11)/Menu_cells_Y;
|
||||||
// width: Menu_palette_cell_width
|
// width: Menu_palette_cell_width
|
||||||
|
|
||||||
if (Menu_is_visible)
|
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)
|
if (Config.Separate_colors)
|
||||||
for (color=First_color_in_palette;color<256&&(color-First_color_in_palette)<Menu_cells_X*Menu_cells_Y;color++)
|
for (color=First_color_in_palette;color<256&&(color-First_color_in_palette)<Menu_cells_X*Menu_cells_Y;color++)
|
||||||
@ -313,7 +313,7 @@ void Display_menu_palette(void)
|
|||||||
|
|
||||||
Frame_menu_color(Back_color);
|
Frame_menu_color(Back_color);
|
||||||
Frame_menu_color(Fore_color);
|
Frame_menu_color(Fore_color);
|
||||||
Update_rect(MENU_WIDTH*Menu_factor_X,Menu_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),(MENU_HEIGHT-9)*Menu_factor_Y);
|
Update_rect(MENU_WIDTH*Menu_factor_X,Menu_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),(Menu_height-11)*Menu_factor_Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ void Change_palette_cells()
|
|||||||
// Mise à jour de la taille du bouton dans le menu. C'est pour pas que
|
// Mise à jour de la taille du bouton dans le menu. C'est pour pas que
|
||||||
// la bordure noire soit active.
|
// la bordure noire soit active.
|
||||||
Buttons_Pool[BUTTON_CHOOSE_COL].Width=(Menu_palette_cell_width*Menu_cells_X)-1;
|
Buttons_Pool[BUTTON_CHOOSE_COL].Width=(Menu_palette_cell_width*Menu_cells_X)-1;
|
||||||
Buttons_Pool[BUTTON_CHOOSE_COL].Height=32/Menu_cells_Y*Menu_cells_Y-1;
|
Buttons_Pool[BUTTON_CHOOSE_COL].Height=(Menu_height-11)/Menu_cells_Y*Menu_cells_Y-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrouve la couleur sur laquelle pointe le curseur souris.
|
// Retrouve la couleur sur laquelle pointe le curseur souris.
|
||||||
@ -395,7 +395,7 @@ int Pick_color_in_palette()
|
|||||||
int line;
|
int line;
|
||||||
int column;
|
int column;
|
||||||
|
|
||||||
line=(((Mouse_Y-Menu_Y)/Menu_factor_Y)-2)/(32/Menu_cells_Y);
|
line=(((Mouse_Y-Menu_Y)/Menu_factor_Y)-2)/((Menu_height-11)/Menu_cells_Y);
|
||||||
column=(((Mouse_X/Menu_factor_X)-(MENU_WIDTH+1))/Menu_palette_cell_width);
|
column=(((Mouse_X/Menu_factor_X)-(MENU_WIDTH+1))/Menu_palette_cell_width);
|
||||||
if (Config.Palette_vertical)
|
if (Config.Palette_vertical)
|
||||||
{
|
{
|
||||||
@ -457,7 +457,7 @@ void Display_menu(void)
|
|||||||
Print_filename();
|
Print_filename();
|
||||||
}
|
}
|
||||||
// Now update the area: menu height and whole screen width (including palette)
|
// Now update the area: menu height and whole screen width (including palette)
|
||||||
Update_rect(0,Menu_Y,Screen_width,MENU_HEIGHT*Menu_factor_Y);
|
Update_rect(0,Menu_Y,Screen_width,Menu_height*Menu_factor_Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1107,12 +1107,12 @@ void Display_menu_palette_avoiding_window(byte * table)
|
|||||||
if (Config.Separate_colors)
|
if (Config.Separate_colors)
|
||||||
{
|
{
|
||||||
width=(Menu_palette_cell_width-1)*Menu_factor_X;
|
width=(Menu_palette_cell_width-1)*Menu_factor_X;
|
||||||
height=Menu_factor_Y*(32/Menu_cells_Y-1);
|
height=Menu_factor_Y*((Menu_height-11)/Menu_cells_Y-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
width=Menu_palette_cell_width*Menu_factor_X;
|
width=Menu_palette_cell_width*Menu_factor_X;
|
||||||
height=Menu_factor_Y*(32/Menu_cells_Y);
|
height=Menu_factor_Y*((Menu_height-11)/Menu_cells_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (color=0,real_color=First_color_in_palette;color<Menu_cells_X*Menu_cells_Y;color++,real_color++)
|
for (color=0,real_color=First_color_in_palette;color<Menu_cells_X*Menu_cells_Y;color++,real_color++)
|
||||||
@ -1195,7 +1195,7 @@ void Display_menu_palette_avoiding_window(byte * table)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Update_rect(MENU_WIDTH*Menu_factor_X,Menu_Y_before_window,Screen_width-(MENU_WIDTH*Menu_factor_X),(MENU_HEIGHT-9)*Menu_factor_Y);
|
Update_rect(MENU_WIDTH*Menu_factor_X,Menu_Y_before_window,Screen_width-(MENU_WIDTH*Menu_factor_X),(Menu_height-11)*Menu_factor_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------- Calcul des bornes de la partie d'image visible à l'écran ---------
|
// -------- Calcul des bornes de la partie d'image visible à l'écran ---------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user