Code

Give SPNamedView a SnapManager instance and use it for all management of snapping...
[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) Lauris Kaplinski 2000-2002
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #define SP_TYPE_NAMEDVIEW (sp_namedview_get_type())
16 #define SP_NAMEDVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_NAMEDVIEW, SPNamedView))
17 #define SP_NAMEDVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_NAMEDVIEW, SPNamedViewClass))
18 #define SP_IS_NAMEDVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_NAMEDVIEW))
19 #define SP_IS_NAMEDVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_NAMEDVIEW))
21 #include "helper/helper-forward.h"
22 #include "sp-object-group.h"
23 #include "libnr/nr-point.h"
24 #include "sp-metric.h"
25 #include "snap.h"
27 enum {
28     SP_BORDER_LAYER_BOTTOM,
29     SP_BORDER_LAYER_TOP
30 };
32 struct SPNamedView : public SPObjectGroup {
33     unsigned int editable : 1;
34     unsigned int showgrid : 1;
35     unsigned int showguides : 1;
36     unsigned int showborder : 1;
37     unsigned int showpageshadow : 1;
38     unsigned int borderlayer : 2;
40     double zoom;
41     double cx;
42     double cy;
43     gint window_width;
44     gint window_height;
45     gint window_x;
46     gint window_y;
48     SnapManager snap_manager;
50     SPUnit const *gridunit;
51     /* Grid data is in points regardless of unit */
52     NR::Point gridorigin;
53     gdouble gridspacing[2];
54     gint gridempspacing;
56     SPUnit const *doc_units;
58     SPUnit const *gridtoleranceunit;
59     gdouble gridtolerance;
61     SPUnit const *guidetoleranceunit;
62     gdouble guidetolerance;
64     SPUnit const *objecttoleranceunit;
65     gdouble objecttolerance;
67     bool has_abs_tolerance;
68     
69     GQuark default_layer_id;
70     
71     double connector_spacing;
73     guint32 gridcolor;
74     guint32 gridempcolor;
75     guint32 guidecolor;
76     guint32 guidehicolor;
77     guint32 bordercolor;
78     guint32 pagecolor;
79     guint32 pageshadow;
81     GSList *guides;
82     GSList *views;
83     GSList *gridviews;
84     gint viewcount;
86     void show(SPDesktop *desktop);
87     void hide(SPDesktop const *desktop);
88     void activateGuides(gpointer desktop, gboolean active);
89     gchar const *getName() const;
90     guint getViewCount();
91     GSList const *getViewList() const;
92     SPMetric getDefaultMetric() const;
93 };
95 struct SPNamedViewClass {
96     SPObjectGroupClass parent_class;
97 };
99 GType sp_namedview_get_type();
101 SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name);
103 void sp_namedview_window_from_document(SPDesktop *desktop);
104 void sp_namedview_document_from_window(SPDesktop *desktop);
106 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
107 void sp_namedview_toggle_grid(SPDocument *doc, Inkscape::XML::Node *repr);
109 #endif /* !INKSCAPE_SP_NAMEDVIEW_H */
112 /*
113   Local Variables:
114   mode:c++
115   c-file-style:"stroustrup"
116   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
117   indent-tabs-mode:nil
118   fill-column:99
119   End:
120 */
121 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :