diff --git a/share/grafx2/skins/skin_Aurora.png b/share/grafx2/skins/skin_Aurora.png index 1ab5b5ac..7c6c4795 100644 Binary files a/share/grafx2/skins/skin_Aurora.png and b/share/grafx2/skins/skin_Aurora.png differ diff --git a/share/grafx2/skins/skin_Clax2.gif b/share/grafx2/skins/skin_Clax2.gif new file mode 100644 index 00000000..59de0444 Binary files /dev/null and b/share/grafx2/skins/skin_Clax2.gif differ diff --git a/share/grafx2/skins/skin_Clax3.gif b/share/grafx2/skins/skin_Clax3.gif new file mode 100644 index 00000000..66ca8b14 Binary files /dev/null and b/share/grafx2/skins/skin_Clax3.gif differ diff --git a/share/grafx2/skins/skin_Clax4.gif b/share/grafx2/skins/skin_Clax4.gif new file mode 100644 index 00000000..9f91654c Binary files /dev/null and b/share/grafx2/skins/skin_Clax4.gif differ diff --git a/share/grafx2/skins/skin_DPaint.png b/share/grafx2/skins/skin_DPaint.png index 3f62c8ee..656578d0 100644 Binary files a/share/grafx2/skins/skin_DPaint.png and b/share/grafx2/skins/skin_DPaint.png differ diff --git a/share/grafx2/skins/skin_classic.png b/share/grafx2/skins/skin_classic.png index 567a646b..0c13ccad 100644 Binary files a/share/grafx2/skins/skin_classic.png and b/share/grafx2/skins/skin_classic.png differ diff --git a/share/grafx2/skins/skin_modern.png b/share/grafx2/skins/skin_modern.png index 57cae3e5..2c39c999 100644 Binary files a/share/grafx2/skins/skin_modern.png and b/share/grafx2/skins/skin_modern.png differ diff --git a/share/grafx2/skins/skin_scenish.png b/share/grafx2/skins/skin_scenish.png index 9a26a88f..98a29211 100644 Binary files a/share/grafx2/skins/skin_scenish.png and b/share/grafx2/skins/skin_scenish.png differ diff --git a/src/buttons.c b/src/buttons.c index e0ea1b88..00f30fd4 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -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;yEffect_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); } diff --git a/src/const.h b/src/const.h index 7d8d3a54..2efc2454 100644 --- a/src/const.h +++ b/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 diff --git a/src/engine.c b/src/engine.c index 99c91d38..3ac7889f 100644 --- a/src/engine.c +++ b/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_posNo_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_posNo_outline) + for (x_pos=1;x_posNo_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; diff --git a/src/engine.h b/src/engine.h index e0d70f62..897cd37b 100644 --- a/src/engine.h +++ b/src/engine.h @@ -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); diff --git a/src/global.h b/src/global.h index d48a92d1..bb3661fb 100644 --- a/src/global.h +++ b/src/global.h @@ -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 diff --git a/src/init.c b/src/init.c index 13e88e63..4cd99434 100644 --- a/src/init.c +++ b/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; iEffect_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; iMenu_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; iMenu_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]); + } } /// diff --git a/src/main.c b/src/main.c index 5b1dff35..126208ce 100644 --- a/src/main.c +++ b/src/main.c @@ -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(); diff --git a/src/operatio.c b/src/operatio.c index 5f393282..7ea05d28 100644 --- a/src/operatio.c +++ b/src/operatio.c @@ -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 // diff --git a/src/palette.c b/src/palette.c index 3086727a..fcdabe1a 100644 --- a/src/palette.c +++ b/src/palette.c @@ -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); } } diff --git a/src/struct.h b/src/struct.h index 3073f039..2cbdcb89 100644 --- a/src/struct.h +++ b/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; diff --git a/src/windows.c b/src/windows.c index 6501b98b..4e0eba83 100644 --- a/src/windows.c +++ b/src/windows.c @@ -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_posMenu_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_posMenu_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; iCursor_sprite[k][j][i]); // Main menu bar - for (j=0; jMenu_block[j][i]); + for (k=0; k<3; k++) + for (j=0; jMenu_block[k][j][i]); // Menu sprites - for (k=0; kMenu_sprite[k][j][i]); + for (l=0; l<2; l++) + for (k=0; kMenu_sprite[l][k][j][i]); // Effects sprites for (k=0; kEffect_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; jStatusbar_block[j][i]); + for (k=0; k<3; k++) + for (j=0; jStatusbar_block[k][j][i]); // Layer bar - for (j=0; jLayerbar_block[j][i]); + for (k=0; k<3; k++) + for (j=0; jLayerbar_block[k][j][i]); // Help fonts for (k=0; k<256; k++) diff --git a/src/windows.h b/src/windows.h index 420d44c5..d87461bb 100644 --- a/src/windows.h +++ b/src/windows.h @@ -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);