From 8ac66726f2c42241c247dc59c76a117213baeb65 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sat, 22 Aug 2009 22:11:01 +0000 Subject: [PATCH] Brush container integrated as the bottom row of Paintbrush screen (F4) git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1003 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- buttons.c | 88 +++++++++++++++++++++++++++++++++++++++++-------------- init.c | 2 +- 2 files changed, 67 insertions(+), 23 deletions(-) diff --git a/buttons.c b/buttons.c index d645acd5..142bee0f 100644 --- a/buttons.c +++ b/buttons.c @@ -2482,19 +2482,27 @@ void Button_Paintbrush_menu(void) short x_pos,y_pos; byte index; - Open_window(310,155,"Paintbrush menu"); + Open_window(310,180,"Paintbrush menu"); - Window_display_frame(8,21,294,107); + Window_display_frame(8,21,294,132); - Window_set_normal_button(122,133,67,14,"Cancel",0,1,KEY_ESC); // 1 + Window_set_normal_button(122,158,67,14,"Cancel",0,1,KEY_ESC); // 1 for (index=0; index(NB_PAINTBRUSH_SPRITES+1)) + { + index = clicked_button-NB_PAINTBRUSH_SPRITES-2; + + if (Window_attribute1==RIGHT_SIDE) + { + // Store + + x_pos=13+((index+NB_PAINTBRUSH_SPRITES)%12)*24; + y_pos=27+((index+NB_PAINTBRUSH_SPRITES)/12)*25; + + Store_brush(index); + Hide_cursor(); + Display_stored_brush_in_window(x_pos+2, y_pos+2, index); + Display_cursor(); + } + else + { + // Restore and exit + + if (Restore_brush(index)) + { + Close_window(); + break; + } + } + + } + else if (clicked_button>1 && Window_attribute1==LEFT_SIDE) + // Standard paintbrushes + { + Close_window(); + index=clicked_button-2; + Paintbrush_shape=Gfx->Paintbrush_type[index]; + Paintbrush_width=Gfx->Preset_paintbrush_width[index]; + Paintbrush_height=Gfx->Preset_paintbrush_height[index]; + Paintbrush_offset_X=Gfx->Preset_paintbrush_offset_X[index]; + Paintbrush_offset_Y=Gfx->Preset_paintbrush_offset_Y[index]; + for (y_pos=0; y_posPaintbrush_sprite[index][y_pos][x_pos]; + Change_paintbrush_shape(Gfx->Paintbrush_type[index]); + + break; + } + else if (clicked_button==1) + { + Close_window(); + break; + } } - while (clicked_button<=0); - - Close_window(); - - if (clicked_button!=1) // pas Cancel - { - index=clicked_button-2; - Paintbrush_shape=Gfx->Paintbrush_type[index]; - Paintbrush_width=Gfx->Preset_paintbrush_width[index]; - Paintbrush_height=Gfx->Preset_paintbrush_height[index]; - Paintbrush_offset_X=Gfx->Preset_paintbrush_offset_X[index]; - Paintbrush_offset_Y=Gfx->Preset_paintbrush_offset_Y[index]; - for (y_pos=0; y_posPaintbrush_sprite[index][y_pos][x_pos]; - Change_paintbrush_shape(Gfx->Paintbrush_type[index]); - } + while (1); Unselect_button(BUTTON_PAINTBRUSHES); Display_cursor(); diff --git a/init.c b/init.c index 1aa4b496..2cc6761a 100644 --- a/init.c +++ b/init.c @@ -1063,7 +1063,7 @@ void Init_buttons(void) 106,18, 16,16, BUTTON_SHAPE_RECTANGLE, - Button_Brush_FX,Button_Brush_container, + Button_Brush_FX,Button_Brush_FX, Do_nothing, FAMILY_INSTANT);