From 13aa8e09885d2fcce7c876810b05c989575e3210 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Thu, 5 Feb 2009 22:58:13 +0000 Subject: [PATCH] Support for two shortcuts per function git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@602 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- Makefile.dep | 8 +- aide.c | 20 ++- boutons.c | 94 ++++++------ clavier.c | 13 +- const.h | 2 +- gfxcfg.c | 13 +- global.h | 6 +- hotkeys.h | 403 ++++++++++++++++++++++++++++++++++----------------- init.c | 58 ++++++-- input.c | 76 +++++++--- input.h | 1 + moteur.c | 6 +- palette.c | 5 +- shade.c | 4 +- 14 files changed, 468 insertions(+), 241 deletions(-) diff --git a/Makefile.dep b/Makefile.dep index 27feb007..defdf975 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -1,9 +1,9 @@ $(OBJDIR)/aide.o: aide.c const.h struct.h global.h divers.h graph.h moteur.h \ - tables_aide.h aide.h sdlscreen.h texte.h clavier.h windows.h + tables_aide.h aide.h sdlscreen.h texte.h clavier.h windows.h input.h $(OBJDIR)/boutons.o: boutons.c const.h struct.h global.h divers.h graph.h moteur.h \ readline.h files.h loadsave.h init.h boutons.h operatio.h pages.h \ erreurs.h readini.h saveini.h shade.h io.h aide.h texte.h sdlscreen.h \ - windows.h brush.h + windows.h brush.h input.h $(OBJDIR)/brush.o: brush.c global.h struct.h const.h graph.h divers.h erreurs.h \ windows.h sdlscreen.h $(OBJDIR)/clavier.o: clavier.c global.h struct.h const.h @@ -21,7 +21,7 @@ $(OBJDIR)/init.o: init.c const.h struct.h global.h graph.h boutons.h palette.h \ aide.h operatio.h divers.h erreurs.h clavier.h io.h hotkeys.h files.h \ setup.h windows.h sdlscreen.h mountlist.h $(OBJDIR)/input.o: input.c global.h struct.h const.h clavier.h graph.h sdlscreen.h \ - windows.h erreurs.h + windows.h erreurs.h divers.h input.h $(OBJDIR)/io.o: io.c struct.h const.h io.h $(OBJDIR)/loadsave.o: loadsave.c const.h struct.h global.h graph.h divers.h pages.h \ op_c.h boutons.h erreurs.h io.h sdlscreen.h windows.h loadsave.h @@ -40,7 +40,7 @@ $(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h graph.h erreurs.h \ divers.h windows.h $(OBJDIR)/palette.o: palette.c const.h struct.h global.h divers.h graph.h moteur.h \ readline.h boutons.h pages.h aide.h sdlscreen.h erreurs.h op_c.h \ - windows.h + windows.h input.h $(OBJDIR)/pxsimple.o: pxsimple.c global.h struct.h const.h sdlscreen.h divers.h $(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h sdlscreen.h divers.h \ pxsimple.h diff --git a/aide.c b/aide.c index 71e4a1aa..b80eca2f 100644 --- a/aide.c +++ b/aide.c @@ -53,23 +53,31 @@ extern char SVNRevision[]; word * Raccourci(word NumeroRaccourci) { if (NumeroRaccourci & 0x100) - return &(Bouton[NumeroRaccourci & 0xFF].Raccourci_gauche); + return &(Bouton[NumeroRaccourci & 0xFF].Raccourci_gauche[0]); if (NumeroRaccourci & 0x200) - return &(Bouton[NumeroRaccourci & 0xFF].Raccourci_droite); - return &(Config_Touche[NumeroRaccourci & 0xFF]); + return &(Bouton[NumeroRaccourci & 0xFF].Raccourci_droite[0]); + return &(Config_Touche[NumeroRaccourci & 0xFF][0]); } // Nom de la touche actuallement assignée à un raccourci d'après son numéro // de type 0x100+BOUTON_* ou SPECIAL_* const char * Valeur_Raccourci_Clavier(word NumeroRaccourci) { + static char Noms_raccourcis[80]; word * Pointeur = Raccourci(NumeroRaccourci); if (Pointeur == NULL) return "(Problem)"; - else if (*Pointeur == 0 || *Pointeur == 0xFFFF) - return "None"; else - return Nom_touche(*Pointeur); + { + if (Pointeur[0] == 0 || Pointeur[0] == 0xFFFF) + return "None"; + strcpy(Noms_raccourcis, Nom_touche(Pointeur[0])); + if (Pointeur[1] == 0 || Pointeur[1] == 0xFFFF) + return Noms_raccourcis; + strcat(Noms_raccourcis, " "); + strcat(Noms_raccourcis, Nom_touche(Pointeur[1])); + return Noms_raccourcis; + } } diff --git a/boutons.c b/boutons.c index 2c4f6626..2f199924 100644 --- a/boutons.c +++ b/boutons.c @@ -441,7 +441,7 @@ byte Bouton_Quitter_Routine_locale(void) do { Bouton_clicke=Fenetre_Bouton_clicke(); - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) Fenetre_aide(BOUTON_QUIT, NULL); } while (Bouton_clicke<=0); @@ -631,7 +631,7 @@ void Menu_Tag_couleurs(char * En_tete, byte * Table, byte * Mode, byte Cancel, c Touche=0; break; default: - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) { Fenetre_aide(BOUTON_EFFETS, Section_aide); Touche=0; @@ -967,7 +967,7 @@ void Bouton_Settings(void) if ((Bouton_clicke>=1) && (Bouton_clicke<=18)) Settings_Afficher_config(&Config_choisie); - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) Fenetre_aide(BOUTON_PARAMETRES, NULL); } while ( (Bouton_clicke!=18) && (Touche!=SDLK_RETURN) ); @@ -1194,7 +1194,7 @@ void Bouton_Copy_page(void) do { Bouton_clicke=Fenetre_Bouton_clicke(); - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) Fenetre_aide(BOUTON_PAGE, NULL); } while (Bouton_clicke<=0); @@ -1609,7 +1609,7 @@ void Bouton_Resol(void) Touche=0; break; default: - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) { Fenetre_aide(BOUTON_RESOL, NULL); Touche=0; @@ -2076,9 +2076,9 @@ void Bouton_Degrades(void) Touche=0; break; default: - if (Touche==Bouton[BOUTON_GRADMENU].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) { - Fenetre_aide(BOUTON_PINCEAUX, NULL); + Fenetre_aide(BOUTON_GRADMENU, NULL); Touche=0; break; } @@ -2207,7 +2207,7 @@ void Bouton_Menu_pinceaux(void) do { Bouton_clicke=Fenetre_Bouton_clicke(); - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) Fenetre_aide(BOUTON_PINCEAUX, NULL); } while (Bouton_clicke<=0); @@ -2949,7 +2949,7 @@ byte Bouton_Load_ou_Save(byte Load, byte Image) default: // Autre => On se place sur le nom de fichier qui correspond if (Bouton_clicke<=0) { - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) { Fenetre_aide(Load?BOUTON_CHARGER:BOUTON_SAUVER, NULL); break; @@ -3906,7 +3906,7 @@ void Bouton_Menu_Loupe(void) do { Bouton_clicke=Fenetre_Bouton_clicke(); - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) Fenetre_aide(BOUTON_LOUPE, NULL); } while (Bouton_clicke<=0); @@ -4123,7 +4123,7 @@ void Bouton_Menu_Grille(void) Afficher_curseur(); } - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) Fenetre_aide(BOUTON_EFFETS, "GRID"); } while ( (Bouton_clicke!=1) && (Bouton_clicke!=2) ); @@ -4160,28 +4160,28 @@ void Bouton_Brush_FX(void) Fenetre_Afficher_cadre(137,83,167,53); Fenetre_Definir_bouton_normal(236,141, 67,14,"Cancel" ,0,1,TOUCHE_ESC); // 1 - Fenetre_Definir_bouton_normal( 19, 46, 27,14,"X\035" ,0,1,Config_Touche[SPECIAL_FLIP_X]); // 2 - Fenetre_Definir_bouton_normal( 19, 61, 27,14,"Y\022" ,0,1,Config_Touche[SPECIAL_FLIP_Y]); // 3 - Fenetre_Definir_bouton_normal( 58, 46, 37,14,"90°" ,0,1,Config_Touche[SPECIAL_ROTATE_90]); // 4 - Fenetre_Definir_bouton_normal( 96, 46, 37,14,"180°" ,0,1,Config_Touche[SPECIAL_ROTATE_180]); // 5 - Fenetre_Definir_bouton_normal( 58, 61, 75,14,"any angle" ,0,1,Config_Touche[SPECIAL_ROTATE_ANY_ANGLE]); // 6 - Fenetre_Definir_bouton_normal(145, 46, 67,14,"Stretch" ,0,1,Config_Touche[SPECIAL_STRETCH]); // 7 - Fenetre_Definir_bouton_normal(145, 61, 67,14,"Distort" ,0,1,Config_Touche[SPECIAL_DISTORT]); // 8 - Fenetre_Definir_bouton_normal(155, 99,131,14,"Recolorize" ,0,1,Config_Touche[SPECIAL_RECOLORIZE_BRUSH]); // 9 - Fenetre_Definir_bouton_normal(155,117,131,14,"Get brush colors",0,1,Config_Touche[SPECIAL_GET_BRUSH_COLORS]); // 10 + Fenetre_Definir_bouton_normal( 19, 46, 27,14,"X\035" ,0,1,Config_Touche[SPECIAL_FLIP_X][0]); // 2 + Fenetre_Definir_bouton_normal( 19, 61, 27,14,"Y\022" ,0,1,Config_Touche[SPECIAL_FLIP_Y][0]); // 3 + Fenetre_Definir_bouton_normal( 58, 46, 37,14,"90°" ,0,1,Config_Touche[SPECIAL_ROTATE_90][0]); // 4 + Fenetre_Definir_bouton_normal( 96, 46, 37,14,"180°" ,0,1,Config_Touche[SPECIAL_ROTATE_180][0]); // 5 + Fenetre_Definir_bouton_normal( 58, 61, 75,14,"any angle" ,0,1,Config_Touche[SPECIAL_ROTATE_ANY_ANGLE][0]); // 6 + Fenetre_Definir_bouton_normal(145, 46, 67,14,"Stretch" ,0,1,Config_Touche[SPECIAL_STRETCH][0]); // 7 + Fenetre_Definir_bouton_normal(145, 61, 67,14,"Distort" ,0,1,Config_Touche[SPECIAL_DISTORT][0]); // 8 + Fenetre_Definir_bouton_normal(155, 99,131,14,"Recolorize" ,0,1,Config_Touche[SPECIAL_RECOLORIZE_BRUSH][0]); // 9 + Fenetre_Definir_bouton_normal(155,117,131,14,"Get brush colors",0,1,Config_Touche[SPECIAL_GET_BRUSH_COLORS][0]); // 10 // Boutons représentant les coins du brush handle: (HG,HD,C,BG,BD) - Fenetre_Definir_bouton_normal( 75, 90,11,11,"",0,1,Config_Touche[SPECIAL_TOP_LEFT_ATTACHMENT]); // 11 - Fenetre_Definir_bouton_normal(103, 90,11,11,"",0,1,Config_Touche[SPECIAL_TOP_RIGHT_ATTACHMENT]); // 12 - Fenetre_Definir_bouton_normal( 89,104,11,11,"",0,1,Config_Touche[SPECIAL_CENTER_ATTACHMENT]); // 13 - Fenetre_Definir_bouton_normal( 75,118,11,11,"",0,1,Config_Touche[SPECIAL_BOTTOM_LEFT_ATTACHMENT]); // 14 - Fenetre_Definir_bouton_normal(103,118,11,11,"",0,1,Config_Touche[SPECIAL_BOTTOM_RIGHT_ATTACHMENT]); // 15 + Fenetre_Definir_bouton_normal( 75, 90,11,11,"",0,1,Config_Touche[SPECIAL_TOP_LEFT_ATTACHMENT][0]); // 11 + Fenetre_Definir_bouton_normal(103, 90,11,11,"",0,1,Config_Touche[SPECIAL_TOP_RIGHT_ATTACHMENT][0]); // 12 + Fenetre_Definir_bouton_normal( 89,104,11,11,"",0,1,Config_Touche[SPECIAL_CENTER_ATTACHMENT][0]); // 13 + Fenetre_Definir_bouton_normal( 75,118,11,11,"",0,1,Config_Touche[SPECIAL_BOTTOM_LEFT_ATTACHMENT][0]); // 14 + Fenetre_Definir_bouton_normal(103,118,11,11,"",0,1,Config_Touche[SPECIAL_BOTTOM_RIGHT_ATTACHMENT][0]); // 15 - Fenetre_Definir_bouton_normal(224,46,67,14,"Outline",0,1,Config_Touche[SPECIAL_OUTLINE]); // 16 - Fenetre_Definir_bouton_normal(224,61,67,14,"Nibble" ,0,1,Config_Touche[SPECIAL_NIBBLE]); // 17 + Fenetre_Definir_bouton_normal(224,46,67,14,"Outline",0,1,Config_Touche[SPECIAL_OUTLINE][0]); // 16 + Fenetre_Definir_bouton_normal(224,61,67,14,"Nibble" ,0,1,Config_Touche[SPECIAL_NIBBLE][0]); // 17 - Fenetre_Definir_bouton_normal( 7,141, 60,14,"Load",0,1,Config_Touche[SPECIAL_LOAD_BRUSH]); // 18 - Fenetre_Definir_bouton_normal( 70,141, 60,14,"Save",0,1,Config_Touche[SPECIAL_SAVE_BRUSH]); // 19 + Fenetre_Definir_bouton_normal( 7,141, 60,14,"Load",0,1,Config_Touche[SPECIAL_LOAD_BRUSH][0]); // 18 + Fenetre_Definir_bouton_normal( 70,141, 60,14,"Save",0,1,Config_Touche[SPECIAL_SAVE_BRUSH][0]); // 19 Print_dans_fenetre( 80, 24,"Shape modifications",CM_Fonce,CM_Clair); Print_dans_fenetre( 10, 36,"Mirror",CM_Fonce,CM_Clair); @@ -4224,7 +4224,7 @@ void Bouton_Brush_FX(void) do { Bouton_clicke=Fenetre_Bouton_clicke(); - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) { Touche=0; Fenetre_aide(BOUTON_EFFETS_BROSSE, NULL); @@ -4410,7 +4410,7 @@ void Bouton_Smooth_Menu(void) Afficher_curseur(); } } - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) Fenetre_aide(BOUTON_EFFETS, "SMOOTH"); } while ((Bouton_clicke!=1) && (Bouton_clicke!=2)); @@ -4577,7 +4577,7 @@ void Bouton_Colorize_Menu(void) Bouton_Colorize_Afficher_la_selection(Mode_choisi); Afficher_curseur(); } - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) Fenetre_aide(BOUTON_EFFETS, "TRANSPARENCY"); } while (Bouton_clicke<5); @@ -4678,7 +4678,7 @@ void Bouton_Tiling_Menu(void) } Afficher_curseur(); } - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) Fenetre_aide(BOUTON_EFFETS, "TILING"); } while ( (Bouton_clicke!=1) && (Bouton_clicke!=2) ); @@ -5054,7 +5054,7 @@ void Bouton_Spray_Menu(void) Touche=0; break; default: - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) { Fenetre_aide(BOUTON_SPRAY, NULL); Touche=0; @@ -5516,7 +5516,7 @@ void Bouton_Trame_Menu(void) Afficher_curseur(); Mettre_a_jour_trame(Orig_X, Orig_Y); } - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) { Touche=0; Fenetre_aide(BOUTON_EFFETS, "SIEVE"); @@ -5640,16 +5640,16 @@ void Bouton_Effets(void) Ouvrir_fenetre(270,152,"Drawing modes (effects)"); - Fenetre_Definir_bouton_normal( 7, 19, 16,16,"",0,1,Config_Touche[SPECIAL_SHADE_MODE]); // 1 - Fenetre_Definir_bouton_normal( 7, 38, 16,16,"",0,1,Config_Touche[SPECIAL_QUICK_SHADE_MODE]); // 2 - Fenetre_Definir_bouton_normal( 7, 57, 16,16,"",0,1,Config_Touche[SPECIAL_COLORIZE_MODE]); // 3 - Fenetre_Definir_bouton_normal( 7, 76, 16,16,"",0,1,Config_Touche[SPECIAL_SMOOTH_MODE]); // 4 - Fenetre_Definir_bouton_normal( 7, 95, 16,16,"",0,1,Config_Touche[SPECIAL_SMEAR_MODE]); // 5 - Fenetre_Definir_bouton_normal(153, 19, 16,16,"",0,1,Config_Touche[SPECIAL_MASK_MODE]); // 6 - Fenetre_Definir_bouton_normal(153, 38, 16,16,"",0,1,Config_Touche[SPECIAL_STENCIL_MODE]); // 7 - Fenetre_Definir_bouton_normal(153, 57, 16,16,"",0,1,Config_Touche[SPECIAL_SIEVE_MODE]); // 8 - Fenetre_Definir_bouton_normal(153, 76, 16,16,"",0,1,Config_Touche[SPECIAL_GRID_MODE]); // 9 - Fenetre_Definir_bouton_normal(153, 95, 16,16,"",0,1,Config_Touche[SPECIAL_TILING_MODE]); // 10 + Fenetre_Definir_bouton_normal( 7, 19, 16,16,"",0,1,Config_Touche[SPECIAL_SHADE_MODE][0]); // 1 + Fenetre_Definir_bouton_normal( 7, 38, 16,16,"",0,1,Config_Touche[SPECIAL_QUICK_SHADE_MODE][0]); // 2 + Fenetre_Definir_bouton_normal( 7, 57, 16,16,"",0,1,Config_Touche[SPECIAL_COLORIZE_MODE][0]); // 3 + Fenetre_Definir_bouton_normal( 7, 76, 16,16,"",0,1,Config_Touche[SPECIAL_SMOOTH_MODE][0]); // 4 + Fenetre_Definir_bouton_normal( 7, 95, 16,16,"",0,1,Config_Touche[SPECIAL_SMEAR_MODE][0]); // 5 + Fenetre_Definir_bouton_normal(153, 19, 16,16,"",0,1,Config_Touche[SPECIAL_MASK_MODE][0]); // 6 + Fenetre_Definir_bouton_normal(153, 38, 16,16,"",0,1,Config_Touche[SPECIAL_STENCIL_MODE][0]); // 7 + Fenetre_Definir_bouton_normal(153, 57, 16,16,"",0,1,Config_Touche[SPECIAL_SIEVE_MODE][0]); // 8 + Fenetre_Definir_bouton_normal(153, 76, 16,16,"",0,1,Config_Touche[SPECIAL_GRID_MODE][0]); // 9 + Fenetre_Definir_bouton_normal(153, 95, 16,16,"",0,1,Config_Touche[SPECIAL_TILING_MODE][0]); // 10 Fenetre_Definir_bouton_normal(195,131, 68,14,"Close",0,1,SDLK_RETURN); // 11 Fenetre_Definir_bouton_normal( 7,131, 68,14,"All off",0,1,SDLK_DELETE); // 12 Fenetre_Definir_bouton_normal( 83,131,104,14,"Feedback: ",1,1,SDLK_f); // 13 @@ -5680,7 +5680,7 @@ void Bouton_Effets(void) Bouton_clicke=11; Touche=0; } - else if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + else if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) { Touche=0; // Aide contextuelle @@ -6193,7 +6193,7 @@ void Bouton_Texte() Scroller_de_fontes->Position=Debut_liste; Fenetre_Dessiner_jauge(Scroller_de_fontes); } - if (Touche==Bouton[BOUTON_AIDE].Raccourci_gauche) + if (Est_Raccourci(Touche,0x100+BOUTON_AIDE)) Fenetre_aide(BOUTON_TEXTE, NULL); } switch(Bouton_clicke) diff --git a/clavier.c b/clavier.c index b9a5e013..e0760746 100644 --- a/clavier.c +++ b/clavier.c @@ -421,7 +421,10 @@ const char * Nom_touche(word Touche) { SDLK_MENU , "Menu" }, { SDLK_POWER , "Power" }, { SDLK_EURO , "Euro" }, - { SDLK_UNDO , "Undo" } + { SDLK_UNDO , "Undo" }, + { TOUCHE_MOUSEMIDDLE, "Mouse3" }, + { TOUCHE_MOUSEWHEELUP, "WheelUp" }, + { TOUCHE_MOUSEWHEELDOWN, "WheelDown" } }; int Indice; @@ -434,7 +437,13 @@ const char * Nom_touche(word Touche) strcat(Buffer, "Alt+"); if (Touche & MOD_SHIFT) strcat(Buffer, "Shift+"); - + + if (Touche>=TOUCHE_BUTTON && Touche<=TOUCHE_BUTTON+18) + { + sprintf(Buffer+strlen(Buffer), "[B%d]", Touche); + return Buffer; + } + if (Touche & 0x8000) { sprintf(Buffer+strlen(Buffer), "[%d]", Touche & 0xFFF); diff --git a/const.h b/const.h index 27b76545..32085466 100644 --- a/const.h +++ b/const.h @@ -31,7 +31,7 @@ #define POURCENTAGE_VERSION "98.0%" // Libellé du pourcentage de la version ß #define VERSION1 2 // | #define VERSION2 0 // |_ Numéro de version découpé en -#define BETA1 97 // | plusieurs parties => 2.0 ß95.5% +#define BETA1 98 // | plusieurs parties => 2.0 ß95.5% #define BETA2 0 // | (utilisé pour le fichier de config) #define ALPHA_BETA "ß" // Type de la version "Þ" ou "ß" #define MAX_MODES_VIDEO 100 // Nombre de modes vidéo maxi diff --git a/gfxcfg.c b/gfxcfg.c index 5c52b546..9c1b3e6f 100644 --- a/gfxcfg.c +++ b/gfxcfg.c @@ -42,6 +42,17 @@ #define MOD_CTRL 0x2000 #define MOD_ALT 0x4000 +#define TOUCHE_MOUSEMIDDLE (SDLK_LAST+1) +#define TOUCHE_MOUSEWHEELUP (SDLK_LAST+2) +#define TOUCHE_MOUSEWHEELDOWN (SDLK_LAST+3) +#define TOUCHE_BUTTON (SDLK_LAST+4) + +#ifdef __gp2x__ + #define TOUCHE_ESC (TOUCHE_BUTTON+GP2X_BUTTON_X) +#else + #define TOUCHE_ESC SDLK_ESCAPE +#endif + #include "struct.h" #include "clavier.h" #include "const.h" @@ -640,7 +651,7 @@ void Enregistrer_config() { write_word_le(Fichier,ConfigTouche[Indice_touche].Numero); write_word_le(Fichier,ConfigTouche[Indice_touche].Touche); - write_word_le(Fichier,0xFF); + write_word_le(Fichier,ConfigTouche[Indice_touche].Touche2); } } else diff --git a/global.h b/global.h index 81a6c372..79c2534e 100644 --- a/global.h +++ b/global.h @@ -83,7 +83,7 @@ GFX2_GLOBAL struct S_Config } Config; // Tableau des touches spéciales -GFX2_GLOBAL word Config_Touche[NB_TOUCHES_SPECIALES]; +GFX2_GLOBAL word Config_Touche[NB_TOUCHES_SPECIALES][2]; struct S_Mode_video @@ -391,8 +391,8 @@ GFX2_GLOBAL struct // Information sur les clicks de la souris: fonction_action Gauche; // Action déclenchée par un click gauche sur le bouton fonction_action Droite; // Action déclenchée par un click droit sur le bouton - word Raccourci_gauche; // Raccourci clavier équivalent à un click gauche sur le bouton - word Raccourci_droite; // Raccourci clavier équivalent à un click droit sur le bouton + word Raccourci_gauche[2]; // Raccourci clavier équivalent à un click gauche sur le bouton + word Raccourci_droite[2]; // Raccourci clavier équivalent à un click droit sur le bouton // Informations sur le désenclenchement du bouton géré par le moteur: fonction_action Desenclencher; // Action appelée lors du désenclenchement du bouton diff --git a/hotkeys.h b/hotkeys.h index 13c465b2..3f0272f4 100644 --- a/hotkeys.h +++ b/hotkeys.h @@ -31,6 +31,7 @@ typedef struct{ char Explic2[77]; bool Suppr; // Raccourci facultatif uint16_t Touche; + uint16_t Touche2; } S_ConfigTouche; S_ConfigTouche ConfigTouche[] = { @@ -39,803 +40,937 @@ S_ConfigTouche ConfigTouche[] = { "Scrolls the picture up, both in magnify and normal mode.", "This hotkey cannot be removed.", false, - SDLK_UP}, // HAUT + SDLK_UP, // HAUT + 0xFFFF}, {1, "Scroll down", "Scrolls the picture down, both in magnify and normal mode.", "This hotkey cannot be removed.", false, - SDLK_DOWN}, // BAS + SDLK_DOWN, // BAS + 0xFFFF}, {2, "Scroll left", "Scrolls the picture to the left, both in magnify and normal mode.", "This hotkey cannot be removed.", false, - SDLK_LEFT}, // GAUCHE + SDLK_LEFT, // GAUCHE + 0xFFFF}, {3, "Scroll right", "Scrolls the picture to the right, both in magnify and normal mode.", "This hotkey cannot be removed.", false, - SDLK_RIGHT}, // DROITE + SDLK_RIGHT, // DROITE + 0xFFFF}, {4, "Faster scroll up", "Used to scroll upwards in the picture fast, either in magnify and normal", "mode.", true, - SDLK_UP|MOD_SHIFT}, // Shift + Haut + SDLK_UP|MOD_SHIFT, // Shift + Haut + 0xFFFF}, {5, "Faster scroll down", "Used to scroll downwards in the picture fast, either in magnify and normal", "mode.", true, - SDLK_DOWN|MOD_SHIFT}, // Shift + Bas + SDLK_DOWN|MOD_SHIFT, // Shift + Bas + 0xFFFF}, {6, "Faster scroll left", "Used to scroll to the left in the picture fast, either in magnify and normal", "mode.", true, - SDLK_LEFT|MOD_SHIFT}, // Shift + Gauche + SDLK_LEFT|MOD_SHIFT, // Shift + Gauche + 0xFFFF}, {7, "Faster scroll right", "Used to scroll to the right in the picture fast, either in magnify and", "normal mode.", true, - SDLK_RIGHT|MOD_SHIFT}, // Shift + Droite + SDLK_RIGHT|MOD_SHIFT, // Shift + Droite + 0xFFFF}, {8, "Slower scroll up", "Used to scroll upwards in the picture pixel by pixel, either in magnify and", "normal mode.", true, - SDLK_UP|MOD_ALT}, // Alt + Haut + SDLK_UP|MOD_ALT, // Alt + Haut + 0xFFFF}, {9, "Slower scroll down", "Used to scroll downwards in the picture pixel by pixel, either in magnify and", "normal mode.", true, - SDLK_DOWN|MOD_ALT}, // Alt + Bas + SDLK_DOWN|MOD_ALT, // Alt + Bas + 0xFFFF}, {10, "Slower scroll left", "Used to scroll to the left in the picture pixel by pixel, either in magnify", "and normal mode.", true, - SDLK_LEFT|MOD_ALT}, // Alt + Gauche + SDLK_LEFT|MOD_ALT, // Alt + Gauche + 0xFFFF}, {11, "Slower scroll right", "Used to scroll to the right in the picture pixel by pixel, either in magnify", "and normal mode.", true, - SDLK_RIGHT|MOD_ALT}, // Alt + Droite + SDLK_RIGHT|MOD_ALT, // Alt + Droite + 0xFFFF}, {12, "Move mouse cursor 1 pixel up", "Used to simulate a very small mouse deplacement upwards.", "It""s very useful when you want a ultra-high precision.", true, - SDLK_UP|MOD_CTRL}, // Ctrl + Haut + SDLK_UP|MOD_CTRL, // Ctrl + Haut + 0xFFFF}, {13, "Move mouse cursor 1 pixel down", "Used to simulate a very small mouse deplacement downwards.", "It""s very useful when you want a ultra-high precision.", true, - SDLK_DOWN|MOD_CTRL}, // Ctrl + Bas + SDLK_DOWN|MOD_CTRL, // Ctrl + Bas + 0xFFFF}, {14, "Move mouse cursor 1 pixel left", "Used to simulate a very small mouse deplacement to the left.", "It""s very useful when you want a ultra-high precision.", true, - SDLK_LEFT|MOD_CTRL}, // Ctrl + Gauche + SDLK_LEFT|MOD_CTRL, // Ctrl + Gauche + 0xFFFF}, {15, "Move mouse cursor 1 pixel right", "Used to simulate a very small mouse deplacement to the right.", "It""s very useful when you want a ultra-high precision.", true, - SDLK_RIGHT|MOD_CTRL}, // Ctrl + Droite + SDLK_RIGHT|MOD_CTRL, // Ctrl + Droite + 0xFFFF}, {16, "Simulate left mouse click", "Used to simulate a click with the left mouse button..", "It""s very useful when you want a ultra-high precision.", true, - SDLK_SPACE}, // Space + SDLK_SPACE, // Space + 0xFFFF}, {17, "Simulate right mouse click", "Used to simulate a click with the right mouse button..", "It""s very useful when you want a ultra-high precision.", true, - SDLK_SPACE|MOD_SHIFT}, // Shift + Space + SDLK_SPACE|MOD_SHIFT, // Shift + Space + 0xFFFF}, {18, "Show/hide option menu", "Switch the tool bar display on/off.", "This hot-key cannot be removed.", false, - SDLK_F10}, // F10 + SDLK_F10, // F10 + 0xFFFF}, {19, "Show/hide cursor", "Switch the cursor display on/off.", "This only works on the \"small cross\" and \"hand\" cursors.", true, - SDLK_F9}, // F9 + SDLK_F9, // F9 + 0xFFFF}, {20, "Set paintbrush to 1 pixel", "Useful when you want to use a \"single-pixel-brush\".", "", true, - SDLK_DELETE}, // Del + SDLK_DELETE, // Del + 0xFFFF}, {21, "Paintbrush choice", "Opens a menu where you can choose a paintbrush out of 24 predefined ones.", "", true, - SDLK_F4}, // F4 + SDLK_F4, // F4 + 0xFFFF}, {22, "Monochrome brush", "Turn your current user-defined brush into a single colored one.", "All non-transparent colors are set to current foreground color.", true, - SDLK_F4|MOD_SHIFT}, // Shift + F4 + SDLK_F4|MOD_SHIFT, // Shift + F4 + 0xFFFF}, {23, "Freehand drawing", "Set the drawing mode to the classical freehand one.", "", true, - SDLK_d}, // D + SDLK_d, // D + 0xFFFF}, {24, "Switch freehand drawing mode", "Switch between the 3 ways to use freehand drawing.", "These modes are: continuous, discontinuous and point by point.", true, - SDLK_d|MOD_SHIFT}, // Shift + D + SDLK_d|MOD_SHIFT, // Shift + D + 0xFFFF}, {25, "Continuous freehand drawing", "Switch directly to continuous freehand drawing mode.", "", true, - SDLK_d|MOD_CTRL}, // Ctrl + D + SDLK_d|MOD_CTRL, // Ctrl + D + 0xFFFF}, {26, "Line", "Allows you to draw lines.", "", true, - SDLK_l}, // L + SDLK_l, // L + 0xFFFF}, {27, "Knotted lines", "Allows you to draw linked lines.", "This mode can also be called \"Polyline\".", true, - SDLK_l|MOD_SHIFT}, // Shift + L + SDLK_l|MOD_SHIFT, // Shift + L + 0xFFFF}, {28, "Spray", "Allows you to spray brushes randomly in the picture.", "", true, - SDLK_a}, // A (Q en AZERTY) + SDLK_a, // A (Q en AZERTY) + 0xFFFF}, {29, "Spray menu", "Opens a menu in which you can configure the spray flow and size.", "", true, - SDLK_a|MOD_SHIFT}, // Shift + A + SDLK_a|MOD_SHIFT, // Shift + A + 0xFFFF}, {30, "Flood-fill", "Allows you to fill an area of the picture made of pixels of the same color.", "", true, - SDLK_f}, // F + SDLK_f, // F + 0xFFFF}, {124, "Replace color", "Allows you to replace all the pixels of the color pointed by the mouse with", "the fore-color or the back-color.", true, - SDLK_f|MOD_SHIFT}, // Shift + F + SDLK_f|MOD_SHIFT, // Shift + F + 0xFFFF}, {31, "Bezier""s curves", "Allows you to draw Bezier""s curves.", "", true, - SDLK_i}, // I + SDLK_i, // I + 0xFFFF}, {32, "Bezier""s curve with 3 or 4 points", "Allows you to choose whether you want to draw Bezier""s curves with 3 or 4", "points.", true, - SDLK_i|MOD_SHIFT}, // Shift + I + SDLK_i|MOD_SHIFT, // Shift + I + 0xFFFF}, {33, "Empty rectangle", "Allows you to draw a rectangle using the brush.", "", true, - SDLK_r}, // R + SDLK_r, // R + 0xFFFF}, {34, "Filled rectangle", "Allows you to draw a filled rectangle.", "", true, - SDLK_r|MOD_SHIFT}, // Shift + R + SDLK_r|MOD_SHIFT, // Shift + R + 0xFFFF}, {35, "Empty circle", "Allows you to draw a circle using the brush.", "", true, - SDLK_c}, // C + SDLK_c, // C + 0xFFFF}, {36, "Empty ellipse", "Allows you to draw an ellipse using the brush.", "", true, - SDLK_c|MOD_CTRL}, // Ctrl + C + SDLK_c|MOD_CTRL, // Ctrl + C + 0xFFFF}, {37, "Filled circle", "Allows you to draw a filled circle.", "", true, - SDLK_c|MOD_SHIFT}, // Shift + C + SDLK_c|MOD_SHIFT, // Shift + C + 0xFFFF}, {38, "Filled ellipse", "Allows you to draw a filled ellipse.", "", true, - SDLK_c|MOD_SHIFT|MOD_CTRL}, // Shift + Ctrl + C + SDLK_c|MOD_SHIFT|MOD_CTRL, // Shift + Ctrl + C + 0xFFFF}, {39, "Empty polygon", "Allows you to draw a polygon using the brush.", "", true, - SDLK_n}, // N + SDLK_n, // N + 0xFFFF}, {40, "Empty \"polyform\"", "Allows you to draw a freehand polygon using the brush.", "", true, - SDLK_n|MOD_CTRL}, // Ctrl + N + SDLK_n|MOD_CTRL, // Ctrl + N + 0xFFFF}, {41, "Filled polygon", "Allows you to draw a filled polygon.", "", true, - SDLK_n|MOD_SHIFT}, // Shift + N + SDLK_n|MOD_SHIFT, // Shift + N + 0xFFFF}, {42, "Filled \"polyform\"", "Allows you to draw a filled freehand polygon.", "", true, - SDLK_n|MOD_SHIFT|MOD_CTRL}, // Shift + Ctrl + N + SDLK_n|MOD_SHIFT|MOD_CTRL, // Shift + Ctrl + N + 0xFFFF}, {43, "Rectangle with gradation", "Allows you to draw a rectangle with a color gradation.", "", true, - SDLK_r|MOD_ALT}, // Alt + R + SDLK_r|MOD_ALT, // Alt + R + 0xFFFF}, {44, "Gradation menu", "Allows you to configure the way color gradations are calculated.", "", true, - SDLK_g|MOD_ALT}, // Alt + G + SDLK_g|MOD_ALT, // Alt + G + 0xFFFF}, {45, "Sphere with gradation", "Allows you to draw a rectangle with a color gradation.", "", true, - SDLK_c|MOD_ALT}, // Alt + C + SDLK_c|MOD_ALT, // Alt + C + 0xFFFF}, {46, "Ellipse with gradation", "Allows you to draw an ellipse filled with a color gradation.", "", true, - SDLK_c|MOD_SHIFT|MOD_ALT}, // Shift + Alt + C + SDLK_c|MOD_SHIFT|MOD_ALT, // Shift + Alt + C + 0xFFFF}, {47, "Adjust picture", "Allows you to move the whole picture in order to re-center it.", "Notice that what gets out from a side reappears on the other.", true, - SDLK_KP5}, // Kpad5 + SDLK_KP5, // Kpad5 + 0xFFFF}, {48, "Flip/shrink picture menu", "Opens a menu which allows you to flip the picture horizontally/vertically or", "to shrink it to half-scale horizontally and/or vertically.", true, - SDLK_KP5|MOD_SHIFT}, // Shift + Kpad5 + SDLK_KP5|MOD_SHIFT, // Shift + Kpad5 + 0xFFFF}, {49, "Drawing effects", "Opens a menu where you can enable/disable and configure the drawing effects", "listed below.", true, - SDLK_e}, // E + SDLK_e, // E + 0xFFFF}, {50, "Shade mode", "Allows you to shade or lighten some pixels of the picture belonging to a", "color range, in addition of any drawing tool.", true, - SDLK_F5}, // F5 + SDLK_F5, // F5 + 0xFFFF}, {51, "Shade menu", "Opens a menu where you can choose color ranges to use with the Shade mode.", "This menu also contains parameters used both in Shade and Quick-shade modes.", true, - SDLK_F5|MOD_SHIFT}, // Shift + F5 + SDLK_F5|MOD_SHIFT, // Shift + F5 + 0xFFFF}, {131, "Quick-shade mode", "Does the same thing as shade mode with a simpler method (faster to define", "but a bit less powerful).", true, - SDLK_F5|MOD_CTRL}, // Ctrl + F5 + SDLK_F5|MOD_CTRL, // Ctrl + F5 + 0xFFFF}, {132, "Quick-shade menu", "Opens a menu where you can define the parameters of the quick-shade mode.", "", true, - SDLK_F5|MOD_SHIFT|MOD_CTRL}, // Shift + Ctrl + F5 + SDLK_F5|MOD_SHIFT|MOD_CTRL, // Shift + Ctrl + F5 + 0xFFFF}, {52, "Stencil mode", "Allows you to mask colors that must not be affected when you are drawing.", "", true, - SDLK_F6}, // F6 + SDLK_F6, // F6 + 0xFFFF}, {53, "Stencil menu", "Opens a menu where you can choose colors masked by the Stencil mode.", "", true, - SDLK_F6|MOD_SHIFT}, // Shift + F6 + SDLK_F6|MOD_SHIFT, // Shift + F6 + 0xFFFF}, {54, "Mask mode", "Allows you to mask colors of the spare page that will keep you from ", "drawing. This mode should be called \"True stencil\".", true, - SDLK_F6|MOD_ALT}, // Alt + F6 + SDLK_F6|MOD_ALT, // Alt + F6 + 0xFFFF}, {55, "Mask menu", "Opens a menu where you can choose colors for the Mask mode.", "", true, - SDLK_F6|MOD_SHIFT|MOD_ALT}, // Shift + Alt + F6 + SDLK_F6|MOD_SHIFT|MOD_ALT, // Shift + Alt + F6 + 0xFFFF}, {56, "Grid mode", "Force the cursor to snap up grid points.", "", true, - SDLK_g}, // G + SDLK_g, // G + 0xFFFF}, {57, "Grid menu", "Open a menu where you can configure the grid used by Grid mode.", "", true, - SDLK_g|MOD_SHIFT}, // Shift + G + SDLK_g|MOD_SHIFT, // Shift + G + 0xFFFF}, {58, "Sieve mode", "Only draws pixels on certain positions matching with a sieve.", "", true, - SDLK_g|MOD_CTRL}, // Ctrl + G + SDLK_g|MOD_CTRL, // Ctrl + G + 0xFFFF}, {59, "Sieve menu", "Opens a menu where you can configure the sieve.", "", true, - SDLK_g|MOD_SHIFT|MOD_CTRL}, // Shift + Ctrl + G + SDLK_g|MOD_SHIFT|MOD_CTRL, // Shift + Ctrl + G + 0xFFFF}, {60, "Invert sieve", "Inverts the pattern defined in the Sieve menu.", "", true, - SDLK_g|MOD_CTRL|MOD_ALT}, // Ctrl + Alt + G + SDLK_g|MOD_CTRL|MOD_ALT, // Ctrl + Alt + G + 0xFFFF}, {61, "Colorize mode", "Allows you to colorize the pixels on which your brush is pasted.", "This permits you to make transparency effects.", true, - SDLK_F7}, // F7 + SDLK_F7, // F7 + 0xFFFF}, {62, "Colorize menu", "Opens a menu where you can give the opacity percentage for Colorize mode.", "", true, - SDLK_F7|MOD_SHIFT}, // Shift + F7 + SDLK_F7|MOD_SHIFT, // Shift + F7 + 0xFFFF}, {63, "Smooth mode", "Soften pixels on which your brush is pasted.", "", true, - SDLK_F8}, // F8 + SDLK_F8, // F8 + 0xFFFF}, {123, "Smooth menu", "Opens a menu where you can define the Smooth matrix.", "", true, - SDLK_F8|MOD_SHIFT}, // Shift + F8 + SDLK_F8|MOD_SHIFT, // Shift + F8 + 0xFFFF}, {64, "Smear mode", "Smears the pixels when you move your brush on the picture.", "", true, - SDLK_F8|MOD_ALT}, // Alt + F8 + SDLK_F8|MOD_ALT, // Alt + F8 + 0xFFFF}, {65, "Tiling mode", "Puts parts of the brush where you draw.", "", true, - SDLK_b|MOD_ALT}, // Alt + B + SDLK_b|MOD_ALT, // Alt + B + 0xFFFF}, {66, "Tiling menu", "Opens a menu where you can configure the origin of the tiling.", "", true, - SDLK_b|MOD_SHIFT|MOD_ALT}, // Shift + Alt + B + SDLK_b|MOD_SHIFT|MOD_ALT, // Shift + Alt + B + 0xFFFF}, {67, "Classical brush grabbing", "Allows you to pick a brush defined within a rectangle.", "", true, - SDLK_b}, // B + SDLK_b, // B + 0xFFFF}, {68, "\"Lasso\" brush grabbing", "Allows you to pick a brush defined within a freehand polygon.", "", true, - SDLK_b|MOD_CTRL}, // Ctrl + B + SDLK_b|MOD_CTRL, // Ctrl + B + 0xFFFF}, {69, "Get previous brush back", "Restore the last user-defined brush.", "", true, - SDLK_b|MOD_SHIFT}, // Shift + B + SDLK_b|MOD_SHIFT, // Shift + B + 0xFFFF}, {70, "Horizontal brush flipping", "Reverse brush horizontally.", "", true, - SDLK_x}, // X + SDLK_x, // X + 0xFFFF}, {71, "Vertical brush flipping", "Reverse brush vertically.", "", true, - SDLK_y}, // Y + SDLK_y, // Y + 0xFFFF}, {72, "90ø brush rotation", "Rotate the user-defined brush by 90ø (counter-clockwise).", "", true, - SDLK_z}, // Z (W en AZERTY) + SDLK_z, // Z (W en AZERTY) + 0xFFFF}, {73, "180ø brush rotation", "Rotate the user-defined brush by 180ø.", "", true, - SDLK_z|MOD_SHIFT}, // Shift + Z + SDLK_z|MOD_SHIFT, // Shift + Z + 0xFFFF}, {74, "Strech brush", "Allows you to resize the user-defined brush.", "", true, - SDLK_s}, // S + SDLK_s, // S + 0xFFFF}, {75, "Distort brush", "Allows you to distort the user-defined brush.", "", true, - SDLK_s|MOD_SHIFT}, // Shift + S + SDLK_s|MOD_SHIFT, // Shift + S + 0xFFFF}, {76, "Outline brush", "Outlines the user-defined brush with the fore color.", "", true, - SDLK_o}, // O + SDLK_o, // O + 0xFFFF}, {77, "Nibble brush", "Deletes the borders of the user-defined brush.", "This does the opposite of the Outline option.", true, - SDLK_o|MOD_SHIFT}, // Shift + O + SDLK_o|MOD_SHIFT, // Shift + O + 0xFFFF}, {78, "Get colors from brush", "Copy colors of the spare page that are used in the brush.", "", true, - SDLK_F11}, // F11 + SDLK_F11, // F11 + 0xFFFF}, {79, "Recolorize brush", "Recolorize pixels of the user-defined brush in order to get a brush which", "looks like the one grabbed in the spare page.", true, - SDLK_F12}, // F12 + SDLK_F12, // F12 + 0xFFFF}, {80, "Rotate by any angle", "Rotate the brush by an angle that you can define.", "", true, - SDLK_w}, // W (Z en AZERTY) + SDLK_w, // W (Z en AZERTY) + 0xFFFF}, {81, "Pipette", "Allows you to copy the color of a pixel in the picture into the foreground", "or background color.", true, - SDLK_BACKQUOTE}, // `~ (Touche sous le Esc - ² en AZERTY) + SDLK_BACKQUOTE, // `~ (Touche sous le Esc - ² en AZERTY) + 0xFFFF}, {82, "Swap foreground/background colors", "Invert foreground and background colors.", "", true, - SDLK_BACKQUOTE|MOD_SHIFT}, // Shift + `~ + SDLK_BACKQUOTE|MOD_SHIFT, // Shift + `~ + 0xFFFF}, {83, "Magnifier mode", "Allows you to zoom into the picture.", "", true, - SDLK_m}, // M (, ? sur AZERTY) + SDLK_m, // M (, ? sur AZERTY) + TOUCHE_MOUSEMIDDLE}, {84, "Zoom factor menu", "Opens a menu where you can choose a magnifying factor.", "", true, - SDLK_m|MOD_SHIFT}, // Shift + M + SDLK_m|MOD_SHIFT, // Shift + M + 0xFFFF}, {85, "Zoom in", "Increase magnifying factor.", "", true, - SDLK_KP_PLUS}, // Grey + + SDLK_KP_PLUS, // Grey + + TOUCHE_MOUSEWHEELUP}, {86, "Zoom out", "Decrease magnifying factor.", "", true, - SDLK_KP_MINUS}, // Grey - + SDLK_KP_MINUS, // Grey - + TOUCHE_MOUSEWHEELDOWN}, {87, "Brush effects menu", "Opens a menu which proposes different effects on the user-defined brush.", "", true, - SDLK_b|MOD_CTRL|MOD_ALT}, // Ctrl + Alt + B + SDLK_b|MOD_CTRL|MOD_ALT, // Ctrl + Alt + B + 0xFFFF}, {88, "Text", "Opens a menu which permits you to type in a character string and to choose a", "font, and then creates a new user-defined brush fitting to your choices.", true, - SDLK_t}, // T + SDLK_t, // T + 0xFFFF}, {89, "Screen resolution menu", "Opens a menu where you can choose the dimensions of the screen in which you", "want to draw among the numerous X and SVGA proposed modes.", true, - SDLK_RETURN}, // Enter + SDLK_RETURN, // Enter + 0xFFFF}, {90, "\"Safety\" resolution", "Set resolution to 320x200. This can be useful if you choosed a resolution", "that is not supported by your monitor and video card. Cannot be removed.", false, - SDLK_RETURN|MOD_SHIFT}, // Shift + Enter + SDLK_RETURN|MOD_SHIFT, // Shift + Enter + 0xFFFF}, {91, "Help and credits", "Opens a window where you can get information about the program.", "", true, - SDLK_F1}, // F1 + SDLK_F1, // F1 + 0xFFFF}, {92, "Statistics", "Displays miscellaneous more or less useful information.", "", true, - SDLK_F1|MOD_SHIFT}, // Shift + F1 + SDLK_F1|MOD_SHIFT, // Shift + F1 + 0xFFFF}, {93, "Jump to spare page", "Swap current page and spare page.", "", true, - SDLK_TAB}, // Tab + SDLK_TAB, // Tab + 0xFFFF}, {94, "Copy current page to spare page", "Copy current page to spare page.", "", true, - SDLK_TAB|MOD_SHIFT}, // Shift + Tab + SDLK_TAB|MOD_SHIFT, // Shift + Tab + 0xFFFF}, {95, "Save picture as...", "Opens a file-selector that allows you to save your picture with a new", "path-name.", true, - SDLK_F2}, // F2 + SDLK_F2, // F2 + 0xFFFF}, {96, "Save picture", "Saves your picture with the last name you gave it.", "", true, - SDLK_F2|MOD_SHIFT}, // Shift + F2 + SDLK_F2|MOD_SHIFT, // Shift + F2 + 0xFFFF}, {97, "Load picture", "Opens a file-selector that allows you to load a new picture.", "", true, - SDLK_F3}, // F3 + SDLK_F3, // F3 + 0xFFFF}, {98, "Re-load picture", "Re-load the current picture.", "This allows you to cancel modifications made since last saving.", true, - SDLK_F3|MOD_SHIFT}, // Shift + F3 + SDLK_F3|MOD_SHIFT, // Shift + F3 + 0xFFFF}, {99, "Save brush", "Opens a file-selector that allows you to save your current user-defined", "brush.", true, - SDLK_F2|MOD_CTRL}, // Ctrl + F2 + SDLK_F2|MOD_CTRL, // Ctrl + F2 + 0xFFFF}, {100, "Load brush", "Opens a file-selector that allows you to load a brush.", "", true, - SDLK_F3|MOD_CTRL}, // Ctrl + F3 + SDLK_F3|MOD_CTRL, // Ctrl + F3 + 0xFFFF}, {101, "Settings", "Opens a menu which permits you to set the dimension of your picture, and to", "modify some parameters of the program.", true, - SDLK_F10|MOD_SHIFT}, // Shift + F10 + SDLK_F10|MOD_SHIFT, // Shift + F10 + 0xFFFF}, {102, "Undo (Oops!)", "Cancel the last action which modified the picture. This has no effect after", "a jump to the spare page, loading a picture or modifying its size.", true, - SDLK_u}, // U + SDLK_u, // U + 0xFFFF}, {103, "Redo", "Redo the last undone action. This has no effect after a jump to the spare", "page, loading a picture or modifying its size.", true, - SDLK_u|MOD_SHIFT}, // Shift + U + SDLK_u|MOD_SHIFT, // Shift + U + 0xFFFF}, {133, "Kill", "Kills the current page. It actually removes the current page from the list", "of \"Undo\" pages.", true, - SDLK_DELETE|MOD_SHIFT}, // Shift + Suppr + SDLK_DELETE|MOD_SHIFT, // Shift + Suppr + 0xFFFF}, {104, "Clear page", "Clears the picture with the first color of the palette (usually black).", "", true, - SDLK_BACKSPACE}, // BackSpace + SDLK_BACKSPACE, // BackSpace + 0xFFFF}, {105, "Clear page with backcolor", "Clears the picture with the backcolor.", "", true, - SDLK_BACKSPACE|MOD_SHIFT}, // Shift + BackSpace + SDLK_BACKSPACE|MOD_SHIFT, // Shift + BackSpace + 0xFFFF}, {106, "Quit program", "Allows you to leave the program.", "If modifications were not saved, confirmation is asked.", false, - SDLK_q}, // Q (A en AZERTY) + SDLK_q, // Q (A en AZERTY) + 0xFFFF}, {107, "Palette menu", "Opens a menu which allows you to modify the current palette.", "", true, - SDLK_p}, // P + SDLK_p, // P + 0xFFFF}, {125, "Secondary palette menu", "Opens a menu which allows you to define color series and some tagged colors.", "", true, - SDLK_p|MOD_SHIFT}, // Shift + P + SDLK_p|MOD_SHIFT, // Shift + P + 0xFFFF}, {130, "Exclude colors menu", "Opens a menu which allows you to define the colors you don""t want to use in", "modes such as Smooth and Transparency, or when remapping a brush.", true, - SDLK_p|MOD_CTRL}, // Ctrl + P + SDLK_p|MOD_CTRL, // Ctrl + P + 0xFFFF}, {108, "Scroll palette to the left", "Scroll palette in the tool bar to the left, column by column.", "", true, - SDLK_PAGEUP}, // PgUp + SDLK_PAGEUP, // PgUp + 0xFFFF}, {109, "Scroll palette to the right", "Scroll palette in the tool bar to the right, column by column.", "", true, - SDLK_PAGEDOWN}, // PgDn + SDLK_PAGEDOWN, // PgDn + 0xFFFF}, {110, "Scroll palette to the left faster", "Scroll palette in the tool bar to the left, 8 columns by 8 columns.", "", true, - SDLK_PAGEUP|MOD_SHIFT}, // Shift + PgUp + SDLK_PAGEUP|MOD_SHIFT, // Shift + PgUp + 0xFFFF}, {111, "Scroll palette to the right faster", "Scroll palette in the tool bar to the right, 8 columns by 8 columns.", "", true, - SDLK_PAGEDOWN|MOD_SHIFT}, // Shift + PgDn + SDLK_PAGEDOWN|MOD_SHIFT, // Shift + PgDn + 0xFFFF}, {112, "Center brush attachment point", "Set the attachement of the user-defined brush to its center.", "", true, - SDLK_KP5|MOD_CTRL}, // Ctrl + 5 (pavé numérique) + SDLK_KP5|MOD_CTRL, // Ctrl + 5 (pavé numérique) + 0xFFFF}, {113, "Top-left brush attachment point", "Set the attachement of the user-defined brush to its top-left corner.", "", true, - SDLK_HOME|MOD_CTRL}, // Ctrl + 7 + SDLK_HOME|MOD_CTRL, // Ctrl + 7 + 0xFFFF}, {114, "Top-right brush attachment point", "Set the attachement of the user-defined brush to its top-right corner.", "", true, - SDLK_PAGEUP|MOD_CTRL}, // Ctrl + 9 + SDLK_PAGEUP|MOD_CTRL, // Ctrl + 9 + 0xFFFF}, {115, "Bottom-left brush attachment point", "Set the attachement of the user-defined brush to its bottom-left corner.", "", true, - SDLK_END|MOD_CTRL}, // Ctrl + 1 + SDLK_END|MOD_CTRL, // Ctrl + 1 + 0xFFFF}, {116, "Bottom-right brush attachment point", "Set the attachement of the user-defined brush to its bottom-right corner.", "", true, - SDLK_PAGEDOWN|MOD_CTRL}, // Ctrl + 3 + SDLK_PAGEDOWN|MOD_CTRL, // Ctrl + 3 + 0xFFFF}, {117, "Next foreground color", "Set the foreground color to the next in the palette.", "", true, - SDLK_RIGHTBRACKET}, // ] (0x en AZERTY) + SDLK_RIGHTBRACKET, // ] (0x en AZERTY) + 0xFFFF}, {118, "Previous foreground color", "Set the foreground color to the previous in the palette.", "", true, - SDLK_LEFTBRACKET}, // [ (^ en AZERTY) + SDLK_LEFTBRACKET, // [ (^ en AZERTY) + 0xFFFF}, {119, "Next background color", "Set the background color to the next in the palette.", "", true, - SDLK_RIGHTBRACKET|MOD_SHIFT}, // Shift + ] + SDLK_RIGHTBRACKET|MOD_SHIFT, // Shift + ] + 0xFFFF}, {120, "Previous background color", "Set the background color to the previous in the palette.", "", true, - SDLK_LEFTBRACKET|MOD_SHIFT}, // Shift + [ + SDLK_LEFTBRACKET|MOD_SHIFT, // Shift + [ + 0xFFFF}, {126, "Next user-defined forecolor", "Set the foreground color to the next in the user-defined color series.", "", true, - SDLK_EQUALS}, // "=+" + SDLK_EQUALS, // "=+" + 0xFFFF}, {127, "Previous user-defined forecolor", "Set the foreground color to the previous in the user-defined color series.", "", true, - SDLK_MINUS}, // "-_" (")ø" en AZERTY + SDLK_MINUS, // "-_" (")ø" en AZERTY + 0xFFFF}, {128, "Next user-defined backcolor", "Set the background color to the next in the user-defined color series.", "", true, - SDLK_EQUALS|MOD_SHIFT}, // Shift + "=+" + SDLK_EQUALS|MOD_SHIFT, // Shift + "=+" + 0xFFFF}, {129, "Previous user-defined backcolor", "Set the background color to the previous in the user-defined color series.", "", true, - SDLK_MINUS|MOD_SHIFT}, // Shift + "-_" (")ø" en AZERTY + SDLK_MINUS|MOD_SHIFT, // Shift + "-_" (")ø" en AZERTY + 0xFFFF}, {121, "Shrink paintbrush", "Decrease the width of the paintbrush if it is special circle or square.", "", true, - SDLK_COMMA}, // , < (;. en AZERTY) + SDLK_COMMA, // , < (;. en AZERTY) + 0xFFFF}, {122, "Enlarge paintbrush", "Increase the width of the paintbrush if it is special circle or square.", "", true, - SDLK_PERIOD}, // .> (:/ en AZERTY) + SDLK_PERIOD, // .> (:/ en AZERTY) + 0xFFFF}, }; diff --git a/init.c b/init.c index 4075d7f1..706fce41 100644 --- a/init.c +++ b/init.c @@ -886,8 +886,10 @@ void Initialisation_des_boutons(void) for (Indice_bouton=0;Indice_bouton>8) { case 0 : - Config_Touche[Ordonnancement[Indice2]&0xFF]=CFG_Infos_touche.Touche; + Config_Touche[Ordonnancement[Indice2]&0xFF][0]=CFG_Infos_touche.Touche; + Config_Touche[Ordonnancement[Indice2]&0xFF][1]=CFG_Infos_touche.Touche2; break; case 1 : - Bouton[Ordonnancement[Indice2]&0xFF].Raccourci_gauche = CFG_Infos_touche.Touche; + Bouton[Ordonnancement[Indice2]&0xFF].Raccourci_gauche[0] = CFG_Infos_touche.Touche; + Bouton[Ordonnancement[Indice2]&0xFF].Raccourci_gauche[1] = CFG_Infos_touche.Touche2; break; case 2 : - Bouton[Ordonnancement[Indice2]&0xFF].Raccourci_droite = CFG_Infos_touche.Touche; + Bouton[Ordonnancement[Indice2]&0xFF].Raccourci_droite[0] = CFG_Infos_touche.Touche; + Bouton[Ordonnancement[Indice2]&0xFF].Raccourci_droite[1] = CFG_Infos_touche.Touche2; break; } } @@ -2220,11 +2241,19 @@ int Sauver_CFG(void) CFG_Infos_touche.Numero = ConfigTouche[Indice].Numero; switch(Ordonnancement[Indice]>>8) { - case 0 : CFG_Infos_touche.Touche=Config_Touche[Ordonnancement[Indice]&0xFF]; break; - case 1 : CFG_Infos_touche.Touche=Bouton[Ordonnancement[Indice]&0xFF].Raccourci_gauche; break; - case 2 : CFG_Infos_touche.Touche=Bouton[Ordonnancement[Indice]&0xFF].Raccourci_droite; break; + case 0 : + CFG_Infos_touche.Touche =Config_Touche[Ordonnancement[Indice]&0xFF][0]; + CFG_Infos_touche.Touche2=Config_Touche[Ordonnancement[Indice]&0xFF][1]; + break; + case 1 : + CFG_Infos_touche.Touche =Bouton[Ordonnancement[Indice]&0xFF].Raccourci_gauche[0]; + CFG_Infos_touche.Touche2=Bouton[Ordonnancement[Indice]&0xFF].Raccourci_gauche[1]; + break; + case 2 : + CFG_Infos_touche.Touche =Bouton[Ordonnancement[Indice]&0xFF].Raccourci_droite[0]; + CFG_Infos_touche.Touche2=Bouton[Ordonnancement[Indice]&0xFF].Raccourci_droite[1]; + break; } - CFG_Infos_touche.Touche2=0x00FF; if (!write_word_le(Handle, CFG_Infos_touche.Numero) || !write_word_le(Handle, CFG_Infos_touche.Touche) || !write_word_le(Handle, CFG_Infos_touche.Touche2) ) @@ -2399,13 +2428,16 @@ void Config_par_defaut(void) switch(Ordonnancement[Indice]>>8) { case 0 : - Config_Touche[Ordonnancement[Indice]&0xFF]=ConfigTouche[Indice].Touche; + Config_Touche[Ordonnancement[Indice]&0xFF][0]=ConfigTouche[Indice].Touche; + Config_Touche[Ordonnancement[Indice]&0xFF][1]=ConfigTouche[Indice].Touche2; break; case 1 : - Bouton[Ordonnancement[Indice]&0xFF].Raccourci_gauche = ConfigTouche[Indice].Touche; + Bouton[Ordonnancement[Indice]&0xFF].Raccourci_gauche[0] = ConfigTouche[Indice].Touche; + Bouton[Ordonnancement[Indice]&0xFF].Raccourci_gauche[1] = ConfigTouche[Indice].Touche2; break; case 2 : - Bouton[Ordonnancement[Indice]&0xFF].Raccourci_droite = ConfigTouche[Indice].Touche; + Bouton[Ordonnancement[Indice]&0xFF].Raccourci_droite[0] = ConfigTouche[Indice].Touche; + Bouton[Ordonnancement[Indice]&0xFF].Raccourci_droite[1] = ConfigTouche[Indice].Touche2; break; } } diff --git a/input.c b/input.c index 35cdcb51..ce2d9b91 100644 --- a/input.c +++ b/input.c @@ -52,6 +52,30 @@ short Button_alt=-1; // Button number that serves as a "alt" modifier short Button_clic_gauche=0; // Button number that serves as left click short Button_clic_droit=0; // Button number that serves as right-click +int Est_Raccourci(word Touche, word Fonction) +{ + if (Fonction & 0x100) + { + if (Bouton[Fonction&0xFF].Raccourci_gauche[0]==Touche) + return 1; + if (Bouton[Fonction&0xFF].Raccourci_gauche[1]==Touche) + return 1; + return 0; + } + if (Fonction & 0x200) + { + if (Bouton[Fonction&0xFF].Raccourci_droite[0]==Touche) + return 1; + if (Bouton[Fonction&0xFF].Raccourci_droite[1]==Touche) + return 1; + return 0; + } + if(Touche == Config_Touche[Fonction][0]) + return 1; + if(Touche == Config_Touche[Fonction][1]) + return 1; + return 0; +} // Called each time there is a cursor move, either triggered by mouse or keyboard shortcuts int Move_cursor_with_constraints() @@ -210,32 +234,32 @@ int Handle_Key_Press(SDL_KeyboardEvent event) Touche = Conversion_Touche(event.keysym); Touche_ANSI = Conversion_ANSI(event.keysym); - if(Touche == Config_Touche[SPECIAL_MOUSE_UP]) + if(Est_Raccourci(Touche,SPECIAL_MOUSE_UP)) { Directional_up=1; return 0; } - else if(Touche == Config_Touche[SPECIAL_MOUSE_DOWN]) + else if(Est_Raccourci(Touche,SPECIAL_MOUSE_DOWN)) { Directional_down=1; return 0; } - else if(Touche == Config_Touche[SPECIAL_MOUSE_LEFT]) + else if(Est_Raccourci(Touche,SPECIAL_MOUSE_LEFT)) { Directional_left=1; return 0; } - else if(Touche == Config_Touche[SPECIAL_MOUSE_RIGHT]) + else if(Est_Raccourci(Touche,SPECIAL_MOUSE_RIGHT)) { Directional_right=1; return 0; } - else if(Touche == Config_Touche[SPECIAL_CLICK_LEFT]) + else if(Est_Raccourci(Touche,SPECIAL_CLICK_LEFT)) { INPUT_Nouveau_Mouse_K=1; return Move_cursor_with_constraints(); } - else if(Touche == Config_Touche[SPECIAL_CLICK_RIGHT]) + else if(Est_Raccourci(Touche,SPECIAL_CLICK_RIGHT)) { INPUT_Nouveau_Mouse_K=2; return Move_cursor_with_constraints(); @@ -252,16 +276,16 @@ int Handle_Key_Press(SDL_KeyboardEvent event) //supportant le changement de couleur ou de taille de pinceau. if( - (Touche != Config_Touche[SPECIAL_NEXT_FORECOLOR]) && - (Touche != Config_Touche[SPECIAL_PREVIOUS_FORECOLOR]) && - (Touche != Config_Touche[SPECIAL_NEXT_BACKCOLOR]) && - (Touche != Config_Touche[SPECIAL_PREVIOUS_BACKCOLOR]) && - (Touche != Config_Touche[SPECIAL_RETRECIR_PINCEAU]) && - (Touche != Config_Touche[SPECIAL_GROSSIR_PINCEAU]) && - (Touche != Config_Touche[SPECIAL_NEXT_USER_FORECOLOR]) && - (Touche != Config_Touche[SPECIAL_PREVIOUS_USER_FORECOLOR]) && - (Touche != Config_Touche[SPECIAL_NEXT_USER_BACKCOLOR]) && - (Touche != Config_Touche[SPECIAL_PREVIOUS_USER_BACKCOLOR]) + (!Est_Raccourci(Touche,SPECIAL_NEXT_FORECOLOR)) && + (!Est_Raccourci(Touche,SPECIAL_PREVIOUS_FORECOLOR)) && + (!Est_Raccourci(Touche,SPECIAL_NEXT_BACKCOLOR)) && + (!Est_Raccourci(Touche,SPECIAL_PREVIOUS_BACKCOLOR)) && + (!Est_Raccourci(Touche,SPECIAL_RETRECIR_PINCEAU)) && + (!Est_Raccourci(Touche,SPECIAL_GROSSIR_PINCEAU)) && + (!Est_Raccourci(Touche,SPECIAL_NEXT_USER_FORECOLOR)) && + (!Est_Raccourci(Touche,SPECIAL_PREVIOUS_USER_FORECOLOR)) && + (!Est_Raccourci(Touche,SPECIAL_NEXT_USER_BACKCOLOR)) && + (!Est_Raccourci(Touche,SPECIAL_PREVIOUS_USER_BACKCOLOR)) ) { Touche=0; @@ -276,28 +300,34 @@ int Handle_Key_Press(SDL_KeyboardEvent event) int Relache_controle(int CodeTouche, int Modifieur) { - if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_UP]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_UP]&Modifieur)) + if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_UP][0]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_UP][0]&Modifieur) || + CodeTouche == (Config_Touche[SPECIAL_MOUSE_UP][1]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_UP][1]&Modifieur)) { Directional_up=0; } - if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_DOWN]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_DOWN]&Modifieur)) + if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_DOWN][0]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_DOWN][0]&Modifieur) || + CodeTouche == (Config_Touche[SPECIAL_MOUSE_DOWN][1]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_DOWN][1]&Modifieur)) { Directional_down=0; } - if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_LEFT]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_LEFT]&Modifieur)) + if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_LEFT][0]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_LEFT][0]&Modifieur) || + CodeTouche == (Config_Touche[SPECIAL_MOUSE_LEFT][1]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_LEFT][1]&Modifieur)) { Directional_left=0; } - if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_RIGHT]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_RIGHT]&Modifieur)) + if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_RIGHT][0]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_RIGHT][0]&Modifieur) || + CodeTouche == (Config_Touche[SPECIAL_MOUSE_RIGHT][1]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_RIGHT][1]&Modifieur)) { Directional_right=0; } - if(CodeTouche == (Config_Touche[SPECIAL_CLICK_LEFT]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_LEFT]&Modifieur)) + if(CodeTouche == (Config_Touche[SPECIAL_CLICK_LEFT][0]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_LEFT][0]&Modifieur) || + CodeTouche == (Config_Touche[SPECIAL_CLICK_LEFT][1]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_LEFT][1]&Modifieur)) { INPUT_Nouveau_Mouse_K &= ~1; return Move_cursor_with_constraints(); } - if(CodeTouche == (Config_Touche[SPECIAL_CLICK_RIGHT]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_RIGHT]&Modifieur)) + if(CodeTouche == (Config_Touche[SPECIAL_CLICK_RIGHT][0]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_RIGHT][0]&Modifieur) || + CodeTouche == (Config_Touche[SPECIAL_CLICK_RIGHT][1]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_RIGHT][1]&Modifieur)) { INPUT_Nouveau_Mouse_K &= ~2; return Move_cursor_with_constraints(); @@ -605,7 +635,7 @@ int Get_input(void) break; default: - DEBUG("Unhandled SDL event number : ",event.type); + // DEBUG("Unhandled SDL event number : ",event.type); break; } } diff --git a/input.h b/input.h index e9c6e3d1..2a91401b 100644 --- a/input.h +++ b/input.h @@ -21,3 +21,4 @@ void Gere_Evenement_SDL(SDL_Event * event); int Get_input(void); +int Est_Raccourci(word Touche, word Fonction); diff --git a/moteur.c b/moteur.c index 99f715be..251a9d23 100644 --- a/moteur.c +++ b/moteur.c @@ -535,7 +535,7 @@ void Gestion_principale(void) // Gestion des touches if (Touche) { - for (Indice_Touche=0;(Indice_ToucheSPECIAL_CLICK_RIGHT) @@ -901,13 +901,13 @@ void Gestion_principale(void) Bouton_Touche=-1; for (Indice_bouton=0;Indice_bouton