Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / sp-namedview.h
1 #ifndef INKSCAPE_SP_NAMEDVIEW_H
2 #define INKSCAPE_SP_NAMEDVIEW_H
4 /*
5  * <sodipodi:namedview> implementation
6  *
7  * Authors:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *   Abhishek Sharma
10  *
11  * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
12  * Copyright (C) Lauris Kaplinski 2000-2002
13  *
14  * Released under GNU GPL, read the file 'COPYING' for more information
15  */
17 #define SP_TYPE_NAMEDVIEW (sp_namedview_get_type())
18 #define SP_NAMEDVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_NAMEDVIEW, SPNamedView))
19 #define SP_NAMEDVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_NAMEDVIEW, SPNamedViewClass))
20 #define SP_IS_NAMEDVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_NAMEDVIEW))
21 #define SP_IS_NAMEDVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_NAMEDVIEW))
23 #include "helper/helper-forward.h"
24 #include "sp-object-group.h"
25 #include "sp-metric.h"
26 #include "snap.h"
27 #include "display/canvas-grid.h"
28 #include "document.h"
30 namespace Inkscape {
31 class CanvasGrid;
32 }
34 enum {
35     SP_BORDER_LAYER_BOTTOM,
36     SP_BORDER_LAYER_TOP
37 };
39 struct SPNamedView : public SPObjectGroup {
40     unsigned int editable : 1;
41     unsigned int showguides : 1;
42     unsigned int showborder : 1;
43     unsigned int showpageshadow : 1;
44     unsigned int borderlayer : 2;
46     double zoom;
47     double cx;
48     double cy;
49     gint window_width;
50     gint window_height;
51     gint window_x;
52     gint window_y;
53     gint window_maximized;
55     SnapManager snap_manager;
56     GSList * grids;
57     bool grids_visible;
59     SPUnit const *doc_units;
60     SPUnit const *units;
61     
62     GQuark default_layer_id;
64     double connector_spacing;
66     guint32 guidecolor;
67     guint32 guidehicolor;
68     guint32 bordercolor;
69     guint32 pagecolor;
70     guint32 pageshadow;
72     GSList *guides;
73     GSList *views;
75     gint viewcount;
77     void show(SPDesktop *desktop);
78     void hide(SPDesktop const *desktop);
79     void activateGuides(gpointer desktop, gboolean active);
80     gchar const *getName() const;
81     guint getViewCount();
82     GSList const *getViewList() const;
83     SPMetric getDefaultMetric() const;
85     void translateGuides(Geom::Translate const &translation);
86     void scrollAllDesktops(double dx, double dy, bool is_scrolling);
87     void writeNewGrid(SPDocument *document,int gridtype);
88     bool getSnapGlobal() const;
89     void setSnapGlobal(bool v);
90     void setGuides(bool v);
92 private:
93     double getMarginLength(gchar const * const key,SPUnit const * const margin_units,SPUnit const * const return_units,double const width,double const height,bool const use_width);
94     friend class SPDocument;
95 };
97 struct SPNamedViewClass {
98     SPObjectGroupClass parent_class;
99 };
101 GType sp_namedview_get_type();
103 SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name);
105 void sp_namedview_window_from_document(SPDesktop *desktop);
106 void sp_namedview_document_from_window(SPDesktop *desktop);
107 void sp_namedview_update_layers_from_document (SPDesktop *desktop);
109 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
110 void sp_namedview_show_grids(SPNamedView *namedview, bool show, bool dirty_document);
111 Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedview);
113 #endif /* !INKSCAPE_SP_NAMEDVIEW_H */
116 /*
117   Local Variables:
118   mode:c++
119   c-file-style:"stroustrup"
120   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
121   indent-tabs-mode:nil
122   fill-column:99
123   End:
124 */
125 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :