Changed skin format to allow skinmakers to provide 'selected' versions of buttons. Still slightly buggy
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1495 416bcca6-2ee7-4201-b75f-2eb2f807beb1
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 26 KiB |
BIN
share/grafx2/skins/skin_Clax2.gif
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
share/grafx2/skins/skin_Clax3.gif
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
share/grafx2/skins/skin_Clax4.gif
Normal file
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 19 KiB |
@ -208,7 +208,7 @@ void Button_Undo(void)
|
||||
|
||||
Display_all_screen();
|
||||
Unselect_button(BUTTON_UNDO);
|
||||
Draw_menu_button_frame(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
||||
Display_menu();
|
||||
Display_cursor();
|
||||
}
|
||||
@ -223,7 +223,7 @@ void Button_Redo(void)
|
||||
|
||||
Display_all_screen();
|
||||
Unselect_button(BUTTON_UNDO);
|
||||
Draw_menu_button_frame(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
||||
Display_menu();
|
||||
Display_cursor();
|
||||
}
|
||||
@ -1558,7 +1558,7 @@ void Button_Page(void)
|
||||
Compute_optimal_menu_colors(Main_palette);
|
||||
Display_all_screen();
|
||||
Unselect_button(BUTTON_PAGE);
|
||||
Draw_menu_button_frame(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
||||
Display_menu();
|
||||
|
||||
Display_cursor();
|
||||
@ -1754,7 +1754,7 @@ void Button_Kill(void)
|
||||
|
||||
Display_all_screen();
|
||||
Unselect_button(BUTTON_KILL);
|
||||
Draw_menu_button_frame(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
||||
Display_menu();
|
||||
Display_cursor();
|
||||
}
|
||||
@ -2224,13 +2224,31 @@ void Button_Draw(void)
|
||||
|
||||
void Button_Draw_switch_mode(void)
|
||||
{
|
||||
char icon;
|
||||
|
||||
/* ANCIEN CODE SANS POPUPS */
|
||||
Selected_freehand_mode++;
|
||||
if (Selected_freehand_mode>OPERATION_FILLED_CONTOUR)
|
||||
Selected_freehand_mode=OPERATION_CONTINUOUS_DRAW;
|
||||
|
||||
Hide_cursor();
|
||||
Display_sprite_in_menu(BUTTON_DRAW,Selected_freehand_mode);
|
||||
switch(Selected_freehand_mode)
|
||||
{
|
||||
default:
|
||||
case OPERATION_CONTINUOUS_DRAW:
|
||||
icon=-1;
|
||||
break;
|
||||
case OPERATION_DISCONTINUOUS_DRAW:
|
||||
icon=MENU_SPRITE_DISCONTINUOUS_DRAW;
|
||||
break;
|
||||
case OPERATION_POINT_DRAW:
|
||||
icon=MENU_SPRITE_POINT_DRAW;
|
||||
break;
|
||||
case OPERATION_FILLED_CONTOUR:
|
||||
icon=MENU_SPRITE_CONTOUR_DRAW;
|
||||
break;
|
||||
}
|
||||
Display_sprite_in_menu(BUTTON_DRAW,icon);
|
||||
Start_operation_stack(Selected_freehand_mode);
|
||||
Display_cursor();
|
||||
/* NOUVEAU CODE AVEC POPUP (EN COURS DE TEST) ***
|
||||
@ -2258,7 +2276,7 @@ void Button_Draw_switch_mode(void)
|
||||
while (Mouse_K);
|
||||
|
||||
Close_popup();
|
||||
Display_sprite_in_menu(BUTTON_DRAW,Selected_freehand_mode);
|
||||
//Display_sprite_in_menu(BUTTON_DRAW,Selected_freehand_mode+2);
|
||||
Start_operation_stack(Selected_freehand_mode);
|
||||
Display_cursor();
|
||||
*/
|
||||
@ -3087,9 +3105,9 @@ void Load_picture(byte image)
|
||||
{
|
||||
if (Main_magnifier_mode)
|
||||
{
|
||||
Draw_menu_button_frame(BUTTON_MAGNIFIER,0);
|
||||
Pixel_preview=Pixel_preview_normal;
|
||||
Main_magnifier_mode=0;
|
||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
||||
}
|
||||
|
||||
new_mode=Best_video_mode();
|
||||
@ -3190,9 +3208,9 @@ void Button_Reload(void)
|
||||
{
|
||||
if (Main_magnifier_mode)
|
||||
{
|
||||
Draw_menu_button_frame(BUTTON_MAGNIFIER,0);
|
||||
Pixel_preview=Pixel_preview_normal;
|
||||
Main_magnifier_mode=0;
|
||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
||||
}
|
||||
|
||||
new_mode=Best_video_mode();
|
||||
@ -3427,18 +3445,33 @@ void Button_Lines(void)
|
||||
|
||||
void Button_Lines_switch_mode(void)
|
||||
{
|
||||
char icon;
|
||||
|
||||
if (Selected_line_mode==OPERATION_LINE)
|
||||
Selected_line_mode=OPERATION_K_LIGNE;
|
||||
Selected_line_mode=OPERATION_K_LINE;
|
||||
else
|
||||
{
|
||||
if (Selected_line_mode==OPERATION_K_LIGNE)
|
||||
if (Selected_line_mode==OPERATION_K_LINE)
|
||||
Selected_line_mode=OPERATION_CENTERED_LINES;
|
||||
else
|
||||
Selected_line_mode=OPERATION_LINE;
|
||||
}
|
||||
switch(Selected_line_mode)
|
||||
{
|
||||
default:
|
||||
case OPERATION_LINE:
|
||||
icon=-1;
|
||||
break;
|
||||
case OPERATION_K_LINE:
|
||||
icon=MENU_SPRITE_K_LINE;
|
||||
break;
|
||||
case OPERATION_CENTERED_LINES:
|
||||
icon=MENU_SPRITE_CENTERED_LINES;
|
||||
break;
|
||||
}
|
||||
|
||||
Hide_cursor();
|
||||
Display_sprite_in_menu(BUTTON_LINES,Selected_line_mode-OPERATION_LINE+7);
|
||||
Display_sprite_in_menu(BUTTON_LINES,icon);
|
||||
Start_operation_stack(Selected_line_mode);
|
||||
Display_cursor();
|
||||
}
|
||||
@ -3898,7 +3931,7 @@ void Button_Curves_switch_mode(void)
|
||||
Selected_curve_mode=OPERATION_4_POINTS_CURVE;
|
||||
|
||||
Hide_cursor();
|
||||
Display_sprite_in_menu(BUTTON_CURVES,Selected_curve_mode-OPERATION_3_POINTS_CURVE+5);
|
||||
Display_sprite_in_menu(BUTTON_CURVES,Selected_curve_mode==OPERATION_4_POINTS_CURVE?MENU_SPRITE_4_POINTS_CURVE:-1);
|
||||
Start_operation_stack(Selected_curve_mode);
|
||||
Display_cursor();
|
||||
}
|
||||
@ -4318,11 +4351,11 @@ void Display_effect_sprite(short sprite_number, short start_x, short start_y)
|
||||
{
|
||||
short x,y,x_pos,y_pos;
|
||||
|
||||
for (y=0,y_pos=start_y;y<MENU_SPRITE_HEIGHT;y++,y_pos++)
|
||||
for (x=0,x_pos=start_x;x<MENU_SPRITE_WIDTH;x++,x_pos++)
|
||||
for (y=0,y_pos=start_y;y<EFFECT_SPRITE_HEIGHT;y++,y_pos++)
|
||||
for (x=0,x_pos=start_x;x<EFFECT_SPRITE_WIDTH;x++,x_pos++)
|
||||
Pixel_in_window(x_pos,y_pos,Gfx->Effect_sprite[sprite_number][y][x]);
|
||||
|
||||
Update_rect(ToWinX(start_x),ToWinY(start_y),MENU_SPRITE_WIDTH*Menu_factor_X,MENU_SPRITE_HEIGHT*Menu_factor_Y);
|
||||
Update_rect(ToWinX(start_x),ToWinY(start_y),EFFECT_SPRITE_WIDTH*Menu_factor_X,EFFECT_SPRITE_HEIGHT*Menu_factor_Y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
27
src/const.h
@ -45,9 +45,10 @@
|
||||
#define CURSOR_SPRITE_WIDTH 15 ///< Width of a mouse cursor sprite.
|
||||
#define CURSOR_SPRITE_HEIGHT 15 ///< Height of a mouse cursor sprite.
|
||||
#define NB_EFFECTS_SPRITES 9 ///< Number of effect sprites.
|
||||
#define NB_MENU_SPRITES 20 ///< Number of menu sprites.
|
||||
#define MENU_SPRITE_WIDTH 14 ///< Width of a menu sprite in pixels
|
||||
#define MENU_SPRITE_HEIGHT 14 ///< Height of a menu sprite in pixels
|
||||
#define MENU_SPRITE_WIDTH 16 ///< Width of a menu sprite in pixels
|
||||
#define MENU_SPRITE_HEIGHT 16 ///< Height of a menu sprite in pixels
|
||||
#define EFFECT_SPRITE_WIDTH 14 ///< Width of an effect sprite in pixels
|
||||
#define EFFECT_SPRITE_HEIGHT 14 ///< Height of an effect sprite in pixels
|
||||
#define LAYER_SPRITE_WIDTH 14 ///< Width of a layer button in pixels
|
||||
#define LAYER_SPRITE_HEIGHT 10 ///< Height of a layer button in pixels
|
||||
#define PAINTBRUSH_WIDTH 16 ///< Width of a preset paintbrush sprite
|
||||
@ -327,6 +328,24 @@ enum BUTTON_NUMBERS
|
||||
NB_BUTTONS ///< Number of buttons in the menu bar.
|
||||
};
|
||||
|
||||
enum MENU_SPRITE
|
||||
{
|
||||
MENU_SPRITE_COLOR_BRUSH=0,
|
||||
MENU_SPRITE_MONO_BRUSH,
|
||||
MENU_SPRITE_DISCONTINUOUS_DRAW,
|
||||
MENU_SPRITE_POINT_DRAW,
|
||||
MENU_SPRITE_CONTOUR_DRAW,
|
||||
MENU_SPRITE_4_POINTS_CURVE,
|
||||
MENU_SPRITE_K_LINE,
|
||||
MENU_SPRITE_CENTERED_LINES,
|
||||
MENU_SPRITE_ELLIPSES,
|
||||
MENU_SPRITE_POLYFORM,
|
||||
MENU_SPRITE_REPLACE,
|
||||
MENU_SPRITE_GRAD_ELLIPSE,
|
||||
MENU_SPRITE_VERTICAL_PALETTE_SCROLL,
|
||||
NB_MENU_SPRITES ///< Number of menu sprites.
|
||||
};
|
||||
|
||||
///
|
||||
/// Identifiers of special actions that can have a keyboard shortcut.
|
||||
/// They are special in the sense that there's no button in the menu for them,
|
||||
@ -457,7 +476,7 @@ enum OPERATIONS
|
||||
OPERATION_POINT_DRAW, ///< Freehand point-by-point draw
|
||||
OPERATION_FILLED_CONTOUR, ///< Filled contour
|
||||
OPERATION_LINE, ///< Lines
|
||||
OPERATION_K_LIGNE, ///< Linked lines
|
||||
OPERATION_K_LINE, ///< Linked lines
|
||||
OPERATION_CENTERED_LINES, ///< Centered lines
|
||||
OPERATION_EMPTY_RECTANGLE, ///< Empty rectangle
|
||||
OPERATION_FILLED_RECTANGLE, ///< Filled rectangle
|
||||
|
||||
203
src/engine.c
@ -210,19 +210,20 @@ int Button_under_mouse(void)
|
||||
}
|
||||
|
||||
|
||||
///Draw the frame for a menu button
|
||||
void Draw_menu_button_frame(byte btn_number,byte pressed)
|
||||
///Draw a menu button, selected or not
|
||||
void Draw_menu_button(byte btn_number,byte pressed)
|
||||
{
|
||||
byte color_top_left;
|
||||
byte color_bottom_right;
|
||||
byte color_diagonal;
|
||||
word start_x;
|
||||
word start_y;
|
||||
word end_x;
|
||||
word end_y;
|
||||
word width;
|
||||
word height;
|
||||
byte * bitmap;
|
||||
word bitmap_width;
|
||||
word x_pos;
|
||||
word y_pos;
|
||||
byte current_menu;
|
||||
byte color;
|
||||
char icon;
|
||||
|
||||
// Find in which menu the button is
|
||||
for (current_menu = 0; current_menu < MENUBAR_COUNT; current_menu++)
|
||||
@ -235,49 +236,78 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
|
||||
}
|
||||
}
|
||||
|
||||
start_x=Buttons_Pool[btn_number].X_offset;
|
||||
start_y=Buttons_Pool[btn_number].Y_offset;
|
||||
end_x =start_x+Buttons_Pool[btn_number].Width;
|
||||
end_y =start_y+Buttons_Pool[btn_number].Height;
|
||||
start_x = Buttons_Pool[btn_number].X_offset;
|
||||
start_y = Buttons_Pool[btn_number].Y_offset;
|
||||
width = Buttons_Pool[btn_number].Width+1;
|
||||
height = Buttons_Pool[btn_number].Height+1;
|
||||
icon = Buttons_Pool[btn_number].Icon;
|
||||
|
||||
if (icon==-1)
|
||||
{
|
||||
// Standard button
|
||||
bitmap_width = Menu_bars[current_menu].Skin_width;
|
||||
bitmap=&(Menu_bars[current_menu].Skin[pressed][start_y*Menu_bars[current_menu].Skin_width+start_x]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// From Menu_buttons
|
||||
bitmap_width = MENU_SPRITE_WIDTH;
|
||||
bitmap=Gfx->Menu_sprite[pressed][(byte)icon][0];
|
||||
// For bottom right: offset +1,+1
|
||||
if (Buttons_Pool[btn_number].Shape==BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT)
|
||||
bitmap += MENU_SPRITE_WIDTH+1;
|
||||
}
|
||||
|
||||
switch(Buttons_Pool[btn_number].Shape)
|
||||
{
|
||||
case BUTTON_SHAPE_NO_FRAME :
|
||||
break;
|
||||
case BUTTON_SHAPE_RECTANGLE :
|
||||
for (y_pos=0;y_pos<height;y_pos++)
|
||||
for (x_pos=0;x_pos<width;x_pos++)
|
||||
{
|
||||
color=bitmap[x_pos+y_pos*bitmap_width];
|
||||
Pixel_in_menu_and_skin(current_menu, start_x+x_pos, start_y+y_pos, color);
|
||||
}
|
||||
break;
|
||||
case BUTTON_SHAPE_TRIANGLE_TOP_LEFT:
|
||||
for (y_pos=0;y_pos<15;y_pos++)
|
||||
for (x_pos=0;x_pos<15-y_pos;x_pos++)
|
||||
{
|
||||
color=bitmap[x_pos+y_pos*bitmap_width];
|
||||
Pixel_in_menu_and_skin(current_menu, start_x+x_pos, start_y+y_pos, color);
|
||||
}
|
||||
break;
|
||||
case BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT:
|
||||
for (y_pos=0;y_pos<15;y_pos++)
|
||||
for (x_pos=14-y_pos;x_pos<15;x_pos++)
|
||||
{
|
||||
color=bitmap[(x_pos)+(y_pos)*bitmap_width];
|
||||
Pixel_in_menu_and_skin(current_menu, start_x+x_pos, start_y+y_pos, color);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (Menu_is_visible && Menu_bars[MENUBAR_TOOLS].Visible)
|
||||
Update_rect(Menu_factor_X*(Buttons_Pool[btn_number].X_offset),
|
||||
(Buttons_Pool[btn_number].Y_offset+Menu_bars[MENUBAR_TOOLS].Top)*Menu_factor_Y+Menu_Y,
|
||||
width*Menu_factor_X,height*Menu_factor_Y);
|
||||
|
||||
/*
|
||||
switch (pressed)
|
||||
{
|
||||
default:
|
||||
case BUTTON_RELEASED:
|
||||
if (Gfx->No_outline)
|
||||
{
|
||||
color_top_left=MC_Light;
|
||||
color_bottom_right=MC_Light;
|
||||
color_diagonal=MC_Light;
|
||||
}
|
||||
else
|
||||
{
|
||||
color_top_left=MC_White;
|
||||
color_bottom_right=MC_Dark;
|
||||
color_diagonal=MC_Light;
|
||||
}
|
||||
break;
|
||||
|
||||
case BUTTON_PRESSED:
|
||||
if (Gfx->No_outline)
|
||||
{
|
||||
color_top_left=MC_Dark;
|
||||
color_bottom_right=MC_White;
|
||||
color_diagonal=MC_White;
|
||||
}
|
||||
else
|
||||
{
|
||||
color_top_left=MC_Dark;
|
||||
color_bottom_right=MC_Black;
|
||||
color_diagonal=MC_Dark;
|
||||
}
|
||||
break;
|
||||
|
||||
case BUTTON_HIGHLIGHTED:
|
||||
color_top_left=MC_White;
|
||||
color_bottom_right=MC_Dark;
|
||||
color_diagonal=MC_Light;
|
||||
break;
|
||||
|
||||
case BUTTON_PRESSED:
|
||||
color_top_left=MC_Dark;
|
||||
color_bottom_right=MC_Black;
|
||||
color_diagonal=MC_Black;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(Buttons_Pool[btn_number].Shape)
|
||||
@ -319,19 +349,10 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
|
||||
Pixel_in_menu_and_skin(current_menu, start_x, start_y+x_pos, color_top_left);
|
||||
}
|
||||
// On colorie la diagonale
|
||||
if (Gfx->No_outline)
|
||||
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
if (! Buttons_Pool[btn_number+1].Pressed)
|
||||
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
Pixel_in_menu_and_skin(current_menu, start_x+x_pos+1, 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);
|
||||
}
|
||||
else
|
||||
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
Pixel_in_menu_and_skin(current_menu, start_x+x_pos, end_y-x_pos, color_bottom_right);
|
||||
}
|
||||
break;
|
||||
case BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT:
|
||||
// On colorie le point haut droit
|
||||
@ -339,19 +360,10 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
|
||||
// On colorie le point bas gauche
|
||||
Pixel_in_menu_and_skin(current_menu, start_x, end_y, color_diagonal);
|
||||
// On colorie la diagonale
|
||||
if (Gfx->No_outline)
|
||||
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
if (! Buttons_Pool[btn_number-1].Pressed)
|
||||
for (x_pos=1;x_pos<=Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
Pixel_in_menu_and_skin(current_menu, start_x+x_pos-1, 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);
|
||||
}
|
||||
else
|
||||
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
Pixel_in_menu_and_skin(current_menu, start_x+x_pos, end_y-x_pos, color_top_left);
|
||||
}
|
||||
// On colorie le coin bas droite
|
||||
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
@ -367,6 +379,7 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
|
||||
(end_x+1-start_x)*Menu_factor_X,
|
||||
(end_y+1-start_y)*Menu_factor_Y);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -375,10 +388,10 @@ void Unselect_button(int btn_number)
|
||||
{
|
||||
if (Buttons_Pool[btn_number].Pressed)
|
||||
{
|
||||
// On affiche le cadre autour du bouton de façon à ce qu'il paraisse relâché
|
||||
Draw_menu_button_frame(btn_number,BUTTON_RELEASED);
|
||||
// On considère que le bouton est relâché
|
||||
Buttons_Pool[btn_number].Pressed=BUTTON_RELEASED;
|
||||
// On affiche le cadre autour du bouton de façon à ce qu'il paraisse relâché
|
||||
Draw_menu_button(btn_number,BUTTON_RELEASED);
|
||||
// On appelle le désenclenchement particulier au bouton:
|
||||
Buttons_Pool[btn_number].Unselect_action();
|
||||
}
|
||||
@ -400,17 +413,21 @@ void Select_button(int btn_number,byte click)
|
||||
{
|
||||
case BUTTON_POLYGONS:
|
||||
case BUTTON_POLYFILL:
|
||||
icon=12;break;
|
||||
icon=MENU_SPRITE_POLYFORM;
|
||||
break;
|
||||
case BUTTON_FLOODFILL:
|
||||
icon=14;break;
|
||||
icon=MENU_SPRITE_REPLACE;
|
||||
break;
|
||||
case BUTTON_CIRCLES:
|
||||
case BUTTON_FILLCIRC:
|
||||
icon=10;break;
|
||||
icon=MENU_SPRITE_ELLIPSES;
|
||||
break;
|
||||
case BUTTON_SPHERES:
|
||||
icon=16;break;
|
||||
icon=MENU_SPRITE_GRAD_ELLIPSE;
|
||||
break;
|
||||
}
|
||||
if (icon!=-1)
|
||||
Display_sprite_in_menu(btn_number,icon+(click==RIGHT_SIDE));
|
||||
Display_sprite_in_menu(btn_number,click==RIGHT_SIDE?icon:-1);
|
||||
|
||||
// On note déjà la famille du bouton (La "Famiglia" c'est sacré)
|
||||
family=Buttons_Pool[btn_number].Family;
|
||||
@ -462,8 +479,11 @@ void Select_button(int btn_number,byte click)
|
||||
Unselect_button(b);
|
||||
}
|
||||
|
||||
// On considère que le bouton est enfoncé
|
||||
Buttons_Pool[btn_number].Pressed=BUTTON_PRESSED;
|
||||
|
||||
// On affiche le cadre autour du bouton de façon à ce qu'il paraisse enfoncé
|
||||
Draw_menu_button_frame(btn_number,BUTTON_PRESSED);
|
||||
Draw_menu_button(btn_number, BUTTON_PRESSED);
|
||||
|
||||
Display_cursor();
|
||||
|
||||
@ -474,9 +494,6 @@ void Select_button(int btn_number,byte click)
|
||||
Wait_end_of_click();
|
||||
}
|
||||
|
||||
// On considère que le bouton est enfoncé
|
||||
Buttons_Pool[btn_number].Pressed=BUTTON_PRESSED;
|
||||
|
||||
// Puis on se contente d'appeler l'action correspondant au bouton:
|
||||
if (click==1)
|
||||
Buttons_Pool[btn_number].Left_action();
|
||||
@ -1163,7 +1180,7 @@ void Main_handler(void)
|
||||
if (effect_modified)
|
||||
{
|
||||
Hide_cursor();
|
||||
Draw_menu_button_frame(BUTTON_EFFECTS,
|
||||
Draw_menu_button(BUTTON_EFFECTS,
|
||||
(Shade_mode||Quick_shade_mode||Colorize_mode||Smooth_mode||Tiling_mode||Smear_mode||Stencil_mode||Mask_mode||Sieve_mode||Snap_mode));
|
||||
Display_cursor();
|
||||
}
|
||||
@ -1217,8 +1234,9 @@ void Main_handler(void)
|
||||
// On nettoie les coordonnées
|
||||
Hide_cursor();
|
||||
|
||||
if (Gfx->No_outline && prev_button_number > -1 && !Buttons_Pool[prev_button_number].Pressed)
|
||||
Draw_menu_button_frame(prev_button_number, BUTTON_RELEASED);
|
||||
/*if (Gfx->Hover_effect && prev_button_number > -1 && !Buttons_Pool[prev_button_number].Pressed)
|
||||
Draw_menu_button(prev_button_number, BUTTON_RELEASED);
|
||||
*/
|
||||
|
||||
Block(18*Menu_factor_X,Menu_status_Y,192*Menu_factor_X,Menu_factor_Y<<3,MC_Light);
|
||||
Update_rect(18*Menu_factor_X,Menu_status_Y,192*Menu_factor_X,Menu_factor_Y<<3);
|
||||
@ -1236,13 +1254,15 @@ void Main_handler(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
|
||||
if (Gfx->No_outline && prev_button_number > -1 && !Buttons_Pool[prev_button_number].Pressed)
|
||||
Draw_menu_button_frame(prev_button_number, BUTTON_RELEASED);
|
||||
|
||||
/*if (Gfx->Hover_effect && prev_button_number > -1 && !Buttons_Pool[prev_button_number].Pressed)
|
||||
Draw_menu_button(prev_button_number, BUTTON_RELEASED);
|
||||
*/
|
||||
|
||||
Print_in_menu(Menu_tooltip[button_index],0);
|
||||
|
||||
if (Gfx->No_outline && !Buttons_Pool[button_index].Pressed)
|
||||
Draw_menu_button_frame(button_index, 2 /* BUTTON_HIGHLIGHTED */);
|
||||
/*if (Gfx->Hover_effect && !Buttons_Pool[button_index].Pressed)
|
||||
Draw_menu_button(button_index, BUTTON_HIGHLIGHTED);
|
||||
*/
|
||||
|
||||
Display_cursor();
|
||||
}
|
||||
@ -1302,9 +1322,10 @@ void Main_handler(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
|
||||
if (Gfx->No_outline && prev_button_number > -1 && !Buttons_Pool[prev_button_number].Pressed)
|
||||
Draw_menu_button_frame(prev_button_number, BUTTON_RELEASED);
|
||||
|
||||
/*if (Gfx->Hover_effect && prev_button_number > -1 && !Buttons_Pool[prev_button_number].Pressed)
|
||||
Draw_menu_button(prev_button_number, BUTTON_RELEASED);
|
||||
*/
|
||||
|
||||
if ( (Current_operation!=OPERATION_COLORPICK) && (Current_operation!=OPERATION_REPLACE) )
|
||||
{
|
||||
Print_in_menu("X: Y: ",0);
|
||||
@ -1358,7 +1379,17 @@ void Open_window(word width,word height, const char * title)
|
||||
size_t title_length;
|
||||
|
||||
Hide_cursor();
|
||||
|
||||
|
||||
/*if (Windows_open == 0 && Gfx->Hover_effect)
|
||||
{
|
||||
if (Cursor_in_menu)
|
||||
{
|
||||
int button_index=Button_under_mouse();
|
||||
if (button_index > -1 && !Buttons_Pool[button_index].Pressed)
|
||||
Draw_menu_button(button_index, BUTTON_RELEASED);
|
||||
}
|
||||
}*/
|
||||
|
||||
Windows_open++;
|
||||
|
||||
Window_width=width;
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include "struct.h"
|
||||
|
||||
void Main_handler (void);
|
||||
void Draw_menu_button_frame(byte btn_number,byte pressed);
|
||||
void Draw_menu_button (byte btn_number,byte pressed);
|
||||
void Unselect_button (int btn_number);
|
||||
void Select_button (int btn_number,byte click);
|
||||
void Open_window (word width,word height, const char * title);
|
||||
|
||||
@ -492,9 +492,9 @@ GFX2_GLOBAL word Menu_palette_cell_width;
|
||||
GFX2_GLOBAL T_Menu_Bar Menu_bars[MENUBAR_COUNT]
|
||||
#ifdef GLOBAL_VARIABLES
|
||||
=
|
||||
{{MENU_WIDTH, 9, 1, 45, NULL, 20, BUTTON_HIDE }, // Status
|
||||
{MENU_WIDTH, 10, 1, 35, NULL, 144, BUTTON_LAYER_SELECT }, // Layers
|
||||
{MENU_WIDTH, 35, 1, 0, NULL, 254, BUTTON_CHOOSE_COL }} // Main
|
||||
{{MENU_WIDTH, 9, 1, 45, {NULL,NULL,NULL}, 20, BUTTON_HIDE }, // Status
|
||||
{MENU_WIDTH, 10, 1, 35, {NULL,NULL,NULL}, 144, BUTTON_LAYER_SELECT }, // Layers
|
||||
{MENU_WIDTH, 35, 1, 0, {NULL,NULL,NULL}, 254, BUTTON_CHOOSE_COL }} // Main
|
||||
#endif
|
||||
;
|
||||
|
||||
@ -587,6 +587,7 @@ GFX2_GLOBAL struct
|
||||
word Height; ///< Button's active heigth
|
||||
byte Pressed; ///< Button is currently pressed
|
||||
byte Shape; ///< Shape, listed in enum ::BUTTON_SHAPES
|
||||
char Icon; ///< Which icon to display: Either the one from the toolbar (-1) or one of ::MENU_SPRITE
|
||||
|
||||
// Triggers on mouse/keyboard
|
||||
Func_action Left_action; ///< Action triggered by a left mouseclick on the button
|
||||
|
||||
122
src/init.c
@ -355,35 +355,51 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
|
||||
// Menu
|
||||
if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu"))
|
||||
return 1;
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_block, Menu_bars[MENUBAR_TOOLS].Skin_width, Menu_bars[MENUBAR_TOOLS].Height,"menu",0))
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_block[0], Menu_bars[MENUBAR_TOOLS].Skin_width, Menu_bars[MENUBAR_TOOLS].Height,"menu",0))
|
||||
return 1;
|
||||
|
||||
// Check the skin as "No outline" if the first button
|
||||
// has a grey pixel at top left angle.
|
||||
gfx->No_outline=gfx->Menu_block[1][0]==gfx->Color[2];
|
||||
|
||||
// Preview
|
||||
cursor_x += Menu_bars[MENUBAR_TOOLS].Skin_width;
|
||||
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "preview"))
|
||||
return 1;
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Preview, 173, 16, "logo", 0))
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Preview, 173, 16, "preview", 0))
|
||||
return 1;
|
||||
cursor_y+= Menu_bars[MENUBAR_TOOLS].Height;
|
||||
|
||||
// Layerbar
|
||||
if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "layer bar"))
|
||||
return 1;
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Layerbar_block, Menu_bars[MENUBAR_LAYERS].Skin_width, Menu_bars[MENUBAR_LAYERS].Height,"layer bar",0))
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Layerbar_block[0], Menu_bars[MENUBAR_LAYERS].Skin_width, Menu_bars[MENUBAR_LAYERS].Height,"layer bar",0))
|
||||
return 1;
|
||||
cursor_y+= Menu_bars[MENUBAR_LAYERS].Height;
|
||||
|
||||
// Status bar
|
||||
if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "status bar"))
|
||||
return 1;
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Statusbar_block, Menu_bars[MENUBAR_STATUS].Skin_width, Menu_bars[MENUBAR_STATUS].Height,"status bar",0))
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Statusbar_block[0], Menu_bars[MENUBAR_STATUS].Skin_width, Menu_bars[MENUBAR_STATUS].Height,"status bar",0))
|
||||
return 1;
|
||||
cursor_y+= Menu_bars[MENUBAR_STATUS].Height;
|
||||
|
||||
// Menu (selected)
|
||||
if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "selected menu"))
|
||||
return 1;
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_block[1], Menu_bars[MENUBAR_TOOLS].Skin_width, Menu_bars[MENUBAR_TOOLS].Height,"selected menu",0))
|
||||
return 1;
|
||||
cursor_y+= Menu_bars[MENUBAR_TOOLS].Height;
|
||||
|
||||
// Layerbar (selected)
|
||||
if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "selected layer bar"))
|
||||
return 1;
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Layerbar_block[1], Menu_bars[MENUBAR_LAYERS].Skin_width, Menu_bars[MENUBAR_LAYERS].Height,"selected layer bar",0))
|
||||
return 1;
|
||||
cursor_y+= Menu_bars[MENUBAR_LAYERS].Height;
|
||||
|
||||
// Status bar (selected)
|
||||
if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "selected status bar"))
|
||||
return 1;
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Statusbar_block[1], Menu_bars[MENUBAR_STATUS].Skin_width, Menu_bars[MENUBAR_STATUS].Height,"selected status bar",0))
|
||||
return 1;
|
||||
cursor_y+= Menu_bars[MENUBAR_STATUS].Height;
|
||||
|
||||
// Effects
|
||||
for (i=0; i<NB_EFFECTS_SPRITES; i++)
|
||||
@ -398,11 +414,11 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
|
||||
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "effect sprite"))
|
||||
return 1;
|
||||
}
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Effect_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "effect sprite",0))
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Effect_sprite[i], EFFECT_SPRITE_WIDTH, EFFECT_SPRITE_HEIGHT, "effect sprite",0))
|
||||
return 1;
|
||||
cursor_x+=MENU_SPRITE_WIDTH;
|
||||
cursor_x+=EFFECT_SPRITE_WIDTH;
|
||||
}
|
||||
cursor_y+=MENU_SPRITE_HEIGHT;
|
||||
cursor_y+=EFFECT_SPRITE_HEIGHT;
|
||||
|
||||
// Layer sprite
|
||||
for (j=0; j<3; j++)
|
||||
@ -460,36 +476,31 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
|
||||
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "menu sprite"))
|
||||
return 1;
|
||||
}
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "menu sprite",1))
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_sprite[0][i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "menu sprite",1))
|
||||
return 1;
|
||||
cursor_x+=MENU_SPRITE_WIDTH;
|
||||
}
|
||||
cursor_y+=MENU_SPRITE_HEIGHT;
|
||||
|
||||
// Menu sprites (selected)
|
||||
for (i=0; i<NB_MENU_SPRITES; i++)
|
||||
{
|
||||
if (i==0)
|
||||
{
|
||||
if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "selected menu sprite"))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "selected menu sprite"))
|
||||
return 1;
|
||||
}
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_sprite[1][i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "selected menu sprite",1))
|
||||
return 1;
|
||||
cursor_x+=MENU_SPRITE_WIDTH;
|
||||
}
|
||||
cursor_y+=MENU_SPRITE_HEIGHT;
|
||||
|
||||
// Paintbrushes
|
||||
/*
|
||||
for (i=0; i<NB_PAINTBRUSH_SPRITES; i++)
|
||||
{
|
||||
// Each line holds 12
|
||||
if ((i%12)==0)
|
||||
{
|
||||
if (i!=0)
|
||||
cursor_y+=PAINTBRUSH_HEIGHT;
|
||||
if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "brush icon"))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "brush icon"))
|
||||
return 1;
|
||||
}
|
||||
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, Paintbrush[i].Sprite, PAINTBRUSH_WIDTH, PAINTBRUSH_HEIGHT, "brush icon",2))
|
||||
return 1;
|
||||
cursor_x+=PAINTBRUSH_WIDTH;
|
||||
}
|
||||
cursor_y+=PAINTBRUSH_HEIGHT;
|
||||
*/
|
||||
|
||||
// Drive sprites
|
||||
for (i=0; i<NB_ICON_SPRITES; i++)
|
||||
{
|
||||
@ -614,7 +625,16 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
|
||||
cursor_x+=6;
|
||||
}
|
||||
cursor_y+=8;
|
||||
|
||||
|
||||
// Copy unselected bitmaps to current ones
|
||||
memcpy(gfx->Menu_block[2], gfx->Menu_block[0],
|
||||
Menu_bars[MENUBAR_TOOLS].Skin_width*Menu_bars[MENUBAR_TOOLS].Height);
|
||||
memcpy(gfx->Layerbar_block[2], gfx->Layerbar_block[0],
|
||||
Menu_bars[MENUBAR_LAYERS].Skin_width*Menu_bars[MENUBAR_LAYERS].Height);
|
||||
memcpy(gfx->Statusbar_block[2], gfx->Statusbar_block[0],
|
||||
Menu_bars[MENUBAR_STATUS].Skin_width*Menu_bars[MENUBAR_STATUS].Height);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -757,6 +777,7 @@ void Init_button(byte btn_number,
|
||||
Buttons_Pool[btn_number].Width =width-1;
|
||||
Buttons_Pool[btn_number].Height =height-1;
|
||||
Buttons_Pool[btn_number].Pressed =0;
|
||||
Buttons_Pool[btn_number].Icon =-1;
|
||||
Buttons_Pool[btn_number].Shape =shape;
|
||||
Buttons_Pool[btn_number].Left_action =left_action;
|
||||
Buttons_Pool[btn_number].Right_action =right_action;
|
||||
@ -1276,21 +1297,21 @@ void Init_operations(void)
|
||||
Init_operation(OPERATION_LINE,2,5,
|
||||
Line_12_5,0,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_K_LIGNE,1,0,
|
||||
Init_operation(OPERATION_K_LINE,1,0,
|
||||
K_line_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_K_LIGNE,1,6,
|
||||
Init_operation(OPERATION_K_LINE,1,6,
|
||||
K_line_12_6,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_K_LIGNE,1,7,
|
||||
Init_operation(OPERATION_K_LINE,1,7,
|
||||
K_line_12_7,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_K_LIGNE,2,FAST_MOUSE,
|
||||
Init_operation(OPERATION_K_LINE,2,FAST_MOUSE,
|
||||
K_line_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_K_LIGNE,2,6,
|
||||
Init_operation(OPERATION_K_LINE,2,6,
|
||||
K_line_12_6,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_K_LIGNE,2,7,
|
||||
Init_operation(OPERATION_K_LINE,2,7,
|
||||
K_line_12_7,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_K_LIGNE,0,6,
|
||||
Init_operation(OPERATION_K_LINE,0,6,
|
||||
K_line_0_6,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_K_LIGNE,0,7,
|
||||
Init_operation(OPERATION_K_LINE,0,7,
|
||||
K_line_12_6,0,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_EMPTY_RECTANGLE,1,0,
|
||||
@ -2558,6 +2579,8 @@ void Init_brush_container(void)
|
||||
|
||||
void Set_current_skin(const char *skinfile, T_Gui_skin *gfx)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Free previous one
|
||||
free(Gfx);
|
||||
|
||||
@ -2584,9 +2607,12 @@ void Set_current_skin(const char *skinfile, T_Gui_skin *gfx)
|
||||
MC_Trans = gfx->Color_trans;
|
||||
|
||||
// Set menubars to point to the new data
|
||||
Menu_bars[MENUBAR_TOOLS].Skin = (byte*)&(gfx->Menu_block);
|
||||
Menu_bars[MENUBAR_LAYERS].Skin = (byte*)&(gfx->Layerbar_block);
|
||||
Menu_bars[MENUBAR_STATUS].Skin = (byte*)&(gfx->Statusbar_block);
|
||||
for (i=0; i<3; i++)
|
||||
{
|
||||
Menu_bars[MENUBAR_TOOLS ].Skin[i] = (byte*)&(gfx->Menu_block[i]);
|
||||
Menu_bars[MENUBAR_LAYERS].Skin[i] = (byte*)&(gfx->Layerbar_block[i]);
|
||||
Menu_bars[MENUBAR_STATUS].Skin[i] = (byte*)&(gfx->Statusbar_block[i]);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
@ -726,7 +726,7 @@ int Init_program(int argc,char * argv[])
|
||||
// On affiche le menu:
|
||||
Display_menu();
|
||||
Display_paintbrush_in_menu();
|
||||
Display_sprite_in_menu(BUTTON_PAL_LEFT,18+(Config.Palette_vertical!=0));
|
||||
Display_sprite_in_menu(BUTTON_PAL_LEFT,Config.Palette_vertical?MENU_SPRITE_VERTICAL_PALETTE_SCROLL:-1);
|
||||
|
||||
// On affiche le curseur pour débutter correctement l'état du programme:
|
||||
Display_cursor();
|
||||
|
||||
@ -570,11 +570,11 @@ void Line_0_5(void)
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////// OPERATION_K_LIGNE
|
||||
/////////////////////////////////////////////////////////// OPERATION_K_LINE
|
||||
|
||||
|
||||
void K_line_12_0(void)
|
||||
// Opération : OPERATION_K_LIGNE
|
||||
// Opération : OPERATION_K_LINE
|
||||
// Click Souris: 1 ou 2
|
||||
// Taille_Pile : 0
|
||||
//
|
||||
@ -610,7 +610,7 @@ void K_line_12_0(void)
|
||||
|
||||
|
||||
void K_line_12_6(void)
|
||||
// Opération : OPERATION_K_LIGNE
|
||||
// Opération : OPERATION_K_LINE
|
||||
// Click Souris: 1 ou 2 | 0
|
||||
// Taille_Pile : 6 | 7
|
||||
//
|
||||
@ -650,7 +650,7 @@ void K_line_12_6(void)
|
||||
|
||||
|
||||
void K_line_0_6(void)
|
||||
// Opération : OPERATION_K_LIGNE
|
||||
// Opération : OPERATION_K_LINE
|
||||
// Click Souris: 0
|
||||
// Taille_Pile : 6
|
||||
//
|
||||
@ -700,7 +700,7 @@ void K_line_0_6(void)
|
||||
|
||||
|
||||
void K_line_12_7(void)
|
||||
// Opération : OPERATION_K_LIGNE
|
||||
// Opération : OPERATION_K_LINE
|
||||
// Click Souris: 1 ou 2
|
||||
// Taille_Pile : 7
|
||||
//
|
||||
|
||||
@ -2473,6 +2473,6 @@ void Button_Secondary_palette(void)
|
||||
{
|
||||
Change_palette_cells();
|
||||
Display_menu();
|
||||
Display_sprite_in_menu(BUTTON_PAL_LEFT,18+(Config.Palette_vertical!=0));
|
||||
Display_sprite_in_menu(BUTTON_PAL_LEFT,Config.Palette_vertical?MENU_SPRITE_VERTICAL_PALETTE_SCROLL:-1);
|
||||
}
|
||||
}
|
||||
|
||||
15
src/struct.h
@ -409,13 +409,13 @@ typedef struct
|
||||
// Menu and other graphics
|
||||
|
||||
/// Bitmap data for the menu, a single rectangle.
|
||||
byte Menu_block[35][MENU_WIDTH];
|
||||
byte Layerbar_block[10][144];
|
||||
byte Statusbar_block[9][20];
|
||||
byte Menu_block[3][35][MENU_WIDTH];
|
||||
byte Layerbar_block[3][10][144];
|
||||
byte Statusbar_block[3][9][20];
|
||||
/// Bitmap data for the icons that are displayed over the menu.
|
||||
byte Menu_sprite[NB_MENU_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
|
||||
byte Menu_sprite[2][NB_MENU_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
|
||||
/// Bitmap data for the different "effects" icons.
|
||||
byte Effect_sprite[NB_EFFECTS_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
|
||||
byte Effect_sprite[NB_EFFECTS_SPRITES][EFFECT_SPRITE_HEIGHT][EFFECT_SPRITE_WIDTH];
|
||||
/// Bitmap data for the different Layer icons.
|
||||
byte Layer_sprite[3][16][LAYER_SPRITE_HEIGHT][LAYER_SPRITE_WIDTH];
|
||||
/// Bitmap data for the Grafx2 logo that appears on splash screen. All 256 colors allowed.
|
||||
@ -448,9 +448,6 @@ typedef struct
|
||||
/// Transparent GUI color index in skin file
|
||||
byte Color_trans;
|
||||
|
||||
/// Boolean, true if the buttons have normally no outline
|
||||
byte No_outline;
|
||||
|
||||
} T_Gui_skin;
|
||||
|
||||
typedef struct {
|
||||
@ -477,7 +474,7 @@ typedef struct {
|
||||
word Height;
|
||||
byte Visible;
|
||||
word Top; ///< Relative to the top line of the menu, hidden bars don't count.
|
||||
byte* Skin;
|
||||
byte* Skin[3]; ///< [0] has normal buttons, [1] has selected buttons, [2] is current.
|
||||
word Skin_width;
|
||||
byte Last_button_index;
|
||||
} T_Menu_Bar;
|
||||
|
||||
@ -67,7 +67,7 @@ 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)
|
||||
{
|
||||
Pixel_in_menu(bar, x, y, color);
|
||||
Menu_bars[bar].Skin[y*Menu_bars[bar].Skin_width + x] = color;
|
||||
Menu_bars[bar].Skin[2][y*Menu_bars[bar].Skin_width + x] = color;
|
||||
}
|
||||
|
||||
// Affichage d'un pixel dans la fenêtre (la fenêtre doit être visible)
|
||||
@ -454,7 +454,7 @@ void Draw_bar_remainder(word current_menu, word x_off)
|
||||
|
||||
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++)
|
||||
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)]);
|
||||
Pixel_in_menu(current_menu, x_pos, y_pos, Menu_bars[current_menu].Skin[0][y_pos * Menu_bars[current_menu].Skin_width + Menu_bars[current_menu].Skin_width - 2 + (x_pos&1)]);
|
||||
}
|
||||
|
||||
|
||||
@ -566,7 +566,7 @@ void Display_menu(void)
|
||||
// Skinned area
|
||||
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++)
|
||||
Pixel_in_menu(current_menu, x_pos, y_pos, 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[2][y_pos * Menu_bars[current_menu].Skin_width + x_pos]);
|
||||
|
||||
if (current_menu == MENUBAR_LAYERS)
|
||||
{
|
||||
@ -1180,32 +1180,15 @@ void Verbose_message(const char *caption, const char * message )
|
||||
|
||||
// -- Redessiner le sprite d'un bouton dans le menu --
|
||||
|
||||
void Display_sprite_in_menu(int btn_number,int sprite_number)
|
||||
void Display_sprite_in_menu(int btn_number,char sprite_number)
|
||||
{
|
||||
word x_pos;
|
||||
word y_pos;
|
||||
word menu_x_pos;
|
||||
word menu_y_pos;
|
||||
byte color;
|
||||
Buttons_Pool[btn_number].Icon=sprite_number;
|
||||
|
||||
menu_y_pos=Buttons_Pool[btn_number].Y_offset;
|
||||
menu_x_pos=Buttons_Pool[btn_number].X_offset;
|
||||
if (Buttons_Pool[btn_number].Shape != BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT)
|
||||
{
|
||||
menu_y_pos+=1;
|
||||
menu_x_pos+=1;
|
||||
}
|
||||
|
||||
for (y_pos=0;y_pos<MENU_SPRITE_HEIGHT;y_pos++)
|
||||
for (x_pos=0;x_pos<MENU_SPRITE_WIDTH;x_pos++)
|
||||
{
|
||||
color=Gfx->Menu_sprite[sprite_number][y_pos][x_pos];
|
||||
Pixel_in_menu_and_skin(MENUBAR_TOOLS, menu_x_pos+x_pos, menu_y_pos+y_pos, color);
|
||||
}
|
||||
if (Menu_is_visible && Menu_bars[MENUBAR_TOOLS].Visible)
|
||||
Update_rect(Menu_factor_X*(Buttons_Pool[btn_number].X_offset+1),
|
||||
(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);
|
||||
if (Buttons_Pool[btn_number].Shape == BUTTON_SHAPE_TRIANGLE_TOP_LEFT)
|
||||
Buttons_Pool[btn_number+1].Icon=sprite_number;
|
||||
|
||||
else if (Buttons_Pool[btn_number].Shape == BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT)
|
||||
Buttons_Pool[btn_number-1].Icon=sprite_number;
|
||||
}
|
||||
|
||||
// -- Redessiner la forme du pinceau dans le menu --
|
||||
@ -1221,13 +1204,10 @@ void Display_paintbrush_in_menu(void)
|
||||
switch (Paintbrush_shape)
|
||||
{
|
||||
case PAINTBRUSH_SHAPE_COLOR_BRUSH : // Brush en couleur
|
||||
Display_sprite_in_menu(BUTTON_PAINTBRUSHES,MENU_SPRITE_COLOR_BRUSH);
|
||||
break;
|
||||
case PAINTBRUSH_SHAPE_MONO_BRUSH : // Brush monochrome
|
||||
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++)
|
||||
{
|
||||
color=Gfx->Menu_sprite[4][y_pos][x_pos];
|
||||
Pixel_in_menu_and_skin(MENUBAR_TOOLS, menu_x_pos, menu_y_pos, color);
|
||||
}
|
||||
Display_sprite_in_menu(BUTTON_PAINTBRUSHES,MENU_SPRITE_MONO_BRUSH);
|
||||
break;
|
||||
default : // Pinceau
|
||||
// On efface le pinceau précédent
|
||||
@ -2952,18 +2932,20 @@ void Remap_menu_sprites()
|
||||
for (i=0; i<CURSOR_SPRITE_WIDTH; i++)
|
||||
Remap_pixel(&Gfx->Cursor_sprite[k][j][i]);
|
||||
// Main menu bar
|
||||
for (j=0; j<Menu_bars[MENUBAR_TOOLS].Height; j++)
|
||||
for (i=0; i<Menu_bars[MENUBAR_TOOLS].Skin_width; i++)
|
||||
Remap_pixel(&Gfx->Menu_block[j][i]);
|
||||
for (k=0; k<3; k++)
|
||||
for (j=0; j<Menu_bars[MENUBAR_TOOLS].Height; j++)
|
||||
for (i=0; i<Menu_bars[MENUBAR_TOOLS].Skin_width; i++)
|
||||
Remap_pixel(&Gfx->Menu_block[k][j][i]);
|
||||
// Menu sprites
|
||||
for (k=0; k<NB_MENU_SPRITES; k++)
|
||||
for (j=0; j<MENU_SPRITE_HEIGHT; j++)
|
||||
for (i=0; i<MENU_SPRITE_WIDTH; i++)
|
||||
Remap_pixel(&Gfx->Menu_sprite[k][j][i]);
|
||||
for (l=0; l<2; l++)
|
||||
for (k=0; k<NB_MENU_SPRITES; k++)
|
||||
for (j=0; j<MENU_SPRITE_HEIGHT; j++)
|
||||
for (i=0; i<MENU_SPRITE_WIDTH; i++)
|
||||
Remap_pixel(&Gfx->Menu_sprite[l][k][j][i]);
|
||||
// Effects sprites
|
||||
for (k=0; k<NB_EFFECTS_SPRITES; k++)
|
||||
for (j=0; j<MENU_SPRITE_HEIGHT; j++)
|
||||
for (i=0; i<MENU_SPRITE_WIDTH; i++)
|
||||
for (j=0; j<EFFECT_SPRITE_HEIGHT; j++)
|
||||
for (i=0; i<EFFECT_SPRITE_WIDTH; i++)
|
||||
Remap_pixel(&Gfx->Effect_sprite[k][j][i]);
|
||||
// Layers buttons
|
||||
for (l=0; l<3; l++)
|
||||
@ -2973,13 +2955,15 @@ void Remap_menu_sprites()
|
||||
Remap_pixel(&Gfx->Layer_sprite[l][k][j][i]);
|
||||
|
||||
// Status bar
|
||||
for (j=0; j<Menu_bars[MENUBAR_STATUS].Height; j++)
|
||||
for (i=0; i<Menu_bars[MENUBAR_STATUS].Skin_width; i++)
|
||||
Remap_pixel(&Gfx->Statusbar_block[j][i]);
|
||||
for (k=0; k<3; k++)
|
||||
for (j=0; j<Menu_bars[MENUBAR_STATUS].Height; j++)
|
||||
for (i=0; i<Menu_bars[MENUBAR_STATUS].Skin_width; i++)
|
||||
Remap_pixel(&Gfx->Statusbar_block[k][j][i]);
|
||||
// Layer bar
|
||||
for (j=0; j<Menu_bars[MENUBAR_LAYERS].Height; j++)
|
||||
for (i=0; i<Menu_bars[MENUBAR_LAYERS].Skin_width; i++)
|
||||
Remap_pixel(&Gfx->Layerbar_block[j][i]);
|
||||
for (k=0; k<3; k++)
|
||||
for (j=0; j<Menu_bars[MENUBAR_LAYERS].Height; j++)
|
||||
for (i=0; i<Menu_bars[MENUBAR_LAYERS].Skin_width; i++)
|
||||
Remap_pixel(&Gfx->Layerbar_block[k][j][i]);
|
||||
|
||||
// Help fonts
|
||||
for (k=0; k<256; k++)
|
||||
|
||||
@ -89,7 +89,7 @@ void Window_display_frame_in(word x_pos,word y_pos,word width,word height);
|
||||
void Window_display_frame_out(word x_pos,word y_pos,word width,word height);
|
||||
void Window_display_frame(word x_pos,word y_pos,word width,word height);
|
||||
|
||||
void Display_sprite_in_menu(int btn_number,int sprite_number);
|
||||
void Display_sprite_in_menu(int btn_number,char sprite_number);
|
||||
void Display_paintbrush_in_menu(void);
|
||||
void Display_paintbrush_in_window(word x,word y,int number);
|
||||
|
||||
|
||||