Mercurial > hg > forks > geeqie
changeset 2694:4126aaeef776
Context-sensitve help
Implement context-sensitive help key for the following windows:
exif
collection
duplicates
image
pan view
search
Replace all instances of the constant GDK_KEY_F1 with a call to a
function which gets the key code set by the user in Preferences/Keyboard
for Help
author | Colin Clark <colin.clark@cclark.uk> |
---|---|
date | Mon, 01 Jan 2018 19:12:33 +0000 |
parents | 8ba86a100c53 |
children | 226c02528774 |
files | doc/docbook/GuideOtherWindowsPanView.xml src/advanced_exif.c src/collect.c src/dupe.c src/img-view.c src/layout_util.c src/layout_util.h src/pan-view/pan-view.c src/search.c web/help/GuideOtherWindowsPanView.html |
diffstat | 10 files changed, 78 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/docbook/GuideOtherWindowsPanView.xml Mon Jan 01 13:40:30 2018 +0100 +++ b/doc/docbook/GuideOtherWindowsPanView.xml Mon Jan 01 19:12:33 2018 +0000 @@ -22,6 +22,11 @@ You can pan the view as you pan an image in normal view mode, using left mouse button and drag. </para> <para>A primary mouse button click on any image will display informations about the image. Secondary mouse button will show a context menu.</para> + <para> + The + <link linkend="GuideReferenceKeyboardShortcuts" endterm="titleGuideReferenceKeyboardShortcuts" /> + available are listed in the Reference section. + </para> <note> <para>Pan view recursively visits each folder under the specified folder. This can consume considerable computer resources.</para> </note> @@ -209,4 +214,4 @@ </varlistentry> </variablelist> </section> -</section> +</section>
--- a/src/advanced_exif.c Mon Jan 01 13:40:30 2018 +0100 +++ b/src/advanced_exif.c Mon Jan 01 19:12:33 2018 +0000 @@ -26,6 +26,7 @@ #include "metadata.h" #include "filedata.h" #include "history_list.h" +#include "layout_util.h" #include "misc.h" #include "ui_misc.h" #include "window.h" @@ -360,6 +361,11 @@ break; } } // if (event->state & GDK_CONTROL... + if (!stop_signal && is_help_key(event)) + { + help_window_show("GuideOtherWindowsExif.html"); + stop_signal = TRUE; + } return stop_signal; } // static gboolean advanced_exif_...
--- a/src/collect.c Mon Jan 01 13:40:30 2018 +0100 +++ b/src/collect.c Mon Jan 01 19:12:33 2018 +0000 @@ -30,6 +30,7 @@ #include "img-view.h" #include "layout.h" #include "layout_image.h" +#include "layout_util.h" #include "misc.h" #include "pixbuf_util.h" #include "print.h" @@ -992,14 +993,17 @@ collection_remove_by_info(cw->cd, collection_table_get_focus_info(cw->table)); } break; - case GDK_KEY_F1: - help_window_show("GuideReferenceKeyboardShortcuts.html#CollectionsKeyboardShortcuts"); - break; default: stop_signal = FALSE; break; } } + if (!stop_signal && is_help_key(event)) + { + help_window_show("GuideCollections.html"); + stop_signal = TRUE; + } + return stop_signal; }
--- a/src/dupe.c Mon Jan 01 13:40:30 2018 +0100 +++ b/src/dupe.c Mon Jan 01 19:12:33 2018 +0000 @@ -32,6 +32,7 @@ #include "img-view.h" #include "layout.h" #include "layout_image.h" +#include "layout_util.h" #include "md5-util.h" #include "menu.h" #include "misc.h" @@ -3165,14 +3166,16 @@ dupe_popup_menu_pos_cb, listview, 0, GDK_CURRENT_TIME); } break; - case GDK_KEY_F1: - help_window_show("GuideReferenceKeyboardShortcuts.html#DuplicatesKeyboardShortcuts"); - break; default: stop_signal = FALSE; break; } } + if (!stop_signal && is_help_key(event)) + { + help_window_show("GuideImageSearchFindingDuplicates.html"); + stop_signal = TRUE; + } return stop_signal; }
--- a/src/img-view.c Mon Jan 01 13:40:30 2018 +0100 +++ b/src/img-view.c Mon Jan 01 19:12:33 2018 +0000 @@ -32,6 +32,7 @@ #include "image-overlay.h" #include "layout.h" #include "layout_image.h" +#include "layout_util.h" #include "menu.h" #include "misc.h" #include "pixbuf_util.h" @@ -563,6 +564,11 @@ break; } } + if (!stop_signal && is_help_key(event)) + { + help_window_show("GuideOtherWindowsImageWindow.html"); + stop_signal = TRUE; + } return stop_signal; }
--- a/src/layout_util.c Mon Jan 01 13:40:30 2018 +0100 +++ b/src/layout_util.c Mon Jan 01 19:12:33 2018 +0000 @@ -3005,6 +3005,34 @@ // layout_menu_edit_update(lw); } +/** + * @brief Checks if event key is mapped to Help + * @param event + * @returns + * + * Used to check if the user has re-mapped the Help key + * in Preferences/Keyboard + * + * Note: help_key.accel_mods and event->state + * differ in the higher bits + */ +gboolean is_help_key(GdkEventKey *event) +{ + GtkAccelKey help_key; + gboolean ret = FALSE; + guint mask = GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK; + + if (gtk_accel_map_lookup_entry("<Actions>/MenuActions/HelpContents", &help_key)) + { + if (help_key.accel_key == event->keyval && + (help_key.accel_mods & mask) == (event->state & mask)) + { + ret = TRUE; + } + } + + return ret; +} /* *-----------------------------------------------------------------------------
--- a/src/layout_util.h Mon Jan 01 13:40:30 2018 +0100 +++ b/src/layout_util.h Mon Jan 01 19:12:33 2018 +0000 @@ -71,5 +71,7 @@ void layout_exif_window_new(LayoutWindow *lw); +gboolean is_help_key(GdkEventKey *event); + #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/pan-view/pan-view.c Mon Jan 01 13:40:30 2018 +0100 +++ b/src/pan-view/pan-view.c Mon Jan 01 19:12:33 2018 +0000 @@ -29,6 +29,7 @@ #include "history_list.h" #include "image.h" #include "img-view.h" +#include "layout_util.h" #include "menu.h" #include "metadata.h" #include "misc.h" @@ -1299,15 +1300,16 @@ case '/': pan_search_toggle_visible(pw, TRUE); break; - case GDK_KEY_F1: - help_window_show("GuideReferenceKeyboardShortcuts.html#PanViewKeyboardShortcuts"); - break; - default: stop_signal = FALSE; break; } } } + if (!stop_signal && is_help_key(event)) + { + help_window_show("GuideOtherWindowsPanView.html"); + stop_signal = TRUE; + } return stop_signal; }
--- a/src/search.c Mon Jan 01 13:40:30 2018 +0100 +++ b/src/search.c Mon Jan 01 19:12:33 2018 +0000 @@ -32,6 +32,7 @@ #include "image-load.h" #include "img-view.h" #include "layout.h" +#include "layout_util.h" #include "math.h" #include "menu.h" #include "metadata.h" @@ -1367,9 +1368,6 @@ search_result_menu_pos_cb, sd, 0, GDK_CURRENT_TIME); } break; - case GDK_KEY_F1: - help_window_show("GuideReferenceKeyboardShortcuts.html#SearchKeyboardShortcuts"); - break; default: stop_signal = FALSE; break; @@ -1401,6 +1399,11 @@ break; } } + if (!stop_signal && is_help_key(event)) + { + help_window_show("GuideImageSearchSearch.html"); + stop_signal = TRUE; + } return stop_signal; }
--- a/web/help/GuideOtherWindowsPanView.html Mon Jan 01 13:40:30 2018 +0100 +++ b/web/help/GuideOtherWindowsPanView.html Mon Jan 01 19:12:33 2018 +0000 @@ -464,6 +464,11 @@ You can pan the view as you pan an image in normal view mode, using left mouse button and drag. </p> <p class="para block">A primary mouse button click on any image will display informations about the image. Secondary mouse button will show a context menu.</p> +<p class="para block"> + The + <a class="link" href="GuideReferenceKeyboardShortcuts.html" title="Keyboard and Mouse Shortcuts">Keyboard and Mouse Shortcuts</a> + available are listed in the Reference section. + </p> <div class="admonition block note block-indent"><div class="note-inner"> <p class="para block block-first">Pan view recursively visits each folder under the specified folder. This can consume considerable computer resources.</p> </div></div>