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 guint32 gridcolor;
86 guint32 gridempcolor;
87 guint32 guidecolor;
88 guint32 guidehicolor;
89 guint32 bordercolor;
90 guint32 pagecolor;
91 guint32 pageshadow;
93 GSList *guides;
94 GSList *views;
95 GSList *gridviews;
96 gint viewcount;
98 void show(SPDesktop *desktop);
99 void hide(SPDesktop const *desktop);
100 void activateGuides(gpointer desktop, gboolean active);
101 gchar const *getName() const;
102 guint getViewCount();
103 GSList const *getViewList() const;
104 SPMetric getDefaultMetric() const;
106 typedef std::list<const Inkscape::Snapper *> SnapperList;
107 SnapperList getSnappers() const;
108 };
110 struct SPNamedViewClass {
111 SPObjectGroupClass parent_class;
112 };
114 GType sp_namedview_get_type();
116 SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name);
118 void sp_namedview_window_from_document(SPDesktop *desktop);
119 void sp_namedview_document_from_window(SPDesktop *desktop);
121 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
122 void sp_namedview_toggle_grid(SPDocument *doc, Inkscape::XML::Node *repr);
124 #endif /* !INKSCAPE_SP_NAMEDVIEW_H */
127 /*
128 Local Variables:
129 mode:c++
130 c-file-style:"stroustrup"
131 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
132 indent-tabs-mode:nil
133 fill-column:99
134 End:
135 */
136 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :