diff --git a/buttons.c b/buttons.c index 1483c785..a06bb8a1 100644 --- a/buttons.c +++ b/buttons.c @@ -287,7 +287,7 @@ void Button_Select_forecolor(void) if (color == Fore_color) { // Check if it's a double-click - if (time_click - time_previous < 500) + if (time_click - time_previous < Config.Double_click_speed) { // Open palette window Button_Palette(); @@ -3814,7 +3814,7 @@ void Effects_off(void) void Transparency_set(byte amount) { - const int doubleclick_delay = 500; + const int doubleclick_delay = Config.Double_key_speed; static long time_click = 0; long time_previous; diff --git a/gfx2.cfg b/gfx2.cfg index 43f249a8..20ab6b67 100644 Binary files a/gfx2.cfg and b/gfx2.cfg differ diff --git a/gfx2def.ini b/gfx2def.ini index 757c4c38..d03c6c53 100644 --- a/gfx2def.ini +++ b/gfx2def.ini @@ -312,4 +312,15 @@ ; OS isn't able to do it by itself. (ie: Windows) Window_position = 9999,9999; (Default 9999,9999 which means: NA) + ; This is the time (in milliseconds) between two clicks for Grafx2 to + ; recognize a double-click. Double-click is used mostly in the palette + ; area of the menu: double-click a color to open the palette. + Double_click_speed = 500; (Default 500) + + ; When you press two digit keys in rapid succession (ex: 3 8), Grafx2 + ; sets transparency to 38% (instead of 30% then 80%). This setting + ; allows you to set the maximum delay between two keypresses for + ; GrafX2 to recognize them as a combo. + Double_key_speed = 500; (Default 500) + ; end of configuration diff --git a/hotkeys.c b/hotkeys.c index c6a12d5e..2d232019 100644 --- a/hotkeys.c +++ b/hotkeys.c @@ -1116,7 +1116,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { "opacity at 20%.", "", true, - SDLK_1, // 1 + SDLK_2, // 2 0}, {137, "Transparency 30%", @@ -1124,7 +1124,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { "opacity at 30%.", "", true, - SDLK_1, // 1 + SDLK_3, // 3 0}, {138, "Transparency 40%", @@ -1132,7 +1132,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { "opacity at 40%.", "", true, - SDLK_1, // 1 + SDLK_4, // 4 0}, {139, "Transparency 50%", @@ -1140,7 +1140,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { "opacity at 50%.", "", true, - SDLK_1, // 1 + SDLK_5, // 5 0}, {140, "Transparency 60%", @@ -1148,7 +1148,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { "opacity at 60%.", "", true, - SDLK_1, // 1 + SDLK_6, // 6 0}, {141, "Transparency 70%", @@ -1156,7 +1156,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { "opacity at 70%.", "", true, - SDLK_1, // 1 + SDLK_7, // 7 0}, {142, "Transparency 80%", @@ -1164,7 +1164,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { "opacity at 80%.", "", true, - SDLK_1, // 1 + SDLK_8, // 8 0}, {143, "Transparency 90%", @@ -1172,7 +1172,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { "opacity at 90%.", "", true, - SDLK_1, // 1 + SDLK_9, // 9 0}, {144, "Transparency 0%", @@ -1180,7 +1180,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { "opacity at 0%.", "", true, - SDLK_1, // 1 + SDLK_0, // 0 0}, }; diff --git a/readini.c b/readini.c index 7c3b7cb6..26c5fdb2 100644 --- a/readini.c +++ b/readini.c @@ -788,7 +788,7 @@ int Load_INI(T_Config * conf) break; } conf->Palette_vertical=0; - // Optionnel, vertical palette option (>98.0%) + // Optional, vertical palette option (>98.0%) if (!Load_INI_get_values (file,buffer,"Palette_vertical",1,values)) { if ((values[0]<0) || (values[0]>1)) @@ -804,6 +804,22 @@ int Load_INI(T_Config * conf) conf->Window_pos_x = values[0]; conf->Window_pos_y = values[1]; } + + conf->Double_click_speed=500; + // Optional, speed of double-click (>98.0%) + if (!Load_INI_get_values (file,buffer,"Double_click_speed",1,values)) + { + if ((values[0]>0) || (values[0]<=2000)) + conf->Double_click_speed=values[0]; + } + + conf->Double_key_speed=500; + // Optional, speed of double-keypress (>98.0%) + if (!Load_INI_get_values (file,buffer,"Double_key_speed",1,values)) + { + if ((values[0]>0) || (values[0]<=2000)) + conf->Double_key_speed=values[0]; + } fclose(file); diff --git a/saveini.c b/saveini.c index ac8e53d3..975c9807 100644 --- a/saveini.c +++ b/saveini.c @@ -635,6 +635,13 @@ int Save_INI(T_Config * conf) if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Window_position",2,values,0))) goto Erreur_Retour; + values[0]=(conf->Double_click_speed); + if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Double_click_speed",1,values,0))) + goto Erreur_Retour; + + values[0]=(conf->Double_key_speed); + if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Double_key_speed",1,values,0))) + goto Erreur_Retour; Save_INI_flush(Ancien_fichier,Nouveau_fichier,buffer); diff --git a/struct.h b/struct.h index 81f26b0d..ee1cf40d 100644 --- a/struct.h +++ b/struct.h @@ -269,6 +269,8 @@ typedef struct char Bookmark_label[NB_BOOKMARKS][8+1];///< Bookmarked directories in fileselectors: This is the displayed name. int Window_pos_x; ///< Last window x position (9999 if unsupportd/irrelevant for the platform) int Window_pos_y; ///< Last window y position (9999 if unsupportd/irrelevant for the platform) + word Double_click_speed; ///< Maximum delay for double-click, in ms. + word Double_key_speed; ///< Maximum delay for double-keypress, in ms. } T_Config; // Structures utilisées pour les descriptions de pages et de liste de pages.