diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ev-view.c | 38 | ||||
-rw-r--r-- | shell/ev-view.h | 4 | ||||
-rw-r--r-- | shell/ev-window.c | 32 |
3 files changed, 49 insertions, 25 deletions
diff --git a/shell/ev-view.c b/shell/ev-view.c index 6ae9ac6..c366b04 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -2145,7 +2145,7 @@ ev_view_zoom_out (EvView *view) ev_view_set_zoom (view, ZOOM_OUT_FACTOR, TRUE); } -void +static void ev_view_set_orientation (EvView *view, EvOrientation orientation) { @@ -2157,6 +2157,42 @@ ev_view_set_orientation (EvView *view, gtk_widget_queue_resize (GTK_WIDGET (view)); } +void +ev_view_rotate_right (EvView *view) +{ + EvOrientation orientation, new_orientation; + + orientation = ev_document_get_orientation (view->document); + if (orientation == EV_ORIENTATION_PORTRAIT) { + new_orientation = EV_ORIENTATION_LANDSCAPE; + } else if (orientation == EV_ORIENTATION_LANDSCAPE) { + new_orientation = EV_ORIENTATION_UPSIDEDOWN; + } else if (orientation == EV_ORIENTATION_UPSIDEDOWN) { + new_orientation = EV_ORIENTATION_SEASCAPE; + } else { + new_orientation = EV_ORIENTATION_PORTRAIT; + } + ev_view_set_orientation (view, new_orientation); +} + +void +ev_view_rotate_left (EvView *view) +{ + EvOrientation orientation, new_orientation; + + orientation = ev_document_get_orientation (view->document); + if (orientation == EV_ORIENTATION_PORTRAIT) { + new_orientation = EV_ORIENTATION_SEASCAPE; + } else if (orientation == EV_ORIENTATION_SEASCAPE) { + new_orientation = EV_ORIENTATION_UPSIDEDOWN; + } else if (orientation == EV_ORIENTATION_UPSIDEDOWN) { + new_orientation = EV_ORIENTATION_LANDSCAPE; + } else { + new_orientation = EV_ORIENTATION_PORTRAIT; + } + ev_view_set_orientation (view, new_orientation); +} + static double zoom_for_size_fit_width (int doc_width, int doc_height, diff --git a/shell/ev-view.h b/shell/ev-view.h index 2244ae0..05b2542 100644 --- a/shell/ev-view.h +++ b/shell/ev-view.h @@ -90,8 +90,8 @@ void ev_view_set_zoom_for_size (EvView *view, int height, int vsb_width, int hsb_height); -void ev_view_set_orientation (EvView *view, - EvOrientation orientation); +void ev_view_rotate_left (EvView *view); +void ev_view_rotate_right (EvView *view); /* Find */ gboolean ev_view_can_find_next (EvView *view); diff --git a/shell/ev-window.c b/shell/ev-window.c index e9e1c4e..2020e9c 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -1798,24 +1798,15 @@ ev_window_cmd_edit_toolbar_cb (GtkDialog *dialog, gint response, gpointer data) } static void -ev_window_cmd_edit_landscape (GtkAction *action, EvWindow *ev_window) +ev_window_cmd_edit_rotate_left (GtkAction *action, EvWindow *ev_window) { - ev_view_set_orientation (EV_VIEW (ev_window->priv->view), - EV_ORIENTATION_LANDSCAPE); + ev_view_rotate_left (EV_VIEW (ev_window->priv->view)); } static void -ev_window_cmd_edit_portrait (GtkAction *action, EvWindow *ev_window) +ev_window_cmd_edit_rotate_right (GtkAction *action, EvWindow *ev_window) { - ev_view_set_orientation (EV_VIEW (ev_window->priv->view), - EV_ORIENTATION_PORTRAIT); -} - -static void -ev_window_cmd_edit_flip (GtkAction *action, EvWindow *ev_window) -{ - ev_view_set_orientation (EV_VIEW (ev_window->priv->view), - EV_ORIENTATION_SEASCAPE); + ev_view_rotate_right (EV_VIEW (ev_window->priv->view)); } static void @@ -2511,15 +2502,12 @@ static const GtkActionEntry entries[] = { { "EditToolbar", NULL, N_("T_oolbar"), NULL, N_("Customize the toolbar"), G_CALLBACK (ev_window_cmd_edit_toolbar) }, - { "EditLandscape", NULL, N_("_Landscape"), NULL, - N_("Change the document orientation to landscape"), - G_CALLBACK (ev_window_cmd_edit_landscape) }, - { "EditPortrait", NULL, N_("_Portrait"), NULL, - N_("Change the document orientation to portrait"), - G_CALLBACK (ev_window_cmd_edit_portrait) }, - { "EditFlip", NULL, N_("_Flip"), NULL, - N_("Flip the document"), - G_CALLBACK (ev_window_cmd_edit_flip) }, + { "EditRotateLeft", NULL, N_("Rotate _Left"), NULL, + N_("Rotate the document to the left"), + G_CALLBACK (ev_window_cmd_edit_rotate_left) }, + { "EditRotateRight", NULL, N_("Rotate _Right"), NULL, + N_("Rotate the document to the right"), + G_CALLBACK (ev_window_cmd_edit_rotate_right) }, /* View menu */ { "ViewZoomIn", GTK_STOCK_ZOOM_IN, NULL, "<control>plus", |