X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libview%2Fev-document-model.c;h=727264a09b5b692c00774b64e776fa094ccaf4fe;hb=671655393d655c3ab62fdf671beec9922b7ec7f1;hp=a850e841233459a36a728b85168aab488b99e2a7;hpb=34148304a0237fd9fd7c4ea05ca2e053d9ddd3ff;p=evince.git diff --git a/libview/ev-document-model.c b/libview/ev-document-model.c index a850e841..727264a0 100644 --- a/libview/ev-document-model.c +++ b/libview/ev-document-model.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" @@ -35,6 +35,10 @@ struct _EvDocumentModel gint rotation; gdouble scale; EvSizingMode sizing_mode; + guint continuous : 1; + guint dual_page : 1; + guint fullscreen : 1; + guint inverted_colors : 1; gdouble max_scale; gdouble min_scale; @@ -55,8 +59,12 @@ enum { PROP_DOCUMENT, PROP_PAGE, PROP_ROTATION, + PROP_INVERTED_COLORS, PROP_SCALE, - PROP_SIZING_MODE + PROP_SIZING_MODE, + PROP_CONTINUOUS, + PROP_DUAL_PAGE, + PROP_FULLSCREEN }; enum @@ -100,12 +108,24 @@ 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; case PROP_SIZING_MODE: ev_document_model_set_sizing_mode (model, g_value_get_enum (value)); break; + case PROP_CONTINUOUS: + ev_document_model_set_continuous (model, g_value_get_boolean (value)); + break; + case PROP_DUAL_PAGE: + ev_document_model_set_dual_page (model, g_value_get_boolean (value)); + break; + case PROP_FULLSCREEN: + ev_document_model_set_fullscreen (model, g_value_get_boolean (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -129,12 +149,24 @@ 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; case PROP_SIZING_MODE: g_value_set_enum (value, model->sizing_mode); break; + case PROP_CONTINUOUS: + g_value_set_boolean (value, ev_document_model_get_continuous (model)); + break; + case PROP_DUAL_PAGE: + g_value_set_boolean (value, ev_document_model_get_dual_page (model)); + break; + case PROP_FULLSCREEN: + g_value_set_boolean (value, ev_document_model_get_fullscreen (model)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -171,6 +203,13 @@ ev_document_model_class_init (EvDocumentModelClass *klass) "Current rotation angle", 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", @@ -186,6 +225,27 @@ ev_document_model_class_init (EvDocumentModelClass *klass) EV_TYPE_SIZING_MODE, EV_SIZING_FIT_WIDTH, G_PARAM_READWRITE)); + g_object_class_install_property (g_object_class, + PROP_CONTINUOUS, + g_param_spec_boolean ("continuous", + "Continuous", + "Whether document is displayed in continuous mode", + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (g_object_class, + PROP_DUAL_PAGE, + g_param_spec_boolean ("dual-page", + "Dual Page", + "Whether document is displayed in dual page mode", + FALSE, + G_PARAM_READWRITE)); + g_object_class_install_property (g_object_class, + PROP_FULLSCREEN, + g_param_spec_boolean ("fullscreen", + "Fullscreen", + "Whether document is displayed in fullscreen mode", + FALSE, + G_PARAM_READWRITE)); /* Signals */ signals [PAGE_CHANGED] = @@ -205,6 +265,8 @@ ev_document_model_init (EvDocumentModel *model) model->page = -1; 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; } @@ -414,3 +476,96 @@ ev_document_model_get_rotation (EvDocumentModel *model) return model->rotation; } +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) +{ + g_return_if_fail (EV_IS_DOCUMENT_MODEL (model)); + + continuous = continuous != FALSE; + + if (continuous == model->continuous) + return; + + model->continuous = continuous; + + g_object_notify (G_OBJECT (model), "continuous"); +} + +gboolean +ev_document_model_get_continuous (EvDocumentModel *model) +{ + g_return_val_if_fail (EV_IS_DOCUMENT_MODEL (model), TRUE); + + return model->continuous; +} + +void +ev_document_model_set_dual_page (EvDocumentModel *model, + gboolean dual_page) +{ + g_return_if_fail (EV_IS_DOCUMENT_MODEL (model)); + + dual_page = dual_page != FALSE; + + if (dual_page == model->dual_page) + return; + + model->dual_page = dual_page; + + g_object_notify (G_OBJECT (model), "dual-page"); +} + +gboolean +ev_document_model_get_dual_page (EvDocumentModel *model) +{ + g_return_val_if_fail (EV_IS_DOCUMENT_MODEL (model), FALSE); + + return model->dual_page; +} + +void +ev_document_model_set_fullscreen (EvDocumentModel *model, + gboolean fullscreen) +{ + g_return_if_fail (EV_IS_DOCUMENT_MODEL (model)); + + fullscreen = fullscreen != FALSE; + + if (fullscreen == model->fullscreen) + return; + + model->fullscreen = fullscreen; + + g_object_notify (G_OBJECT (model), "fullscreen"); +} + +gboolean +ev_document_model_get_fullscreen (EvDocumentModel *model) +{ + g_return_val_if_fail (EV_IS_DOCUMENT_MODEL (model), FALSE); + + return model->fullscreen; +}