[evince] [libdocument] Add inverted-color property to EvDocumentModel



commit f89486b20069a9e9de2ff8bc08df1fcd49bb6355
Author: Juanjo Marín <juanj marin juntadeandalucia es>
Date:   Sun Nov 29 15:50:29 2009 +0100

    [libdocument] Add inverted-color property to EvDocumentModel
    
    See bgo#321823.

 libview/ev-document-model.c |   38 ++++++++++++++++++++++++++++++++++++++
 libview/ev-document-model.h |    3 +++
 2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/libview/ev-document-model.c b/libview/ev-document-model.c
index 2e3db25..b92fa01 100644
--- a/libview/ev-document-model.c
+++ b/libview/ev-document-model.c
@@ -33,6 +33,7 @@ struct _EvDocumentModel
 
 	gint page;
 	gint rotation;
+	gboolean inverted_colors;
 	gdouble scale;
 	EvSizingMode sizing_mode;
 	guint continuous : 1;
@@ -58,6 +59,7 @@ enum {
 	PROP_DOCUMENT,
 	PROP_PAGE,
 	PROP_ROTATION,
+	PROP_INVERTED_COLORS,
 	PROP_SCALE,
 	PROP_SIZING_MODE,
 	PROP_CONTINUOUS,
@@ -106,6 +108,9 @@ ev_document_model_set_property (GObject      *object,
 	case PROP_ROTATION:
 		ev_document_model_set_rotation (model, g_value_get_int (value));
 		break;
+	case PROP_INVERTED_COLORS:
+		ev_document_model_set_inverted_colors (model, g_value_get_boolean (value));
+		break;
 	case PROP_SCALE:
 		ev_document_model_set_scale (model, g_value_get_double (value));
 		break;
@@ -144,6 +149,9 @@ ev_document_model_get_property (GObject    *object,
 	case PROP_ROTATION:
 		g_value_set_int (value, model->rotation);
 		break;
+	case PROP_INVERTED_COLORS:
+		g_value_set_boolean (value, model->inverted_colors);
+		break;
 	case PROP_SCALE:
 		g_value_set_double (value, model->scale);
 		break;
@@ -196,6 +204,13 @@ ev_document_model_class_init (EvDocumentModelClass *klass)
 							   0, 360, 0,
 							   G_PARAM_READWRITE));
 	g_object_class_install_property (g_object_class,
+					 PROP_INVERTED_COLORS,
+					 g_param_spec_boolean ("inverted-colors",
+							       "Inverted Colors",
+							       "Whether document is displayed with inverted colors",
+							       FALSE,
+							       G_PARAM_READWRITE));
+	g_object_class_install_property (g_object_class,
 					 PROP_SCALE,
 					 g_param_spec_double ("scale",
 							      "Scale",
@@ -251,6 +266,7 @@ ev_document_model_init (EvDocumentModel *model)
 	model->scale = 1.;
 	model->sizing_mode = EV_SIZING_FIT_WIDTH;
 	model->continuous = TRUE;
+	model->inverted_colors = FALSE;
 	model->min_scale = 0.;
 	model->max_scale = G_MAXDOUBLE;
 }
@@ -461,6 +477,28 @@ ev_document_model_get_rotation (EvDocumentModel *model)
 }
 
 void
+ev_document_model_set_inverted_colors (EvDocumentModel *model,
+				       gboolean         inverted_colors)
+{
+	g_return_if_fail (EV_IS_DOCUMENT_MODEL (model));
+
+	if (inverted_colors == model->inverted_colors)
+		return;
+
+	model->inverted_colors = inverted_colors;
+
+	g_object_notify (G_OBJECT (model), "inverted-colors");
+}
+
+gboolean
+ev_document_model_get_inverted_colors (EvDocumentModel *model)
+{
+	g_return_val_if_fail (EV_IS_DOCUMENT_MODEL (model), FALSE);
+
+	return model->inverted_colors;
+}
+
+void
 ev_document_model_set_continuous (EvDocumentModel *model,
 				  gboolean         continuous)
 {
diff --git a/libview/ev-document-model.h b/libview/ev-document-model.h
index 26c6d7b..b535c9a 100644
--- a/libview/ev-document-model.h
+++ b/libview/ev-document-model.h
@@ -69,6 +69,9 @@ EvSizingMode     ev_document_model_get_sizing_mode   (EvDocumentModel *model);
 void             ev_document_model_set_rotation      (EvDocumentModel *model,
 						      gint             rotation);
 gint             ev_document_model_get_rotation      (EvDocumentModel *model);
+void           ev_document_model_set_inverted_colors (EvDocumentModel *model,
+						      gboolean         inverted_colors);
+gboolean       ev_document_model_get_inverted_colors (EvDocumentModel *model);
 void             ev_document_model_set_continuous    (EvDocumentModel *model,
 						      gboolean         continuous);
 gboolean         ev_document_model_get_continuous    (EvDocumentModel *model);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]