Code

separate updating window from updating layers
[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  *
10  * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
11  * Copyright (C) Lauris Kaplinski 2000-2002
12  *
13  * Released under GNU GPL, read the file 'COPYING' for more information
14  */
16 #define SP_TYPE_NAMEDVIEW (sp_namedview_get_type())
17 #define SP_NAMEDVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_NAMEDVIEW, SPNamedView))
18 #define SP_NAMEDVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_NAMEDVIEW, SPNamedViewClass))
19 #define SP_IS_NAMEDVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_NAMEDVIEW))
20 #define SP_IS_NAMEDVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_NAMEDVIEW))
22 #include "helper/helper-forward.h"
23 #include "sp-object-group.h"
24 #include "libnr/nr-point.h"
25 #include "sp-metric.h"
26 #include "snap.h"
28 enum {
29     SP_BORDER_LAYER_BOTTOM,
30     SP_BORDER_LAYER_TOP
31 };
33 struct SPNamedView : public SPObjectGroup {
34     unsigned int editable : 1;
35     unsigned int showgrid : 1;
36     unsigned int gridtype : 1; // 0=normal 1=axonometric
37     unsigned int showguides : 1;
38     unsigned int showborder : 1;
39     unsigned int showpageshadow : 1;
40     unsigned int borderlayer : 2;
42     double zoom;
43     double cx;
44     double cy;
45     gint window_width;
46     gint window_height;
47     gint window_x;
48     gint window_y;
50     SnapManager snap_manager;
52     SPUnit const *gridunit;
53     /* Grid data is in points regardless of unit */
54     NR::Point gridorigin;
55     gdouble gridspacing[2];
56     gdouble gridangle[2];   // for axonometric grid
57     gint gridempspacing;
59     SPUnit const *doc_units;
61     SPUnit const *gridtoleranceunit;
62     gdouble gridtolerance;
64     SPUnit const *guidetoleranceunit;
65     gdouble guidetolerance;
67     SPUnit const *objecttoleranceunit;
68     gdouble objecttolerance;
70     bool has_abs_tolerance;
71     
72     GQuark default_layer_id;
73     
74     double connector_spacing;
76     guint32 gridcolor;
77     guint32 gridempcolor;
78     guint32 guidecolor;
79     guint32 guidehicolor;
80     guint32 bordercolor;
81     guint32 pagecolor;
82     guint32 pageshadow;
84     GSList *guides;
85     GSList *views;
86     GSList *gridviews;
87     
88     gint viewcount;
90     void show(SPDesktop *desktop);
91     void hide(SPDesktop const *desktop);
92     void activateGuides(gpointer desktop, gboolean active);
93     gchar const *getName() const;
94     guint getViewCount();
95     GSList const *getViewList() const;
96     SPMetric getDefaultMetric() const;
97 };
99 struct SPNamedViewClass {
100     SPObjectGroupClass parent_class;
101 };
103 GType sp_namedview_get_type();
105 SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name);
107 void sp_namedview_window_from_document(SPDesktop *desktop);
108 void sp_namedview_document_from_window(SPDesktop *desktop);
109 void sp_namedview_update_layers_from_document (SPDesktop *desktop);
111 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
112 void sp_namedview_toggle_grid(SPDocument *doc, Inkscape::XML::Node *repr);
113 void sp_namedview_set_gridtype(unsigned int type, SPDocument *doc, Inkscape::XML::Node *repr);
115 #endif /* !INKSCAPE_SP_NAMEDVIEW_H */
118 /*
119   Local Variables:
120   mode:c++
121   c-file-style:"stroustrup"
122   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
123   indent-tabs-mode:nil
124   fill-column:99
125   End:
126 */
127 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :