Hide button now brings a drop-down menu to choose toolbars to show/hide. Right-clicking it toggles them all off/on. Internal: Added support for dropdowns that expand above the button (available in toolbars and windows); Allowed toolbar buttons to wait for button release (the usual) or immediately trigger their effect.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1266 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-01-17 01:56:56 +00:00
parent 450b64ca10
commit 6a69fa2b79
14 changed files with 224 additions and 70 deletions

View File

@ -13,7 +13,8 @@ $(OBJDIR)/engine.o: engine.c const.h struct.h global.h graph.h misc.h special.h
buttons.h operatio.h shade.h errors.h sdlscreen.h windows.h brush.h \
input.h engine.h pages.h layers.h
$(OBJDIR)/factory.o: factory.c brush.h struct.h const.h buttons.h engine.h errors.h \
filesel.h global.h graph.h io.h misc.h readline.h sdlscreen.h windows.h
filesel.h loadsave.h global.h graph.h io.h misc.h pages.h readline.h \
sdlscreen.h windows.h
$(OBJDIR)/fileformats.o: fileformats.c errors.h global.h struct.h const.h \
loadsave.h misc.h io.h windows.h pages.h
$(OBJDIR)/filesel.o: filesel.c const.h struct.h global.h misc.h errors.h io.h \
@ -35,7 +36,7 @@ $(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h sdlscreen.h \
$(OBJDIR)/io.o: io.c struct.h const.h io.h realpath.h
$(OBJDIR)/keyboard.o: keyboard.c global.h struct.h const.h keyboard.h
$(OBJDIR)/layers.o: layers.c const.h struct.h global.h windows.h engine.h pages.h
$(OBJDIR)/libraw2crtc.o: libraw2crtc.c global.h struct.h const.h
$(OBJDIR)/libraw2crtc.o: libraw2crtc.c const.h global.h struct.h loadsave.h
$(OBJDIR)/loadsave.o: loadsave.c buttons.h struct.h const.h errors.h global.h io.h \
loadsave.h misc.h graph.h op_c.h pages.h palette.h sdlscreen.h \
windows.h engine.h
@ -43,7 +44,7 @@ $(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h misc.h init.h buttons
engine.h pages.h loadsave.h sdlscreen.h errors.h readini.h saveini.h \
io.h text.h setup.h windows.h brush.h palette.h realpath.h
$(OBJDIR)/misc.o: misc.c struct.h const.h sdlscreen.h global.h errors.h buttons.h \
engine.h misc.h keyboard.h windows.h palette.h input.h graph.h
engine.h misc.h keyboard.h windows.h palette.h input.h graph.h pages.h
$(OBJDIR)/miscfileformats.o: miscfileformats.c engine.h struct.h const.h errors.h \
global.h io.h libraw2crtc.h loadsave.h misc.h sdlscreen.h windows.h
$(OBJDIR)/mountlist.o: mountlist.c

View File

@ -488,21 +488,80 @@ void Set_bar_visibility(word bar, byte visible)
}
}
void Button_Toggle_layerbar(void)
void Button_Toggle_toolbar(void)
{
T_Dropdown_button dropdown;
T_Dropdown_choice *item;
static char menu_name[2][9]= {
" Tools",
" Layers"
};
menu_name[0][0] = Menu_bars[MENUBAR_TOOLS ].Visible ? 22 : ' ';
menu_name[1][0] = Menu_bars[MENUBAR_LAYERS].Visible ? 22 : ' ';
Hide_cursor();
dropdown.Pos_X =Buttons_Pool[BUTTON_HIDE].X_offset;
dropdown.Pos_Y =Buttons_Pool[BUTTON_HIDE].Y_offset;
dropdown.Height =Buttons_Pool[BUTTON_HIDE].Height;
dropdown.Dropdown_width=70;
dropdown.First_item =NULL;
dropdown.Bottom_up =1;
Window_dropdown_add_item(&dropdown, 0, menu_name[0]);
Window_dropdown_add_item(&dropdown, 1, menu_name[1]);
item=Dropdown_activate(&dropdown,0,Menu_Y+Menu_bars[MENUBAR_STATUS].Top*Menu_factor_Y);
if (item)
{
switch (item->Number)
{
case 0:
Set_bar_visibility(MENUBAR_TOOLS, !Menu_bars[MENUBAR_TOOLS].Visible);
break;
case 1:
Set_bar_visibility(MENUBAR_LAYERS, !Menu_bars[MENUBAR_LAYERS].Visible);
break;
}
}
// Closing
Window_dropdown_clear_items(&dropdown);
Unselect_button(BUTTON_HIDE);
Display_cursor();
}
void Button_Toggle_toolbox(void)
void Button_Toggle_all_toolbars(void)
{
// This is used to memorize the bars' visibility when temporarily hidden
static word Last_visibility = 0xFFFF;
int i;
word current_visibility;
Hide_cursor();
Set_bar_visibility(MENUBAR_TOOLS, !Menu_bars[MENUBAR_TOOLS].Visible);
// Check which bars are visible
current_visibility=0;
for (i=MENUBAR_STATUS+1;i<MENUBAR_COUNT;i++)
if (Menu_bars[i].Visible)
current_visibility |= (1<<i);
if (current_visibility)
{
// At least one is visible: Hide all
Last_visibility=current_visibility;
for (i=MENUBAR_STATUS+1;i<MENUBAR_COUNT;i++)
Set_bar_visibility(i,0);
}
else
{
// Restore all
for (i=MENUBAR_STATUS+1;i<MENUBAR_COUNT;i++)
Set_bar_visibility(i,(Last_visibility & (1<<i)) ? 1 : 0);
}
Unselect_button(BUTTON_HIDE);
Display_cursor();
@ -1025,7 +1084,7 @@ void Button_Skins(void)
skin_list->Cursor_position = Find_file_in_fileselector(&Skin_files_list, Config.Skin_file);
// Buttons to choose a font
font_dropdown = Window_set_dropdown_button(172, 43, 104, 11, 0, Get_item_by_index(&Font_files_list,selected_font)->Short_name,1,0,1,RIGHT_SIDE|LEFT_SIDE); // 5
font_dropdown = Window_set_dropdown_button(172, 43, 104, 11, 0, Get_item_by_index(&Font_files_list,selected_font)->Short_name,1,0,1,RIGHT_SIDE|LEFT_SIDE,0); // 5
for (temp=0; temp<Font_files_list.Nb_files; temp++)
Window_dropdown_add_item(font_dropdown,temp,Get_item_by_index(&Font_files_list,temp)->Short_name);
@ -1034,7 +1093,7 @@ void Button_Skins(void)
// Dropdown list to choose cursor type
cursor_dropdown = Window_set_dropdown_button(172, 69, 104, 11, 0,
cursors[selected_cursor], 1, 0, 1, RIGHT_SIDE|LEFT_SIDE); // 7
cursors[selected_cursor], 1, 0, 1, RIGHT_SIDE|LEFT_SIDE,0); // 7
for (temp = 0; temp<3; temp++)
Window_dropdown_add_item(cursor_dropdown, temp, cursors[temp]);
@ -1617,7 +1676,7 @@ void Button_Resolution(void)
chosen_pixel=Pixel_ratio;
Print_in_window( 12, 57,"Pixel size:" ,MC_Dark,MC_Light);
pixel_button=Window_set_dropdown_button(108,55,17*8,11,17*8,pixel_ratio_labels[Pixel_ratio],1,0,1,LEFT_SIDE|RIGHT_SIDE); // 7
pixel_button=Window_set_dropdown_button(108,55,17*8,11,17*8,pixel_ratio_labels[Pixel_ratio],1,0,1,LEFT_SIDE|RIGHT_SIDE,0); // 7
for (temp=0;temp<PIXEL_MAX;temp++)
Window_dropdown_add_item(pixel_button,temp,pixel_ratio_labels[temp]);

View File

@ -630,14 +630,14 @@ void Button_Quit(void);
void Button_Hide_menu(void);
/*!
Shows or hide the layerbar
Shows a dropdown panel where you can choose which toolbars are visible
*/
void Button_Toggle_layerbar(void);
void Button_Toggle_toolbar(void);
/*!
Shows or hide the main toolbox
Hides all toolbars (except status) or shows them again
*/
void Button_Toggle_toolbox(void);
void Button_Toggle_all_toolbars(void);
/*!

View File

@ -66,7 +66,7 @@ byte* Window_background[8];
///Table of tooltip texts for menu buttons
char * Menu_tooltip[NB_BUTTONS]=
{
"Layerbar / Hide menu ",
"Toolbars / Hide toolbars",
"Layers manager ",
"Get/Set transparent col.",
@ -422,8 +422,12 @@ void Select_button(int btn_number,byte click)
Display_cursor();
if ((click==1 && !Buttons_Pool[btn_number].Left_instant)
||(click!=1 && !Buttons_Pool[btn_number].Right_instant))
{
// On attend ensuite que l'utilisateur lâche son bouton:
Wait_end_of_click();
}
// On considère que le bouton est enfoncé
Buttons_Pool[btn_number].Pressed=BUTTON_PRESSED;
@ -1763,7 +1767,7 @@ T_Special_button * Window_set_input_button(word x_pos,word y_pos,word width_in_c
return temp;
}
T_Dropdown_button * Window_set_dropdown_button(word x_pos,word y_pos,word width,word height,word dropdown_width,const char *label,byte display_choice,byte display_centered,byte display_arrow,byte active_button)
T_Dropdown_button * Window_set_dropdown_button(word x_pos,word y_pos,word width,word height,word dropdown_width,const char *label,byte display_choice,byte display_centered,byte display_arrow,byte active_button, byte bottom_up)
{
T_Dropdown_button *temp;
@ -1779,6 +1783,7 @@ T_Dropdown_button * Window_set_dropdown_button(word x_pos,word y_pos,word width,
temp->Display_centered=display_centered;
temp->Display_arrow=display_arrow;
temp->Active_button=active_button;
temp->Bottom_up=bottom_up;
temp->Next=Window_dropdown_button_list;
Window_dropdown_button_list=temp;
@ -2317,8 +2322,12 @@ void Move_window(short dx, short dy)
}
// Gestion des dropdown
short Window_dropdown_on_click(T_Dropdown_button *Button)
///
/// Displays a dropped-down menu and handles the UI logic until the user
/// releases a mouse button.
/// This function then clears the dropdown and returns the selected item,
/// or NULL if the user wasn't highlighting an item when he closed.
T_Dropdown_choice * Dropdown_activate(T_Dropdown_button *button, short off_x, short off_y)
{
short nb_choices;
short choice_index;
@ -2326,6 +2335,7 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
short old_selected_index;
short box_height;
T_Dropdown_choice *item;
// Taille de l'ombre portée (en plus des dimensions normales)
#define SHADOW_RIGHT 3
#define SHADOW_BOTTOM 4
@ -2333,18 +2343,17 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
// Comptage des items pour calculer la taille
nb_choices=0;
for (item=Button->First_item; item!=NULL; item=item->Next)
for (item=button->First_item; item!=NULL; item=item->Next)
{
nb_choices++;
}
box_height=3+nb_choices*8+1;
Hide_cursor();
Window_select_normal_button(Button->Pos_X,Button->Pos_Y,Button->Width,Button->Height);
// Open a new stacked "window" to serve as drawing area.
Open_popup(
Window_pos_X+(Button->Pos_X)*Menu_factor_X,
Window_pos_Y+(Button->Pos_Y+Button->Height)*Menu_factor_Y,
Button->Dropdown_width+SHADOW_RIGHT,
off_x+(button->Pos_X)*Menu_factor_X,
off_y+(button->Pos_Y+(button->Bottom_up?-box_height:button->Height))*Menu_factor_Y,
button->Dropdown_width+SHADOW_RIGHT,
box_height+SHADOW_BOTTOM);
// Dessin de la boite
@ -2352,13 +2361,13 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
// Bord gauche
Block(Window_pos_X,Window_pos_Y,Menu_factor_X,box_height*Menu_factor_Y,MC_Black);
// Frame fonce et blanc
Window_display_frame_out(1,0,Button->Dropdown_width-1,box_height);
Window_display_frame_out(1,0,button->Dropdown_width-1,box_height);
// Ombre portée
if (SHADOW_BOTTOM)
{
Block(Window_pos_X+SHADOW_RIGHT*Menu_factor_X,
Window_pos_Y+box_height*Menu_factor_Y,
Button->Dropdown_width*Menu_factor_X,
button->Dropdown_width*Menu_factor_X,
SHADOW_BOTTOM*Menu_factor_Y,
MC_Black);
Block(Window_pos_X,
@ -2369,12 +2378,12 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
}
if (SHADOW_RIGHT)
{
Block(Window_pos_X+Button->Dropdown_width*Menu_factor_X,
Block(Window_pos_X+button->Dropdown_width*Menu_factor_X,
Window_pos_Y+SHADOW_BOTTOM*Menu_factor_Y,
SHADOW_RIGHT*Menu_factor_X,
(box_height-SHADOW_BOTTOM)*Menu_factor_Y,
MC_Black);
Block(Window_pos_X+Button->Dropdown_width*Menu_factor_X,
Block(Window_pos_X+button->Dropdown_width*Menu_factor_X,
Window_pos_Y,
Menu_factor_X,
SHADOW_BOTTOM*Menu_factor_Y,
@ -2388,9 +2397,9 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
// Fenêtre grise
Block(Window_pos_X+2*Menu_factor_X,
Window_pos_Y+1*Menu_factor_Y,
(Button->Dropdown_width-3)*Menu_factor_X,(box_height-2)*Menu_factor_Y,MC_Light);
(button->Dropdown_width-3)*Menu_factor_X,(box_height-2)*Menu_factor_Y,MC_Light);
// Affichage des items
for(item=Button->First_item,choice_index=0; item!=NULL; item=item->Next,choice_index++)
for(item=button->First_item,choice_index=0; item!=NULL; item=item->Next,choice_index++)
{
byte color_1;
byte color_2;
@ -2400,7 +2409,7 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
color_2=MC_Dark;
Block(Window_pos_X+3*Menu_factor_X,
Window_pos_Y+((2+choice_index*8)*Menu_factor_Y),
(Button->Dropdown_width-5)*Menu_factor_X,(8)*Menu_factor_Y,MC_Dark);
(button->Dropdown_width-5)*Menu_factor_X,(8)*Menu_factor_Y,MC_Dark);
}
else
{
@ -2417,7 +2426,7 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
// Attente
if(!Get_input()) SDL_Delay(20);
// Mise à jour du survol
selected_index=Window_click_in_rectangle(2,2,Button->Dropdown_width-2,box_height-1)?
selected_index=Window_click_in_rectangle(2,2,button->Dropdown_width-2,box_height-1)?
(((Mouse_Y-Window_pos_Y)/Menu_factor_Y-2)>>3) : -1;
} while (Mouse_K && selected_index==old_selected_index);
@ -2429,29 +2438,51 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
Close_popup();
Window_unselect_normal_button(Button->Pos_X,Button->Pos_Y,Button->Width,Button->Height);
Display_cursor();
if (selected_index>=0 && selected_index<nb_choices)
{
for(item=Button->First_item; selected_index; item=item->Next,selected_index--)
for(item=button->First_item; selected_index; item=item->Next,selected_index--)
;
Window_attribute2=item->Number;
if (Button->Display_choice)
return item;
}
return NULL;
}
// Gestion des dropdown
short Window_dropdown_on_click(T_Dropdown_button *button)
{
T_Dropdown_choice * item;
// Highlight the button
Hide_cursor();
Window_select_normal_button(button->Pos_X,button->Pos_Y,button->Width,button->Height);
// Handle the dropdown's logic
item = Dropdown_activate(button, Window_pos_X, Window_pos_Y);
// Unhighlight the button
Window_unselect_normal_button(button->Pos_X,button->Pos_Y,button->Width,button->Height);
Display_cursor();
if (item == NULL)
{
// Automatically update the label of the dropdown list.
int text_length = (Button->Width-4-(Button->Display_arrow?8:0))/8;
// Clear original label area
Window_rectangle(Button->Pos_X+2,Button->Pos_Y+(Button->Height-7)/2,text_length*8,8,MC_Light);
Print_in_window_limited(Button->Pos_X+2,Button->Pos_Y+(Button->Height-7)/2,item->Label,text_length ,MC_Black,MC_Light);
}
return Button->Number;
}
Window_attribute2=-1;
return 0;
}
if (button->Display_choice)
{
// Automatically update the label of the dropdown list.
int text_length = (button->Width-4-(button->Display_arrow?8:0))/8;
// Clear original label area
Window_rectangle(button->Pos_X+2,button->Pos_Y+(button->Height-7)/2,text_length*8,8,MC_Light);
Print_in_window_limited(button->Pos_X+2,button->Pos_Y+(button->Height-7)/2,item->Label,text_length ,MC_Black,MC_Light);
}
Window_attribute2=item->Number;
return button->Number;
}
// --- Fonction de clic sur un bouton a peu près ordinaire:
// Attend que l'on relache le bouton, et renvoie le numero du bouton si on
// est resté dessus, 0 si on a annulé en sortant du bouton.

View File

@ -78,13 +78,21 @@ T_Special_button * Window_set_input_button(word x_pos, word y_pos,
T_Dropdown_button * Window_set_dropdown_button(word x_pos, word y_pos,
word width, word height, word dropdown_width, const char *label,
byte display_choice, byte display_centered, byte display_arrow,
byte active_button);
byte active_button,byte bottom_up);
/// Adds an item to a dropdown menu
void Window_dropdown_add_item(T_Dropdown_button * dropdown, word btn_number,
const char *label);
void Window_dropdown_clear_items(T_Dropdown_button * dropdown);
///
/// Displays a dropped-down menu and handles the UI logic until the user
/// releases a mouse button.
/// This function then clears the dropdown and returns the selected item,
/// or NULL if the user wasn't highlighting an item when he closed.
T_Dropdown_choice * Dropdown_activate(T_Dropdown_button *button, short off_x, short off_y);
T_List_button * Window_set_list_button(T_Special_button * entry_button,
T_Scroller_button * scroller, Func_draw_list_item draw_list_item);
void Window_redraw_list(T_List_button * list);

View File

@ -1109,7 +1109,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
formats_dropdown=
Window_set_dropdown_button(68,28,52,11,0,
Get_fileformat(Main_format)->Label,
1,0,1,RIGHT_SIDE|LEFT_SIDE); // 6
1,0,1,RIGHT_SIDE|LEFT_SIDE,0); // 6
for (temp=0; temp < NB_KNOWN_FORMATS; temp++)
{
@ -1141,7 +1141,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
for (temp=0;temp<NB_BOOKMARKS;temp++)
{
bookmark_dropdown[temp]=
Window_set_dropdown_button(127+(88+1)*(temp%2),18+(temp/2)*12,88,11,56,"",0,0,1,RIGHT_SIDE); // 10-13
Window_set_dropdown_button(127+(88+1)*(temp%2),18+(temp/2)*12,88,11,56,"",0,0,1,RIGHT_SIDE,0); // 10-13
Window_display_icon_sprite(bookmark_dropdown[temp]->Pos_X+3,bookmark_dropdown[temp]->Pos_Y+2,ICON_STAR);
Display_bookmark(bookmark_dropdown[temp],temp);
}

View File

@ -595,6 +595,8 @@ GFX2_GLOBAL struct
Func_action Right_action; ///< Action triggered by a right mouseclick on the button
word Left_shortcut[2]; ///< Keyboard shortcut for a left mouseclick
word Right_shortcut[2];///< Keyboard shortcut for a right mouseclick
byte Left_instant; ///< Will not wait for mouse release before triggering action
byte Right_instant; ///< Will not wait for mouse release before triggering action
// Data used when the button is unselected
Func_action Unselect_action; ///< Action triggered by unselecting the button

View File

@ -2478,14 +2478,16 @@ static const T_Help_table helptable_hide[] =
HELP_TEXT ("")
HELP_BOLD ("LEFT CLICK")
HELP_TEXT ("")
HELP_TEXT ("Allow you to hide or show the layer bar.")
HELP_TEXT ("Opens a drop-down menu where you can choose")
HELP_TEXT ("Which toolbars are going to be visible in")
HELP_TEXT ("the menu.")
HELP_TEXT ("")
HELP_BOLD ("RIGHT CLICK")
HELP_LINK ("(Key:%s)",0x200+BUTTON_HIDE)
HELP_TEXT ("")
HELP_TEXT ("Allows you to hide all the menus. If you do ")
HELP_TEXT ("this, take care to watch before the key to ")
HELP_TEXT ("press to show the menu back (the key is")
HELP_LINK ("%s).",0x100+BUTTON_HIDE)
HELP_TEXT ("Allows you to hide all toolbars, leaving")
HELP_TEXT ("only the status bar.")
HELP_TEXT ("Click again to show them again.")
};

View File

@ -174,9 +174,9 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
SDLK_SPACE|MOD_SHIFT, // Shift + Space
0},
{18,
"Show/hide option menu",
"Switch the tool bar display on/off.",
"This hot-key cannot be removed.",
"Show/hide menu toolbars",
"Hides all toolbar menus, or shows",
"them back.",
"",
false,
SDLK_F10, // F10
@ -1499,7 +1499,7 @@ word Ordering[NB_SHORTCUTS]=
SPECIAL_MOUSE_RIGHT, // Emulate mouse right
SPECIAL_CLICK_LEFT, // Emulate mouse click left
SPECIAL_CLICK_RIGHT, // Emulate mouse click right
0x200+BUTTON_HIDE, // Show / Hide menu
0x200+BUTTON_HIDE, // Show / Hide menus
SPECIAL_SHOW_HIDE_CURSOR, // Show / Hide cursor
SPECIAL_DOT_PAINTBRUSH, // Paintbrush = "."
0x100+BUTTON_PAINTBRUSHES, // Paintbrush choice

52
init.c
View File

@ -928,6 +928,8 @@ void Init_button(byte btn_number,
byte shape,
Func_action left_action,
Func_action right_action,
byte left_instant,
byte right_instant,
Func_action unselect_action,
byte family)
{
@ -939,6 +941,8 @@ void Init_button(byte btn_number,
Buttons_Pool[btn_number].Shape =shape;
Buttons_Pool[btn_number].Left_action =left_action;
Buttons_Pool[btn_number].Right_action =right_action;
Buttons_Pool[btn_number].Left_instant =left_instant;
Buttons_Pool[btn_number].Right_instant =right_instant;
Buttons_Pool[btn_number].Unselect_action =unselect_action;
Buttons_Pool[btn_number].Family =family;
}
@ -961,6 +965,7 @@ void Init_buttons(void)
1,1,
BUTTON_SHAPE_RECTANGLE,
Do_nothing,Do_nothing,
0,0,
Do_nothing,
0);
}
@ -972,6 +977,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Paintbrush_menu,Button_Brush_monochrome,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -980,6 +986,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Adjust,Button_Transform_menu,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -988,6 +995,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Draw,Button_Draw_switch_mode,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -996,6 +1004,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Curves,Button_Curves_switch_mode,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1004,6 +1013,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Lines,Button_Lines_switch_mode,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1012,6 +1022,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Airbrush,Button_Airbrush_menu,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1020,6 +1031,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Fill,Button_Replace,
0,0,
Button_Unselect_fill,
FAMILY_TOOL);
@ -1028,6 +1040,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_TOP_LEFT,
Button_polygon,Button_Polyform,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1036,6 +1049,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT,
Button_Polyfill,Button_Filled_polyform,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1044,6 +1058,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_TOP_LEFT,
Button_Empty_rectangle,Button_Empty_rectangle,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1052,6 +1067,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT,
Button_Filled_rectangle,Button_Filled_rectangle,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1060,6 +1076,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_TOP_LEFT,
Button_Empty_circle,Button_Empty_ellipse,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1068,6 +1085,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT,
Button_Filled_circle,Button_Filled_ellipse,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1076,6 +1094,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Grad_rectangle,Button_Gradients,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1084,6 +1103,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Grad_circle,Button_Grad_ellipse,
0,0,
Do_nothing,
FAMILY_TOOL);
@ -1092,6 +1112,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_TOP_LEFT,
Button_Brush,Button_Restore_brush,
0,0,
Button_Unselect_brush,
FAMILY_INTERRUPTION);
@ -1100,6 +1121,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT,
Button_Lasso,Button_Restore_brush,
0,0,
Button_Unselect_lasso,
FAMILY_INTERRUPTION);
@ -1112,6 +1134,7 @@ void Init_buttons(void)
#else
Button_Brush_FX, Button_Brush_FX,
#endif
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1120,6 +1143,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Effects,Button_Effects,
0,0,
Do_nothing,
FAMILY_EFFECTS);
@ -1128,6 +1152,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Text,Button_Text,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1136,6 +1161,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Magnify,Button_Magnify_menu,
0,0,
Button_Unselect_magnifier,
FAMILY_INTERRUPTION);
@ -1144,6 +1170,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Colorpicker,Button_Invert_foreback,
0,0,
Button_Unselect_colorpicker,
FAMILY_INTERRUPTION);
@ -1152,6 +1179,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Resolution,Button_Safety_resolution,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1160,6 +1188,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Page,Button_Copy_page,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1168,6 +1197,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_TOP_LEFT,
Button_Save,Button_Autosave,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1176,6 +1206,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT,
Button_Load,Button_Reload,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1184,6 +1215,7 @@ void Init_buttons(void)
16,16,
BUTTON_SHAPE_RECTANGLE,
Button_Settings,Button_Skins,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1192,6 +1224,7 @@ void Init_buttons(void)
17,16,
BUTTON_SHAPE_RECTANGLE,
Button_Clear,Button_Clear_with_backcolor,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1200,6 +1233,7 @@ void Init_buttons(void)
17,16,
BUTTON_SHAPE_RECTANGLE,
Button_Help,Button_Stats,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1208,6 +1242,7 @@ void Init_buttons(void)
19,12,
BUTTON_SHAPE_RECTANGLE,
Button_Undo,Button_Redo,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1216,6 +1251,7 @@ void Init_buttons(void)
19,7,
BUTTON_SHAPE_RECTANGLE,
Button_Kill,Button_Kill,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1224,6 +1260,7 @@ void Init_buttons(void)
19,12,
BUTTON_SHAPE_RECTANGLE,
Button_Quit,Button_Quit,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1232,6 +1269,7 @@ void Init_buttons(void)
16,8,
BUTTON_SHAPE_RECTANGLE,
Button_Palette,Button_Secondary_palette,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1240,6 +1278,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_TOP_LEFT,
Button_Pal_left,Button_Pal_left_fast,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1248,6 +1287,7 @@ void Init_buttons(void)
15,15,
BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT,
Button_Pal_right,Button_Pal_right_fast,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1256,6 +1296,7 @@ void Init_buttons(void)
1,32, // La largeur est mise à jour à chq chngmnt de mode
BUTTON_SHAPE_NO_FRAME,
Button_Select_forecolor,Button_Select_backcolor,
0,0,
Do_nothing,
FAMILY_INSTANT);
@ -1265,6 +1306,7 @@ void Init_buttons(void)
57,9,
BUTTON_SHAPE_RECTANGLE,
Button_Layer_menu, Button_Layer_menu,
0,0,
Do_nothing,
FAMILY_INSTANT);
Init_button(BUTTON_LAYER_COLOR,
@ -1272,6 +1314,7 @@ void Init_buttons(void)
13,9,
BUTTON_SHAPE_RECTANGLE,
Button_Layer_get_transparent, Button_Layer_set_transparent,
0,0,
Do_nothing,
FAMILY_INSTANT);
Init_button(BUTTON_LAYER_MERGE,
@ -1279,6 +1322,7 @@ void Init_buttons(void)
13,9,
BUTTON_SHAPE_RECTANGLE,
Button_Layer_merge, Button_Layer_merge,
0,0,
Do_nothing,
FAMILY_INSTANT);
Init_button(BUTTON_LAYER_ADD,
@ -1286,6 +1330,7 @@ void Init_buttons(void)
13,9,
BUTTON_SHAPE_RECTANGLE,
Button_Layer_add, Button_Layer_add,
0,0,
Do_nothing,
FAMILY_INSTANT);
Init_button(BUTTON_LAYER_REMOVE,
@ -1293,6 +1338,7 @@ void Init_buttons(void)
13,9,
BUTTON_SHAPE_RECTANGLE,
Button_Layer_remove, Button_Layer_remove,
0,0,
Do_nothing,
FAMILY_INSTANT);
Init_button(BUTTON_LAYER_DOWN,
@ -1300,6 +1346,7 @@ void Init_buttons(void)
13,9,
BUTTON_SHAPE_RECTANGLE,
Button_Layer_down, Button_Layer_down,
0,0,
Do_nothing,
FAMILY_INSTANT);
Init_button(BUTTON_LAYER_UP,
@ -1307,6 +1354,7 @@ void Init_buttons(void)
13,9,
BUTTON_SHAPE_RECTANGLE,
Button_Layer_up, Button_Layer_up,
0,0,
Do_nothing,
FAMILY_INSTANT);
Init_button(BUTTON_LAYER_SELECT,
@ -1314,6 +1362,7 @@ void Init_buttons(void)
13,9, // Will be updated according to actual number of layers
BUTTON_SHAPE_NO_FRAME,
Button_Layer_select, Button_Layer_toggle,
0,0,
Do_nothing,
FAMILY_INSTANT);
// Status bar
@ -1321,7 +1370,8 @@ void Init_buttons(void)
0,0,
16,9,
BUTTON_SHAPE_RECTANGLE,
Button_Toggle_layerbar, Button_Toggle_toolbox,
Button_Toggle_toolbar, Button_Toggle_all_toolbars,
1,0,
Do_nothing,
FAMILY_TOOLBAR);
}

View File

@ -2301,13 +2301,13 @@ int Save_C64_window(byte *saveWhat, byte *loadAddr)
Window_set_normal_button(10,100,80,15,"Cancel",1,1,SDLK_ESCAPE);
Print_in_window(13,18,"Data:",MC_Dark,MC_Light);
what=Window_set_dropdown_button(10,28,90,15,70,what_label[*saveWhat],1, 0, 1, LEFT_SIDE);
what=Window_set_dropdown_button(10,28,90,15,70,what_label[*saveWhat],1, 0, 1, LEFT_SIDE,0);
Window_dropdown_clear_items(what);
for (i=0; i<sizeof(what_label)/sizeof(char *); i++)
Window_dropdown_add_item(what,i,what_label[i]);
Print_in_window(113,18,"Address:",MC_Dark,MC_Light);
addr=Window_set_dropdown_button(110,28,70,15,70,address_label[*loadAddr/32],1, 0, 1, LEFT_SIDE);
addr=Window_set_dropdown_button(110,28,70,15,70,address_label[*loadAddr/32],1, 0, 1, LEFT_SIDE,0);
Window_dropdown_clear_items(addr);
for (i=0; i<sizeof(address_label)/sizeof(char *); i++)
Window_dropdown_add_item(addr,i,address_label[i]);

View File

@ -868,7 +868,7 @@ void Button_Palette(void)
Window_set_normal_button( 6,32,59,14,"Spread" ,4,1,SDLK_e); // 10
reduce_dropdown = Window_set_dropdown_button(222, 17, 60, 14, 60, "Reduce", 0,
0, 1, 1); // 11
0, 1, LEFT_SIDE, 0); // 11
Window_dropdown_add_item(reduce_dropdown, 0, "to 128");
Window_dropdown_add_item(reduce_dropdown, 1, "to 64");
Window_dropdown_add_item(reduce_dropdown, 2, "to 32");

View File

@ -152,6 +152,7 @@ typedef struct T_Dropdown_button
byte Display_choice; ///< Boolean, true if the engine should print the selected item's label in the dropdown area when the user chooses it.
byte Display_centered; ///< Boolean, true to center the labels (otherwise, align left)
byte Display_arrow; ///< Boolean, true to display a "down" arrow box in top right
byte Bottom_up; ///< Boolean, true to make the dropdown panel go above its button instead of below it
byte Active_button; ///< Determines which mouse button(s) cause the dropdown panel to open: LEFT_SIDE || RIGHT_SIDE || (LEFT_SIDE|RIGHT_SIDE)
word Dropdown_width; ///< Width of the dropdown panel when it's open. Use 0 for "same as the dropdown button"
T_Dropdown_choice * First_item; ///< Linked list with the choices available for this dropdown.

View File

@ -136,7 +136,7 @@ void Button_Transform_menu(void)
Print_in_window( 44, 75,"Lock proportions",MC_Dark,MC_Light);
Window_set_normal_button( 28, 72, 13,13,ratio_is_locked?"X":" ",0,1,SDLK_l);// 8
unit_button = Window_set_dropdown_button(128,50,69,11,69,unit_label[unit_index],1,0,1,LEFT_SIDE|RIGHT_SIDE);// 9
unit_button = Window_set_dropdown_button(128,50,69,11,69,unit_label[unit_index],1,0,1,LEFT_SIDE|RIGHT_SIDE,0);// 9
Window_dropdown_add_item(unit_button,UNIT_PIXELS,unit_label[UNIT_PIXELS]);
Window_dropdown_add_item(unit_button,UNIT_PERCENT,unit_label[UNIT_PERCENT]);
Window_dropdown_add_item(unit_button,UNIT_RATIO,unit_label[UNIT_RATIO]);