change all references to SDLK_xxxxx to KEY_xxxx

+ some fixes
This commit is contained in:
Thomas Bernard 2018-05-31 16:44:04 +02:00
parent 77005eb780
commit 4d86b8a0c1
31 changed files with 863 additions and 542 deletions

View File

@ -64,6 +64,11 @@ endif
# Video / input API used
API ?= sdl
# At the moment support for TTF requires SDL or SDL2
ifneq (sdl,$(findstring sdl,$(API)))
NOTTF = 1
endif
### PLATFORM DETECTION AND CONFIGURATION ###
PLATFORMOBJ =

View File

@ -1,104 +1,104 @@
$(OBJDIR)/SFont.o: SFont.c SFont.h
$(OBJDIR)/SFont.o: SFont.c
$(OBJDIR)/brush.o: brush.c global.h struct.h const.h graph.h misc.h errors.h \
windows.h sdlscreen.h brush.h tiles.h
windows.h screen.h brush.h tiles.h
$(OBJDIR)/brush_ops.o: brush_ops.c brush.h struct.h const.h buttons.h loadsave.h \
gfx2surface.h engine.h global.h graph.h misc.h operatio.h pages.h \
sdlscreen.h windows.h
screen.h windows.h
$(OBJDIR)/buttons.o: buttons.c const.h struct.h global.h misc.h graph.h engine.h \
readline.h filesel.h loadsave.h gfx2surface.h init.h buttons.h \
operatio.h pages.h palette.h errors.h readini.h saveini.h shade.h io.h \
help.h text.h sdlscreen.h windows.h brush.h input.h special.h tiles.h \
setup.h unicode.h
help.h text.h screen.h windows.h brush.h input.h keycodes.h special.h \
tiles.h setup.h unicode.h
$(OBJDIR)/buttons_effects.o: buttons_effects.c brush.h struct.h const.h buttons.h \
loadsave.h gfx2surface.h engine.h global.h graph.h help.h input.h misc.h \
pages.h readline.h sdlscreen.h windows.h tiles.h
loadsave.h gfx2surface.h engine.h global.h graph.h help.h input.h \
keycodes.h misc.h pages.h readline.h screen.h windows.h tiles.h
$(OBJDIR)/colorred.o: colorred.c colorred.h struct.h const.h
$(OBJDIR)/engine.o: engine.c const.h struct.h global.h graph.h misc.h special.h \
buttons.h loadsave.h gfx2surface.h operatio.h shade.h errors.h \
sdlscreen.h windows.h brush.h input.h engine.h pages.h layers.h \
factory.h io.h pxsimple.h oldies.h
buttons.h loadsave.h gfx2surface.h operatio.h shade.h errors.h screen.h \
windows.h brush.h input.h keycodes.h engine.h pages.h layers.h factory.h \
io.h pxsimple.h oldies.h
$(OBJDIR)/factory.o: factory.c brush.h struct.h const.h buttons.h loadsave.h \
gfx2surface.h engine.h errors.h filesel.h global.h graph.h io.h misc.h \
pages.h readline.h sdlscreen.h windows.h palette.h input.h help.h \
realpath.h setup.h tiles.h
pages.h readline.h screen.h windows.h palette.h input.h keycodes.h \
help.h realpath.h setup.h tiles.h
$(OBJDIR)/fileformats.o: fileformats.c errors.h global.h struct.h const.h \
loadsave.h gfx2surface.h misc.h io.h pages.h windows.h fileformats.h
$(OBJDIR)/filesel.o: filesel.c const.h struct.h global.h misc.h errors.h io.h \
windows.h sdlscreen.h loadsave.h gfx2surface.h mountlist.h engine.h \
readline.h input.h help.h unicode.h filesel.h
windows.h screen.h loadsave.h gfx2surface.h mountlist.h engine.h \
readline.h input.h keycodes.h help.h unicode.h filesel.h
$(OBJDIR)/gfx2surface.o: gfx2surface.c gfx2surface.h struct.h const.h errors.h
$(OBJDIR)/graph.o: graph.c global.h struct.h const.h engine.h buttons.h loadsave.h \
gfx2surface.h pages.h errors.h sdlscreen.h graph.h misc.h pxsimple.h \
gfx2surface.h pages.h errors.h screen.h graph.h misc.h pxsimple.h \
pxtall.h pxwide.h pxdouble.h pxtriple.h pxwide2.h pxtall2.h pxtall3.h \
pxquad.h windows.h input.h brush.h tiles.h
pxquad.h windows.h input.h keycodes.h brush.h tiles.h
$(OBJDIR)/help.o: help.c const.h struct.h global.h misc.h engine.h helpfile.h \
help.h sdlscreen.h text.h keyboard.h windows.h input.h hotkeys.h \
help.h screen.h text.h keyboard.h windows.h input.h keycodes.h hotkeys.h \
errors.h pages.h factory.h
$(OBJDIR)/hotkeys.o: hotkeys.c struct.h const.h global.h hotkeys.h
$(OBJDIR)/hotkeys.o: hotkeys.c struct.h const.h global.h hotkeys.h keycodes.h
$(OBJDIR)/init.o: init.c buttons.h struct.h const.h loadsave.h gfx2surface.h \
errors.h global.h graph.h init.h io.h factory.h help.h hotkeys.h \
keyboard.h misc.h mountlist.h operatio.h palette.h setup.h transform.h \
windows.h layers.h special.h
$(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h sdlscreen.h \
windows.h errors.h misc.h buttons.h loadsave.h gfx2surface.h input.h
$(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h screen.h windows.h \
errors.h misc.h buttons.h loadsave.h gfx2surface.h input.h keycodes.h
$(OBJDIR)/io.o: io.c struct.h const.h io.h realpath.h unicode.h global.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 \
sdlscreen.h input.h help.h misc.h readline.h graph.h
screen.h input.h keycodes.h help.h misc.h readline.h graph.h
$(OBJDIR)/libraw2crtc.o: libraw2crtc.c const.h global.h struct.h loadsave.h \
gfx2surface.h
$(OBJDIR)/loadrecoil.o: loadrecoil.c struct.h const.h global.h loadsave.h \
gfx2surface.h io.h errors.h recoil.h
$(OBJDIR)/loadsave.o: loadsave.c buttons.h struct.h const.h loadsave.h \
gfx2surface.h errors.h global.h io.h misc.h graph.h op_c.h colorred.h \
pages.h palette.h windows.h engine.h brush.h setup.h filesel.h unicode.h \
fileformats.h
pages.h palette.h screen.h windows.h engine.h brush.h setup.h filesel.h \
unicode.h fileformats.h
$(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h misc.h init.h buttons.h \
loadsave.h gfx2surface.h engine.h pages.h sdlscreen.h errors.h readini.h \
loadsave.h gfx2surface.h engine.h pages.h screen.h errors.h readini.h \
saveini.h io.h text.h setup.h windows.h brush.h palette.h realpath.h \
input.h help.h filesel.h
$(OBJDIR)/misc.o: misc.c struct.h const.h sdlscreen.h global.h errors.h buttons.h \
loadsave.h gfx2surface.h engine.h misc.h keyboard.h windows.h palette.h \
input.h graph.h pages.h
input.h keycodes.h help.h filesel.h
$(OBJDIR)/misc.o: misc.c struct.h const.h global.h errors.h buttons.h loadsave.h \
gfx2surface.h engine.h misc.h keyboard.h screen.h windows.h palette.h \
input.h keycodes.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 gfx2surface.h misc.h sdlscreen.h \
windows.h oldies.h pages.h fileformats.h
global.h io.h libraw2crtc.h loadsave.h gfx2surface.h misc.h screen.h \
windows.h oldies.h pages.h keycodes.h fileformats.h
$(OBJDIR)/mountlist.o: mountlist.c mountlist.h
$(OBJDIR)/oldies.o: oldies.c struct.h const.h global.h errors.h misc.h palette.h \
pages.h windows.h layers.h
$(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h colorred.h errors.h global.h \
engine.h windows.h
$(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h misc.h engine.h graph.h \
operatio.h buttons.h loadsave.h gfx2surface.h pages.h errors.h \
sdlscreen.h brush.h windows.h input.h special.h tiles.h
operatio.h buttons.h loadsave.h gfx2surface.h pages.h errors.h screen.h \
brush.h windows.h input.h keycodes.h special.h tiles.h
$(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h errors.h loadsave.h \
gfx2surface.h misc.h windows.h tiles.h graph.h
$(OBJDIR)/palette.o: palette.c const.h struct.h global.h misc.h engine.h readline.h \
buttons.h loadsave.h gfx2surface.h pages.h help.h sdlscreen.h errors.h \
op_c.h colorred.h windows.h input.h palette.h shade.h
buttons.h loadsave.h gfx2surface.h pages.h help.h screen.h errors.h \
op_c.h colorred.h windows.h input.h keycodes.h palette.h shade.h
$(OBJDIR)/pversion.o: pversion.c
$(OBJDIR)/pxdouble.o: pxdouble.c global.h struct.h const.h sdlscreen.h misc.h \
graph.h pxdouble.h pxwide.h
$(OBJDIR)/pxquad.o: pxquad.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
$(OBJDIR)/pxdouble.o: pxdouble.c global.h struct.h const.h screen.h misc.h graph.h \
pxdouble.h pxwide.h
$(OBJDIR)/pxquad.o: pxquad.c global.h struct.h const.h screen.h misc.h graph.h \
pxquad.h
$(OBJDIR)/pxsimple.o: pxsimple.c global.h struct.h const.h sdlscreen.h misc.h \
graph.h pxsimple.h
$(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
$(OBJDIR)/pxsimple.o: pxsimple.c global.h struct.h const.h screen.h misc.h graph.h \
pxsimple.h
$(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h screen.h misc.h graph.h \
pxtall.h pxsimple.h
$(OBJDIR)/pxtall2.o: pxtall2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
$(OBJDIR)/pxtall2.o: pxtall2.c global.h struct.h const.h screen.h misc.h graph.h \
pxtall2.h
$(OBJDIR)/pxtall3.o: pxtall3.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
$(OBJDIR)/pxtall3.o: pxtall3.c global.h struct.h const.h screen.h misc.h graph.h \
pxtall3.h
$(OBJDIR)/pxtriple.o: pxtriple.c global.h struct.h const.h sdlscreen.h misc.h \
graph.h pxtriple.h
$(OBJDIR)/pxwide.o: pxwide.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
$(OBJDIR)/pxtriple.o: pxtriple.c global.h struct.h const.h screen.h misc.h graph.h \
pxtriple.h
$(OBJDIR)/pxwide.o: pxwide.c global.h struct.h const.h screen.h misc.h graph.h \
pxwide.h
$(OBJDIR)/pxwide2.o: pxwide2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
$(OBJDIR)/pxwide2.o: pxwide2.c global.h struct.h const.h screen.h misc.h graph.h \
pxwide2.h
$(OBJDIR)/readini.o: readini.c const.h errors.h global.h struct.h misc.h readini.h \
setup.h realpath.h io.h windows.h
$(OBJDIR)/readline.o: readline.c const.h struct.h global.h misc.h errors.h \
sdlscreen.h readline.h windows.h input.h engine.h unicode.h
$(OBJDIR)/readline.o: readline.c const.h struct.h global.h misc.h errors.h screen.h \
readline.h windows.h input.h keycodes.h engine.h unicode.h
$(OBJDIR)/realpath.o: realpath.c
$(OBJDIR)/recoil.o: recoil.c recoil.h
$(OBJDIR)/saveini.o: saveini.c const.h global.h struct.h readini.h io.h errors.h \
@ -107,18 +107,18 @@ $(OBJDIR)/sdlscreen.o: sdlscreen.c global.h struct.h const.h sdlscreen.h errors.
misc.h
$(OBJDIR)/setup.o: setup.c struct.h const.h io.h setup.h
$(OBJDIR)/shade.o: shade.c global.h struct.h const.h graph.h engine.h errors.h \
misc.h readline.h help.h sdlscreen.h windows.h input.h shade.h
misc.h readline.h help.h screen.h windows.h input.h keycodes.h shade.h
$(OBJDIR)/special.o: special.c const.h struct.h global.h graph.h engine.h windows.h \
special.h pages.h misc.h buttons.h loadsave.h gfx2surface.h
$(OBJDIR)/text.o: text.c SFont.h struct.h const.h global.h sdlscreen.h io.h \
errors.h windows.h misc.h setup.h
$(OBJDIR)/tiles.o: tiles.c struct.h const.h global.h graph.h sdlscreen.h engine.h \
windows.h input.h misc.h tiles.h
$(OBJDIR)/text.o: text.c struct.h const.h global.h io.h errors.h windows.h misc.h \
setup.h
$(OBJDIR)/tiles.o: tiles.c struct.h const.h global.h graph.h screen.h engine.h \
windows.h input.h keycodes.h misc.h tiles.h
$(OBJDIR)/transform.o: transform.c global.h struct.h const.h transform.h engine.h \
sdlscreen.h windows.h input.h help.h misc.h readline.h buttons.h \
screen.h windows.h input.h keycodes.h help.h misc.h readline.h buttons.h \
loadsave.h gfx2surface.h pages.h tiles.h
$(OBJDIR)/unicode.o: unicode.c unicode.h struct.h const.h
$(OBJDIR)/version.o: version.c
$(OBJDIR)/windows.o: windows.c windows.h struct.h const.h engine.h errors.h \
global.h graph.h input.h misc.h op_c.h colorred.h readline.h sdlscreen.h \
palette.h unicode.h
global.h graph.h input.h keycodes.h misc.h op_c.h colorred.h readline.h \
screen.h palette.h unicode.h

View File

@ -25,6 +25,7 @@
GERMANY
karlb@gmx.net
*/
#if defined(USE_SDL) || defined(USE_SDL2)
#include <SDL.h>
#include <SDL_video.h>
@ -222,3 +223,4 @@ void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font *Font,
y, text);
}
*/
#endif

View File

@ -79,6 +79,7 @@
#include "tiles.h"
#include "setup.h"
#include "unicode.h"
#include "keycodes.h"
#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
#include <proto/dos.h>
@ -109,7 +110,7 @@ void Bouton_***(void)
Open_window(310,190,"***");
Window_set_normal_button(103,137,80,14,"OK",0,1,SDLK_RETURN); // 1
Window_set_normal_button(103,137,80,14,"OK",0,1,KEY_RETURN); // 1
Window_set_scroller_button(18,44,88,16,4,0); // 2
Update_window_area(0,0,Window_width, Window_height);
@ -137,13 +138,13 @@ void Message_out_of_memory(void)
Print_in_window(8,20,"Please consult the manual",MC_Black,MC_Light);
Print_in_window(24,28,"to know how to obtain",MC_Black,MC_Light);
Print_in_window(36,36,"more memory space.",MC_Black,MC_Light);
Window_set_normal_button(60,53,40,14,"OK",1,1,SDLK_RETURN); // 1
Window_set_normal_button(60,53,40,14,"OK",1,1,KEY_RETURN); // 1
Update_window_area(0,0,Window_width, Window_height);
Display_cursor();
do
clicked_button=Window_clicked_button();
while ((clicked_button<=0) && (Key!=KEY_ESC) && (Key!=SDLK_o));
while ((clicked_button<=0) && (Key!=KEY_ESC) && (Key!=KEY_o));
if(clicked_button<=0) Key=0;
Close_window();
@ -613,8 +614,8 @@ byte Button_Quit_local_function(void)
// On commence par afficher la fenêtre de QUIT
Open_window(160,84,"Quit ?");
Window_set_normal_button(20,20,120,14,"Stay",0,1,KEY_ESC); // 1
Window_set_normal_button(20,40,120,14,"Save & quit",1,1,SDLK_s); // 2
Window_set_normal_button(20,60,120,14,"Discard (Quit)",1,1,SDLK_d);// 3
Window_set_normal_button(20,40,120,14,"Save & quit",1,1,KEY_s); // 2
Window_set_normal_button(20,60,120,14,"Discard (Quit)",1,1,KEY_d);// 3
Update_window_area(0,0,Window_width, Window_height);
Display_cursor();
@ -1035,11 +1036,11 @@ void Button_Settings(int btn)
Open_window(307,182,"Settings");
// Button Reload
Window_set_normal_button( 6,163, 51,14,"Reload" ,1,1,SDLK_r); // 1
Window_set_normal_button( 6,163, 51,14,"Reload" ,1,1,KEY_r); // 1
// Button Auto-save
Window_set_normal_button( 73,163,107,14,"Auto-save: ",1,1,SDLK_a); // 2
Window_set_normal_button( 73,163,107,14,"Auto-save: ",1,1,KEY_a); // 2
// Button Save
Window_set_normal_button(183,163, 51,14,"Save" ,1,1,SDLK_s); // 3
Window_set_normal_button(183,163, 51,14,"Save" ,1,1,KEY_s); // 3
// Button Close
Window_set_normal_button(250,163, 51,14,"Close" ,0,1,KEY_ESC); // 4
@ -1165,7 +1166,7 @@ void Button_Settings(int btn)
else if (Is_shortcut(Key,0x100+BUTTON_SETTINGS))
clicked_button=4;
}
while ( (clicked_button!=4) && (Key!=SDLK_RETURN) );
while ( (clicked_button!=4) && (Key!=KEY_RETURN) );
// Checks on change
if (Config.Show_hidden_directories!=selected_config.Show_hidden_directories
@ -1327,7 +1328,7 @@ void Button_Skins(int btn)
Print_in_window( 172, 59,"Cursor:" ,MC_Black,MC_Light);
// Ok button
Window_set_normal_button(6, 120, 51, 14, "OK", 0, 1, SDLK_RETURN); // 1
Window_set_normal_button(6, 120, 51, 14, "OK", 0, 1, KEY_RETURN); // 1
// List of skins
skin_list = Window_set_list_button(
@ -1346,7 +1347,7 @@ void Button_Skins(int btn)
Window_dropdown_add_item(font_dropdown,temp,Get_item_by_index(&Font_files_list,temp)->Short_name);
// Cancel
Window_set_normal_button(61, 120, 51,14,"Cancel",0,1,SDLK_ESCAPE); // 6
Window_set_normal_button(61, 120, 51,14,"Cancel",0,1,KEY_ESCAPE); // 6
// Dropdown list to choose cursor type
cursor_dropdown = Window_set_dropdown_button(172, 69, 104, 11, 0,
@ -1488,7 +1489,7 @@ void Button_Skins(int btn)
break;
}
}
while ( (clicked_button!=1) && (clicked_button !=6) && (Key != SDLK_ESCAPE));
while ( (clicked_button!=1) && (clicked_button !=6) && (Key != KEY_ESCAPE));
if(clicked_button == 1)
{
@ -1688,11 +1689,11 @@ void Button_Copy_page(int btn)
Open_window(168,137,"Copy to spare page");
Window_set_normal_button(10, 20,148,14,"Pixels + palette" , 0,1,SDLK_RETURN); // 1
Window_set_normal_button(10, 37,148,14,"Pixels only" , 3,1,SDLK_x); // 2
Window_set_normal_button(10, 54,148,14,"Palette only" , 1,1,SDLK_p); // 3
Window_set_normal_button(10, 71,148,14,"Some colors only" , 6,1,SDLK_c); // 4
Window_set_normal_button(10, 88,148,14,"Palette and remap",13,1,SDLK_r); // 5
Window_set_normal_button(10, 20,148,14,"Pixels + palette" , 0,1,KEY_RETURN); // 1
Window_set_normal_button(10, 37,148,14,"Pixels only" , 3,1,KEY_x); // 2
Window_set_normal_button(10, 54,148,14,"Palette only" , 1,1,KEY_p); // 3
Window_set_normal_button(10, 71,148,14,"Some colors only" , 6,1,KEY_c); // 4
Window_set_normal_button(10, 88,148,14,"Palette and remap",13,1,KEY_r); // 5
Window_set_normal_button(44,114, 80,14,"Cancel" , 0,1,KEY_ESC); // 6
Update_window_area(0,0,Window_width, Window_height);
@ -1927,14 +1928,14 @@ void Button_Resolution(int btn)
Print_in_window( 12, 21,"Picture size:" ,MC_Dark,MC_Light);
Window_display_frame ( 8,17,195, 33);
Window_set_normal_button(223, 18,67,14,"OK" ,0,1,SDLK_RETURN); // 1
Window_set_normal_button(223, 18,67,14,"OK" ,0,1,KEY_RETURN); // 1
Window_set_normal_button(223, 35,67,14,"Cancel" ,0,1,KEY_ESC); // 2
Print_in_window_underscore( 12, 37,"Width:",MC_Dark,MC_Light,1);
input_width_button=Window_set_input_button_s( 60, 35,4,SDLK_w); // 3
input_width_button=Window_set_input_button_s( 60, 35,4,KEY_w); // 3
Print_in_window_underscore(108, 37,"Height:",MC_Dark,MC_Light,1);
input_button_height=Window_set_input_button_s(164, 35,4,SDLK_h); // 4
input_button_height=Window_set_input_button_s(164, 35,4,KEY_h); // 4
Window_display_frame ( 8,72,283,110);
Window_display_frame_in (37,84,228,84);
@ -2099,7 +2100,7 @@ void Button_Resolution(int btn)
// Gestion des touches de déplacement dans la liste
switch (Key)
{
case SDLK_UP : // Haut
case KEY_UP : // Haut
if (cursor_position>0)
cursor_position--;
else
@ -2108,7 +2109,7 @@ void Button_Resolution(int btn)
Scroll_list_of_modes(list_start,cursor_position,&selected_mode);
Key=0;
break;
case SDLK_DOWN : // Bas
case KEY_DOWN : // Bas
if (cursor_position<(MODELIST_LINES-1) && cursor_position<(Nb_video_modes-1))
cursor_position++;
else
@ -2117,7 +2118,7 @@ void Button_Resolution(int btn)
Scroll_list_of_modes(list_start,cursor_position,&selected_mode);
Key=0;
break;
case SDLK_PAGEUP : // PageUp
case KEY_PAGEUP : // PageUp
if (cursor_position>0)
cursor_position=0;
else
@ -2130,7 +2131,7 @@ void Button_Resolution(int btn)
Scroll_list_of_modes(list_start,cursor_position,&selected_mode);
Key=0;
break;
case SDLK_PAGEDOWN : // PageDown
case KEY_PAGEDOWN : // PageDown
if (Nb_video_modes<MODELIST_LINES)
cursor_position=Nb_video_modes-1;
else if (cursor_position<(MODELIST_LINES-1))
@ -2145,13 +2146,13 @@ void Button_Resolution(int btn)
Scroll_list_of_modes(list_start,cursor_position,&selected_mode);
Key=0;
break;
case SDLK_HOME : // Home
case KEY_HOME : // Home
list_start=0;
cursor_position=0;
Scroll_list_of_modes(list_start,cursor_position,&selected_mode);
Key=0;
break;
case SDLK_END : // End
case KEY_END : // End
if (Nb_video_modes<MODELIST_LINES)
cursor_position=Nb_video_modes-1;
else
@ -2559,12 +2560,12 @@ void Button_Gradients(int btn)
Main.backups->Pages->Gradients->Range[Current_gradient].Mix); // 3
// Direction
Window_set_normal_button(8,20,15,14,
(Main.backups->Pages->Gradients->Range[Current_gradient].Inverse)?"\033":"\032",0,1,SDLK_TAB); // 4
(Main.backups->Pages->Gradients->Range[Current_gradient].Inverse)?"\033":"\032",0,1,KEY_TAB); // 4
// Technique
Window_set_normal_button(8,90,15,14,"",0,1,SDLK_TAB|MOD_SHIFT); // 5
Window_set_normal_button(8,90,15,14,"",0,1,KEY_TAB|MOD_SHIFT); // 5
Draw_button_gradient_style(8,90,Main.backups->Pages->Gradients->Range[Current_gradient].Technique);
Window_set_normal_button(178,128,51,14,"OK",0,1,SDLK_RETURN); // 6
Window_set_normal_button(178,128,51,14,"OK",0,1,KEY_RETURN); // 6
Window_set_normal_button(123,128,51,14,"Cancel",0,1,KEY_ESC); // 7
// Scrolling speed
speed_scroller = Window_set_horizontal_scroller_button(99,111,130,106,1,Main.backups->Pages->Gradients->Range[Current_gradient].Speed); // 8
@ -2743,8 +2744,8 @@ void Button_Gradients(int btn)
if (!Mouse_K)
switch (Key)
{
case SDLK_BACKQUOTE : // Récupération d'une couleur derrière le menu
case SDLK_COMMA :
case KEY_BACKQUOTE : // Récupération d'une couleur derrière le menu
case KEY_COMMA :
Get_color_behind_window(&color,&click);
if (click)
{
@ -4177,42 +4178,42 @@ void Button_Airbrush_menu(int btn)
Open_window(226,170,"Spray");
Window_set_normal_button(110,148,51,14,"Cancel" ,0,1,KEY_ESC); // 1
Window_set_normal_button(166,148,51,14,"OK" ,0,1,SDLK_RETURN); // 2
Window_set_normal_button(166,148,51,14,"OK" ,0,1,KEY_RETURN); // 2
Window_set_scroller_button(178,62,74,50,1,49-Airbrush_multi_flow[selected_color]); // 3
Window_set_palette_button(7,56); // 4
Window_set_normal_button( 8,148,83,14,"Mode: ",0,1,SDLK_TAB); // 5
Window_set_normal_button( 8,148,83,14,"Mode: ",0,1,KEY_TAB); // 5
if (Airbrush_mode)
Print_in_window(50,151," Mono",MC_Black,MC_Light);
else
Print_in_window(50,151,"Multi",MC_Black,MC_Light);
Window_set_normal_button(194, 62,19,14,"+1" ,0,1,SDLK_KP_PLUS); // 6
Window_set_normal_button(194, 79,19,14,"-1" ,0,1,SDLK_KP_MINUS); // 7
Window_set_normal_button(194, 96,19,14,"x2" ,0,1,SDLK_KP_MULTIPLY); // 8
Window_set_normal_button(194,113,19,14,"\xf7""2" ,0,1,SDLK_KP_ENTER); // 9
Window_set_normal_button(194, 62,19,14,"+1" ,0,1,KEY_KP_PLUS); // 6
Window_set_normal_button(194, 79,19,14,"-1" ,0,1,KEY_KP_MINUS); // 7
Window_set_normal_button(194, 96,19,14,"x2" ,0,1,KEY_KP_MULTIPLY); // 8
Window_set_normal_button(194,113,19,14,"\xf7""2" ,0,1,KEY_KP_ENTER); // 9
Window_set_normal_button( 8, 37,43,14,"Clear" ,1,1,SDLK_c); // 10
Window_set_normal_button( 8, 37,43,14,"Clear" ,1,1,KEY_c); // 10
Print_in_window_underscore(142,25,"Size:" ,MC_Dark,MC_Light,1);
input_size_button = Window_set_input_button_s(186,23,3,SDLK_s); // 11
input_size_button = Window_set_input_button_s(186,23,3,KEY_s); // 11
Num2str(Airbrush_size,str,3);
Window_input_content(input_size_button,str);
Print_in_window_underscore(142,39,"Delay:" ,MC_Dark,MC_Light,1);
input_delay_button = Window_set_input_button_s(194,37,2,SDLK_d); // 12
input_delay_button = Window_set_input_button_s(194,37,2,KEY_d); // 12
Num2str(Airbrush_delay,str,2);
Window_input_content(input_delay_button,str);
Print_in_window_underscore( 27,24,"Mono-Flow:",MC_Dark,MC_Light,1);
input_flow_button = Window_set_input_button_s(111,22,2,SDLK_m); // 13
input_flow_button = Window_set_input_button_s(111,22,2,KEY_m); // 13
Num2str(Airbrush_mono_flow,str,2);
Window_input_content(input_flow_button,str);
Print_in_window_underscore( 67,40,"Init:",MC_Dark,MC_Light,1);
input_init_button = Window_set_input_button_s(111,38,2,SDLK_i); // 14
input_init_button = Window_set_input_button_s(111,38,2,KEY_i); // 14
Num2str(spray_init,str,2);
Window_input_content(input_init_button,str);
@ -4426,8 +4427,8 @@ void Button_Airbrush_menu(int btn)
if (!Mouse_K)
switch (Key)
{
case SDLK_BACKQUOTE : // Récupération d'une couleur derrière le menu
case SDLK_COMMA :
case KEY_BACKQUOTE : // Récupération d'une couleur derrière le menu
case KEY_COMMA :
Get_color_behind_window(&color,&click);
if (click)
{
@ -4616,14 +4617,14 @@ void Button_Effects(int btn)
Window_set_normal_button(C3, L2, 16,16,"",0,1,Config_Key[SPECIAL_GRID_MODE][0]); // 9
Window_set_normal_button(C3, L4, 16,16,"",0,1,Config_Key[SPECIAL_TILING_MODE][0]); // 10
Window_set_normal_button(195,131, 68,14,"Close",0,1,SDLK_RETURN); // 11
Window_set_normal_button(118,131, 68,14,"All off",0,1,SDLK_DELETE); // 12
Window_set_normal_button(195,131, 68,14,"Close",0,1,KEY_RETURN); // 11
Window_set_normal_button(118,131, 68,14,"All off",0,1,KEY_DELETE); // 12
// "Feedback" frame
Window_display_frame_mono(C1-5,L1+8,90,88,MC_Dark);
Window_rectangle(C1-1, L1+2, 78, 14, MC_Light);
Window_set_normal_button(C1+1,L1+2,14,14," ",0,1,SDLK_f); // 13
Window_set_normal_button(C1+1,L1+2,14,14," ",0,1,KEY_f); // 13
Print_in_window(28,24,"Feedback",MC_Dark,MC_Light);
Window_set_normal_button(C2, L4, 16,16,"",0,1,Config_Key[SPECIAL_FORMAT_CHECKER_MENU][0]); // 14
@ -4974,19 +4975,19 @@ void Button_Text(int btn)
// Texte saisi
Print_in_window_underscore(6,20,"Text:",MC_Dark,MC_Light,1);
input_text_button = Window_set_input_button_s(48,18,29,SDLK_t); // 1
input_text_button = Window_set_input_button_s(48,18,29,KEY_t); // 1
// TrueType options
Window_display_frame_in(182,34,100,68);
Print_in_window(199,31,"TrueType", MC_Dark, MC_Light);
// AA
Window_set_normal_button(188,58,13,11,antialias?"X":" ",0,1,SDLK_a); // 2
Window_set_normal_button(188,58,13,11,antialias?"X":" ",0,1,KEY_a); // 2
Print_in_window_underscore(206,60,"AntiAlias", MC_Dark, MC_Light,5);
// Bold
Window_set_normal_button(188,72,13,11,is_bold?"X":" ",0,1,SDLK_b); // 3
Window_set_normal_button(188,72,13,11,is_bold?"X":" ",0,1,KEY_b); // 3
Print_in_window_underscore(206,75,"Bold", MC_Dark, MC_Light,1);
// Italic
Window_set_normal_button(188,86,13,11,is_italic?"X":" ",0,1,SDLK_i); // 4
Window_set_normal_button(188,86,13,11,is_italic?"X":" ",0,1,KEY_i); // 4
Print_in_window_underscore(206,89,"Italic", MC_Dark, MC_Light,1);
// Scroller des fontes
@ -4996,7 +4997,7 @@ void Button_Text(int btn)
Window_display_frame_in(7, 33, 154, NB_FONTS*8+4);
// Taille texte
input_size_button = Window_set_input_button_s(220,43,3,SDLK_s); // 7
input_size_button = Window_set_input_button_s(220,43,3,KEY_s); // 7
Window_set_repeatable_button(202,43,13,11,"-",0,1,KEY_NONE); // 8
Window_set_repeatable_button(251,43,13,11,"+",0,1,KEY_NONE); // 9
@ -5004,7 +5005,7 @@ void Button_Text(int btn)
preview_button = Window_set_special_button(8,106,273,50,0); // 10
Window_display_frame_in(7, 105, 275, 52);
Window_set_normal_button(8,160,40,14,"OK",0,1,SDLK_RETURN); // 11
Window_set_normal_button(8,160,40,14,"OK",0,1,KEY_RETURN); // 11
Window_set_normal_button(54,160,60,14,"Cancel",0,1,KEY_ESC); // 12
// List of fonts

View File

@ -60,17 +60,17 @@ void Menu_tag_colors(char * window_title, byte * table, byte * mode, byte can_ca
Open_window(176,150,window_title);
Window_set_palette_button(6,38); // 1
Window_set_normal_button( 7, 19,78,14,"Clear" ,1,1,SDLK_c); // 2
Window_set_normal_button(91, 19,78,14,"Invert",1,1,SDLK_i); // 3
Window_set_normal_button( 7, 19,78,14,"Clear" ,1,1,KEY_c); // 2
Window_set_normal_button(91, 19,78,14,"Invert",1,1,KEY_i); // 3
if (can_cancel)
{
Window_set_normal_button(91,129,78,14,"OK" ,0,1,SDLK_RETURN); // 4
Window_set_normal_button(91,129,78,14,"OK" ,0,1,KEY_RETURN); // 4
Window_set_normal_button( 7,129,78,14,"Cancel",0,1,KEY_ESC); // 5
// On enregistre la table dans un backup au cas où on ferait Cancel
memcpy(backup_table,table,256);
}
else
Window_set_normal_button(49,129,78,14,"OK" ,0,1,SDLK_RETURN); // 4
Window_set_normal_button(49,129,78,14,"OK" ,0,1,KEY_RETURN); // 4
// On affiche l'état actuel de la table
for (index=0; index<=255; index++)
@ -122,8 +122,8 @@ void Menu_tag_colors(char * window_title, byte * table, byte * mode, byte can_ca
if (!Mouse_K)
switch (Key)
{
case SDLK_BACKQUOTE : // Récupération d'une couleur derrière le menu
case SDLK_COMMA :
case KEY_BACKQUOTE : // Récupération d'une couleur derrière le menu
case KEY_COMMA :
Get_color_behind_window(&color,&click);
if (click)
{
@ -232,7 +232,7 @@ void Button_Constraint_menu(void)
Open_window(154,79,"8-bit constraints");
Window_set_normal_button(21,55,51,14,"Cancel",0,1,KEY_ESC); // 1
Window_set_normal_button(82,55,51,14,"OK" ,0,1,SDLK_RETURN); // 2
Window_set_normal_button(82,55,51,14,"OK" ,0,1,KEY_RETURN); // 2
label = "Constraints";
for (i = 0; i < sizeof(modes)/sizeof(modes[0]) ; i++)
@ -290,7 +290,7 @@ void Button_Tilemap_menu(void)
Open_window(166,120,"Tilemap options");
Window_set_normal_button(6,102,51,14,"Cancel",0,1,KEY_ESC); // 1
Window_set_normal_button(110,102,51,14,"OK" ,0,1,SDLK_RETURN); // 2
Window_set_normal_button(110,102,51,14,"OK" ,0,1,KEY_RETURN); // 2
Print_in_window(24,21, "Detect mirrored",MC_Dark,MC_Light);
Window_display_frame(5,17,155,56);
@ -432,7 +432,7 @@ void Button_Grid_menu(void)
Open_window(149,118,"Grid");
Window_set_normal_button(12,92,51,14,"Cancel",0,1,KEY_ESC); // 1
Window_set_normal_button(86,92,51,14,"OK" ,0,1,SDLK_RETURN); // 2
Window_set_normal_button(86,92,51,14,"OK" ,0,1,KEY_RETURN); // 2
Print_in_window(11,26, "X:",MC_Dark,MC_Light);
input_x_button = Window_set_input_button(29,24,3); // 3
@ -624,7 +624,7 @@ void Button_Smooth_menu(void)
Open_window(142,109,"Smooth");
Window_set_normal_button(82,59,53,14,"Cancel",0,1,KEY_ESC); // 1
Window_set_normal_button(82,88,53,14,"OK" ,0,1,SDLK_RETURN); // 2
Window_set_normal_button(82,88,53,14,"OK" ,0,1,KEY_RETURN); // 2
Window_display_frame(6,17,130,37);
for (x=11,y=0; y<4; x+=31,y++)
@ -806,15 +806,15 @@ void Button_Colorize_menu(void)
Print_in_window(16,23,"Opacity:",MC_Dark,MC_Light);
Window_set_input_button(87,21,3); // 1
Print_in_window(117,23,"%",MC_Dark,MC_Light);
Window_set_normal_button(16,34,108,14,"Interpolate",1,1,SDLK_i); // 2
Window_set_normal_button(16,34,108,14,"Interpolate",1,1,KEY_i); // 2
Window_display_frame(12,18,116,34);
Window_set_normal_button(16,54,108,14,"Additive" ,2,1,SDLK_d); // 3
Window_set_normal_button(16,71,108,14,"Subtractive",1,1,SDLK_s); // 4
Window_set_normal_button(16,88,108,14,"Alpha",1,1,SDLK_a); // 4
Window_set_normal_button(16,54,108,14,"Additive" ,2,1,KEY_d); // 3
Window_set_normal_button(16,71,108,14,"Subtractive",1,1,KEY_s); // 4
Window_set_normal_button(16,88,108,14,"Alpha",1,1,KEY_a); // 4
Window_set_normal_button(16,111, 51,14,"Cancel" ,0,1,KEY_ESC); // 5
Window_set_normal_button(73,111, 51,14,"OK" ,0,1,SDLK_RETURN); // 6
Window_set_normal_button(73,111, 51,14,"OK" ,0,1,KEY_RETURN); // 6
Num2str(Colorize_opacity,str,3);
Window_input_content(Window_special_button_list,str);
@ -906,7 +906,7 @@ void Button_Tiling_menu(void)
Open_window(138,79,"Tiling");
Window_set_normal_button(13,55,51,14,"Cancel",0,1,KEY_ESC); // 1
Window_set_normal_button(74,55,51,14,"OK" ,0,1,SDLK_RETURN); // 2
Window_set_normal_button(74,55,51,14,"OK" ,0,1,KEY_RETURN); // 2
input_offset_x_button = Window_set_input_button(91,21,4); // 3
input_offset_y_button = Window_set_input_button(91,35,4); // 4
Print_in_window(12,23,"Offset X:",MC_Dark,MC_Light);
@ -1126,30 +1126,30 @@ void Button_Sieve_menu(void)
Window_set_special_button(143,69,80,80,0); // 1
Window_set_normal_button(175,157,51,14,"Cancel",0,1,KEY_ESC); // 2
Window_set_normal_button(230,157,51,14,"OK" ,0,1,SDLK_RETURN); // 3
Window_set_normal_button(230,157,51,14,"OK" ,0,1,KEY_RETURN); // 3
Window_set_normal_button( 8,157,51,14,"Clear" ,1,1,SDLK_c); // 4
Window_set_normal_button( 63,157,51,14,"Invert",1,1,SDLK_i); // 5
Window_set_normal_button( 8,157,51,14,"Clear" ,1,1,KEY_c); // 4
Window_set_normal_button( 63,157,51,14,"Invert",1,1,KEY_i); // 5
Window_set_normal_button( 8,46,131,14,"Get from brush" ,1,1,SDLK_g); // 6
Window_set_normal_button(142,46,139,14,"Transfer to brush",1,1,SDLK_t); // 7
Window_set_normal_button( 8,46,131,14,"Get from brush" ,1,1,KEY_g); // 6
Window_set_normal_button(142,46,139,14,"Transfer to brush",1,1,KEY_t); // 7
Window_set_normal_button(109,114,11,11,"\030",0,1,SDLK_UP|MOD_SHIFT); // 8
Window_set_normal_button(109,138,11,11,"\031",0,1,SDLK_DOWN|MOD_SHIFT); // 9
Window_set_normal_button( 97,126,11,11,"\033",0,1,SDLK_LEFT|MOD_SHIFT); // 10
Window_set_normal_button(121,126,11,11,"\032",0,1,SDLK_RIGHT|MOD_SHIFT); // 11
button_bg_color = Window_set_normal_button(109,126,11,11,"" ,0,1,SDLK_INSERT); // 12
Window_set_normal_button(109,114,11,11,"\030",0,1,KEY_UP|MOD_SHIFT); // 8
Window_set_normal_button(109,138,11,11,"\031",0,1,KEY_DOWN|MOD_SHIFT); // 9
Window_set_normal_button( 97,126,11,11,"\033",0,1,KEY_LEFT|MOD_SHIFT); // 10
Window_set_normal_button(121,126,11,11,"\032",0,1,KEY_RIGHT|MOD_SHIFT); // 11
button_bg_color = Window_set_normal_button(109,126,11,11,"" ,0,1,KEY_INSERT); // 12
Window_rectangle(button_bg_color->Pos_X+2,
button_bg_color->Pos_Y+2,
7, 7, (default_bg_color)?MC_White:MC_Black);
Window_set_repeatable_button(109, 69,11,11,"\030",0,1,SDLK_UP); // 13
Window_set_repeatable_button(109, 93,11,11,"\031",0,1,SDLK_DOWN); // 14
Window_set_repeatable_button( 97, 81,11,11,"\033",0,1,SDLK_LEFT); // 15
Window_set_repeatable_button(121, 81,11,11,"\032",0,1,SDLK_RIGHT); // 16
Window_set_repeatable_button(109, 69,11,11,"\030",0,1,KEY_UP); // 13
Window_set_repeatable_button(109, 93,11,11,"\031",0,1,KEY_DOWN); // 14
Window_set_repeatable_button( 97, 81,11,11,"\033",0,1,KEY_LEFT); // 15
Window_set_repeatable_button(121, 81,11,11,"\032",0,1,KEY_RIGHT); // 16
for (index=0; index<12; index++)
Window_set_normal_button((index*23)+8,20,20,20,"",0,1,SDLK_F1+index); // 17 -> 28
Window_set_normal_button((index*23)+8,20,20,20,"",0,1,KEY_F1+index); // 17 -> 28
Draw_preset_sieve_patterns();
origin_x=Window_pos_X+(Menu_factor_X*Window_special_button_list->Pos_X);

View File

@ -3341,7 +3341,7 @@ short Window_clicked_button(void)
// FIXME: Make only one list have the keyboard focus.
if (1)
{
if (Key==SDLK_UP && (list->Cursor_position+list->List_start)>0)
if (Key==KEY_UP && (list->Cursor_position+list->List_start)>0)
{
Key=0;
Hide_cursor();
@ -3361,7 +3361,7 @@ short Window_clicked_button(void)
// Return the control ID of the list.
return list->Number;
}
if (Key==SDLK_DOWN && (list->Cursor_position+list->List_start)<(list->Scroller->Nb_elements-1))
if (Key==KEY_DOWN && (list->Cursor_position+list->List_start)<(list->Scroller->Nb_elements-1))
{
Key=0;
Hide_cursor();
@ -3381,7 +3381,7 @@ short Window_clicked_button(void)
// Return the control ID of the list.
return list->Number;
}
if (Key==SDLK_HOME && (list->Cursor_position!=0 || list->List_start!=0))
if (Key==KEY_HOME && (list->Cursor_position!=0 || list->List_start!=0))
{
Key=0;
Hide_cursor();
@ -3397,7 +3397,7 @@ short Window_clicked_button(void)
// Return the control ID of the list.
return list->Number;
}
if (Key==SDLK_END && (list->Cursor_position+list->List_start)<(list->Scroller->Nb_elements-1))
if (Key==KEY_END && (list->Cursor_position+list->List_start)<(list->Scroller->Nb_elements-1))
{
Key=0;
Hide_cursor();
@ -3417,7 +3417,7 @@ short Window_clicked_button(void)
// Return the control ID of the list.
return list->Number;
}
if (Key==SDLK_PAGEDOWN && (list->Cursor_position+list->List_start)<(list->Scroller->Nb_elements-1))
if (Key==KEY_PAGEDOWN && (list->Cursor_position+list->List_start)<(list->Scroller->Nb_elements-1))
{
Key=0;
Hide_cursor();
@ -3447,7 +3447,7 @@ short Window_clicked_button(void)
// Return the control ID of the list.
return list->Number;
}
if (Key==SDLK_PAGEUP && (list->Cursor_position+list->List_start)>0)
if (Key==KEY_PAGEUP && (list->Cursor_position+list->List_start)>0)
{
Key=0;
Hide_cursor();

View File

@ -1087,7 +1087,7 @@ int L_InputBox(lua_State* L)
control[0]=0;
// OK
Window_set_normal_button( 7, 25 + 17 * nb_settings, 51,14,"OK" , 0,1,SDLK_RETURN);
Window_set_normal_button( 7, 25 + 17 * nb_settings, 51,14,"OK" , 0,1,KEY_RETURN);
control[Window_nb_buttons] = CONTROL_OK;
// Cancel
@ -1488,7 +1488,7 @@ int L_WaitInput(lua_State* L)
}
lua_pushboolean(L, moved ? 1 : 0);
lua_pushinteger(L, (Key == KEY_ESC) ? SDLK_ESCAPE : Key);
lua_pushinteger(L, (Key == KEY_ESC) ? KEY_ESCAPE : Key);
lua_pushinteger(L, Mouse_X);
lua_pushinteger(L, Mouse_Y);
lua_pushinteger(L, Mouse_K);
@ -2669,7 +2669,7 @@ void Button_Brush_Factory(void)
Scripts_selector.Nb_elements,10, 0); // 3
scriptlist = Window_set_list_button(scriptarea,scriptscroll,Draw_script_name, 0); // 4
Window_set_normal_button(10, 161, 67, 14, "Run", 0, 1, SDLK_RETURN); // 5
Window_set_normal_button(10, 161, 67, 14, "Run", 0, 1, KEY_RETURN); // 5
Window_display_frame_in(6, FILESEL_Y + 88, DESC_WIDTH*6+4, 4*8+2); // Descr.
Window_set_special_button(7, FILESEL_Y + 89+24,DESC_WIDTH*6,8,0); // 6
@ -2719,7 +2719,7 @@ void Button_Brush_Factory(void)
do
{
clicked_button = Window_clicked_button();
if (Key==SDLK_BACKSPACE && Config.Scripts_directory[0]!='\0')
if (Key==KEY_BACKSPACE && Config.Scripts_directory[0]!='\0')
{
// Make it select first entry (parent directory)
scriptlist->List_start=0;

View File

@ -27,6 +27,7 @@
///@file fileformats.c
/// Saving and loading different picture formats.
#include <string.h>
#ifndef __no_pnglib__
#include <png.h>
#if !defined(PNG_HAVE_PLTE)

View File

@ -1573,7 +1573,7 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
Open_window(310,200,"Load palette");
else
Open_window(310,200,"Load brush");
Window_set_normal_button(198,180,51,14,"Load",0,1,SDLK_RETURN); // 1
Window_set_normal_button(198,180,51,14,"Load",0,1,KEY_RETURN); // 1
}
else
{
@ -1585,7 +1585,7 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
Open_window(310,200,"Save palette");
else
assert(0);
Window_set_normal_button(198,180,51,14,"Save",0,1,SDLK_RETURN); // 1
Window_set_normal_button(198,180,51,14,"Save",0,1,KEY_RETURN); // 1
if (Selector->Format_filter<=FORMAT_ALL_FILES) // Correction du *.*
{
Selector->Format_filter=context->Format;
@ -1605,7 +1605,7 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
}
Window_set_normal_button(253,180,51,14,"Cancel",0,1,KEY_ESC); // 2
Window_set_normal_button(7,180,51,14,"Delete",0,1,SDLK_DELETE); // 3
Window_set_normal_button(7,180,51,14,"Delete",0,1,KEY_DELETE); // 3
// Frame autour des infos sur le fichier de dessin
Window_display_frame_in(6, 44,299, 37);
@ -2117,43 +2117,43 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
switch (Key)
{
case SDLK_UNKNOWN : break;
case SDLK_DOWN : // Bas
case KEY_UNKNOWN : break;
case KEY_DOWN : // Bas
Reset_quicksearch();
Hide_cursor();
Selector_scroll_down(&Selector->Position,&Selector->Offset);
Scroll_fileselector(file_scroller);
Key=0;
break;
case SDLK_UP : // Haut
case KEY_UP : // Haut
Reset_quicksearch();
Hide_cursor();
Selector_scroll_up(&Selector->Position,&Selector->Offset);
Scroll_fileselector(file_scroller);
Key=0;
break;
case SDLK_PAGEDOWN : // PageDown
case KEY_PAGEDOWN : // PageDown
Reset_quicksearch();
Hide_cursor();
Selector_page_down(&Selector->Position,&Selector->Offset,9);
Scroll_fileselector(file_scroller);
Key=0;
break;
case SDLK_PAGEUP : // PageUp
case KEY_PAGEUP : // PageUp
Reset_quicksearch();
Hide_cursor();
Selector_page_up(&Selector->Position,&Selector->Offset,9);
Scroll_fileselector(file_scroller);
Key=0;
break;
case SDLK_END : // End
case KEY_END : // End
Reset_quicksearch();
Hide_cursor();
Selector_end(&Selector->Position,&Selector->Offset);
Scroll_fileselector(file_scroller);
Key=0;
break;
case SDLK_HOME : // Home
case KEY_HOME : // Home
Reset_quicksearch();
Hide_cursor();
Selector_home(&Selector->Position,&Selector->Offset);
@ -2174,7 +2174,7 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
Scroll_fileselector(file_scroller);
Key=0;
break;
case SDLK_BACKSPACE : // Backspace
case KEY_BACKSPACE : // Backspace
Reset_quicksearch();
// Si le choix ".." est bien en tête des propositions...
if (Filelist.Nb_elements && !strcmp(Filelist.First->Full_name,PARENT_DIR))

View File

@ -158,7 +158,7 @@ void Window_set_shortcut(int action_id)
Open_window(302,131,"Keyboard shortcut");
Window_set_normal_button(181,111,55,14,"Cancel",0,1,KEY_ESC); // 1
Window_set_normal_button(241,111,55,14,"OK",0,1,SDLK_RETURN); // 2
Window_set_normal_button(241,111,55,14,"OK",0,1,KEY_RETURN); // 2
Window_set_normal_button(6,111,111,14,"Reset default",0,1,KEY_NONE); // 3
@ -259,7 +259,7 @@ void Window_set_shortcut(int action_id)
break;
}
}
while ((clicked_button!=1) && (clicked_button!=2) && (Key!=SDLK_RETURN));
while ((clicked_button!=1) && (clicked_button!=2) && (Key!=KEY_RETURN));
Key=0;
Close_window();
Display_cursor();
@ -532,11 +532,11 @@ void Window_help(int section, const char *sub_section)
scroller=Window_set_scroller_button(290,18,130,nb_lines,
16,Help_position); // 2
Window_set_normal_button( 9,154, 6*8,14,"About" ,1,1,SDLK_a); // 3
Window_set_normal_button( 9,154, 6*8,14,"About" ,1,1,KEY_a); // 3
Window_set_normal_button( 9+6*8+4,154, 8*8,14,"License",1,1,SDLK_l); // 4
Window_set_normal_button( 9+6*8+4+8*8+4,154, 5*8,14,"Help",1,1,SDLK_h); // 5
Window_set_normal_button(9+6*8+4+8*8+4+5*8+4,154, 8*8,14,"Credits",1,1,SDLK_c); // 6
Window_set_normal_button( 9+6*8+4,154, 8*8,14,"License",1,1,KEY_l); // 4
Window_set_normal_button( 9+6*8+4+8*8+4,154, 5*8,14,"Help",1,1,KEY_h); // 5
Window_set_normal_button(9+6*8+4+8*8+4+5*8+4,154, 8*8,14,"Credits",1,1,KEY_c); // 6
Window_set_special_button(9,18,272,130,0); // 7
@ -603,19 +603,19 @@ void Window_help(int section, const char *sub_section)
// Gestion des touches de déplacement dans la liste
switch (Key)
{
case SDLK_UP : // Haut
case KEY_UP : // Haut
if (Help_position>0)
Help_position--;
Scroll_help(scroller);
Key=0;
break;
case SDLK_DOWN : // Bas
case KEY_DOWN : // Bas
if (Help_position<nb_lines-16)
Help_position++;
Scroll_help(scroller);
Key=0;
break;
case SDLK_PAGEUP : // PageUp
case KEY_PAGEUP : // PageUp
if (Help_position>15)
Help_position-=15;
else
@ -631,7 +631,7 @@ void Window_help(int section, const char *sub_section)
Scroll_help(scroller);
Key=0;
break;
case SDLK_PAGEDOWN : // PageDown
case KEY_PAGEDOWN : // PageDown
if (nb_lines>16)
{
if (Help_position<nb_lines-16-15)
@ -653,12 +653,12 @@ void Window_help(int section, const char *sub_section)
Key=0;
}
break;
case SDLK_HOME : // Home
case KEY_HOME : // Home
Help_position=0;
Scroll_help(scroller);
Key=0;
break;
case SDLK_END : // End
case KEY_END : // End
if (nb_lines>16)
{
Help_position=nb_lines-16;
@ -670,7 +670,7 @@ void Window_help(int section, const char *sub_section)
if (Is_shortcut(Key,0x100+BUTTON_HELP))
clicked_button=1;
}
while ((clicked_button!=1) && (Key!=SDLK_RETURN));
while ((clicked_button!=1) && (Key!=KEY_RETURN));
Key=0;
Close_window();
@ -884,9 +884,9 @@ void Button_Stats(int btn)
if (Is_shortcut(Key,0x200+BUTTON_HELP))
clicked_button=1;
}
while ( (clicked_button!=1) && (Key!=SDLK_RETURN) );
while ( (clicked_button!=1) && (Key!=KEY_RETURN) );
if(Key==SDLK_RETURN)Key=0;
if(Key==KEY_RETURN)Key=0;
Close_window();
Unselect_button(btn);

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,7 @@
#if defined(__WIN32__)
#include <windows.h> // GetLogicalDrives(), GetDriveType(), DRIVE_*
#endif
#ifndef __GP2X__
#if !defined(__GP2X__) && defined(USE_SDL)
#include <SDL_syswm.h>
#endif
#if defined (__MINT__)

View File

@ -20,8 +20,11 @@
along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/
#include <string.h>
#if defined(USE_SDL) || defined(USE_SDL2)
#include <SDL.h>
#include <SDL_syswm.h>
#endif
#ifdef __WIN32__
#include <windows.h>
@ -50,7 +53,9 @@
#if defined(USE_SDL)
void Handle_window_resize(SDL_ResizeEvent event);
#endif
#if defined(USE_SDL) || defined(USE_SDL2)
void Handle_window_exit(SDL_QuitEvent event);
#endif
static int Color_cycling(void);
// public Globals (available as extern)
@ -302,6 +307,7 @@ void Handle_window_resize(SDL_ResizeEvent event)
}
#endif
#if defined(USE_SDL) || defined(USE_SDL2)
void Handle_window_exit(SDL_QuitEvent event)
{
(void)event, // unused
@ -381,6 +387,7 @@ int Handle_mouse_release(SDL_MouseButtonEvent event)
return Move_cursor_with_constraints();
}
#endif
// Keyboard management
@ -599,6 +606,7 @@ int Handle_key_release(SDL_KeyboardEvent event)
// Joystick management
#if defined(USE_SDL) || defined(USE_SDL2)
int Handle_joystick_press(SDL_JoyButtonEvent event)
{
if (event.button == Joybutton_shift)
@ -805,6 +813,7 @@ void Handle_joystick_movement(SDL_JoyAxisEvent event)
Directional_down=1;
}
}
#endif
// Attempts to move the mouse cursor by the given deltas (may be more than 1 pixel at a time)
int Cursor_displace(short delta_x, short delta_y)
@ -861,6 +870,7 @@ int Directional_acceleration(int msec)
int Get_input(int sleep_time)
{
#if defined(USE_SDL) || defined(USE_SDL2)
SDL_Event event;
int user_feedback_required = 0; // Flag qui indique si on doit arrêter de traiter les évènements ou si on peut enchainer
@ -1091,6 +1101,7 @@ int Get_input(int sleep_time)
// Nothing significant happened
if (sleep_time)
SDL_Delay(sleep_time);
#endif
return 0;
}

View File

@ -26,6 +26,11 @@
/// pointing device, ie: the GP2X.
//////////////////////////////////////////////////////////////////////////////
#ifndef INPUT_H_INCLUDED
#define INPUT_H_INCLUDED
#include "keycodes.h"
///
/// This is the keyboard/mouse/joystick input polling function.
/// Returns 1 if a significant changed occurred, such as a mouse button pressed
@ -70,18 +75,19 @@ extern int Snap_axis_origin_Y;
extern char * Drop_file_name;
#if defined __HAIKU__
#define SHORTCUT_COPY (SDLK_c|MOD_ALT)
#define SHORTCUT_COPY (KEY_c|MOD_ALT)
#elif defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
#define SHORTCUT_COPY (SDLK_c|MOD_META)
#define SHORTCUT_COPY (KEY_c|MOD_META)
#else
#define SHORTCUT_COPY (SDLK_c|MOD_CTRL)
#define SHORTCUT_COPY (KEY_c|MOD_CTRL)
#endif
#if defined __HAIKU__
#define SHORTCUT_PASTE (SDLK_v|MOD_ALT)
#define SHORTCUT_PASTE (KEY_v|MOD_ALT)
#elif defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
#define SHORTCUT_PASTE (SDLK_v|MOD_META)
#define SHORTCUT_PASTE (KEY_v|MOD_META)
#else
#define SHORTCUT_PASTE (SDLK_v|MOD_CTRL)
#define SHORTCUT_PASTE (KEY_v|MOD_CTRL)
#endif
#endif

View File

@ -53,7 +53,9 @@
#else
#include <dirent.h>
#endif
#if defined(USE_SDL) || defined(USE_SDL2)
#include <SDL_endian.h>
#endif
#include "struct.h"
#include "io.h"

View File

@ -20,11 +20,15 @@
You should have received a copy of the GNU General Public License
along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#if defined(USE_SDL)
#include <SDL.h>
#endif
#include "global.h"
#include "keyboard.h"
#include "keycodes.h"
#if defined(__macosx__)
// Apple's "command" character is not present in the ANSI table, so we
@ -373,6 +377,7 @@ word Keysym_to_keycode(SDL_keysym keysym)
key_code |= mod;
return key_code;
}
#endif
const char * Key_name(word key)
{
@ -391,59 +396,61 @@ const char * Key_name(word key)
{ SDLK_PAUSE , "Power-Down" },
{ SDLK_ESCAPE , "SELECT" },
#else
{ SDLK_BACKSPACE , "Backspace" },
{ SDLK_TAB , "Tab" },
{ SDLK_CLEAR , "Clear" },
{ SDLK_RETURN , "Return" },
{ SDLK_PAUSE , "Pause" },
{ SDLK_ESCAPE , "Esc" },
{ KEY_BACKSPACE , "Backspace" },
{ KEY_TAB , "Tab" },
{ KEY_CLEAR , "Clear" },
{ KEY_RETURN , "Return" },
{ KEY_PAUSE , "Pause" },
{ KEY_ESCAPE , "Esc" },
#endif
{ SDLK_DELETE , "Del" },
{ SDLK_KP0 , "KP 0" },
{ SDLK_KP1 , "KP 1" },
{ SDLK_KP2 , "KP 2" },
{ SDLK_KP3 , "KP 3" },
{ SDLK_KP4 , "KP 4" },
{ SDLK_KP5 , "KP 5" },
{ SDLK_KP6 , "KP 6" },
{ SDLK_KP7 , "KP 7" },
{ SDLK_KP8 , "KP 8" },
{ SDLK_KP9 , "KP 9" },
{ SDLK_KP_PERIOD , "KP ." },
{ SDLK_KP_DIVIDE , "KP /" },
{ SDLK_KP_MULTIPLY, "KP *" },
{ SDLK_KP_MINUS , "KP -" },
{ SDLK_KP_PLUS , "KP +" },
{ SDLK_KP_ENTER , "KP Enter" },
{ SDLK_KP_EQUALS , "KP =" },
{ SDLK_UP , "Up" },
{ SDLK_DOWN , "Down" },
{ SDLK_RIGHT , "Right" },
{ SDLK_LEFT , "Left" },
{ SDLK_INSERT , "Ins" },
{ SDLK_HOME , "Home" },
{ SDLK_END , "End" },
{ SDLK_PAGEUP , "PgUp" },
{ SDLK_PAGEDOWN , "PgDn" },
{ SDLK_F1 , "F1" },
{ SDLK_F2 , "F2" },
{ SDLK_F3 , "F3" },
{ SDLK_F4 , "F4" },
{ SDLK_F5 , "F5" },
{ SDLK_F6 , "F6" },
{ SDLK_F7 , "F7" },
{ SDLK_F8 , "F8" },
{ SDLK_F9 , "F9" },
{ SDLK_F10 , "F10" },
{ SDLK_F11 , "F11" },
{ SDLK_F12 , "F12" },
{ KEY_DELETE , "Del" },
{ KEY_KP0 , "KP 0" },
{ KEY_KP1 , "KP 1" },
{ KEY_KP2 , "KP 2" },
{ KEY_KP3 , "KP 3" },
{ KEY_KP4 , "KP 4" },
{ KEY_KP5 , "KP 5" },
{ KEY_KP6 , "KP 6" },
{ KEY_KP7 , "KP 7" },
{ KEY_KP8 , "KP 8" },
{ KEY_KP9 , "KP 9" },
{ KEY_KP_PERIOD , "KP ." },
{ KEY_KP_DIVIDE , "KP /" },
{ KEY_KP_MULTIPLY, "KP *" },
{ KEY_KP_MINUS , "KP -" },
{ KEY_KP_PLUS , "KP +" },
{ KEY_KP_ENTER , "KP Enter" },
{ KEY_KP_EQUALS , "KP =" },
{ KEY_UP , "Up" },
{ KEY_DOWN , "Down" },
{ KEY_RIGHT , "Right" },
{ KEY_LEFT , "Left" },
{ KEY_INSERT , "Ins" },
{ KEY_HOME , "Home" },
{ KEY_END , "End" },
{ KEY_PAGEUP , "PgUp" },
{ KEY_PAGEDOWN , "PgDn" },
{ KEY_F1 , "F1" },
{ KEY_F2 , "F2" },
{ KEY_F3 , "F3" },
{ KEY_F4 , "F4" },
{ KEY_F5 , "F5" },
{ KEY_F6 , "F6" },
{ KEY_F7 , "F7" },
{ KEY_F8 , "F8" },
{ KEY_F9 , "F9" },
{ KEY_F10 , "F10" },
{ KEY_F11 , "F11" },
{ KEY_F12 , "F12" },
#if defined(USE_SDL)
{ SDLK_F13 , "F13" },
{ SDLK_F14 , "F14" },
{ SDLK_F15 , "F15" },
{ SDLK_NUMLOCK , "NumLock" },
{ SDLK_CAPSLOCK , "CapsLck" },
{ SDLK_SCROLLOCK , "ScrlLock" },
{ SDLK_RSHIFT , "RShift" },
#endif
{ KEY_NUMLOCK , "NumLock" },
{ KEY_CAPSLOCK , "CapsLck" },
{ KEY_SCROLLOCK , "ScrlLock" },
{ KEY_RSHIFT , "RShift" },
#ifdef GCWZERO
{ SDLK_LSHIFT , "X" },
{ SDLK_RCTRL , "RCtrl" },
@ -451,12 +458,13 @@ const char * Key_name(word key)
{ SDLK_RALT , "RAlt" },
{ SDLK_LALT , "B" },
#else
{ SDLK_LSHIFT , "LShift" },
{ SDLK_RCTRL , "RCtrl" },
{ SDLK_LCTRL , "LCtrl" },
{ SDLK_RALT , "RAlt" },
{ SDLK_LALT , "LAlt" },
{ KEY_LSHIFT , "LShift" },
{ KEY_RCTRL , "RCtrl" },
{ KEY_LCTRL , "LCtrl" },
{ KEY_RALT , "RAlt" },
{ KEY_LALT , "LAlt" },
#endif
#if defined(USE_SDL)
{ SDLK_RMETA , "RMeta" },
{ SDLK_LMETA , "LMeta" },
{ SDLK_LSUPER , "LWin" },
@ -471,6 +479,7 @@ const char * Key_name(word key)
{ SDLK_POWER , "Power" },
{ SDLK_EURO , "Euro" },
{ SDLK_UNDO , "Undo" },
#endif
{ KEY_MOUSEMIDDLE, "Mouse3" },
{ KEY_MOUSEWHEELUP, "WheelUp" },
{ KEY_MOUSEWHEELDOWN, "WheelDown" }
@ -480,7 +489,7 @@ const char * Key_name(word key)
static char buffer[41];
buffer[0] = '\0';
if (key == SDLK_UNKNOWN)
if (key == KEY_UNKNOWN)
return "None";
#ifdef GCWZERO
@ -605,12 +614,14 @@ const char * Key_name(word key)
sprintf(buffer+strlen(buffer), "'%c'", toupper(key));
return buffer;
}
#if defined(USE_SDL) || defined(USE_SDL2)
// Touches 'World'
if (key>=SDLK_WORLD_0 && key <= SDLK_WORLD_95)
{
sprintf(buffer+strlen(buffer), "w%d", key - SDLK_WORLD_0);
return buffer;
}
#endif
// Touches au libellé connu
for (index=0; index < (long)sizeof(key_labels)/(long)sizeof(T_key_label);index++)
@ -627,6 +638,7 @@ const char * Key_name(word key)
}
#if defined(USE_SDL)
// Obtient le caractère ANSI tapé, à partir d'un keysym.
// (Valeur 32 à 255)
// Renvoie 0 s'il n'y a pas de caractère associé (shift, backspace, etc)
@ -750,18 +762,19 @@ word Keysym_to_ANSI(SDL_keysym keysym)
// Sinon c'est une touche spéciale, on retourne son scancode
return keysym.sym;
}
#else
#elif defined(USE_SDL2)
// SDL2 TODO
word Key_for_scancode(word scancode)
{
return scancode;
}
const char * Key_name(word key)
{
return "Unknown";
}
word Key_modifiers(SDL_Keymod mod)
{
return 0;
}
#else
word Key_for_scancode(word scancode)
{
return scancode;
}
#endif

View File

@ -39,8 +39,11 @@
//////////////////////////////////////////////////////////////////////////////
#if defined(USE_SDL)
#include <SDL.h>
#elif defined(USE_SDL2)
#include <SDL_keyboard.h>
#endif
/*!
Convert an SDL keysym to an ANSI/ASCII character.
This is used to type text and numeric values in input boxes.

View File

@ -26,4 +26,206 @@
#include <SDL.h>
#endif
#if defined(USE_SDL)
#define K2K(x) (x)
#elif defined(USE_SDL2)
#define K2K(x) ((((x) & 0x40000000) >> 19) | ((x) & 0x1FF))
#endif
/* generated lists */
#if defined(USE_SDL) || defined(USE_SDL2)
// KEY definitions for SDL and SDL2
#define KEY_UNKNOWN K2K(SDLK_UNKNOWN)
#define KEY_ESCAPE K2K(SDLK_ESCAPE)
#define KEY_RETURN K2K(SDLK_RETURN)
#define KEY_BACKSPACE K2K(SDLK_BACKSPACE)
#define KEY_TAB K2K(SDLK_TAB)
#define KEY_UP K2K(SDLK_UP)
#define KEY_DOWN K2K(SDLK_DOWN)
#define KEY_LEFT K2K(SDLK_LEFT)
#define KEY_RIGHT K2K(SDLK_RIGHT)
#define KEY_LEFTBRACKET K2K(SDLK_LEFTBRACKET)
#define KEY_RIGHTBRACKET K2K(SDLK_RIGHTBRACKET)
#define KEY_INSERT K2K(SDLK_INSERT)
#define KEY_DELETE K2K(SDLK_DELETE)
#define KEY_COMMA K2K(SDLK_COMMA)
#define KEY_BACKQUOTE K2K(SDLK_BACKQUOTE)
#define KEY_PAGEUP K2K(SDLK_PAGEUP)
#define KEY_PAGEDOWN K2K(SDLK_PAGEDOWN)
#define KEY_HOME K2K(SDLK_HOME)
#define KEY_END K2K(SDLK_END)
#define KEY_KP_PLUS K2K(SDLK_KP_PLUS)
#define KEY_KP_MINUS K2K(SDLK_KP_MINUS)
#define KEY_KP_MULTIPLY K2K(SDLK_KP_MULTIPLY)
#define KEY_KP_ENTER K2K(SDLK_KP_ENTER)
#define KEY_EQUALS K2K(SDLK_EQUALS)
#define KEY_MINUS K2K(SDLK_MINUS)
#define KEY_PERIOD K2K(SDLK_PERIOD)
#define KEY_CAPSLOCK K2K(SDLK_CAPSLOCK)
#define KEY_CLEAR K2K(SDLK_CLEAR)
#define KEY_SPACE K2K(SDLK_SPACE)
#define KEY_0 K2K(SDLK_0)
#define KEY_1 K2K(SDLK_1)
#define KEY_2 K2K(SDLK_2)
#define KEY_3 K2K(SDLK_3)
#define KEY_4 K2K(SDLK_4)
#define KEY_5 K2K(SDLK_5)
#define KEY_6 K2K(SDLK_6)
#define KEY_7 K2K(SDLK_7)
#define KEY_8 K2K(SDLK_8)
#define KEY_9 K2K(SDLK_9)
#define KEY_a K2K(SDLK_a)
#define KEY_b K2K(SDLK_b)
#define KEY_c K2K(SDLK_c)
#define KEY_d K2K(SDLK_d)
#define KEY_e K2K(SDLK_e)
#define KEY_f K2K(SDLK_f)
#define KEY_g K2K(SDLK_g)
#define KEY_h K2K(SDLK_h)
#define KEY_i K2K(SDLK_i)
#define KEY_j K2K(SDLK_j)
#define KEY_k K2K(SDLK_k)
#define KEY_l K2K(SDLK_l)
#define KEY_m K2K(SDLK_m)
#define KEY_n K2K(SDLK_n)
#define KEY_o K2K(SDLK_o)
#define KEY_p K2K(SDLK_p)
#define KEY_q K2K(SDLK_q)
#define KEY_r K2K(SDLK_r)
#define KEY_s K2K(SDLK_s)
#define KEY_t K2K(SDLK_t)
#define KEY_u K2K(SDLK_u)
#define KEY_v K2K(SDLK_v)
#define KEY_w K2K(SDLK_w)
#define KEY_x K2K(SDLK_x)
#define KEY_y K2K(SDLK_y)
#define KEY_z K2K(SDLK_z)
#if defined(USE_SDL)
#define KEY_KP0 K2K(SDLK_KP0)
#define KEY_KP1 K2K(SDLK_KP1)
#define KEY_KP2 K2K(SDLK_KP2)
#define KEY_KP3 K2K(SDLK_KP3)
#define KEY_KP4 K2K(SDLK_KP4)
#define KEY_KP5 K2K(SDLK_KP5)
#define KEY_KP6 K2K(SDLK_KP6)
#define KEY_KP7 K2K(SDLK_KP7)
#define KEY_KP8 K2K(SDLK_KP8)
#define KEY_KP9 K2K(SDLK_KP9)
#else
#define KEY_KP0 K2K(SDLK_KP_0)
#define KEY_KP1 K2K(SDLK_KP_1)
#define KEY_KP2 K2K(SDLK_KP_2)
#define KEY_KP3 K2K(SDLK_KP_3)
#define KEY_KP4 K2K(SDLK_KP_4)
#define KEY_KP5 K2K(SDLK_KP_5)
#define KEY_KP6 K2K(SDLK_KP_6)
#define KEY_KP7 K2K(SDLK_KP_7)
#define KEY_KP8 K2K(SDLK_KP_8)
#define KEY_KP9 K2K(SDLK_KP_9)
#endif
#define KEY_F1 K2K(SDLK_F1)
#define KEY_F2 K2K(SDLK_F2)
#define KEY_F3 K2K(SDLK_F3)
#define KEY_F4 K2K(SDLK_F4)
#define KEY_F5 K2K(SDLK_F5)
#define KEY_F6 K2K(SDLK_F6)
#define KEY_F7 K2K(SDLK_F7)
#define KEY_F8 K2K(SDLK_F8)
#define KEY_F9 K2K(SDLK_F9)
#define KEY_F10 K2K(SDLK_F10)
#define KEY_F11 K2K(SDLK_F11)
#define KEY_F12 K2K(SDLK_F12)
// end of KEY definitions for SDL and SDL2
#else
// KEY definitions for others
#define KEY_UNKNOWN 0
#define KEY_ESCAPE 1
#define KEY_RETURN 2
#define KEY_BACKSPACE 3
#define KEY_TAB 4
#define KEY_UP 5
#define KEY_DOWN 6
#define KEY_LEFT 7
#define KEY_RIGHT 8
#define KEY_LEFTBRACKET 9
#define KEY_RIGHTBRACKET 10
#define KEY_INSERT 11
#define KEY_DELETE 12
#define KEY_COMMA 13
#define KEY_BACKQUOTE 14
#define KEY_PAGEUP 15
#define KEY_PAGEDOWN 16
#define KEY_HOME 17
#define KEY_END 18
#define KEY_KP_PLUS 19
#define KEY_KP_MINUS 20
#define KEY_KP_MULTIPLY 21
#define KEY_KP_ENTER 22
#define KEY_EQUALS 23
#define KEY_MINUS 24
#define KEY_PERIOD 25
#define KEY_CAPSLOCK 26
#define KEY_CLEAR 27
#define KEY_SPACE 28
#define KEY_0 29
#define KEY_1 30
#define KEY_2 31
#define KEY_3 32
#define KEY_4 33
#define KEY_5 34
#define KEY_6 35
#define KEY_7 36
#define KEY_8 37
#define KEY_9 38
#define KEY_a 39
#define KEY_b 40
#define KEY_c 41
#define KEY_d 42
#define KEY_e 43
#define KEY_f 44
#define KEY_g 45
#define KEY_h 46
#define KEY_i 47
#define KEY_j 48
#define KEY_k 49
#define KEY_l 50
#define KEY_m 51
#define KEY_n 52
#define KEY_o 53
#define KEY_p 54
#define KEY_q 55
#define KEY_r 56
#define KEY_s 57
#define KEY_t 58
#define KEY_u 59
#define KEY_v 60
#define KEY_w 61
#define KEY_x 62
#define KEY_y 63
#define KEY_z 64
#define KEY_KP0 65
#define KEY_KP1 66
#define KEY_KP2 67
#define KEY_KP3 68
#define KEY_KP4 69
#define KEY_KP5 70
#define KEY_KP6 71
#define KEY_KP7 72
#define KEY_KP8 73
#define KEY_KP9 74
#define KEY_F1 75
#define KEY_F2 76
#define KEY_F3 77
#define KEY_F4 78
#define KEY_F5 79
#define KEY_F6 80
#define KEY_F7 81
#define KEY_F8 82
#define KEY_F9 83
#define KEY_F10 84
#define KEY_F11 85
#define KEY_F12 86
// end of KEY definitions for others
#endif
#endif

View File

@ -263,7 +263,7 @@ void Button_Layer_menu(void)
Window_set_normal_button(95, 54, 15,13,"" , 0,1,KEY_NONE); // 2
Draw_transparent_background(transparent_background);
Window_set_normal_button( 7, 78, 51,14,"OK" , 0,1,SDLK_RETURN); // 3
Window_set_normal_button( 7, 78, 51,14,"OK" , 0,1,KEY_RETURN); // 3
Window_set_normal_button(63, 78, 51,14,"Cancel", 0,1,KEY_ESC); // 4
Update_window_area(0,0,Window_width, Window_height);
@ -489,7 +489,7 @@ void Button_Anim_time(void)
Print_in_window(24,73,"Add to all frames",MC_Black,MC_Light);
Window_set_normal_button(7, 70, 13,13,"" , 0,1,KEY_NONE); // 4
Window_set_normal_button( 7, 92, 51,14,"OK" , 0,1,SDLK_RETURN); // 5
Window_set_normal_button( 7, 92, 51,14,"OK" , 0,1,KEY_RETURN); // 5
Window_set_normal_button(63, 92, 51,14,"Cancel", 0,1,KEY_ESC); // 6
Update_window_area(0,0,Window_width, Window_height);

View File

@ -18,6 +18,8 @@
along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/
#include <stdlib.h>
#include <string.h>
#ifdef _MSC_VER
#include <stdio.h>
#if _MSC_VER < 1900

View File

@ -1120,6 +1120,7 @@ void Load_SDL_Image(T_IO_Context *context)
SDL_FreeSurface(surface);
}
#endif
///
/// Load an arbitrary Surface.
@ -1155,7 +1156,6 @@ T_GFX2_Surface * Load_surface(char *full_name, T_Gradient_array *gradients)
return bmp;
}
#endif
/// Saves an image.

View File

@ -205,7 +205,9 @@ void Error_function(int error_code, const char *filename, int line_number, const
break;
}
#if defined(USE_SDL) || defined(USE_SDL2)
SDL_Quit();
#endif
exit(error_code);
}
}
@ -1138,7 +1140,9 @@ void Program_shutdown(void)
iconv_close(cd_utf16_inv);
#endif
#if defined(USE_SDL) || defined(USE_SDL2)
SDL_Quit();
#endif
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
chdir("/usr/gp2x");

View File

@ -58,8 +58,8 @@
word Count_used_colors(dword* usage)
{
int nb_pixels = 0;
Uint8* current_pixel;
Uint8 color;
byte* current_pixel;
byte color;
word nb_colors = 0;
int i;
int layer;
@ -100,7 +100,7 @@ word Count_used_colors(dword* usage)
word Count_used_colors_screen_area(dword* usage, word start_x, word start_y,
word width, word height)
{
Uint8 color;
byte color;
word x, y;
word nb_colors = 0;
int i;
@ -135,7 +135,7 @@ word Count_used_colors_screen_area(dword* usage, word start_x, word start_y,
word Count_used_colors_area(dword* usage, word start_x, word start_y,
word width, word height)
{
Uint8 color;
byte color;
word x, y;
word nb_colors = 0;
int i;

View File

@ -43,6 +43,7 @@
#include "windows.h"
#include "oldies.h"
#include "pages.h"
#include "keycodes.h"
#include "fileformats.h"
//////////////////////////////////// PAL ////////////////////////////////////
@ -2645,8 +2646,8 @@ int Save_C64_window(byte *saveWhat, byte *loadAddr)
};
Open_window(200,120,"c64 settings");
Window_set_normal_button(110,100,80,15,"Save",1,1,SDLK_RETURN); // 1
Window_set_normal_button(10,100,80,15,"Cancel",1,1,SDLK_ESCAPE); // 2
Window_set_normal_button(110,100,80,15,"Save",1,1,KEY_RETURN); // 1
Window_set_normal_button(10,100,80,15,"Cancel",1,1,KEY_ESCAPE); // 2
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,0); // 3

View File

@ -520,8 +520,10 @@ void Line_12_5(void)
cursor_y = Paintbrush_Y;
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
#if defined(USE_SDL) || defined(USE_SDL2)
if(SDL_GetModState() & KMOD_SHIFT)
Clamp_coordinates_regular_angle(start_x,start_y,&cursor_x,&cursor_y);
#endif
// On vient de bouger
if ((cursor_x!=end_x) || (cursor_y!=end_y))
@ -3806,8 +3808,10 @@ void Grad_rectangle_12_9(void)
cursor_x = Paintbrush_X;
cursor_y = Paintbrush_Y;
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
#if defined(USE_SDL) || defined(USE_SDL2)
if(SDL_GetModState() & KMOD_SHIFT)
Clamp_coordinates_regular_angle(start_x,start_y,&cursor_x,&cursor_y);
#endif
if ((cursor_x!=end_x) || (cursor_y!=end_y))
{

View File

@ -933,7 +933,7 @@ int Window_Histogram(unsigned char block_start, unsigned char block_end, dword*
}
Open_window(263, 150, "Histogram");
Window_set_normal_button(120, 130, 42, 14, "Close",-1,1,SDLK_RETURN);
Window_set_normal_button(120, 130, 42, 14, "Close",-1,1,KEY_RETURN);
Print_in_window(6, 17, "Color:", MC_Dark, MC_Light);
Print_in_window(110+12*8, 17, "Pixels", MC_Dark, MC_Light);
@ -1200,12 +1200,12 @@ void Button_Palette(int btn)
Num2str(Fore_color, str, 3);
Print_in_window(COLOR_X, COLOR_Y, str, MC_Black, MC_Light);
Window_set_normal_button(C4_X,L3,C4_W,14,"Merge" ,1,1,SDLK_m); // 5
Window_set_normal_button(C2_X,L3,C2_W,14,"Gray" ,1,1,SDLK_g); // 6
Window_set_normal_button(C1_X,L1,C1_W,14,"Swap" ,2,1,SDLK_w); // 7
Window_set_normal_button(C2_X,L1,C2_W,14,"X-Swap" ,1,1,SDLK_x); // 8
Window_set_normal_button(C3_X,L1,C3_W,14,"Copy" ,1,1,SDLK_c); // 9
Window_set_normal_button(C3_X,L3,C3_W,14,"Spread" ,4,1,SDLK_e); // 10
Window_set_normal_button(C4_X,L3,C4_W,14,"Merge" ,1,1,KEY_m); // 5
Window_set_normal_button(C2_X,L3,C2_W,14,"Gray" ,1,1,KEY_g); // 6
Window_set_normal_button(C1_X,L1,C1_W,14,"Swap" ,2,1,KEY_w); // 7
Window_set_normal_button(C2_X,L1,C2_W,14,"X-Swap" ,1,1,KEY_x); // 8
Window_set_normal_button(C3_X,L1,C3_W,14,"Copy" ,1,1,KEY_c); // 9
Window_set_normal_button(C3_X,L3,C3_W,14,"Spread" ,4,1,KEY_e); // 10
reduce_dropdown = Window_set_dropdown_button(89, L4, 83, 14, 84, "Reduce", 0,
0, 1, RIGHT_SIDE|LEFT_SIDE, 0); // 11
@ -1219,22 +1219,22 @@ void Button_Palette(int btn)
Window_dropdown_add_item(reduce_dropdown, 2, "to 2");
Window_dropdown_add_item(reduce_dropdown, 0, "Other");
Window_set_normal_button( 5,178,35,14,"Undo" ,1,1,SDLK_u); // 12
Window_set_normal_button( 5,178,35,14,"Undo" ,1,1,KEY_u); // 12
Window_set_normal_button(122,178,51,14,"Cancel",0,1,KEY_ESC); // 13
Window_set_normal_button(177,178,35,14,"OK" ,0,1,SDLK_RETURN); // 14
Window_set_normal_button(177,178,35,14,"OK" ,0,1,KEY_RETURN); // 14
Window_set_normal_button(C4_X,L2,C4_W,14,"Used",4,1,SDLK_d); // 15
Window_set_normal_button(C1_X,L4,83,14,"Zap unused",0,1,SDLK_DELETE);//16
Window_set_normal_button(C4_X,L2,C4_W,14,"Used",4,1,KEY_d); // 15
Window_set_normal_button(C1_X,L4,83,14,"Zap unused",0,1,KEY_DELETE);//16
Window_set_repeatable_button(BUTTON_PLUS_X, BUTTON_PLUS_Y,12,11,"+",0,1,SDLK_KP_PLUS); // 17
Window_set_repeatable_button(BUTTON_MINUS_X,BUTTON_MINUS_Y,12,11,"-",0,1,SDLK_KP_MINUS); // 18
Window_set_repeatable_button(BUTTON_PLUS_X, BUTTON_PLUS_Y,12,11,"+",0,1,KEY_KP_PLUS); // 17
Window_set_repeatable_button(BUTTON_MINUS_X,BUTTON_MINUS_Y,12,11,"-",0,1,KEY_KP_MINUS); // 18
Window_set_normal_button(C1_X,L3,C1_W,14,"Neg" ,1,1,SDLK_n); // 19
Window_set_normal_button(C1_X,L2,C1_W,14,"Flip" ,1,1,SDLK_f); // 20
Window_set_normal_button(C2_X,L2,C2_W,14,"X-Flip" ,5,1,SDLK_i); // 21
Window_set_normal_button(C1_X,L3,C1_W,14,"Neg" ,1,1,KEY_n); // 19
Window_set_normal_button(C1_X,L2,C1_W,14,"Flip" ,1,1,KEY_f); // 20
Window_set_normal_button(C2_X,L2,C2_W,14,"X-Flip" ,5,1,KEY_i); // 21
// Button without outline (RGB/HSL switch)
Window_set_normal_button(NUMERIC_BOX_X,14,81,11,"" ,0,1,SDLK_h); // 22
Window_set_normal_button(NUMERIC_BOX_X,14,81,11,"" ,0,1,KEY_h); // 22
Window_display_frame_mono(NUMERIC_BOX_X-1,14-1,81+2,11+2,MC_Light);
sort_dropdown = Window_set_dropdown_button(C3_X, L2, C3_W, 14, 80, " Sort", 0,
@ -1247,10 +1247,10 @@ void Button_Palette(int btn)
// Button without outline
Window_display_frame_mono(NUMERIC_BOX_X-1,NUMERIC_BOX_Y-1,NUMERIC_BOX_W+2,NUMERIC_BOX_H+2,MC_Light);
Window_set_normal_button(C4_X,L1,C4_W,14,"Histo",4,1,SDLK_t);// 25
Window_set_normal_button(C4_X,L1,C4_W,14,"Histo",4,1,KEY_t);// 25
Window_set_normal_button( 44,178,35,14,"Load" ,1,1,SDLK_l); // 26
Window_set_normal_button( 83,178,35,14,"Save" ,1,1,SDLK_s); // 27
Window_set_normal_button( 44,178,35,14,"Load" ,1,1,KEY_l); // 26
Window_set_normal_button( 83,178,35,14,"Save" ,1,1,KEY_s); // 27
// Dessin des petits effets spéciaux pour les boutons [+] et [-]
Draw_thingumajig(BUTTON_PLUS_X-5, BUTTON_PLUS_Y,MC_White,-1);
@ -2703,7 +2703,7 @@ void Button_Palette(int btn)
Display_cursor();
Key=0;
}
else if (Key == SDLK_BACKSPACE)
else if (Key == KEY_BACKSPACE)
// Remise des couleurs du menu à l'état normal en essayant
// de ne pas trop modifier l'image.
{
@ -2899,9 +2899,9 @@ void Button_Secondary_palette(int btn)
(void)btn;
Open_window(218,146,"Palettes");
Window_set_normal_button(10,20,180,14,"Colors for best match",12,1,SDLK_b); // 1
Window_set_normal_button(10,37,180,14,"User's color series" ,14,1,SDLK_s); // 2
Window_set_normal_button(155,126,53,14,"OK" , 0,1,SDLK_RETURN); // 3
Window_set_normal_button(10,20,180,14,"Colors for best match",12,1,KEY_b); // 1
Window_set_normal_button(10,37,180,14,"User's color series" ,14,1,KEY_s); // 2
Window_set_normal_button(155,126,53,14,"OK" , 0,1,KEY_RETURN); // 3
Window_set_normal_button( 96,126,53,14,"Cancel" , 0,1,KEY_ESC); // 4
Window_display_frame(10,55,122,66);
Print_in_window(18,59,"Palette layout",MC_Dark,MC_Light);
@ -2927,8 +2927,8 @@ void Button_Secondary_palette(int btn)
Print_in_window(38,108,(palette_vertical)?"X":" ",MC_Black,MC_Light);
Print_in_window(51,108,"Vertical",MC_Dark,MC_Light);
Window_set_normal_button(190,82,18,14,"x2" , 1,1,SDLK_x); // 9
Window_set_normal_button(137,82,18,14,"\xf7""2" , 0,1,SDLK_w); // 10
Window_set_normal_button(190,82,18,14,"x2" , 1,1,KEY_x); // 9
Window_set_normal_button(137,82,18,14,"\xf7""2" , 0,1,KEY_w); // 10
gamma_slider = Window_set_horizontal_scroller_button(137,110,71,30, 1,Gamma*10);// 11
Num2str(Gamma*10,str,2);

View File

@ -473,11 +473,11 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
static byte caps_lock=0;
static const word keymapping[] =
{
SDLK_CLEAR,SDLK_BACKSPACE,SDLK_RETURN,KEY_ESC,
KEY_CLEAR,KEY_BACKSPACE,KEY_RETURN,KEY_ESC,
'0','1','2','3','4','5','6','7','8','9','.',',',
'Q','W','E','R','T','Y','U','I','O','P',
'A','S','D','F','G','H','J','K','L',
SDLK_CAPSLOCK,'Z','X','C','V','B','N','M',' ',
KEY_CAPSLOCK,'Z','X','C','V','B','N','M',' ',
'-','+','*','/','|','\\',
'(',')','{','}','[',']',
'_','=','<','>','%','@',
@ -502,7 +502,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
#if defined(__ANDROID__)
SDL_ANDROID_GetScreenKeyboardTextInput(str, max_size);
input_key = SDLK_RETURN;
input_key = KEY_RETURN;
#else
// Virtual keyboards
if (Config.Use_virtual_keyboard==1 ||
@ -667,7 +667,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
Hide_cursor();
}
while ((input_key!=SDLK_RETURN) && (input_key!=KEY_ESC))
while ((input_key!=KEY_RETURN) && (input_key!=KEY_ESC))
{
Display_cursor();
if (use_virtual_keyboard)
@ -678,11 +678,11 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
input_key=Key_ANSI;
if (clicked_button==-1)
input_key=SDLK_RETURN;
input_key=KEY_RETURN;
else if (clicked_button>0)
{
input_key=keymapping[clicked_button-1];
if (input_key==SDLK_CAPSLOCK)
if (input_key==KEY_CAPSLOCK)
{
// toggle uppercase
caps_lock=!caps_lock;
@ -690,14 +690,14 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
Print_in_window(8, 49,caps_lock?"\036":"\037", MC_Black,MC_Light);
Display_cursor();
}
else if (input_key==SDLK_BACKSPACE)
else if (input_key==KEY_BACKSPACE)
{
// A little hack: the button for backspace will:
// - backspace if the cursor is at end of string
// - delete otherwise
// It's needed for those input boxes that are completely full.
if (position<size)
input_key = SDLK_DELETE;
input_key = KEY_DELETE;
}
else if (input_key>='A' && input_key<='Z' && !caps_lock)
{
@ -712,7 +712,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
Get_input(20);
input_key = (str_unicode == NULL) ? Key_ANSI : Key_UNICODE;
if (Mouse_K)
input_key=SDLK_RETURN;
input_key=KEY_RETURN;
// Handle paste request on CTRL+v
if (Key == SHORTCUT_PASTE)
@ -778,7 +778,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
switch (input_key)
{
case SDLK_DELETE : // Suppr.
case KEY_DELETE : // Suppr.
if (position<size)
{
if (str_unicode != NULL)
@ -792,7 +792,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
goto affichage;
}
break;
case SDLK_LEFT : // Gauche
case KEY_LEFT : // Gauche
if (position>0)
{
// Effacement de la chaîne
@ -804,7 +804,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
goto affichage;
}
break;
case SDLK_RIGHT : // Droite
case KEY_RIGHT : // Droite
if ((position<size) && (position<max_size-1))
{
position++;
@ -823,7 +823,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
goto affichage;
}
break;
case SDLK_HOME : // Home
case KEY_HOME : // Home
if (position)
{
// Effacement de la chaîne
@ -834,7 +834,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
goto affichage;
}
break;
case SDLK_END : // End
case KEY_END : // End
if ((position<size) && (position<max_size-1))
{
position = (byte)((size<max_size) ? size : size-1);
@ -843,7 +843,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
goto affichage;
}
break;
case SDLK_BACKSPACE : // Backspace : combinaison de gauche + suppr
case KEY_BACKSPACE : // Backspace : combinaison de gauche + suppr
if (position > 0)
{
@ -860,7 +860,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
goto affichage;
}
break;
case SDLK_CLEAR : // Clear
case KEY_CLEAR : // Clear
str[0]='\0';
if (str_unicode != NULL)
str_unicode[0] = 0;
@ -868,7 +868,7 @@ byte Readline_ex_unicode(word x_pos,word y_pos,char * str,word * str_unicode,byt
// Effacement de la chaîne
Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR);
goto affichage;
case SDLK_RETURN :
case KEY_RETURN :
break;
case KEY_ESC :
@ -995,7 +995,7 @@ affichage:
}
Update_window_area(x_pos,y_pos,visible_size<<3,8);
return (input_key==SDLK_RETURN);
return (input_key==KEY_RETURN);
}
void Sprint_double(char *str, double value, byte decimal_places, byte min_positions)

View File

@ -473,11 +473,11 @@ int Menu_shade(void)
// Déclaration & tracé des boutons de sortie
Window_set_normal_button(207,17,51,14,"Cancel",0,1,KEY_ESC); // 4
Window_set_normal_button(261,17,43,14,"OK" ,0,1,SDLK_RETURN); // 5
Window_set_normal_button(261,17,43,14,"OK" ,0,1,KEY_RETURN); // 5
// Déclaration & tracé des boutons de copie de shade
Window_set_normal_button(206,87,27,14,"Cpy" ,1,1,SDLK_c); // 6
Window_set_normal_button(234,87,43,14,"Paste" ,1,1,SDLK_p); // 7
Window_set_normal_button(206,87,27,14,"Cpy" ,1,1,KEY_c); // 6
Window_set_normal_button(234,87,43,14,"Paste" ,1,1,KEY_p); // 7
// On tagge le bloc
Tag_color_range(Fore_color,Fore_color);
@ -493,16 +493,16 @@ int Menu_shade(void)
Display_all_shade(first_color,last_color,selection_start,selection_end);
// Déclaration & tracé des boutons d'édition de shade
Window_set_normal_button( 6,107,27,14,"Ins" ,0,1,SDLK_INSERT); // 8
Window_set_normal_button( 38,107,27,14,"Del" ,0,1,SDLK_DELETE); // 9
Window_set_normal_button( 66,107,43,14,"Blank",1,1,SDLK_b); // 10
Window_set_normal_button(110,107,27,14,"Inv" ,1,1,SDLK_i); // 11
Window_set_normal_button(138,107,27,14,"Swp" ,1,1,SDLK_s); // 12
Window_set_normal_button( 6,107,27,14,"Ins" ,0,1,KEY_INSERT); // 8
Window_set_normal_button( 38,107,27,14,"Del" ,0,1,KEY_DELETE); // 9
Window_set_normal_button( 66,107,43,14,"Blank",1,1,KEY_b); // 10
Window_set_normal_button(110,107,27,14,"Inv" ,1,1,KEY_i); // 11
Window_set_normal_button(138,107,27,14,"Swp" ,1,1,KEY_s); // 12
// Déclaration & tracé des boutons de taggage
Print_in_window(268,123,"Disbl"/*"Dsabl"*/,MC_Dark,MC_Light);
Window_set_normal_button(274,133,27,14,"Set" ,0,1,SDLK_F1); // 13
Window_set_normal_button(274,148,27,14,"Clr" ,0,1,SDLK_F2); // 14
Window_set_normal_button(274,133,27,14,"Set" ,0,1,KEY_F1); // 13
Window_set_normal_button(274,148,27,14,"Clr" ,0,1,KEY_F2); // 14
// Déclaration & tracé de la zone de saisie du pas
Print_in_window(272,165,"Step",MC_Dark,MC_Light);
@ -511,12 +511,12 @@ int Menu_shade(void)
Window_input_content(input_button,str);
// Button Undo
Window_set_normal_button(170,107,35,14,"Undo",1,1,SDLK_u); // 16
Window_set_normal_button(170,107,35,14,"Undo",1,1,KEY_u); // 16
// Button Clear
Window_set_normal_button(278,87,27,14,"Clr",0,1,SDLK_BACKSPACE); // 17
Window_set_normal_button(278,87,27,14,"Clr",0,1,KEY_BACKSPACE); // 17
// Button Mode
Window_set_normal_button(244,107,60,14,"",0,1,SDLK_TAB); // 18
Window_set_normal_button(244,107,60,14,"",0,1,KEY_TAB); // 18
// Affichage du n° de shade actif
Num2str(Shade_current+1,str,1);
@ -884,11 +884,11 @@ int Menu_shade(void)
if (!Mouse_K)
switch (Key)
{
case SDLK_LEFTBRACKET : // Décaler couleur dans palette vers la gauche
case SDLK_RIGHTBRACKET : // Décaler couleur dans palette vers la droite
case KEY_LEFTBRACKET : // Décaler couleur dans palette vers la gauche
case KEY_RIGHTBRACKET : // Décaler couleur dans palette vers la droite
if (first_color==last_color)
{
if (Key==SDLK_LEFTBRACKET)
if (Key==KEY_LEFTBRACKET)
{
first_color--;
last_color--;
@ -910,15 +910,15 @@ int Menu_shade(void)
Key=0;
break;
case SDLK_UP : // Select Haut
case SDLK_DOWN : // Select Bas
case SDLK_LEFT : // Select Gauche
case SDLK_RIGHT : // Select Droite
case KEY_UP : // Select Haut
case KEY_DOWN : // Select Bas
case KEY_LEFT : // Select Gauche
case KEY_RIGHT : // Select Droite
if (selection_start==selection_end)
{
switch (Key)
{
case SDLK_UP : // Select Haut
case KEY_UP : // Select Haut
if (selection_start>=64)
{
selection_start-=64;
@ -927,7 +927,7 @@ int Menu_shade(void)
else
selection_start=selection_end=0;
break;
case SDLK_DOWN : // Select Bas
case KEY_DOWN : // Select Bas
if (selection_start<448)
{
selection_start+=64;
@ -936,7 +936,7 @@ int Menu_shade(void)
else
selection_start=selection_end=511;
break;
case SDLK_LEFT : // Select Gauche
case KEY_LEFT : // Select Gauche
if (selection_start>0)
{
selection_start--;
@ -958,8 +958,8 @@ int Menu_shade(void)
Key=0;
break;
case SDLK_BACKQUOTE : // Récupération d'une couleur derrière le menu
case SDLK_COMMA :
case KEY_BACKQUOTE : // Récupération d'une couleur derrière le menu
case KEY_COMMA :
Get_color_behind_window(&color,&click);
if (click)
{
@ -1058,9 +1058,9 @@ void Button_Quick_shade_menu(void)
Open_window(142,56,"Quick-shade");
Window_set_normal_button(76,36,60,14,"OK",0,1,SDLK_RETURN); // 1
Window_set_normal_button(76,36,60,14,"OK",0,1,KEY_RETURN); // 1
Window_set_normal_button( 6,36,60,14,"Cancel",0,1,KEY_ESC); // 2
Window_set_normal_button(76,18,60,14,"",0,1,SDLK_TAB); // 3
Window_set_normal_button(76,18,60,14,"",0,1,KEY_TAB); // 3
Display_shade_mode(83,21,Quick_shade_loop);
// Déclaration & tracé de la zone de saisie du pas

View File

@ -119,8 +119,8 @@ void Button_Transform_menu(int btn)
Window_set_normal_button(154,140, 54,14,"Cancel",0,1,KEY_ESC); // 1
Print_in_window( 9,114,"Mirror",MC_Dark,MC_Light);
Window_set_normal_button( 17,125, 27,14,"X\035" ,1,1,SDLK_x); // 2
Window_set_normal_button( 17,140, 27,14,"Y\022" ,1,1,SDLK_y); // 3
Window_set_normal_button( 17,125, 27,14,"X\035" ,1,1,KEY_x); // 2
Window_set_normal_button( 17,140, 27,14,"Y\022" ,1,1,KEY_y); // 3
Print_in_window( 84,114,"Rotate",MC_Dark,MC_Light);
Window_set_normal_button( 69,125, 37,14,"-90\xb0" ,0,1,KEY_NONE); // 4
@ -128,7 +128,7 @@ void Button_Transform_menu(int btn)
Window_set_normal_button( 69,140, 75,14,"180\xb0" ,0,1,KEY_NONE); // 6
Print_in_window( 87, 19,"Resize",MC_Dark,MC_Light);
Window_set_normal_button( 80, 86, 60,14,"RESIZE",1,1,SDLK_r); // 7
Window_set_normal_button( 80, 86, 60,14,"RESIZE",1,1,KEY_r); // 7
Print_in_window( 51, 34,"New",MC_Dark,MC_Light);
Print_in_window( 96, 34,"Old",MC_Dark,MC_Light);
Print_in_window_underscore( 30, 44,"W:",MC_Dark,MC_Light,1);
@ -137,15 +137,15 @@ void Button_Transform_menu(int btn)
Print_in_window( 80, 59,":",MC_Dark,MC_Light);
Print_in_window_underscore( 44, 75,"Lock proportions",MC_Dark,MC_Light,1);
Window_set_normal_button( 28, 72, 13,13,ratio_is_locked?"X":" ",0,1,SDLK_l);// 8
Window_set_normal_button( 28, 72, 13,13,ratio_is_locked?"X":" ",0,1,KEY_l);// 8
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]);
input_button[0] = Window_set_input_button_s(45,43,4,SDLK_w); // 10
input_button[0] = Window_set_input_button_s(45,43,4,KEY_w); // 10
input_button[1] = Window_set_input_button(89,43,4); // 11
input_button[2] = Window_set_input_button_s(45,58,4,SDLK_h); // 12
input_button[2] = Window_set_input_button_s(45,58,4,KEY_h); // 12
input_button[3] = Window_set_input_button(89,58,4); // 13
Update_window_area(0,0,Window_width, Window_height);

View File

@ -1355,8 +1355,8 @@ byte Confirmation_box(char * message)
c++;
}
Window_set_normal_button((window_width/3)-20 ,29+(nb_lines<<3),40,14,"Yes",1,1,SDLK_y); // 1
Window_set_normal_button(((window_width<<1)/3)-20,29+(nb_lines<<3),40,14,"No" ,1,1,SDLK_n); // 2
Window_set_normal_button((window_width/3)-20 ,29+(nb_lines<<3),40,14,"Yes",1,1,KEY_y); // 1
Window_set_normal_button(((window_width<<1)/3)-20,29+(nb_lines<<3),40,14,"No" ,1,1,KEY_n); // 2
Update_window_area(0, 0, Window_width, Window_height);
@ -1365,7 +1365,7 @@ byte Confirmation_box(char * message)
do
{
clicked_button=Window_clicked_button();
if (Key==SDLK_RETURN) clicked_button=1;
if (Key==KEY_RETURN) clicked_button=1;
if (Key==KEY_ESC) clicked_button=2;
}
while (clicked_button<=0);
@ -1397,8 +1397,8 @@ int Requester_window(char* message, int initial_value)
sprintf(str, "%d", initial_value);
Window_set_input_button(10, 37, 4); // 1
Print_in_window(11, 39, str, MC_Black, MC_Light);
Window_set_normal_button(60 ,37,40,14,"OK",1,1,SDLK_y); // 2
Window_set_normal_button(130,37,60,14,"Cancel" ,1,1,SDLK_n); // 3
Window_set_normal_button(60 ,37,40,14,"OK",1,1,KEY_y); // 2
Window_set_normal_button(130,37,60,14,"Cancel" ,1,1,KEY_n); // 3
Update_window_area(0, 0, window_width, 60);
Display_cursor();
@ -1408,7 +1408,7 @@ int Requester_window(char* message, int initial_value)
clicked_button = Window_clicked_button();
if (clicked_button == 1)
Readline(11, 39, str, 4, INPUT_TYPE_INTEGER);
if (Key == SDLK_ESCAPE) clicked_button = 2;
if (Key == KEY_ESCAPE) clicked_button = 2;
}
while (clicked_button <= 0);
@ -1434,13 +1434,13 @@ void Warning_message(char * message)
Open_window(window_width,60,"Warning!");
Print_in_window((window_width>>1)-(strlen(message)<<2),20,message,MC_Black,MC_Light);
Window_set_normal_button((window_width>>1)-20 ,37,40,14,"OK",1,1,SDLK_RETURN); // 1
Window_set_normal_button((window_width>>1)-20 ,37,40,14,"OK",1,1,KEY_RETURN); // 1
Update_window_area(0,0,window_width,60);
Display_cursor();
do
clicked_button=Window_clicked_button();
while ((clicked_button<=0) && (Key!=KEY_ESC) && (Key!=SDLK_o));
while ((clicked_button<=0) && (Key!=KEY_ESC) && (Key!=KEY_o));
Key=0;
Close_window();
@ -1508,14 +1508,14 @@ void Verbose_message(const char *caption, const char * message )
message++;
}
Window_set_normal_button(300/2-20,160-23,40,14,"OK",1,1,SDLK_RETURN); // 1
Window_set_normal_button(300/2-20,160-23,40,14,"OK",1,1,KEY_RETURN); // 1
Update_window_area(0,0,Window_width,Window_height);
Cursor_shape=CURSOR_SHAPE_ARROW;
Display_cursor();
do
clicked_button=Window_clicked_button();
while ((clicked_button<=0) && (Key!=KEY_ESC) && (Key!=SDLK_o));
while ((clicked_button<=0) && (Key!=KEY_ESC) && (Key!=KEY_o));
Key=0;
Close_window();
@ -1852,6 +1852,7 @@ void Compute_paintbrush_coordinates(void)
Snap_axis=0;
break;
// Operations that implement it
#if defined(USE_SDL) || defined(USE_SDL2)
default:
if (Snap_axis==0 && (SDL_GetModState() & KMOD_SHIFT))
{
@ -1860,6 +1861,7 @@ void Compute_paintbrush_coordinates(void)
Snap_axis_origin_X=Paintbrush_X;
Snap_axis_origin_Y=Paintbrush_Y;
}
#endif
}
if (Snap_axis==1)

76
tools/generate_keycodes.py Executable file
View File

@ -0,0 +1,76 @@
#!/usr/bin/env python
# (c) 2018 Thomas Bernard
#import sys
filename = '../src/keycodes.h'
keys = ['UNKNOWN',
'ESCAPE', 'RETURN', 'BACKSPACE', 'TAB',
'UP', 'DOWN', 'LEFT', 'RIGHT',
'LEFTBRACKET', 'RIGHTBRACKET',
'INSERT', 'DELETE', 'COMMA', 'BACKQUOTE',
'PAGEUP', 'PAGEDOWN', 'HOME', 'END',
'KP_PLUS', 'KP_MINUS', 'KP_MULTIPLY', 'KP_ENTER',
'EQUALS', 'MINUS', 'PERIOD',
'CAPSLOCK', 'CLEAR', 'SPACE']
def keycode_def(section, key, index, sdl_key=None):
if section == 'SDL and SDL2':
if sdl_key is None:
sdl_key = key
return '#define KEY_%-12s K2K(SDLK_%s)\n' % (key, sdl_key)
else:
return '#define KEY_%-12s %d\n' % (key, index)
def add_keycodes_defs(section, lines):
global keys
i = 0
for key in keys:
lines.append(keycode_def(section, key, i))
i = i + 1
for j in range(10):
lines.append(keycode_def(section, chr(ord('0') + j), i))
i = i + 1
for j in range(26):
lines.append(keycode_def(section, chr(ord('a') + j), i))
i = i + 1
if section == 'SDL and SDL2':
lines.append('#if defined(USE_SDL)\n')
for j in range(10):
key = "KP%d" % (j)
lines.append(keycode_def(section, key, i))
i = i + 1
if section == 'SDL and SDL2':
lines.append('#else\n')
for j in range(10):
key = "KP%d" % (j)
sdl_key = 'KP_%d' % (j)
lines.append(keycode_def(section, key, 0, sdl_key))
lines.append('#endif\n')
for j in range(1,13):
key = "F%d" % (j)
lines.append(keycode_def(section, key, i))
i = i + 1
def update_keycodes(filename):
output = []
with open(filename) as f:
skipping = False
for line in f:
if skipping:
if line.startswith('// end of KEY definitions'):
output.append(line)
skipping = False
else:
output.append(line)
if line.startswith('// KEY definitions for '):
section = line[23:].strip()
print 'section "%s"' % (section)
skipping = True
add_keycodes_defs(section, output)
with open(filename, "w") as f:
for line in output:
f.write(line)
update_keycodes(filename)