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;
51 //GridManager grid_manager;
53 SPUnit const *gridunit;
54 /* Grid data is in points regardless of unit */
55 NR::Point gridorigin;
56 gdouble gridspacing[2];
57 gdouble gridangle[2]; // for axonometric grid
58 gint gridempspacing;
60 SPUnit const *doc_units;
62 SPUnit const *gridtoleranceunit;
63 gdouble gridtolerance;
65 SPUnit const *guidetoleranceunit;
66 gdouble guidetolerance;
68 SPUnit const *objecttoleranceunit;
69 gdouble objecttolerance;
71 bool has_abs_tolerance;
73 GQuark default_layer_id;
75 double connector_spacing;
77 guint32 gridcolor;
78 guint32 gridempcolor;
79 guint32 guidecolor;
80 guint32 guidehicolor;
81 guint32 bordercolor;
82 guint32 pagecolor;
83 guint32 pageshadow;
85 GSList *guides;
86 GSList *views;
87 GSList *gridviews;
89 gint viewcount;
91 void show(SPDesktop *desktop);
92 void hide(SPDesktop const *desktop);
93 void activateGuides(gpointer desktop, gboolean active);
94 gchar const *getName() const;
95 guint getViewCount();
96 GSList const *getViewList() const;
97 SPMetric getDefaultMetric() const;
98 };
100 struct SPNamedViewClass {
101 SPObjectGroupClass parent_class;
102 };
104 GType sp_namedview_get_type();
106 SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name);
108 void sp_namedview_window_from_document(SPDesktop *desktop);
109 void sp_namedview_document_from_window(SPDesktop *desktop);
110 void sp_namedview_update_layers_from_document (SPDesktop *desktop);
112 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
113 void sp_namedview_toggle_grid(SPDocument *doc, Inkscape::XML::Node *repr);
114 void sp_namedview_set_gridtype(unsigned int type, SPDocument *doc, Inkscape::XML::Node *repr);
116 #endif /* !INKSCAPE_SP_NAMEDVIEW_H */
119 /*
120 Local Variables:
121 mode:c++
122 c-file-style:"stroustrup"
123 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
124 indent-tabs-mode:nil
125 fill-column:99
126 End:
127 */
128 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :