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 "sp-metric.h"
25 #include "snap.h"
26 #include "display/canvas-grid.h"
27 #include "document.h"
29 namespace Inkscape {
30 class CanvasGrid;
31 }
33 enum {
34 SP_BORDER_LAYER_BOTTOM,
35 SP_BORDER_LAYER_TOP
36 };
38 struct SPNamedView : public SPObjectGroup {
39 unsigned int editable : 1;
40 unsigned int showguides : 1;
41 unsigned int showborder : 1;
42 unsigned int showpageshadow : 1;
43 unsigned int borderlayer : 2;
45 double zoom;
46 double cx;
47 double cy;
48 gint window_width;
49 gint window_height;
50 gint window_x;
51 gint window_y;
52 gint window_maximized;
54 SnapManager snap_manager;
55 GSList * grids;
56 bool grids_visible;
58 SPUnit const *doc_units;
60 GQuark default_layer_id;
62 double connector_spacing;
64 guint32 guidecolor;
65 guint32 guidehicolor;
66 guint32 bordercolor;
67 guint32 pagecolor;
68 guint32 pageshadow;
70 GSList *guides;
71 GSList *views;
73 gint viewcount;
75 void show(SPDesktop *desktop);
76 void hide(SPDesktop const *desktop);
77 void activateGuides(gpointer desktop, gboolean active);
78 gchar const *getName() const;
79 guint getViewCount();
80 GSList const *getViewList() const;
81 SPMetric getDefaultMetric() const;
83 void translateGuides(Geom::Translate const &translation);
84 void scrollAllDesktops(double dx, double dy, bool is_scrolling);
85 void writeNewGrid(SPDocument *document,int gridtype);
86 bool getSnapGlobal() const;
87 void setSnapGlobal(bool v);
88 void setGuides(bool v);
90 private:
91 double getMarginLength(gchar const * const key,SPUnit const * const margin_units,SPUnit const * const return_units,double const width,double const height,bool const use_width);
92 friend class SPDocument;
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);
105 void sp_namedview_update_layers_from_document (SPDesktop *desktop);
107 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
108 void sp_namedview_show_grids(SPNamedView *namedview, bool show, bool dirty_document);
109 Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedview);
111 #endif /* !INKSCAPE_SP_NAMEDVIEW_H */
114 /*
115 Local Variables:
116 mode:c++
117 c-file-style:"stroustrup"
118 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
119 indent-tabs-mode:nil
120 fill-column:99
121 End:
122 */
123 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :