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

shortcuts: added shortcuts to scroll the image

parent 8ed10158
......@@ -395,3 +395,152 @@ gth_browser_activate_step_animation (GSimpleAction *action,
image_viewer = GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (viewer_page));
gth_image_viewer_step_animation (image_viewer);
}
void
gth_browser_activate_scroll_step_left (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GthBrowser *browser = user_data;
GthImageViewerPage *viewer_page = get_image_viewer_page (browser);
GthImageViewer *image_viewer;
if (viewer_page == NULL)
return;
image_viewer = GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (viewer_page));
gth_image_viewer_scroll_step_x (image_viewer, FALSE);
}
void
gth_browser_activate_scroll_step_right (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GthBrowser *browser = user_data;
GthImageViewerPage *viewer_page = get_image_viewer_page (browser);
GthImageViewer *image_viewer;
if (viewer_page == NULL)
return;
image_viewer = GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (viewer_page));
gth_image_viewer_scroll_step_x (image_viewer, TRUE);
}
void
gth_browser_activate_scroll_step_up (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GthBrowser *browser = user_data;
GthImageViewerPage *viewer_page = get_image_viewer_page (browser);
GthImageViewer *image_viewer;
if (viewer_page == NULL)
return;
image_viewer = GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (viewer_page));
gth_image_viewer_scroll_step_y (image_viewer, FALSE);
}
void
gth_browser_activate_scroll_step_down (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GthBrowser *browser = user_data;
GthImageViewerPage *viewer_page = get_image_viewer_page (browser);
GthImageViewer *image_viewer;
if (viewer_page == NULL)
return;
image_viewer = GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (viewer_page));
gth_image_viewer_scroll_step_y (image_viewer, TRUE);
}
void
gth_browser_activate_scroll_page_left (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GthBrowser *browser = user_data;
GthImageViewerPage *viewer_page = get_image_viewer_page (browser);
GthImageViewer *image_viewer;
if (viewer_page == NULL)
return;
image_viewer = GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (viewer_page));
gth_image_viewer_scroll_page_x (image_viewer, FALSE);
}
void
gth_browser_activate_scroll_page_right (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GthBrowser *browser = user_data;
GthImageViewerPage *viewer_page = get_image_viewer_page (browser);
GthImageViewer *image_viewer;
if (viewer_page == NULL)
return;
image_viewer = GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (viewer_page));
gth_image_viewer_scroll_page_x (image_viewer, TRUE);
}
void
gth_browser_activate_scroll_page_up (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GthBrowser *browser = user_data;
GthImageViewerPage *viewer_page = get_image_viewer_page (browser);
GthImageViewer *image_viewer;
if (viewer_page == NULL)
return;
image_viewer = GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (viewer_page));
gth_image_viewer_scroll_page_y (image_viewer, FALSE);
}
void
gth_browser_activate_scroll_page_down (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GthBrowser *browser = user_data;
GthImageViewerPage *viewer_page = get_image_viewer_page (browser);
GthImageViewer *image_viewer;
if (viewer_page == NULL)
return;
image_viewer = GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (viewer_page));
gth_image_viewer_scroll_page_y (image_viewer, TRUE);
}
void
gth_browser_activate_scroll_to_center (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GthBrowser *browser = user_data;
GthImageViewerPage *viewer_page = get_image_viewer_page (browser);
GthImageViewer *image_viewer;
if (viewer_page == NULL)
return;
image_viewer = GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (viewer_page));
gth_image_viewer_scroll_to_center (image_viewer);
}
......@@ -44,5 +44,14 @@ DEF_ACTION_CALLBACK (gth_browser_activate_image_zoom)
DEF_ACTION_CALLBACK (gth_browser_activate_toggle_animation)
DEF_ACTION_CALLBACK (gth_browser_activate_step_animation)
DEF_ACTION_CALLBACK (gth_browser_activate_transparency_style)
DEF_ACTION_CALLBACK (gth_browser_activate_scroll_step_left)
DEF_ACTION_CALLBACK (gth_browser_activate_scroll_step_right)
DEF_ACTION_CALLBACK (gth_browser_activate_scroll_step_up)
DEF_ACTION_CALLBACK (gth_browser_activate_scroll_step_down)
DEF_ACTION_CALLBACK (gth_browser_activate_scroll_page_left)
DEF_ACTION_CALLBACK (gth_browser_activate_scroll_page_right)
DEF_ACTION_CALLBACK (gth_browser_activate_scroll_page_up)
DEF_ACTION_CALLBACK (gth_browser_activate_scroll_page_down)
DEF_ACTION_CALLBACK (gth_browser_activate_scroll_to_center)
#endif /* ACTIONS_H */
......@@ -44,6 +44,18 @@ static const GthShortcut shortcuts[] = {
{ "image-undo", N_("Undo edit"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, "<Primary>z" },
{ "image-redo", N_("Redo edit"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, "<Primary><Shift>z" },
{ "scroll-step-left", N_("Scroll left"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE, "Left" },
{ "scroll-step-right", N_("Scroll right"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE, "Right" },
{ "scroll-step-up", N_("Scroll up"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE, "Up" },
{ "scroll-step-down", N_("Scroll down"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE, "Down" },
{ "scroll-page-left", N_("Scroll left fast"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE, "<Shift>Left" },
{ "scroll-page-right", N_("Scroll right fast"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE, "<Shift>Right" },
{ "scroll-page-up", N_("Scroll up fast"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE, "<Shift>Up" },
{ "scroll-page-down", N_("Scroll down fast"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE, "<Shift>Down" },
{ "scroll-to-center", N_("Scroll to center"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE, "<Primary>Down" },
};
......
......@@ -67,6 +67,15 @@ static const GActionEntry actions[] = {
{ "step-animation", gth_browser_activate_step_animation },
{ "image-zoom", gth_browser_activate_image_zoom, "s", "''", NULL },
{ "transparency-style", gth_browser_activate_transparency_style, "s", "''", NULL },
{ "scroll-step-left", gth_browser_activate_scroll_step_left },
{ "scroll-step-right", gth_browser_activate_scroll_step_right },
{ "scroll-step-up", gth_browser_activate_scroll_step_up },
{ "scroll-step-down", gth_browser_activate_scroll_step_down },
{ "scroll-page-left", gth_browser_activate_scroll_page_left },
{ "scroll-page-right", gth_browser_activate_scroll_page_right },
{ "scroll-page-up", gth_browser_activate_scroll_page_up },
{ "scroll-page-down", gth_browser_activate_scroll_page_down },
{ "scroll-to-center", gth_browser_activate_scroll_to_center },
};
......
......@@ -33,7 +33,8 @@
static GthShortcutCategory shortcut_categories[] = {
{ GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER, N_("Image Viewer"), 21 },
{ GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, N_("Image Editor"), 22 }
{ GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE, N_("Scroll Image"), 22 },
{ GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, N_("Image Editor"), 23 },
};
......
......@@ -23,6 +23,7 @@
#define IMAGE_VIEWER_SHORTCUTS_H
#define GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER "image-viewer"
#define GTH_SHORTCUT_CATEGORY_SCROLL_IMAGE "scroll-image"
#define GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR "image-editor"
#endif /* IMAGE_VIEWER_SHORTCUTS_H */
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