From 860648b19006bb905472934d095af3d8566f9ebc Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Mon, 4 Apr 2011 22:30:02 +0000 Subject: [PATCH] Multi-shorcuts option now works. Default OFF, it will avoid situations where user mistakenly sets the same key for multiple actions. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1769 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/buttons.c | 9 ++++++-- src/help.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/help.h | 4 ++++ src/helpfile.h | 10 +++++++++ src/main.c | 5 +++++ 5 files changed, 87 insertions(+), 2 deletions(-) diff --git a/src/buttons.c b/src/buttons.c index ea73b781..0f22a734 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}, - {"Multi shortcuts",1,&(selected_config.Allow_multi_shortcuts),0,1,0,Lookup_YesNo}, + {"",0,NULL,0,0,0,NULL}, {"",0,NULL,0,0,0,NULL}, {" --- Input ---",0,NULL,0,0,0,NULL}, @@ -966,7 +966,7 @@ void Button_Settings(void) {"Auto discontinuous:",1,&(selected_config.Auto_discontinuous),0,1,0,Lookup_YesNo}, {"Auto count colors:",1,&(selected_config.Auto_nb_used),0,1,0,Lookup_YesNo}, {"Right click colorpick:",1,&(selected_config.Right_click_colorpick),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}, {" --- File selector ---",0,NULL,0,0,0,NULL}, @@ -1152,6 +1152,11 @@ void Button_Settings(void) Spare_fileselector_position=0; Spare_fileselector_offset=0; } + if(Config.Allow_multi_shortcuts && !selected_config.Allow_multi_shortcuts) + { + // User just disabled multi shortcuts: make them unique now. + Remove_duplicate_shortcuts(); + } // Copy all Config=selected_config; diff --git a/src/help.c b/src/help.c index 388eb34d..34eec25c 100644 --- a/src/help.c +++ b/src/help.c @@ -228,6 +228,32 @@ void Window_set_shortcut(int action_id) shortcut_ptr[0]=backup_shortcut[0]; shortcut_ptr[1]=backup_shortcut[1]; case 2: // OK + // Replace twice by single + if (shortcut_ptr[0]==shortcut_ptr[1]) + shortcut_ptr[1]=0; + // Remove all other shortcuts that use same keys + if (!Config.Allow_multi_shortcuts) + { + int n; + for (n=0; n<2; n++) + { + if (shortcut_ptr[n]!=0) + { + int i; + for(i=0; i