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 "grid-snapper.h"
26 #include "guide-snapper.h"
27 #include "object-snapper.h"
30 enum {
31 SP_BORDER_LAYER_BOTTOM,
32 SP_BORDER_LAYER_TOP
33 };
35 struct SPNamedView : public SPObjectGroup {
36 unsigned int editable : 1;
37 unsigned int showgrid : 1;
38 unsigned int showguides : 1;
39 unsigned int showborder : 1;
40 unsigned int showpageshadow : 1;
41 unsigned int borderlayer : 2;
43 int snap_grid_bbox;
44 int snap_grid_point;
45 int snap_guide_bbox;
46 int snap_guide_point;
47 int snap_object_bbox;
48 int snap_object_point;
49 int snap_object_paths;
50 int snap_object_nodes;
52 double zoom;
53 double cx;
54 double cy;
55 gint window_width;
56 gint window_height;
57 gint window_x;
58 gint window_y;
60 Inkscape::GridSnapper grid_snapper;
61 Inkscape::GuideSnapper guide_snapper;
62 Inkscape::ObjectSnapper object_snapper;
64 SPUnit const *gridunit;
65 /* Grid data is in points regardless of unit */
66 NR::Point gridorigin;
67 gdouble gridspacing[2];
68 gint gridempspacing;
70 SPUnit const *doc_units;
72 SPUnit const *gridtoleranceunit;
73 gdouble gridtolerance;
75 SPUnit const *guidetoleranceunit;
76 gdouble guidetolerance;
78 SPUnit const *objecttoleranceunit;
79 gdouble objecttolerance;
81 bool has_abs_tolerance;
83 GQuark default_layer_id;
85 double connector_spacing;
87 guint32 gridcolor;
88 guint32 gridempcolor;
89 guint32 guidecolor;
90 guint32 guidehicolor;
91 guint32 bordercolor;
92 guint32 pagecolor;
93 guint32 pageshadow;
95 GSList *guides;
96 GSList *views;
97 GSList *gridviews;
98 gint viewcount;
100 void show(SPDesktop *desktop);
101 void hide(SPDesktop const *desktop);
102 void activateGuides(gpointer desktop, gboolean active);
103 gchar const *getName() const;
104 guint getViewCount();
105 GSList const *getViewList() const;
106 SPMetric getDefaultMetric() const;
108 typedef std::list<const Inkscape::Snapper *> SnapperList;
109 SnapperList getSnappers() const;
110 };
112 struct SPNamedViewClass {
113 SPObjectGroupClass parent_class;
114 };
116 GType sp_namedview_get_type();
118 SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name);
120 void sp_namedview_window_from_document(SPDesktop *desktop);
121 void sp_namedview_document_from_window(SPDesktop *desktop);
123 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
124 void sp_namedview_toggle_grid(SPDocument *doc, Inkscape::XML::Node *repr);
126 #endif /* !INKSCAPE_SP_NAMEDVIEW_H */
129 /*
130 Local Variables:
131 mode:c++
132 c-file-style:"stroustrup"
133 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
134 indent-tabs-mode:nil
135 fill-column:99
136 End:
137 */
138 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :