Commit c4b8e07a authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

make the keyboard editing shortcuts work from the file list as well

when the file list or the image viewer are focused the user can use the following
shortcuts to activate some editing tools:

h : enhance 
l: flip
m: mirror
r: rotate right
<shift>r: rotate left
<shift>c: crop
<shift>s: resize

[bug #621922, new feature]
parent 53119f86
......@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <gdk/gdkkeysyms.h>
#include <gthumb.h>
#include <extensions/image_viewer/gth-image-viewer-page.h>
#include "gth-file-tool-crop.h"
#include "gth-file-tool-enhance.h"
#include "gth-file-tool-flip.h"
......@@ -39,13 +40,11 @@ file_tools__gth_browser_file_list_key_press_cb (GthBrowser *browser,
GdkEventKey *event)
{
gpointer result = NULL;
guint modifiers;
GtkWidget *sidebar;
GtkWidget *toolbox;
GthFileTool *tool = NULL;
if (gth_window_get_current_page (GTH_WINDOW (browser)) != GTH_BROWSER_PAGE_VIEWER)
return NULL;
guint modifiers;
GtkWidget *page;
sidebar = gth_browser_get_viewer_sidebar (browser);
toolbox = gth_sidebar_get_toolbox (GTH_SIDEBAR (sidebar));
......@@ -56,6 +55,16 @@ file_tools__gth_browser_file_list_key_press_cb (GthBrowser *browser,
if (((event->state & modifiers) != 0) && ((event->state & modifiers) != GDK_SHIFT_MASK))
return NULL;
page = gth_browser_get_viewer_page (browser);
if (! GTH_IS_IMAGE_VIEWER_PAGE (page))
return NULL;
if (gth_window_get_current_page (GTH_WINDOW (browser)) == GTH_BROWSER_PAGE_VIEWER
&& ! gtk_widget_has_focus (gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (page))))
{
return NULL;
}
switch (event->keyval) {
case GDK_KEY_h:
tool = (GthFileTool *) gth_toolbox_get_tool (GTH_TOOLBOX (toolbox), GTH_TYPE_FILE_TOOL_ENHANCE);
......@@ -83,6 +92,8 @@ file_tools__gth_browser_file_list_key_press_cb (GthBrowser *browser,
}
if (tool != NULL) {
if (gth_window_get_current_page (GTH_WINDOW (browser)) == GTH_BROWSER_PAGE_BROWSER)
gth_window_set_current_page (GTH_WINDOW (browser), GTH_BROWSER_PAGE_VIEWER);
gth_file_tool_activate (tool);
result = GINT_TO_POINTER (1);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment