]> www.fi.muni.cz Git - evince.git/commitdiff
[presentation] Make inverted colors mode work in presentation mode too
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 25 Apr 2010 16:20:56 +0000 (18:20 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 25 Apr 2010 16:20:56 +0000 (18:20 +0200)
Fixes bug #614693.

libview/ev-view-presentation.c
libview/ev-view-presentation.h
shell/ev-window.c

index 7cf94bdfea854bd83a73988b3dc173bb4430b80b..5df5cfaf5fe3b9ccd69fce5f64d55ee155c629fb 100644 (file)
@@ -36,7 +36,8 @@ enum {
        PROP_0,
        PROP_DOCUMENT,
        PROP_CURRENT_PAGE,
-       PROP_ROTATION
+       PROP_ROTATION,
+       PROP_INVERTED_COLORS
 };
 
 enum {
@@ -60,6 +61,7 @@ struct _EvViewPresentation
        cairo_surface_t       *current_surface;
        EvDocument            *document;
        guint                  rotation;
+       gboolean               inverted_colors;
        EvPresentationState    state;
        gdouble                scale;
        gint                   monitor_width;
@@ -323,6 +325,9 @@ job_finished_cb (EvJob              *job,
 {
        EvJobRender *job_render = EV_JOB_RENDER (job);
 
+       if (pview->inverted_colors)
+               ev_document_misc_invert_surface (job_render->surface);
+
        if (job != pview->curr_job)
                return;
 
@@ -1326,6 +1331,9 @@ ev_view_presentation_set_property (GObject      *object,
        case PROP_ROTATION:
                pview->rotation = g_value_get_uint (value);
                break;
+       case PROP_INVERTED_COLORS:
+               pview->inverted_colors = g_value_get_boolean (value);
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        }
@@ -1401,6 +1409,14 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
                                                            0, 360, 0,
                                                            G_PARAM_WRITABLE |
                                                            G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (gobject_class,
+                                        PROP_INVERTED_COLORS,
+                                        g_param_spec_boolean ("inverted_colors",
+                                                              "Inverted Colors",
+                                                              "Whether presentation is displayed with inverted colors",
+                                                              FALSE,
+                                                              G_PARAM_WRITABLE |
+                                                              G_PARAM_CONSTRUCT_ONLY));
 
        signals[CHANGE_PAGE] =
                g_signal_new ("change_page",
@@ -1461,7 +1477,8 @@ ev_view_presentation_init (EvViewPresentation *pview)
 GtkWidget *
 ev_view_presentation_new (EvDocument *document,
                          guint       current_page,
-                         guint       rotation)
+                         guint       rotation,
+                         gboolean    inverted_colors)
 {
        g_return_val_if_fail (EV_IS_DOCUMENT (document), NULL);
        g_return_val_if_fail (current_page < ev_document_get_n_pages (document), NULL);
@@ -1470,6 +1487,7 @@ ev_view_presentation_new (EvDocument *document,
                                         "document", document,
                                         "current_page", current_page,
                                         "rotation", rotation,
+                                        "inverted_colors", inverted_colors,
                                         NULL));
 }
 
index dde9ad8254a6860e7dfb2dadac429700e66c8fe0..24553b08187c8f70481fb7a485c65fdc7b9a5fd9 100644 (file)
@@ -42,7 +42,8 @@ GType         ev_view_presentation_get_type         (void) G_GNUC_CONST;
 
 GtkWidget      *ev_view_presentation_new             (EvDocument         *document,
                                                       guint               current_page,
-                                                      guint               rotation);
+                                                      guint               rotation,
+                                                      gboolean            inverted_colors);
 guint           ev_view_presentation_get_current_page (EvViewPresentation *pview);
 
 G_END_DECLS
index b78c3175ac232fdf115ca90d867672c34decfe22..a7debed616902f9ba72360aefe5ecd877ed343be 100644 (file)
@@ -3567,6 +3567,7 @@ ev_window_run_presentation (EvWindow *window)
        gboolean fullscreen_window = TRUE;
        guint    current_page;
        guint    rotation;
+       gboolean inverted_colors;
 
        if (EV_WINDOW_IS_PRESENTATION (window))
                return;
@@ -3578,8 +3579,11 @@ ev_window_run_presentation (EvWindow *window)
 
        current_page = ev_document_model_get_page (window->priv->model);
        rotation = ev_document_model_get_rotation (window->priv->model);
-       window->priv->presentation_view =
-               ev_view_presentation_new (window->priv->document, current_page, rotation);
+       inverted_colors = ev_document_model_get_inverted_colors (window->priv->model);
+       window->priv->presentation_view = ev_view_presentation_new (window->priv->document,
+                                                                   current_page,
+                                                                   rotation,
+                                                                   inverted_colors);
        g_signal_connect_swapped (window->priv->presentation_view, "finished",
                                  G_CALLBACK (ev_window_view_presentation_finished),
                                  window);