Added support for hiding the main toolbar, keeping the status line and optionally layer bar. Made it the default behaviour of F10 / right-click 'hide', for testing and feedback. (IMO it's less unforgiving for new users, and we can provide alternative shortcut with old behaviour for veterans).
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1225 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
03cbcee632
commit
3538abadb9
71
buttons.c
71
buttons.c
@ -333,23 +333,12 @@ void Button_Select_backcolor(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------- Cacher ou réafficher le menu ------------------------
|
|
||||||
void Pixel_in_hidden_toolbar(__attribute__((unused)) word x,__attribute__((unused)) word y,__attribute__((unused)) byte color)
|
|
||||||
{
|
|
||||||
// C'est fait exprès que ce soit vide...
|
|
||||||
// C'est parce que y'a rien du tout à afficher vu que la barre d'outil est
|
|
||||||
// cachée... C'est simple non?
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Button_Hide_menu(void)
|
void Button_Hide_menu(void)
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
if (Menu_is_visible)
|
if (Menu_is_visible)
|
||||||
{
|
{
|
||||||
Menu_is_visible=0;
|
Menu_is_visible=0;
|
||||||
Pixel_in_menu=Pixel_in_hidden_toolbar;
|
|
||||||
Menu_Y=Screen_height;
|
Menu_Y=Screen_height;
|
||||||
|
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
@ -393,7 +382,6 @@ void Button_Hide_menu(void)
|
|||||||
{
|
{
|
||||||
byte current_menu;
|
byte current_menu;
|
||||||
Menu_is_visible=1;
|
Menu_is_visible=1;
|
||||||
Pixel_in_menu=Pixel_in_toolbar;
|
|
||||||
Menu_Y=Screen_height;
|
Menu_Y=Screen_height;
|
||||||
for (current_menu = 0; current_menu < MENUBAR_COUNT; current_menu++)
|
for (current_menu = 0; current_menu < MENUBAR_COUNT; current_menu++)
|
||||||
if (Menu_bars[current_menu].Visible)
|
if (Menu_bars[current_menu].Visible)
|
||||||
@ -412,15 +400,28 @@ void Button_Hide_menu(void)
|
|||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button_Show_layerbar(void)
|
|
||||||
|
void Set_bar_visibility(word bar, byte visible)
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
int i;
|
||||||
if (Menu_bars[MENUBAR_LAYERS].Visible)
|
int offset;
|
||||||
|
|
||||||
|
if (!visible && Menu_bars[bar].Visible)
|
||||||
{
|
{
|
||||||
// Hide it
|
// Hide it
|
||||||
Menu_bars[MENUBAR_LAYERS].Visible=0;
|
Menu_bars[bar].Visible=0;
|
||||||
Menu_Y += Menu_bars[MENUBAR_LAYERS].Height * Menu_factor_Y;
|
|
||||||
Menu_height -= Menu_bars[MENUBAR_LAYERS].Height;
|
// Recompute all offsets
|
||||||
|
offset=0;
|
||||||
|
for (i = MENUBAR_COUNT-1; i >=0; i--)
|
||||||
|
{
|
||||||
|
Menu_bars[i].Top = offset;
|
||||||
|
if(Menu_bars[i].Visible)
|
||||||
|
offset += Menu_bars[i].Height;
|
||||||
|
}
|
||||||
|
// Update global menu coordinates
|
||||||
|
Menu_Y += Menu_bars[bar].Height * Menu_factor_Y;
|
||||||
|
Menu_height -= Menu_bars[bar].Height;
|
||||||
|
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
{
|
{
|
||||||
@ -460,12 +461,21 @@ void Button_Show_layerbar(void)
|
|||||||
Display_menu();
|
Display_menu();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
}
|
}
|
||||||
else
|
else if (visible && !Menu_bars[bar].Visible)
|
||||||
{
|
{
|
||||||
// Show it
|
// Show it
|
||||||
Menu_bars[MENUBAR_LAYERS].Visible = 1;
|
Menu_bars[bar].Visible = 1;
|
||||||
Menu_Y -= Menu_bars[MENUBAR_LAYERS].Height * Menu_factor_Y;
|
// Recompute all offsets
|
||||||
Menu_height += Menu_bars[MENUBAR_LAYERS].Height;
|
offset=0;
|
||||||
|
for (i = MENUBAR_COUNT-1; i >=0; i--)
|
||||||
|
{
|
||||||
|
Menu_bars[i].Top = offset;
|
||||||
|
if(Menu_bars[i].Visible)
|
||||||
|
offset += Menu_bars[i].Height;
|
||||||
|
}
|
||||||
|
// Update global menu coordinates
|
||||||
|
Menu_Y -= Menu_bars[bar].Height * Menu_factor_Y;
|
||||||
|
Menu_height += Menu_bars[bar].Height;
|
||||||
|
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
@ -476,10 +486,27 @@ void Button_Show_layerbar(void)
|
|||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button_Toggle_layerbar(void)
|
||||||
|
{
|
||||||
|
Hide_cursor();
|
||||||
|
|
||||||
|
Set_bar_visibility(MENUBAR_LAYERS, !Menu_bars[MENUBAR_LAYERS].Visible);
|
||||||
|
|
||||||
Unselect_button(BUTTON_HIDE);
|
Unselect_button(BUTTON_HIDE);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Button_Toggle_toolbox(void)
|
||||||
|
{
|
||||||
|
Hide_cursor();
|
||||||
|
|
||||||
|
Set_bar_visibility(MENUBAR_TOOLS, !Menu_bars[MENUBAR_TOOLS].Visible);
|
||||||
|
|
||||||
|
Unselect_button(BUTTON_HIDE);
|
||||||
|
Display_cursor();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------- Quitter le programme ---------------------------
|
//--------------------------- Quitter le programme ---------------------------
|
||||||
byte Button_Quit_local_function(void)
|
byte Button_Quit_local_function(void)
|
||||||
|
|||||||
11
buttons.h
11
buttons.h
@ -629,8 +629,15 @@ void Button_Quit(void);
|
|||||||
*/
|
*/
|
||||||
void Button_Hide_menu(void);
|
void Button_Hide_menu(void);
|
||||||
|
|
||||||
/// Shows or hide the layerbar
|
/*!
|
||||||
void Button_Show_layerbar(void);
|
Shows or hide the layerbar
|
||||||
|
*/
|
||||||
|
void Button_Toggle_layerbar(void);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Shows or hide the main toolbox
|
||||||
|
*/
|
||||||
|
void Button_Toggle_toolbox(void);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
68
engine.c
68
engine.c
@ -155,7 +155,6 @@ int Button_under_mouse(void)
|
|||||||
short x_pos;
|
short x_pos;
|
||||||
short y_pos;
|
short y_pos;
|
||||||
byte current_menu;
|
byte current_menu;
|
||||||
word current_offset = Screen_height;
|
|
||||||
byte first_button;
|
byte first_button;
|
||||||
|
|
||||||
x_pos = Mouse_X / Menu_factor_X;
|
x_pos = Mouse_X / Menu_factor_X;
|
||||||
@ -165,12 +164,15 @@ int Button_under_mouse(void)
|
|||||||
{
|
{
|
||||||
if (Menu_bars[current_menu].Visible)
|
if (Menu_bars[current_menu].Visible)
|
||||||
{
|
{
|
||||||
current_offset -= Menu_bars[current_menu].Height * Menu_factor_Y;
|
if (Mouse_Y >= Menu_Y+Menu_factor_Y*(Menu_bars[current_menu].Top) &&
|
||||||
if (Mouse_Y >= current_offset)
|
Mouse_Y < Menu_Y+Menu_factor_Y*(Menu_bars[current_menu].Top + Menu_bars[current_menu].Height))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
y_pos=(Mouse_Y - current_offset)/Menu_factor_Y;
|
if (current_menu==MENUBAR_COUNT)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
y_pos=(Mouse_Y - Menu_Y)/Menu_factor_Y - Menu_bars[current_menu].Top;
|
||||||
|
|
||||||
if (current_menu == 0) first_button = 0;
|
if (current_menu == 0) first_button = 0;
|
||||||
else first_button = Menu_bars[current_menu - 1].Last_button_index + 1;
|
else first_button = Menu_bars[current_menu - 1].Last_button_index + 1;
|
||||||
@ -207,8 +209,6 @@ int Button_under_mouse(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define Pixel_in_skinmenu(x,y,color) Menu_bars[current_menu].Skin[(y - y_off)*Menu_bars[current_menu].Skin_width + x] = color
|
|
||||||
#define Pixel_in_menu_and_skin(x,y,color) Pixel_in_skinmenu(x,y,color); if(visible) Pixel_in_menu(x,y,color)
|
|
||||||
|
|
||||||
///Draw the frame for a menu button
|
///Draw the frame for a menu button
|
||||||
void Draw_menu_button_frame(byte btn_number,byte pressed)
|
void Draw_menu_button_frame(byte btn_number,byte pressed)
|
||||||
@ -223,34 +223,20 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
|
|||||||
word x_pos;
|
word x_pos;
|
||||||
word y_pos;
|
word y_pos;
|
||||||
byte current_menu;
|
byte current_menu;
|
||||||
byte visible = 0;
|
|
||||||
word y_off = 0;
|
|
||||||
|
|
||||||
// Find in which menu the button is
|
// Find in which menu the button is
|
||||||
for (current_menu = 0; current_menu < MENUBAR_COUNT; current_menu++)
|
for (current_menu = 0; current_menu < MENUBAR_COUNT; current_menu++)
|
||||||
{
|
{
|
||||||
if(Menu_bars[current_menu].Visible)
|
|
||||||
{
|
|
||||||
y_off += Menu_bars[current_menu].Height;
|
|
||||||
// We found the right bar !
|
// We found the right bar !
|
||||||
if (Menu_bars[current_menu].Last_button_index >= btn_number && (current_menu==0 || Menu_bars[current_menu -1].Last_button_index < btn_number))
|
if (Menu_bars[current_menu].Last_button_index >= btn_number &&
|
||||||
|
(current_menu==0 || Menu_bars[current_menu -1].Last_button_index < btn_number))
|
||||||
{
|
{
|
||||||
visible = 1;
|
|
||||||
break;
|
|
||||||
} else
|
|
||||||
// We missed the bar, it's hidden ! But we still need to draw in the skin...
|
|
||||||
if (Menu_bars[current_menu].Last_button_index > btn_number)
|
|
||||||
{
|
|
||||||
current_menu--; // We can't enter the if with current_menu=0, so that's ok.
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
y_off = Menu_height - y_off;
|
|
||||||
|
|
||||||
start_x=Buttons_Pool[btn_number].X_offset;
|
start_x=Buttons_Pool[btn_number].X_offset;
|
||||||
start_y=Buttons_Pool[btn_number].Y_offset + y_off;
|
start_y=Buttons_Pool[btn_number].Y_offset;
|
||||||
end_x =start_x+Buttons_Pool[btn_number].Width;
|
end_x =start_x+Buttons_Pool[btn_number].Width;
|
||||||
end_y =start_y+Buttons_Pool[btn_number].Height;
|
end_y =start_y+Buttons_Pool[btn_number].Height;
|
||||||
|
|
||||||
@ -273,66 +259,66 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
|
|||||||
break;
|
break;
|
||||||
case BUTTON_SHAPE_RECTANGLE :
|
case BUTTON_SHAPE_RECTANGLE :
|
||||||
// On colorie le point haut droit
|
// On colorie le point haut droit
|
||||||
Pixel_in_menu_and_skin(end_x,start_y,color_diagonal);
|
Pixel_in_menu_and_skin(current_menu, end_x, start_y, color_diagonal);
|
||||||
// On colorie le point bas gauche
|
// On colorie le point bas gauche
|
||||||
Pixel_in_menu_and_skin(start_x,end_y,color_diagonal);
|
Pixel_in_menu_and_skin(current_menu, start_x, end_y, color_diagonal);
|
||||||
// On colorie la partie haute
|
// On colorie la partie haute
|
||||||
for (x_pos=start_x;x_pos<=end_x-1;x_pos++)
|
for (x_pos=start_x;x_pos<=end_x-1;x_pos++)
|
||||||
{
|
{
|
||||||
Pixel_in_menu_and_skin(x_pos,start_y,color_top_left);
|
Pixel_in_menu_and_skin(current_menu, x_pos, start_y, color_top_left);
|
||||||
}
|
}
|
||||||
for (y_pos=start_y+1;y_pos<=end_y-1;y_pos++)
|
for (y_pos=start_y+1;y_pos<=end_y-1;y_pos++)
|
||||||
{
|
{
|
||||||
// On colorie la partie gauche
|
// On colorie la partie gauche
|
||||||
Pixel_in_menu_and_skin(start_x,y_pos,color_top_left);
|
Pixel_in_menu_and_skin(current_menu, start_x, y_pos, color_top_left);
|
||||||
// On colorie la partie droite
|
// On colorie la partie droite
|
||||||
Pixel_in_menu_and_skin(end_x,y_pos,color_bottom_right);
|
Pixel_in_menu_and_skin(current_menu, end_x, y_pos, color_bottom_right);
|
||||||
}
|
}
|
||||||
// On colorie la partie basse
|
// On colorie la partie basse
|
||||||
for (x_pos=start_x+1;x_pos<=end_x;x_pos++)
|
for (x_pos=start_x+1;x_pos<=end_x;x_pos++)
|
||||||
{
|
{
|
||||||
Pixel_in_menu_and_skin(x_pos,end_y,color_bottom_right);
|
Pixel_in_menu_and_skin(current_menu, x_pos, end_y, color_bottom_right);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUTTON_SHAPE_TRIANGLE_TOP_LEFT:
|
case BUTTON_SHAPE_TRIANGLE_TOP_LEFT:
|
||||||
// On colorie le point haut droit
|
// On colorie le point haut droit
|
||||||
Pixel_in_menu_and_skin(end_x,start_y,color_diagonal);
|
Pixel_in_menu_and_skin(current_menu, end_x, start_y, color_diagonal);
|
||||||
// On colorie le point bas gauche
|
// On colorie le point bas gauche
|
||||||
Pixel_in_menu_and_skin(start_x,end_y,color_diagonal);
|
Pixel_in_menu_and_skin(current_menu, start_x, end_y, color_diagonal);
|
||||||
// On colorie le coin haut gauche
|
// On colorie le coin haut gauche
|
||||||
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||||
{
|
{
|
||||||
Pixel_in_menu_and_skin(start_x+x_pos,start_y,color_top_left);
|
Pixel_in_menu_and_skin(current_menu, start_x+x_pos, start_y, color_top_left);
|
||||||
Pixel_in_menu_and_skin(start_x,start_y+x_pos,color_top_left);
|
Pixel_in_menu_and_skin(current_menu, start_x, start_y+x_pos, color_top_left);
|
||||||
}
|
}
|
||||||
// On colorie la diagonale
|
// On colorie la diagonale
|
||||||
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||||
{
|
{
|
||||||
Pixel_in_menu_and_skin(start_x+x_pos,end_y-x_pos,color_bottom_right);
|
Pixel_in_menu_and_skin(current_menu, start_x+x_pos, end_y-x_pos, color_bottom_right);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT:
|
case BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT:
|
||||||
// On colorie le point haut droit
|
// On colorie le point haut droit
|
||||||
Pixel_in_menu_and_skin(end_x,start_y,color_diagonal);
|
Pixel_in_menu_and_skin(current_menu, end_x, start_y, color_diagonal);
|
||||||
// On colorie le point bas gauche
|
// On colorie le point bas gauche
|
||||||
Pixel_in_menu_and_skin(start_x,end_y,color_diagonal);
|
Pixel_in_menu_and_skin(current_menu, start_x, end_y, color_diagonal);
|
||||||
// On colorie la diagonale
|
// On colorie la diagonale
|
||||||
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||||
{
|
{
|
||||||
Pixel_in_menu_and_skin(start_x+x_pos,end_y-x_pos,color_top_left);
|
Pixel_in_menu_and_skin(current_menu, start_x+x_pos, end_y-x_pos, color_top_left);
|
||||||
}
|
}
|
||||||
// On colorie le coin bas droite
|
// On colorie le coin bas droite
|
||||||
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||||
{
|
{
|
||||||
Pixel_in_menu_and_skin(end_x-x_pos,end_y,color_bottom_right);
|
Pixel_in_menu_and_skin(current_menu, end_x-x_pos, end_y, color_bottom_right);
|
||||||
Pixel_in_menu_and_skin(end_x,end_y-x_pos,color_bottom_right);
|
Pixel_in_menu_and_skin(current_menu, end_x, end_y-x_pos, color_bottom_right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Menu_is_visible && visible)
|
if (Menu_is_visible && Menu_bars[current_menu].Visible)
|
||||||
{
|
{
|
||||||
Update_rect(
|
Update_rect(
|
||||||
start_x*Menu_factor_X,
|
start_x*Menu_factor_X,
|
||||||
start_y*Menu_factor_Y + Menu_Y,
|
(start_y+Menu_bars[current_menu].Top)*Menu_factor_Y + Menu_Y,
|
||||||
(end_x+1-start_x)*Menu_factor_X,
|
(end_x+1-start_x)*Menu_factor_X,
|
||||||
(end_y+1-start_y)*Menu_factor_Y);
|
(end_y+1-start_y)*Menu_factor_Y);
|
||||||
}
|
}
|
||||||
|
|||||||
8
global.h
8
global.h
@ -165,8 +165,6 @@ GFX2_GLOBAL short Paintbrush_offset_Y;
|
|||||||
|
|
||||||
/// On the screen, draw a point.
|
/// On the screen, draw a point.
|
||||||
GFX2_GLOBAL Func_pixel Pixel;
|
GFX2_GLOBAL Func_pixel Pixel;
|
||||||
/// On screen, draw a point in the menu (do nothing is menu is hidden).
|
|
||||||
GFX2_GLOBAL Func_pixel Pixel_in_menu;
|
|
||||||
/// Test a pixel color from screen.
|
/// Test a pixel color from screen.
|
||||||
GFX2_GLOBAL Func_read Read_pixel;
|
GFX2_GLOBAL Func_read Read_pixel;
|
||||||
/// Redraw all screen, without overwriting the menu.
|
/// Redraw all screen, without overwriting the menu.
|
||||||
@ -479,9 +477,9 @@ GFX2_GLOBAL word Menu_palette_cell_width;
|
|||||||
GFX2_GLOBAL T_Menu_Bar Menu_bars[MENUBAR_COUNT]
|
GFX2_GLOBAL T_Menu_Bar Menu_bars[MENUBAR_COUNT]
|
||||||
#ifdef GLOBAL_VARIABLES
|
#ifdef GLOBAL_VARIABLES
|
||||||
=
|
=
|
||||||
{{MENU_WIDTH, 9, 1, NULL, 20, BUTTON_HIDE }, // Status
|
{{MENU_WIDTH, 9, 1, 35, NULL, 20, BUTTON_HIDE }, // Status
|
||||||
{MENU_WIDTH, 10, 0, NULL, 144, BUTTON_LAYER_SELECT }, // Layers
|
{MENU_WIDTH, 10, 0, 35, NULL, 144, BUTTON_LAYER_SELECT }, // Layers
|
||||||
{MENU_WIDTH, 35, 1, NULL, 254, BUTTON_CHOOSE_COL }} // Main
|
{MENU_WIDTH, 35, 1, 0, NULL, 254, BUTTON_CHOOSE_COL }} // Main
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
2
init.c
2
init.c
@ -1321,7 +1321,7 @@ void Init_buttons(void)
|
|||||||
0,0,
|
0,0,
|
||||||
16,9,
|
16,9,
|
||||||
BUTTON_SHAPE_RECTANGLE,
|
BUTTON_SHAPE_RECTANGLE,
|
||||||
Button_Show_layerbar, Button_Hide_menu,
|
Button_Toggle_layerbar, Button_Toggle_toolbox,
|
||||||
Do_nothing,
|
Do_nothing,
|
||||||
FAMILY_TOOLBAR);
|
FAMILY_TOOLBAR);
|
||||||
}
|
}
|
||||||
|
|||||||
1
main.c
1
main.c
@ -465,7 +465,6 @@ int Init_program(int argc,char * argv[])
|
|||||||
Quit_is_required=0;
|
Quit_is_required=0;
|
||||||
Quitting=0;
|
Quitting=0;
|
||||||
// Données sur l'état du menu:
|
// Données sur l'état du menu:
|
||||||
Pixel_in_menu=Pixel_in_toolbar;
|
|
||||||
Menu_is_visible=1;
|
Menu_is_visible=1;
|
||||||
Menu_height=MENU_HEIGHT;
|
Menu_height=MENU_HEIGHT;
|
||||||
// Données sur les couleurs et la palette:
|
// Données sur les couleurs et la palette:
|
||||||
|
|||||||
1
struct.h
1
struct.h
@ -469,6 +469,7 @@ typedef struct {
|
|||||||
word Width;
|
word Width;
|
||||||
word Height;
|
word Height;
|
||||||
byte Visible;
|
byte Visible;
|
||||||
|
word Top; ///< Relative to the top line of the menu, hidden bars don't count.
|
||||||
byte* Skin;
|
byte* Skin;
|
||||||
word Skin_width;
|
word Skin_width;
|
||||||
byte Last_button_index;
|
byte Last_button_index;
|
||||||
|
|||||||
67
windows.c
67
windows.c
@ -56,14 +56,21 @@ word Palette_cells_Y()
|
|||||||
return Menu_cells_Y;
|
return Menu_cells_Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affichage d'un pixel dans le menu (le menu doit être visible)
|
// Affichage d'un pixel dans le menu (si visible)
|
||||||
void Pixel_in_toolbar(word x,word y,byte color)
|
void Pixel_in_menu(word bar, word x, word y, byte color)
|
||||||
{
|
{
|
||||||
Block(x*Menu_factor_X,(y*Menu_factor_Y)+Menu_Y,Menu_factor_X,Menu_factor_Y,color);
|
if (Menu_is_visible && Menu_bars[bar].Visible)
|
||||||
|
Block(x*Menu_factor_X,(y+Menu_bars[bar].Top)*Menu_factor_Y+Menu_Y,Menu_factor_X,Menu_factor_Y,color);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Affichage d'un pixel dans le menu et met a jour la bitmap de skin
|
||||||
|
void Pixel_in_menu_and_skin(word bar, word x, word y, byte color)
|
||||||
|
{
|
||||||
|
Pixel_in_menu(bar, x, y, color);
|
||||||
|
Menu_bars[bar].Skin[y*Menu_bars[bar].Skin_width + x] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affichage d'un pixel dans la fenêtre (la fenêtre doit être visible)
|
// Affichage d'un pixel dans la fenêtre (la fenêtre doit être visible)
|
||||||
|
|
||||||
void Pixel_in_window(word x,word y,byte color)
|
void Pixel_in_window(word x,word y,byte color)
|
||||||
{
|
{
|
||||||
Block((x*Menu_factor_X)+Window_pos_X,(y*Menu_factor_Y)+Window_pos_Y,Menu_factor_X,Menu_factor_Y,color);
|
Block((x*Menu_factor_X)+Window_pos_X,(y*Menu_factor_Y)+Window_pos_Y,Menu_factor_X,Menu_factor_Y,color);
|
||||||
@ -155,7 +162,7 @@ void Window_display_frame(word x_pos,word y_pos,word width,word height)
|
|||||||
|
|
||||||
void Display_foreback(void)
|
void Display_foreback(void)
|
||||||
{
|
{
|
||||||
if (Menu_is_visible)
|
if (Menu_is_visible && Menu_bars[MENUBAR_TOOLS].Visible)
|
||||||
{
|
{
|
||||||
Block((MENU_WIDTH-17)*Menu_factor_X,Menu_Y+Menu_factor_Y,Menu_factor_X<<4,Menu_factor_Y*7,Back_color);
|
Block((MENU_WIDTH-17)*Menu_factor_X,Menu_Y+Menu_factor_Y,Menu_factor_X<<4,Menu_factor_Y*7,Back_color);
|
||||||
Block((MENU_WIDTH-13)*Menu_factor_X,Menu_Y+(Menu_factor_Y<<1),Menu_factor_X<<3,Menu_factor_Y*5,Fore_color);
|
Block((MENU_WIDTH-13)*Menu_factor_X,Menu_Y+(Menu_factor_Y<<1),Menu_factor_X<<3,Menu_factor_Y*5,Fore_color);
|
||||||
@ -226,6 +233,9 @@ void Frame_menu_color(byte id)
|
|||||||
word cell_height=Menu_bars[MENUBAR_TOOLS].Height/Menu_cells_Y;
|
word cell_height=Menu_bars[MENUBAR_TOOLS].Height/Menu_cells_Y;
|
||||||
byte color;
|
byte color;
|
||||||
|
|
||||||
|
if (! Menu_bars[MENUBAR_TOOLS].Visible)
|
||||||
|
return;
|
||||||
|
|
||||||
if (id==Fore_color)
|
if (id==Fore_color)
|
||||||
color = MC_White;
|
color = MC_White;
|
||||||
else if (id==Back_color)
|
else if (id==Back_color)
|
||||||
@ -313,7 +323,7 @@ void Display_menu_palette(void)
|
|||||||
byte cell_height=Menu_bars[MENUBAR_TOOLS].Height/Menu_cells_Y;
|
byte cell_height=Menu_bars[MENUBAR_TOOLS].Height/Menu_cells_Y;
|
||||||
// width: Menu_palette_cell_width
|
// width: Menu_palette_cell_width
|
||||||
|
|
||||||
if (Menu_is_visible)
|
if (Menu_is_visible && Menu_bars[MENUBAR_TOOLS].Visible)
|
||||||
{
|
{
|
||||||
Block(
|
Block(
|
||||||
Menu_bars[MENUBAR_TOOLS].Width*Menu_factor_X,
|
Menu_bars[MENUBAR_TOOLS].Width*Menu_factor_X,
|
||||||
@ -437,22 +447,20 @@ int Pick_color_in_palette()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Draws a solid textured area, to the right of a toolbar.
|
/// Draws a solid textured area, to the right of a toolbar.
|
||||||
void Draw_bar_remainder(word current_menu, word x_off, word y_off)
|
void Draw_bar_remainder(word current_menu, word x_off)
|
||||||
{
|
{
|
||||||
word y_pos;
|
word y_pos;
|
||||||
word x_pos;
|
word x_pos;
|
||||||
|
|
||||||
for (y_pos=0;y_pos<Menu_bars[current_menu].Height;y_pos++)
|
for (y_pos=0;y_pos<Menu_bars[current_menu].Height;y_pos++)
|
||||||
for (x_pos=x_off;x_pos<Screen_width/Menu_factor_X;x_pos++)
|
for (x_pos=x_off;x_pos<Screen_width/Menu_factor_X;x_pos++)
|
||||||
Pixel_in_menu(x_pos, y_pos + y_off, Menu_bars[current_menu].Skin[y_pos * Menu_bars[current_menu].Skin_width + Menu_bars[current_menu].Skin_width - 2 + (x_pos&1)]);
|
Pixel_in_menu(current_menu, x_pos, y_pos, Menu_bars[current_menu].Skin[y_pos * Menu_bars[current_menu].Skin_width + Menu_bars[current_menu].Skin_width - 2 + (x_pos&1)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Display / update the layer menubar
|
/// Display / update the layer menubar
|
||||||
void Display_layerbar(void)
|
void Display_layerbar(void)
|
||||||
{
|
{
|
||||||
word current_menu;
|
|
||||||
word y_off=0;
|
|
||||||
word x_off=0;
|
word x_off=0;
|
||||||
word button_width = LAYER_SPRITE_WIDTH;
|
word button_width = LAYER_SPRITE_WIDTH;
|
||||||
word button_number = Main_backups->Pages->Nb_layers;
|
word button_number = Main_backups->Pages->Nb_layers;
|
||||||
@ -463,14 +471,6 @@ void Display_layerbar(void)
|
|||||||
if (! Menu_bars[MENUBAR_LAYERS].Visible)
|
if (! Menu_bars[MENUBAR_LAYERS].Visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Find top
|
|
||||||
for (current_menu = MENUBAR_COUNT - 1; current_menu > MENUBAR_LAYERS; current_menu --)
|
|
||||||
{
|
|
||||||
if(Menu_bars[current_menu].Visible)
|
|
||||||
{
|
|
||||||
y_off += Menu_bars[current_menu].Height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Available space in pixels
|
// Available space in pixels
|
||||||
horiz_space = Screen_width / Menu_factor_X - Menu_bars[MENUBAR_LAYERS].Skin_width;
|
horiz_space = Screen_width / Menu_factor_X - Menu_bars[MENUBAR_LAYERS].Skin_width;
|
||||||
|
|
||||||
@ -518,7 +518,7 @@ void Display_layerbar(void)
|
|||||||
|
|
||||||
for (;i>0; i--)
|
for (;i>0; i--)
|
||||||
{
|
{
|
||||||
Pixel_in_menu(x_pos + x_off, y_pos + y_off, Gfx->Layer_sprite[sprite_index][current_button][y_pos][source_x]);
|
Pixel_in_menu(MENUBAR_LAYERS, x_pos + x_off, y_pos, Gfx->Layer_sprite[sprite_index][current_button][y_pos][source_x]);
|
||||||
x_pos++;
|
x_pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -530,7 +530,7 @@ void Display_layerbar(void)
|
|||||||
}
|
}
|
||||||
// Texture any remaining space to the right.
|
// Texture any remaining space to the right.
|
||||||
// This overwrites any junk like deleted buttons.
|
// This overwrites any junk like deleted buttons.
|
||||||
Draw_bar_remainder(MENUBAR_LAYERS, x_off, y_off);
|
Draw_bar_remainder(MENUBAR_LAYERS, x_off);
|
||||||
|
|
||||||
// Update the active area of the layers pseudo-button
|
// Update the active area of the layers pseudo-button
|
||||||
Buttons_Pool[BUTTON_LAYER_SELECT].Width = button_number * button_width;
|
Buttons_Pool[BUTTON_LAYER_SELECT].Width = button_number * button_width;
|
||||||
@ -541,7 +541,7 @@ void Display_layerbar(void)
|
|||||||
// A screen refresh required by some callers
|
// A screen refresh required by some callers
|
||||||
Update_rect(
|
Update_rect(
|
||||||
Menu_bars[MENUBAR_LAYERS].Skin_width,
|
Menu_bars[MENUBAR_LAYERS].Skin_width,
|
||||||
Menu_Y+y_off*Menu_factor_Y,
|
Menu_Y+Menu_bars[MENUBAR_LAYERS].Top*Menu_factor_Y,
|
||||||
horiz_space*Menu_factor_X,
|
horiz_space*Menu_factor_X,
|
||||||
Menu_bars[MENUBAR_LAYERS].Height*Menu_factor_Y);
|
Menu_bars[MENUBAR_LAYERS].Height*Menu_factor_Y);
|
||||||
}
|
}
|
||||||
@ -551,7 +551,7 @@ void Display_layerbar(void)
|
|||||||
void Display_menu(void)
|
void Display_menu(void)
|
||||||
{
|
{
|
||||||
word x_pos;
|
word x_pos;
|
||||||
word y_pos, y_off = 0;
|
word y_pos;
|
||||||
int8_t current_menu;
|
int8_t current_menu;
|
||||||
char str[4];
|
char str[4];
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ void Display_menu(void)
|
|||||||
// Skinned area
|
// Skinned area
|
||||||
for (y_pos=0;y_pos<Menu_bars[current_menu].Height;y_pos++)
|
for (y_pos=0;y_pos<Menu_bars[current_menu].Height;y_pos++)
|
||||||
for (x_pos=0;x_pos<Menu_bars[current_menu].Skin_width;x_pos++)
|
for (x_pos=0;x_pos<Menu_bars[current_menu].Skin_width;x_pos++)
|
||||||
Pixel_in_menu(x_pos, y_pos + y_off, Menu_bars[current_menu].Skin[y_pos * Menu_bars[current_menu].Skin_width + x_pos]);
|
Pixel_in_menu(current_menu, x_pos, y_pos, Menu_bars[current_menu].Skin[y_pos * Menu_bars[current_menu].Skin_width + x_pos]);
|
||||||
|
|
||||||
if (current_menu == MENUBAR_LAYERS)
|
if (current_menu == MENUBAR_LAYERS)
|
||||||
{
|
{
|
||||||
@ -577,11 +577,10 @@ void Display_menu(void)
|
|||||||
{
|
{
|
||||||
// If some area is remaining to the right, texture it with a copy of
|
// If some area is remaining to the right, texture it with a copy of
|
||||||
// the last two columns
|
// the last two columns
|
||||||
Draw_bar_remainder(current_menu, Menu_bars[current_menu].Skin_width, y_off);
|
Draw_bar_remainder(current_menu, Menu_bars[current_menu].Skin_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next bar
|
// Next bar
|
||||||
y_off += Menu_bars[current_menu].Height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1193,11 +1192,11 @@ void Display_sprite_in_menu(int btn_number,int sprite_number)
|
|||||||
for (x_pos=0;x_pos<MENU_SPRITE_WIDTH;x_pos++)
|
for (x_pos=0;x_pos<MENU_SPRITE_WIDTH;x_pos++)
|
||||||
{
|
{
|
||||||
color=Gfx->Menu_sprite[sprite_number][y_pos][x_pos];
|
color=Gfx->Menu_sprite[sprite_number][y_pos][x_pos];
|
||||||
Pixel_in_menu(menu_x_pos+x_pos,menu_y_pos+y_pos,color);
|
Pixel_in_menu_and_skin(MENUBAR_TOOLS, menu_x_pos+x_pos, menu_y_pos+y_pos, color);
|
||||||
Gfx->Menu_block[menu_y_pos+y_pos][menu_x_pos+x_pos]=color;
|
|
||||||
}
|
}
|
||||||
|
if (Menu_is_visible && Menu_bars[MENUBAR_TOOLS].Visible)
|
||||||
Update_rect(Menu_factor_X*(Buttons_Pool[btn_number].X_offset+1),
|
Update_rect(Menu_factor_X*(Buttons_Pool[btn_number].X_offset+1),
|
||||||
(Buttons_Pool[btn_number].Y_offset+1)*Menu_factor_Y+Menu_Y,
|
(Buttons_Pool[btn_number].Y_offset+1+Menu_bars[MENUBAR_TOOLS].Top)*Menu_factor_Y+Menu_Y,
|
||||||
MENU_SPRITE_WIDTH*Menu_factor_X,MENU_SPRITE_HEIGHT*Menu_factor_Y);
|
MENU_SPRITE_WIDTH*Menu_factor_X,MENU_SPRITE_HEIGHT*Menu_factor_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1219,8 +1218,7 @@ void Display_paintbrush_in_menu(void)
|
|||||||
for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++)
|
for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++)
|
||||||
{
|
{
|
||||||
color=Gfx->Menu_sprite[4][y_pos][x_pos];
|
color=Gfx->Menu_sprite[4][y_pos][x_pos];
|
||||||
Pixel_in_menu(menu_x_pos,menu_y_pos,color);
|
Pixel_in_menu_and_skin(MENUBAR_TOOLS, menu_x_pos, menu_y_pos, color);
|
||||||
Gfx->Menu_block[menu_y_pos][menu_x_pos]=color;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default : // Pinceau
|
default : // Pinceau
|
||||||
@ -1228,8 +1226,7 @@ void Display_paintbrush_in_menu(void)
|
|||||||
for (menu_y_pos=2,y_pos=0;y_pos<MENU_SPRITE_HEIGHT;menu_y_pos++,y_pos++)
|
for (menu_y_pos=2,y_pos=0;y_pos<MENU_SPRITE_HEIGHT;menu_y_pos++,y_pos++)
|
||||||
for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++)
|
for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++)
|
||||||
{
|
{
|
||||||
Pixel_in_menu(menu_x_pos,menu_y_pos,MC_Light);
|
Pixel_in_menu_and_skin(MENUBAR_TOOLS, menu_x_pos, menu_y_pos, MC_Light);
|
||||||
Gfx->Menu_block[menu_y_pos][menu_x_pos]=MC_Light;
|
|
||||||
}
|
}
|
||||||
// On affiche le nouveau
|
// On affiche le nouveau
|
||||||
menu_start_x=8-Paintbrush_offset_X;
|
menu_start_x=8-Paintbrush_offset_X;
|
||||||
@ -1254,11 +1251,11 @@ void Display_paintbrush_in_menu(void)
|
|||||||
for (menu_x_pos=menu_start_x,x_pos=start_x;((x_pos<Paintbrush_width) && (menu_x_pos<15));menu_x_pos++,x_pos++)
|
for (menu_x_pos=menu_start_x,x_pos=start_x;((x_pos<Paintbrush_width) && (menu_x_pos<15));menu_x_pos++,x_pos++)
|
||||||
{
|
{
|
||||||
color=(Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos])?MC_Black:MC_Light;
|
color=(Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos])?MC_Black:MC_Light;
|
||||||
Pixel_in_menu(menu_x_pos,menu_y_pos,color);
|
Pixel_in_menu_and_skin(MENUBAR_TOOLS, menu_x_pos, menu_y_pos, color);
|
||||||
Gfx->Menu_block[menu_y_pos][menu_x_pos]=color;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Update_rect(0,Menu_Y,MENU_SPRITE_WIDTH*Menu_factor_X+3,MENU_SPRITE_HEIGHT*Menu_factor_Y+3);
|
if (Menu_is_visible && Menu_bars[MENUBAR_TOOLS].Visible)
|
||||||
|
Update_rect(0,Menu_Y + Menu_bars[MENUBAR_TOOLS].Top*Menu_factor_Y,MENU_SPRITE_WIDTH*Menu_factor_X+3,MENU_SPRITE_HEIGHT*Menu_factor_Y+3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Dessiner un pinceau prédéfini dans la fenêtre --
|
// -- Dessiner un pinceau prédéfini dans la fenêtre --
|
||||||
|
|||||||
@ -49,7 +49,8 @@ void Compute_magnifier_data(void);
|
|||||||
void Compute_limits(void);
|
void Compute_limits(void);
|
||||||
void Compute_paintbrush_coordinates(void);
|
void Compute_paintbrush_coordinates(void);
|
||||||
|
|
||||||
void Pixel_in_toolbar(word x,word y,byte color);
|
void Pixel_in_menu(word bar, word x, word y, byte color);
|
||||||
|
void Pixel_in_menu_and_skin(word bar, word x, word y, byte color);
|
||||||
void Pixel_in_window(word x,word y,byte color);
|
void Pixel_in_window(word x,word y,byte color);
|
||||||
void Set_fore_color(byte color);
|
void Set_fore_color(byte color);
|
||||||
void Set_back_color(byte color);
|
void Set_back_color(byte color);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user