From b0b11291d2c9371dddbe42c232e6469f252b524c Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Wed, 4 Jan 2017 20:01:47 +0000 Subject: [PATCH] Rectangular selection Add toggle Rectangular Selection to Select menu. Shortcut key is Alt-R. Also on Collection widow. Removed option from Preferences page as it is redundant --- doc/docbook/GuideMainWindowMenus.xml | 54 +++++++++++++++++-- doc/docbook/GuideOptionsBehavior.xml | 8 --- .../GuideReferenceKeyboardShortcuts.xml | 37 +++++++++++++ src/collect-table.c | 9 ++++ src/collect.c | 6 +++ src/layout_util.c | 9 ++++ src/preferences.c | 5 -- 7 files changed, 112 insertions(+), 16 deletions(-) diff --git a/doc/docbook/GuideMainWindowMenus.xml b/doc/docbook/GuideMainWindowMenus.xml index 8c13af83..bc1fab53 100644 --- a/doc/docbook/GuideMainWindowMenus.xml +++ b/doc/docbook/GuideMainWindowMenus.xml @@ -81,7 +81,14 @@ - Find duplicates… + + + + D + + + Find duplicates... + Opens a new Find Duplicates window. @@ -253,7 +260,7 @@ - 4 + Backspace Previous Image @@ -330,6 +337,12 @@ + + + Ctrl + A + + Select all @@ -340,6 +353,13 @@ + + + Ctrl + Shift + A + + Select none @@ -350,13 +370,36 @@ - Invert Selection + + + Ctrl + Shift + I + + + Invert selection Inverts current selection + + + + + + Alt + R + + + Rectangular selection + + + + Toggles rectangular selection mode for icons + + @@ -370,6 +413,11 @@ + + + M + + Show marks diff --git a/doc/docbook/GuideOptionsBehavior.xml b/doc/docbook/GuideOptionsBehavior.xml index 5b12fb74..c98bd5bc 100644 --- a/doc/docbook/GuideOptionsBehavior.xml +++ b/doc/docbook/GuideOptionsBehavior.xml @@ -97,14 +97,6 @@
Behavior - - - Rectangular selection in icon view - - - Enable this to change the selection method used when selecting multiple items in an icon view. - - Descend folders in tree view diff --git a/doc/docbook/GuideReferenceKeyboardShortcuts.xml b/doc/docbook/GuideReferenceKeyboardShortcuts.xml index da293919..d36c1978 100644 --- a/doc/docbook/GuideReferenceKeyboardShortcuts.xml +++ b/doc/docbook/GuideReferenceKeyboardShortcuts.xml @@ -514,6 +514,33 @@ Unselect all images. + + + + Ctrl + SHIFT + + I + + + + Invert selection. + + + + + Alt + + R + + + + Toggle rectangular selection mode in icon view. + + + + M + + + Show marks. + @@ -677,6 +704,16 @@ Select multiple images. + + + + Alt + + R + + + + Toggle rectangular selection mode. + Space diff --git a/src/collect-table.c b/src/collect-table.c index 26956401..ed61d5aa 100644 --- a/src/collect-table.c +++ b/src/collect-table.c @@ -808,6 +808,13 @@ static void collection_table_popup_select_invert_cb(GtkWidget *widget, gpointer ct->prev_selection= ct->click_info; } +static void collection_table_popup_rectangular_selection_cb(GtkWidget *widget, gpointer data) +{ + CollectTable *ct = data; + + options->collections.rectangular_selection = !(options->collections.rectangular_selection); +} + static void collection_table_popup_remove_cb(GtkWidget *widget, gpointer data) { CollectTable *ct = data; @@ -924,6 +931,8 @@ static GtkWidget *collection_table_popup_menu(CollectTable *ct, gboolean over_ic G_CALLBACK(collection_table_popup_unselectall_cb), ct); menu_item_add(submenu, _("Invert selection"), G_CALLBACK(collection_table_popup_select_invert_cb), ct); + menu_item_add_check(submenu, _("Rectangular selection"), (options->collections.rectangular_selection != FALSE), + G_CALLBACK(collection_table_popup_rectangular_selection_cb), ct); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); menu_item_add_divider(menu); diff --git a/src/collect.c b/src/collect.c index 12bee14d..2287d123 100644 --- a/src/collect.c +++ b/src/collect.c @@ -908,6 +908,12 @@ static gboolean collection_window_keypress(GtkWidget *widget, GdkEventKey *event collection_set_sort_method(cw->cd, SORT_PATH); } break; + case 'R': case 'r': + if (event->state & GDK_MOD1_MASK) + { + options->collections.rectangular_selection = !(options->collections.rectangular_selection); + } + break; case GDK_KEY_Delete: case GDK_KEY_KP_Delete: list = g_list_copy(cw->table->selection); if (list) diff --git a/src/layout_util.c b/src/layout_util.c index 7e883d7e..bdac533f 100644 --- a/src/layout_util.c +++ b/src/layout_util.c @@ -705,6 +705,13 @@ static void layout_menu_histogram_cb(GtkToggleAction *action, gpointer data) } } +static void layout_menu_rectangular_selection_cb(GtkToggleAction *action, gpointer data) +{ + LayoutWindow *lw = data; + + options->collections.rectangular_selection = gtk_toggle_action_get_active(action); +} + static void layout_menu_histogram_toggle_channel_cb(GtkAction *action, gpointer data) { LayoutWindow *lw = data; @@ -1581,6 +1588,7 @@ static GtkToggleActionEntry menu_toggle_entries[] = { { "Grayscale", NULL, N_("Toggle _grayscale"), "G", N_("Toggle grayscale"), CB(layout_menu_alter_desaturate_cb), FALSE}, { "ImageOverlay", NULL, N_("Image _Overlay"), NULL, N_("Image Overlay"), CB(layout_menu_overlay_cb), FALSE }, { "ImageHistogram", NULL, N_("_Show Histogram"), NULL, N_("Show Histogram"), CB(layout_menu_histogram_cb), FALSE }, + { "RectangularSelection", NULL, N_("Rectangular Selection"), "R", N_("Rectangular Selection"), CB(layout_menu_rectangular_selection_cb), FALSE }, }; static GtkRadioActionEntry menu_radio_entries[] = { @@ -1676,6 +1684,7 @@ static const gchar *menu_ui_description = " " " " " " +" " " " " " " " diff --git a/src/preferences.c b/src/preferences.c index 4f558ab7..27773a0d 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -276,8 +276,6 @@ static void config_window_apply(void) options->file_ops.enable_in_place_rename = c_options->file_ops.enable_in_place_rename; - options->collections.rectangular_selection = c_options->collections.rectangular_selection; - options->image.tile_cache_max = c_options->image.tile_cache_max; options->image.image_cache_max = c_options->image.image_cache_max; @@ -2147,9 +2145,6 @@ static void config_tab_behavior(GtkWidget *notebook) group = pref_group_new(vbox, FALSE, _("Behavior"), GTK_ORIENTATION_VERTICAL); - pref_checkbox_new_int(group, _("Rectangular selection in icon view"), - options->collections.rectangular_selection, &c_options->collections.rectangular_selection); - pref_checkbox_new_int(group, _("Descend folders in tree view"), options->tree_descend_subdirs, &c_options->tree_descend_subdirs); -- 2.20.1