diff --git a/share/grafx2/gfx2def.ini b/share/grafx2/gfx2def.ini index 36f045fa..3d9f6728 100644 --- a/share/grafx2/gfx2def.ini +++ b/share/grafx2/gfx2def.ini @@ -380,4 +380,11 @@ ; Scripts_directory = + ; When this setting is disabled, and you create a shortcut with a key that + ; is already associated to another shortcut, Grafx2 will unset the latter. + ; If you enable this mode, Grafx2 will not make such check, so you can design + ; shortcuts that trigger several actions at once. + ; + Allow_multi_shortcuts = no; (Default no) + ; end of configuration diff --git a/src/buttons.c b/src/buttons.c index d53a8b60..ea73b781 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -942,7 +942,7 @@ void Button_Settings(void) {"Safety colors:",1,&(selected_config.Safety_colors),0,1,0,Lookup_YesNo}, {"Grid XOR color:",1,&(selected_config.Grid_XOR_color),0,255,3,NULL}, {"Sync views:",1,&(selected_config.Sync_views),0,1,0,Lookup_YesNo}, - {"",0,NULL,0,0,0,NULL}, + {"Multi shortcuts",1,&(selected_config.Allow_multi_shortcuts),0,1,0,Lookup_YesNo}, {"",0,NULL,0,0,0,NULL}, {" --- Input ---",0,NULL,0,0,0,NULL}, diff --git a/src/readini.c b/src/readini.c index 225eabd6..21827b6c 100644 --- a/src/readini.c +++ b/src/readini.c @@ -948,6 +948,13 @@ int Load_INI(T_Config * conf) Append_path(conf->Scripts_directory, "scripts", NULL); } + conf->Allow_multi_shortcuts=0; + // Optional, allow or disallow multiple shortcuts on same key (>=2.3) + if (!Load_INI_get_values (file,buffer,"Allow_multi_shortcuts",1,values)) + { + conf->Allow_multi_shortcuts=(values[0]!=0); + } + // Insert new values here fclose(file); diff --git a/src/saveini.c b/src/saveini.c index fab3cc12..b691965f 100644 --- a/src/saveini.c +++ b/src/saveini.c @@ -702,6 +702,10 @@ int Save_INI(T_Config * conf) if ((return_code=Save_INI_set_strings (old_file,new_file,buffer,"Scripts_directory",conf->Scripts_directory))) goto Erreur_Retour; + values[0]=(conf->Allow_multi_shortcuts); + if ((return_code=Save_INI_set_values (old_file,new_file,buffer,"Allow_multi_shortcuts",1,values,1))) + goto Erreur_Retour; + // Insert new values here Save_INI_flush(old_file,new_file,buffer); diff --git a/src/struct.h b/src/struct.h index f61f820e..75e610f2 100644 --- a/src/struct.h +++ b/src/struct.h @@ -369,6 +369,7 @@ typedef struct byte Stylus_mode; ///< Boolean, true to tweak some tools (eg:Curve) for single-button stylus. word Swap_buttons; ///< Sets which key swaps mouse buttons : 0=none, or MOD_CTRL, or MOD_ALT. char Scripts_directory[MAX_PATH_CHARACTERS];///< Full pathname of directory for Lua scripts + byte Allow_multi_shortcuts; ///< Boolean, true if the same key combination can trigger multiple shortcuts. } T_Config; // Structures utilisées pour les descriptions de pages et de liste de pages.