1 /*
2 * <sodipodi:namedview> implementation
3 *
4 * Authors:
5 * Lauris Kaplinski <lauris@kaplinski.com>
6 * bulia byak <buliabyak@users.sf.net>
7 * Jon A. Cruz <jon@joncruz.org>
8 * Abhishek Sharma
9 *
10 * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
11 * Copyright (C) 1999-2008 Authors
12 * Copyright (C) 2000-2001 Ximian, Inc.
13 *
14 * Released under GNU GPL, read the file 'COPYING' for more information
15 */
17 #include "config.h"
18 #include <cstring>
19 #include <string>
21 #include "display/canvas-grid.h"
22 #include "display/guideline.h"
23 #include "helper/units.h"
24 #include "svg/svg-color.h"
25 #include "xml/repr.h"
26 #include "attributes.h"
27 #include "document.h"
28 #include "desktop-events.h"
29 #include "desktop-handles.h"
30 #include "event-log.h"
31 #include "sp-guide.h"
32 #include "sp-item-group.h"
33 #include "sp-namedview.h"
34 #include "preferences.h"
35 #include "desktop.h"
36 #include "conn-avoid-ref.h" // for defaultConnSpacing.
38 using Inkscape::DocumentUndo;
40 #define DEFAULTGRIDCOLOR 0x3f3fff25
41 #define DEFAULTGRIDEMPCOLOR 0x3f3fff60
42 #define DEFAULTGRIDEMPSPACING 5
43 #define DEFAULTGUIDECOLOR 0x0000ff7f
44 #define DEFAULTGUIDEHICOLOR 0xff00007f
45 #define DEFAULTBORDERCOLOR 0x000000ff
46 #define DEFAULTPAGECOLOR 0xffffff00
48 static void sp_namedview_class_init(SPNamedViewClass *klass);
49 static void sp_namedview_init(SPNamedView *namedview);
51 static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
52 static void sp_namedview_release(SPObject *object);
53 static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *value);
54 static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
55 static void sp_namedview_remove_child(SPObject *object, Inkscape::XML::Node *child);
56 static Inkscape::XML::Node *sp_namedview_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
58 static void sp_namedview_setup_guides(SPNamedView * nv);
59 static void sp_namedview_show_single_guide(SPGuide* guide, bool show);
61 static gboolean sp_str_to_bool(const gchar *str);
62 static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color);
64 static SPObjectGroupClass * parent_class;
66 GType
67 sp_namedview_get_type()
68 {
69 static GType namedview_type = 0;
70 if (!namedview_type) {
71 GTypeInfo namedview_info = {
72 sizeof(SPNamedViewClass),
73 NULL, /* base_init */
74 NULL, /* base_finalize */
75 (GClassInitFunc) sp_namedview_class_init,
76 NULL, /* class_finalize */
77 NULL, /* class_data */
78 sizeof(SPNamedView),
79 16, /* n_preallocs */
80 (GInstanceInitFunc) sp_namedview_init,
81 NULL, /* value_table */
82 };
83 namedview_type = g_type_register_static(SP_TYPE_OBJECTGROUP, "SPNamedView", &namedview_info, (GTypeFlags)0);
84 }
85 return namedview_type;
86 }
88 static void sp_namedview_class_init(SPNamedViewClass * klass)
89 {
90 GObjectClass * gobject_class;
91 SPObjectClass * sp_object_class;
93 gobject_class = (GObjectClass *) klass;
94 sp_object_class = (SPObjectClass *) klass;
96 parent_class = (SPObjectGroupClass*) g_type_class_ref(SP_TYPE_OBJECTGROUP);
98 sp_object_class->build = sp_namedview_build;
99 sp_object_class->release = sp_namedview_release;
100 sp_object_class->set = sp_namedview_set;
101 sp_object_class->child_added = sp_namedview_child_added;
102 sp_object_class->remove_child = sp_namedview_remove_child;
103 sp_object_class->write = sp_namedview_write;
104 }
106 static void sp_namedview_init(SPNamedView *nv)
107 {
108 nv->editable = TRUE;
109 nv->showguides = TRUE;
110 nv->grids_visible = false;
111 nv->showborder = TRUE;
112 nv->showpageshadow = TRUE;
114 nv->guides = NULL;
115 nv->viewcount = 0;
116 nv->grids = NULL;
118 nv->default_layer_id = 0;
120 nv->connector_spacing = defaultConnSpacing;
122 new (&nv->snap_manager) SnapManager(nv);
123 }
125 static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *document, Inkscape::XML::Node *repr) {
126 bool old_grid_settings_present = false;
128 // set old settings
129 const char* gridspacingx = "1px";
130 const char* gridspacingy = "1px";
131 const char* gridoriginy = "0px";
132 const char* gridoriginx = "0px";
133 const char* gridempspacing = "5";
134 const char* gridcolor = "#0000ff";
135 const char* gridempcolor = "#0000ff";
136 const char* gridopacity = "0.2";
137 const char* gridempopacity = "0.4";
139 const char* value = NULL;
140 if ((value = repr->attribute("gridoriginx"))) {
141 gridspacingx = value;
142 old_grid_settings_present = true;
143 }
144 if ((value = repr->attribute("gridoriginy"))) {
145 gridoriginy = value;
146 old_grid_settings_present = true;
147 }
148 if ((value = repr->attribute("gridspacingx"))) {
149 gridspacingx = value;
150 old_grid_settings_present = true;
151 }
152 if ((value = repr->attribute("gridspacingy"))) {
153 gridspacingy = value;
154 old_grid_settings_present = true;
155 }
156 if ((value = repr->attribute("gridcolor"))) {
157 gridcolor = value;
158 old_grid_settings_present = true;
159 }
160 if ((value = repr->attribute("gridempcolor"))) {
161 gridempcolor = value;
162 old_grid_settings_present = true;
163 }
164 if ((value = repr->attribute("gridempspacing"))) {
165 gridempspacing = value;
166 old_grid_settings_present = true;
167 }
168 if ((value = repr->attribute("gridopacity"))) {
169 gridopacity = value;
170 old_grid_settings_present = true;
171 }
172 if ((value = repr->attribute("gridempopacity"))) {
173 gridempopacity = value;
174 old_grid_settings_present = true;
175 }
177 if (old_grid_settings_present) {
178 // generate new xy grid with the correct settings
179 // first create the child xml node, then hook it to repr. This order is important, to not set off listeners to repr before the new node is complete.
181 Inkscape::XML::Document *xml_doc = document->getReprDoc();
182 Inkscape::XML::Node *newnode = xml_doc->createElement("inkscape:grid");
183 newnode->setAttribute("id", "GridFromPre046Settings");
184 newnode->setAttribute("type", Inkscape::CanvasGrid::getSVGName(Inkscape::GRID_RECTANGULAR));
185 newnode->setAttribute("originx", gridoriginx);
186 newnode->setAttribute("originy", gridoriginy);
187 newnode->setAttribute("spacingx", gridspacingx);
188 newnode->setAttribute("spacingy", gridspacingy);
189 newnode->setAttribute("color", gridcolor);
190 newnode->setAttribute("empcolor", gridempcolor);
191 newnode->setAttribute("opacity", gridopacity);
192 newnode->setAttribute("empopacity", gridempopacity);
193 newnode->setAttribute("empspacing", gridempspacing);
195 repr->appendChild(newnode);
196 Inkscape::GC::release(newnode);
198 // remove all old settings
199 repr->setAttribute("gridoriginx", NULL);
200 repr->setAttribute("gridoriginy", NULL);
201 repr->setAttribute("gridspacingx", NULL);
202 repr->setAttribute("gridspacingy", NULL);
203 repr->setAttribute("gridcolor", NULL);
204 repr->setAttribute("gridempcolor", NULL);
205 repr->setAttribute("gridopacity", NULL);
206 repr->setAttribute("gridempopacity", NULL);
207 repr->setAttribute("gridempspacing", NULL);
209 // SPDocumentUndo::done(doc, SP_VERB_DIALOG_NAMEDVIEW, _("Create new grid from pre0.46 grid settings"));
210 }
211 }
213 static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
214 {
215 SPNamedView *nv = (SPNamedView *) object;
216 SPObjectGroup *og = (SPObjectGroup *) object;
218 if (((SPObjectClass *) (parent_class))->build) {
219 (* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
220 }
222 object->readAttr( "inkscape:document-units" );
223 object->readAttr( "units" );
224 object->readAttr( "viewonly" );
225 object->readAttr( "showguides" );
226 object->readAttr( "showgrid" );
227 object->readAttr( "gridtolerance" );
228 object->readAttr( "guidetolerance" );
229 object->readAttr( "objecttolerance" );
230 object->readAttr( "guidecolor" );
231 object->readAttr( "guideopacity" );
232 object->readAttr( "guidehicolor" );
233 object->readAttr( "guidehiopacity" );
234 object->readAttr( "showborder" );
235 object->readAttr( "inkscape:showpageshadow" );
236 object->readAttr( "borderlayer" );
237 object->readAttr( "bordercolor" );
238 object->readAttr( "borderopacity" );
239 object->readAttr( "pagecolor" );
240 object->readAttr( "inkscape:pageopacity" );
241 object->readAttr( "inkscape:pageshadow" );
242 object->readAttr( "inkscape:zoom" );
243 object->readAttr( "inkscape:cx" );
244 object->readAttr( "inkscape:cy" );
245 object->readAttr( "inkscape:window-width" );
246 object->readAttr( "inkscape:window-height" );
247 object->readAttr( "inkscape:window-x" );
248 object->readAttr( "inkscape:window-y" );
249 object->readAttr( "inkscape:window-maximized" );
250 object->readAttr( "inkscape:snap-global" );
251 object->readAttr( "inkscape:snap-bbox" );
252 object->readAttr( "inkscape:snap-nodes" );
253 object->readAttr( "inkscape:snap-from-guide" );
254 object->readAttr( "inkscape:snap-center" );
255 object->readAttr( "inkscape:snap-smooth-nodes" );
256 object->readAttr( "inkscape:snap-midpoints" );
257 object->readAttr( "inkscape:snap-object-midpoints" );
258 object->readAttr( "inkscape:snap-bbox-edge-midpoints" );
259 object->readAttr( "inkscape:snap-bbox-midpoints" );
260 object->readAttr( "inkscape:snap-to-guides" );
261 object->readAttr( "inkscape:snap-grids" );
262 object->readAttr( "inkscape:snap-intersection-paths" );
263 object->readAttr( "inkscape:object-paths" );
264 object->readAttr( "inkscape:object-nodes" );
265 object->readAttr( "inkscape:bbox-paths" );
266 object->readAttr( "inkscape:bbox-nodes" );
267 object->readAttr( "inkscape:snap-page" );
268 object->readAttr( "inkscape:current-layer" );
269 object->readAttr( "inkscape:connector-spacing" );
271 /* Construct guideline list */
272 for (SPObject *o = SP_OBJECT(og)->firstChild() ; o; o = o->getNext() ) {
273 if (SP_IS_GUIDE(o)) {
274 SPGuide * g = SP_GUIDE(o);
275 nv->guides = g_slist_prepend(nv->guides, g);
276 g_object_set(G_OBJECT(g), "color", nv->guidecolor, "hicolor", nv->guidehicolor, NULL);
277 }
278 }
280 // backwards compatibility with grid settings (pre 0.46)
281 sp_namedview_generate_old_grid(nv, document, repr);
282 }
284 static void sp_namedview_release(SPObject *object)
285 {
286 SPNamedView *namedview = (SPNamedView *) object;
288 if (namedview->guides) {
289 g_slist_free(namedview->guides);
290 namedview->guides = NULL;
291 }
293 // delete grids:
294 while ( namedview->grids ) {
295 Inkscape::CanvasGrid *gr = (Inkscape::CanvasGrid *)namedview->grids->data; // get first entry
296 delete gr;
297 namedview->grids = g_slist_remove_link(namedview->grids, namedview->grids); // deletes first entry
298 }
300 if (((SPObjectClass *) parent_class)->release) {
301 ((SPObjectClass *) parent_class)->release(object);
302 }
304 namedview->snap_manager.~SnapManager();
305 }
307 static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *value)
308 {
309 SPNamedView *nv = SP_NAMEDVIEW(object);
310 // TODO investigate why we grab this and then never use it
311 SPUnit const &px = sp_unit_get_by_id(SP_UNIT_PX);
313 switch (key) {
314 case SP_ATTR_VIEWONLY:
315 nv->editable = (!value);
316 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
317 break;
318 case SP_ATTR_SHOWGUIDES:
319 if (!value) { // show guides if not specified, for backwards compatibility
320 nv->showguides = TRUE;
321 } else {
322 nv->showguides = sp_str_to_bool(value);
323 }
324 sp_namedview_setup_guides(nv);
325 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
326 break;
327 case SP_ATTR_SHOWGRIDS:
328 if (!value) { // don't show grids if not specified, for backwards compatibility
329 nv->grids_visible = false;
330 } else {
331 nv->grids_visible = sp_str_to_bool(value);
332 }
333 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
334 break;
335 case SP_ATTR_GRIDTOLERANCE:
336 nv->snap_manager.snapprefs.setGridTolerance(value ? g_ascii_strtod(value, NULL) : 10000);
337 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
338 break;
339 case SP_ATTR_GUIDETOLERANCE:
340 nv->snap_manager.snapprefs.setGuideTolerance(value ? g_ascii_strtod(value, NULL) : 20);
341 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
342 break;
343 case SP_ATTR_OBJECTTOLERANCE:
344 nv->snap_manager.snapprefs.setObjectTolerance(value ? g_ascii_strtod(value, NULL) : 20);
345 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
346 break;
347 case SP_ATTR_GUIDECOLOR:
348 nv->guidecolor = (nv->guidecolor & 0xff) | (DEFAULTGUIDECOLOR & 0xffffff00);
349 if (value) {
350 nv->guidecolor = (nv->guidecolor & 0xff) | sp_svg_read_color(value, nv->guidecolor);
351 }
352 for (GSList *l = nv->guides; l != NULL; l = l->next) {
353 g_object_set(G_OBJECT(l->data), "color", nv->guidecolor, NULL);
354 }
355 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
356 break;
357 case SP_ATTR_GUIDEOPACITY:
358 nv->guidecolor = (nv->guidecolor & 0xffffff00) | (DEFAULTGUIDECOLOR & 0xff);
359 sp_nv_read_opacity(value, &nv->guidecolor);
360 for (GSList *l = nv->guides; l != NULL; l = l->next) {
361 g_object_set(G_OBJECT(l->data), "color", nv->guidecolor, NULL);
362 }
363 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
364 break;
365 case SP_ATTR_GUIDEHICOLOR:
366 nv->guidehicolor = (nv->guidehicolor & 0xff) | (DEFAULTGUIDEHICOLOR & 0xffffff00);
367 if (value) {
368 nv->guidehicolor = (nv->guidehicolor & 0xff) | sp_svg_read_color(value, nv->guidehicolor);
369 }
370 for (GSList *l = nv->guides; l != NULL; l = l->next) {
371 g_object_set(G_OBJECT(l->data), "hicolor", nv->guidehicolor, NULL);
372 }
373 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
374 break;
375 case SP_ATTR_GUIDEHIOPACITY:
376 nv->guidehicolor = (nv->guidehicolor & 0xffffff00) | (DEFAULTGUIDEHICOLOR & 0xff);
377 sp_nv_read_opacity(value, &nv->guidehicolor);
378 for (GSList *l = nv->guides; l != NULL; l = l->next) {
379 g_object_set(G_OBJECT(l->data), "hicolor", nv->guidehicolor, NULL);
380 }
381 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
382 break;
383 case SP_ATTR_SHOWBORDER:
384 nv->showborder = (value) ? sp_str_to_bool (value) : TRUE;
385 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
386 break;
387 case SP_ATTR_BORDERLAYER:
388 nv->borderlayer = SP_BORDER_LAYER_BOTTOM;
389 if (value && !strcasecmp(value, "true")) nv->borderlayer = SP_BORDER_LAYER_TOP;
390 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
391 break;
392 case SP_ATTR_BORDERCOLOR:
393 nv->bordercolor = (nv->bordercolor & 0xff) | (DEFAULTBORDERCOLOR & 0xffffff00);
394 if (value) {
395 nv->bordercolor = (nv->bordercolor & 0xff) | sp_svg_read_color (value, nv->bordercolor);
396 }
397 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
398 break;
399 case SP_ATTR_BORDEROPACITY:
400 nv->bordercolor = (nv->bordercolor & 0xffffff00) | (DEFAULTBORDERCOLOR & 0xff);
401 sp_nv_read_opacity(value, &nv->bordercolor);
402 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
403 break;
404 case SP_ATTR_PAGECOLOR:
405 nv->pagecolor = (nv->pagecolor & 0xff) | (DEFAULTPAGECOLOR & 0xffffff00);
406 if (value) {
407 nv->pagecolor = (nv->pagecolor & 0xff) | sp_svg_read_color(value, nv->pagecolor);
408 }
409 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
410 break;
411 case SP_ATTR_INKSCAPE_PAGEOPACITY:
412 nv->pagecolor = (nv->pagecolor & 0xffffff00) | (DEFAULTPAGECOLOR & 0xff);
413 sp_nv_read_opacity(value, &nv->pagecolor);
414 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
415 break;
416 case SP_ATTR_INKSCAPE_PAGESHADOW:
417 nv->pageshadow = value? atoi(value) : 2; // 2 is the default
418 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
419 break;
420 case SP_ATTR_SHOWPAGESHADOW:
421 nv->showpageshadow = (value) ? sp_str_to_bool(value) : TRUE;
422 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
423 break;
424 case SP_ATTR_INKSCAPE_ZOOM:
425 nv->zoom = value ? g_ascii_strtod(value, NULL) : 0; // zero means not set
426 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
427 break;
428 case SP_ATTR_INKSCAPE_CX:
429 nv->cx = value ? g_ascii_strtod(value, NULL) : HUGE_VAL; // HUGE_VAL means not set
430 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
431 break;
432 case SP_ATTR_INKSCAPE_CY:
433 nv->cy = value ? g_ascii_strtod(value, NULL) : HUGE_VAL; // HUGE_VAL means not set
434 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
435 break;
436 case SP_ATTR_INKSCAPE_WINDOW_WIDTH:
437 nv->window_width = value? atoi(value) : -1; // -1 means not set
438 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
439 break;
440 case SP_ATTR_INKSCAPE_WINDOW_HEIGHT:
441 nv->window_height = value ? atoi(value) : -1; // -1 means not set
442 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
443 break;
444 case SP_ATTR_INKSCAPE_WINDOW_X:
445 nv->window_x = value ? atoi(value) : 0;
446 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
447 break;
448 case SP_ATTR_INKSCAPE_WINDOW_Y:
449 nv->window_y = value ? atoi(value) : 0;
450 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
451 break;
452 case SP_ATTR_INKSCAPE_WINDOW_MAXIMIZED:
453 nv->window_maximized = value ? atoi(value) : 0;
454 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
455 break;
456 case SP_ATTR_INKSCAPE_SNAP_GLOBAL:
457 nv->snap_manager.snapprefs.setSnapEnabledGlobally(value ? sp_str_to_bool(value) : TRUE);
458 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
459 break;
460 case SP_ATTR_INKSCAPE_SNAP_BBOX:
461 nv->snap_manager.snapprefs.setSnapModeBBox(value ? sp_str_to_bool(value) : FALSE);
462 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
463 break;
464 case SP_ATTR_INKSCAPE_SNAP_NODES:
465 nv->snap_manager.snapprefs.setSnapModeNode(value ? sp_str_to_bool(value) : TRUE);
466 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
467 break;
468 case SP_ATTR_INKSCAPE_SNAP_CENTER:
469 nv->snap_manager.snapprefs.setIncludeItemCenter(value ? sp_str_to_bool(value) : FALSE);
470 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
471 break;
472 case SP_ATTR_INKSCAPE_SNAP_GRIDS:
473 nv->snap_manager.snapprefs.setSnapToGrids(value ? sp_str_to_bool(value) : TRUE);
474 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
475 break;
476 case SP_ATTR_INKSCAPE_SNAP_TO_GUIDES:
477 nv->snap_manager.snapprefs.setSnapToGuides(value ? sp_str_to_bool(value) : TRUE);
478 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
479 break;
480 case SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES:
481 nv->snap_manager.snapprefs.setSnapSmoothNodes(value ? sp_str_to_bool(value) : FALSE);
482 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
483 break;
484 case SP_ATTR_INKSCAPE_SNAP_LINE_MIDPOINTS:
485 nv->snap_manager.snapprefs.setSnapLineMidpoints(value ? sp_str_to_bool(value) : FALSE);
486 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
487 break;
488 case SP_ATTR_INKSCAPE_SNAP_OBJECT_MIDPOINTS:
489 nv->snap_manager.snapprefs.setSnapObjectMidpoints(value ? sp_str_to_bool(value) : FALSE);
490 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
491 break;
492 case SP_ATTR_INKSCAPE_SNAP_BBOX_EDGE_MIDPOINTS:
493 nv->snap_manager.snapprefs.setSnapBBoxEdgeMidpoints(value ? sp_str_to_bool(value) : FALSE);
494 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
495 break;
496 case SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS:
497 nv->snap_manager.snapprefs.setSnapBBoxMidpoints(value ? sp_str_to_bool(value) : FALSE);
498 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
499 break;
500 case SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE:
501 nv->snap_manager.snapprefs.setSnapModeGuide(value ? sp_str_to_bool(value) : TRUE);
502 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
503 break;
504 case SP_ATTR_INKSCAPE_SNAP_INTERS_PATHS:
505 nv->snap_manager.snapprefs.setSnapIntersectionCS(value ? sp_str_to_bool(value) : FALSE);
506 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
507 break;
508 case SP_ATTR_INKSCAPE_OBJECT_PATHS:
509 nv->snap_manager.snapprefs.setSnapToItemPath(value ? sp_str_to_bool(value) : FALSE);
510 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
511 break;
512 case SP_ATTR_INKSCAPE_OBJECT_NODES:
513 nv->snap_manager.snapprefs.setSnapToItemNode(value ? sp_str_to_bool(value) : FALSE);
514 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
515 break;
516 case SP_ATTR_INKSCAPE_BBOX_PATHS:
517 nv->snap_manager.snapprefs.setSnapToBBoxPath(value ? sp_str_to_bool(value) : FALSE);
518 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
519 break;
520 case SP_ATTR_INKSCAPE_BBOX_NODES:
521 nv->snap_manager.snapprefs.setSnapToBBoxNode(value ? sp_str_to_bool(value) : FALSE);
522 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
523 break;
524 case SP_ATTR_INKSCAPE_SNAP_PAGE:
525 nv->snap_manager.snapprefs.setSnapToPageBorder(value ? sp_str_to_bool(value) : FALSE);
526 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
527 break;
528 case SP_ATTR_INKSCAPE_CURRENT_LAYER:
529 nv->default_layer_id = value ? g_quark_from_string(value) : 0;
530 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
531 break;
532 case SP_ATTR_INKSCAPE_CONNECTOR_SPACING:
533 nv->connector_spacing = value ? g_ascii_strtod(value, NULL) :
534 defaultConnSpacing;
535 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
536 break;
537 case SP_ATTR_INKSCAPE_DOCUMENT_UNITS: {
538 /* The default unit if the document doesn't override this: e.g. for files saved as
539 * `plain SVG', or non-inkscape files, or files created by an inkscape 0.40 &
540 * earlier.
541 *
542 * Here we choose `px': useful for screen-destined SVGs, and fewer bug reports
543 * about "not the same numbers as what's in the SVG file" (at least for documents
544 * without a viewBox attribute on the root <svg> element). Similarly, it's also
545 * the most reliable unit (i.e. least likely to be wrong in different viewing
546 * conditions) for viewBox-less SVG files given that it's the unit that inkscape
547 * uses for all coordinates.
548 *
549 * For documents that do have a viewBox attribute on the root <svg> element, it
550 * might be better if we used either viewBox coordinates or if we used the unit of
551 * say the width attribute of the root <svg> element. However, these pose problems
552 * in that they aren't in general absolute units as currently required by
553 * doc_units.
554 */
555 SPUnit const *new_unit = &sp_unit_get_by_id(SP_UNIT_PX);
557 if (value) {
558 SPUnit const *const req_unit = sp_unit_get_by_abbreviation(value);
559 if ( req_unit == NULL ) {
560 g_warning("Unrecognized unit `%s'", value);
561 /* fixme: Document errors should be reported in the status bar or
562 * the like (e.g. as per
563 * http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing); g_log
564 * should be only for programmer errors. */
565 } else if ( req_unit->base == SP_UNIT_ABSOLUTE ||
566 req_unit->base == SP_UNIT_DEVICE ) {
567 new_unit = req_unit;
568 } else {
569 g_warning("Document units must be absolute like `mm', `pt' or `px', but found `%s'",
570 value);
571 /* fixme: Don't use g_log (see above). */
572 }
573 }
574 nv->doc_units = new_unit;
575 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
576 break;
577 }
578 case SP_ATTR_UNITS: {
579 SPUnit const *new_unit = NULL;
581 if (value) {
582 SPUnit const *const req_unit = sp_unit_get_by_abbreviation(value);
583 if ( req_unit == NULL ) {
584 g_warning("Unrecognized unit `%s'", value);
585 /* fixme: Document errors should be reported in the status bar or
586 * the like (e.g. as per
587 * http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing); g_log
588 * should be only for programmer errors. */
589 } else if ( req_unit->base == SP_UNIT_ABSOLUTE ||
590 req_unit->base == SP_UNIT_DEVICE ) {
591 new_unit = req_unit;
592 } else {
593 g_warning("Document units must be absolute like `mm', `pt' or `px', but found `%s'",
594 value);
595 /* fixme: Don't use g_log (see above). */
596 }
597 }
598 nv->units = new_unit;
599 object->requestModified(SP_OBJECT_MODIFIED_FLAG);
600 break;
601 }
602 default:
603 if (((SPObjectClass *) (parent_class))->set) {
604 ((SPObjectClass *) (parent_class))->set(object, key, value);
605 }
606 break;
607 }
608 }
610 /**
611 * add a grid item from SVG-repr. Check if this namedview already has a gridobject for this one! If desktop=null, add grid-canvasitem to all desktops of this namedview,
612 * otherwise only add it to the specified desktop.
613 */
614 static Inkscape::CanvasGrid*
615 sp_namedview_add_grid(SPNamedView *nv, Inkscape::XML::Node *repr, SPDesktop *desktop) {
616 Inkscape::CanvasGrid* grid = NULL;
617 //check if namedview already has an object for this grid
618 for (GSList *l = nv->grids; l != NULL; l = l->next) {
619 Inkscape::CanvasGrid* g = (Inkscape::CanvasGrid*) l->data;
620 if (repr == g->repr) {
621 grid = g;
622 break;
623 }
624 }
626 if (!grid) {
627 //create grid object
628 Inkscape::GridType gridtype = Inkscape::CanvasGrid::getGridTypeFromSVGName(repr->attribute("type"));
629 if (!nv->document) {
630 g_warning("sp_namedview_add_grid - how come doc is null here?!");
631 return NULL;
632 }
633 grid = Inkscape::CanvasGrid::NewGrid(nv, repr, nv->document, gridtype);
634 nv->grids = g_slist_append(nv->grids, grid);
635 }
637 if (!desktop) {
638 //add canvasitem to all desktops
639 for (GSList *l = nv->views; l != NULL; l = l->next) {
640 SPDesktop *dt = static_cast<SPDesktop*>(l->data);
641 grid->createCanvasItem(dt);
642 }
643 } else {
644 //add canvasitem only for specified desktop
645 grid->createCanvasItem(desktop);
646 }
648 return grid;
649 }
651 static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
652 {
653 SPNamedView *nv = (SPNamedView *) object;
655 if (((SPObjectClass *) (parent_class))->child_added) {
656 (* ((SPObjectClass *) (parent_class))->child_added)(object, child, ref);
657 }
659 if (!strcmp(child->name(), "inkscape:grid")) {
660 sp_namedview_add_grid(nv, child, NULL);
661 } else {
662 SPObject *no = object->document->getObjectByRepr(child);
663 if ( !SP_IS_OBJECT(no) )
664 return;
666 if (SP_IS_GUIDE(no)) {
667 SPGuide *g = (SPGuide *) no;
668 nv->guides = g_slist_prepend(nv->guides, g);
669 g_object_set(G_OBJECT(g), "color", nv->guidecolor, "hicolor", nv->guidehicolor, NULL);
670 if (nv->editable) {
671 for (GSList *l = nv->views; l != NULL; l = l->next) {
672 g->SPGuide::showSPGuide(static_cast<SPDesktop*>(l->data)->guides, (GCallback) sp_dt_guide_event);
673 if (static_cast<SPDesktop*>(l->data)->guides_active)
674 g->sensitize(sp_desktop_canvas(static_cast<SPDesktop*> (l->data)),
675 TRUE);
676 sp_namedview_show_single_guide(SP_GUIDE(g), nv->showguides);
677 }
678 }
679 }
680 }
681 }
683 static void sp_namedview_remove_child(SPObject *object, Inkscape::XML::Node *child)
684 {
685 SPNamedView *nv = (SPNamedView *) object;
687 if (!strcmp(child->name(), "inkscape:grid")) {
688 for ( GSList *iter = nv->grids ; iter ; iter = iter->next ) {
689 Inkscape::CanvasGrid *gr = (Inkscape::CanvasGrid *)iter->data;
690 if ( gr->repr == child ) {
691 delete gr;
692 nv->grids = g_slist_remove_link(nv->grids, iter);
693 break;
694 }
695 }
696 } else {
697 GSList **ref = &nv->guides;
698 for ( GSList *iter = nv->guides ; iter ; iter = iter->next ) {
699 if ( SP_OBJECT_REPR((SPObject *)iter->data) == child ) {
700 *ref = iter->next;
701 iter->next = NULL;
702 g_slist_free_1(iter);
703 break;
704 }
705 ref = &iter->next;
706 }
707 }
709 if (((SPObjectClass *) (parent_class))->remove_child) {
710 (* ((SPObjectClass *) (parent_class))->remove_child)(object, child);
711 }
712 }
714 static Inkscape::XML::Node *sp_namedview_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
715 {
716 if ( ( flags & SP_OBJECT_WRITE_EXT ) &&
717 repr != SP_OBJECT_REPR(object) )
718 {
719 if (repr) {
720 repr->mergeFrom(SP_OBJECT_REPR(object), "id");
721 } else {
722 repr = SP_OBJECT_REPR(object)->duplicate(doc);
723 }
724 }
726 return repr;
727 }
729 void SPNamedView::show(SPDesktop *desktop)
730 {
731 for (GSList *l = guides; l != NULL; l = l->next) {
732 SP_GUIDE(l->data)->showSPGuide( desktop->guides, (GCallback) sp_dt_guide_event);
733 if (desktop->guides_active) {
734 SP_GUIDE(l->data)->sensitize(sp_desktop_canvas(desktop), TRUE);
735 }
736 sp_namedview_show_single_guide(SP_GUIDE(l->data), showguides);
737 }
739 views = g_slist_prepend(views, desktop);
741 // generate grids specified in SVG:
742 Inkscape::XML::Node *repr = SP_OBJECT_REPR(this);
743 if (repr) {
744 for (Inkscape::XML::Node * child = repr->firstChild() ; child != NULL; child = child->next() ) {
745 if (!strcmp(child->name(), "inkscape:grid")) {
746 sp_namedview_add_grid(this, child, desktop);
747 }
748 }
749 }
751 desktop->showGrids(grids_visible, false);
752 }
754 #define MIN_ONSCREEN_DISTANCE 50
756 void SPNamedView::writeNewGrid(SPDocument *document,int gridtype)
757 {
758 g_assert(this->getRepr() != NULL);
759 Inkscape::CanvasGrid::writeNewGridToRepr(this->getRepr(),document,static_cast<Inkscape::GridType>(gridtype));
760 }
762 /*
763 * Restores window geometry from the document settings or defaults in prefs
764 */
765 void sp_namedview_window_from_document(SPDesktop *desktop)
766 {
767 SPNamedView *nv = desktop->namedview;
768 Inkscape::Preferences *prefs = Inkscape::Preferences::get();
769 bool geometry_from_file = prefs->getBool("/options/savewindowgeometry/value");
771 // restore window size and position stored with the document
772 if (geometry_from_file) {
773 if (nv->window_maximized) {
774 Gtk::Window *win = desktop->getToplevel();
775 if (win){
776 win->maximize();
777 }
778 } else {
779 gint w = MIN(gdk_screen_width(), nv->window_width);
780 gint h = MIN(gdk_screen_height(), nv->window_height);
781 // prevent the window from moving off the screen to the right or to the bottom
782 gint x = MIN(gdk_screen_width() - MIN_ONSCREEN_DISTANCE, nv->window_x);
783 gint y = MIN(gdk_screen_height() - MIN_ONSCREEN_DISTANCE, nv->window_y);
784 // prevent the window from moving off the screen to the left or to the top
785 x = MAX(MIN_ONSCREEN_DISTANCE - nv->window_width, x);
786 y = MAX(MIN_ONSCREEN_DISTANCE - nv->window_height, y);
787 if (w>0 && h>0) {
788 desktop->setWindowSize(w, h);
789 desktop->setWindowPosition(Geom::Point(x, y));
790 }
791 }
792 }
794 // restore zoom and view
795 if (nv->zoom != 0 && nv->zoom != HUGE_VAL && !IS_NAN(nv->zoom)
796 && nv->cx != HUGE_VAL && !IS_NAN(nv->cx)
797 && nv->cy != HUGE_VAL && !IS_NAN(nv->cy)) {
798 desktop->zoom_absolute(nv->cx, nv->cy, nv->zoom);
799 } else if (sp_desktop_document(desktop)) { // document without saved zoom, zoom to its page
800 desktop->zoom_page();
801 }
803 // cancel any history of zooms up to this point
804 if (desktop->zooms_past) {
805 g_list_free(desktop->zooms_past);
806 desktop->zooms_past = NULL;
807 }
808 }
810 bool SPNamedView::getSnapGlobal() const
811 {
812 return this->snap_manager.snapprefs.getSnapEnabledGlobally();
813 }
815 void SPNamedView::setSnapGlobal(bool v)
816 {
817 g_assert(this->getRepr() != NULL);
818 sp_repr_set_boolean(this->getRepr(), "inkscape:snap-global", v);
819 }
821 void sp_namedview_update_layers_from_document (SPDesktop *desktop)
822 {
823 SPObject *layer = NULL;
824 SPDocument *document = desktop->doc();
825 SPNamedView *nv = desktop->namedview;
826 if ( nv->default_layer_id != 0 ) {
827 layer = document->getObjectById(g_quark_to_string(nv->default_layer_id));
828 }
829 // don't use that object if it's not at least group
830 if ( !layer || !SP_IS_GROUP(layer) ) {
831 layer = NULL;
832 }
833 // if that didn't work out, look for the topmost layer
834 if (!layer) {
835 for ( SPObject *iter = document->getRoot()->firstChild(); iter ; iter = iter->getNext() ) {
836 if (desktop->isLayer(iter)) {
837 layer = iter;
838 }
839 }
840 }
841 if (layer) {
842 desktop->setCurrentLayer(layer);
843 }
845 // FIXME: find a better place to do this
846 desktop->event_log->updateUndoVerbs();
847 }
849 void sp_namedview_document_from_window(SPDesktop *desktop)
850 {
851 Inkscape::Preferences *prefs = Inkscape::Preferences::get();
852 bool save_geometry_in_file = prefs->getBool("/options/savewindowgeometry/value", 0);
853 Inkscape::XML::Node *view = SP_OBJECT_REPR(desktop->namedview);
854 Geom::Rect const r = desktop->get_display_area();
856 // saving window geometry is not undoable
857 bool saved = DocumentUndo::getUndoSensitive(sp_desktop_document(desktop));
858 DocumentUndo::setUndoSensitive(sp_desktop_document(desktop), false);
860 sp_repr_set_svg_double(view, "inkscape:zoom", desktop->current_zoom());
861 sp_repr_set_svg_double(view, "inkscape:cx", r.midpoint()[Geom::X]);
862 sp_repr_set_svg_double(view, "inkscape:cy", r.midpoint()[Geom::Y]);
864 if (save_geometry_in_file) {
865 gint w, h, x, y;
866 desktop->getWindowGeometry(x, y, w, h);
867 sp_repr_set_int(view, "inkscape:window-width", w);
868 sp_repr_set_int(view, "inkscape:window-height", h);
869 sp_repr_set_int(view, "inkscape:window-x", x);
870 sp_repr_set_int(view, "inkscape:window-y", y);
871 sp_repr_set_int(view, "inkscape:window-maximized", desktop->is_maximized());
872 }
874 view->setAttribute("inkscape:current-layer", desktop->currentLayer()->getId());
876 // restore undoability
877 DocumentUndo::setUndoSensitive(sp_desktop_document(desktop), saved);
878 }
880 void SPNamedView::hide(SPDesktop const *desktop)
881 {
882 g_assert(desktop != NULL);
883 g_assert(g_slist_find(views, desktop));
885 for (GSList *l = guides; l != NULL; l = l->next) {
886 SP_GUIDE(l->data)->hideSPGuide(sp_desktop_canvas(desktop));
887 }
889 views = g_slist_remove(views, desktop);
890 }
892 void SPNamedView::activateGuides(gpointer desktop, gboolean active)
893 {
894 g_assert(desktop != NULL);
895 g_assert(g_slist_find(views, desktop));
897 SPDesktop *dt = static_cast<SPDesktop*>(desktop);
899 for (GSList *l = guides; l != NULL; l = l->next) {
900 SP_GUIDE(l->data)->sensitize( sp_desktop_canvas(dt), active);
901 }
902 }
904 static void sp_namedview_setup_guides(SPNamedView *nv)
905 {
906 for (GSList *l = nv->guides; l != NULL; l = l->next) {
907 sp_namedview_show_single_guide(SP_GUIDE(l->data), nv->showguides);
908 }
909 }
911 static void sp_namedview_show_single_guide(SPGuide* guide, bool show)
912 {
913 for (GSList *v = guide->views; v != NULL; v = v->next) {
914 if (show) {
915 sp_canvas_item_show(SP_CANVAS_ITEM(v->data));
916 sp_canvas_item_show(SP_CANVAS_ITEM(SP_GUIDELINE(v->data)->origin));
917 } else {
918 sp_canvas_item_hide(SP_CANVAS_ITEM(v->data));
919 sp_canvas_item_hide(SP_CANVAS_ITEM(SP_GUIDELINE(v->data)->origin));
920 }
921 }
922 }
924 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr)
925 {
926 unsigned int v;
927 unsigned int set = sp_repr_get_boolean(repr, "showguides", &v);
928 if (!set) { // hide guides if not specified, for backwards compatibility
929 v = FALSE;
930 } else {
931 v = !v;
932 }
934 bool saved = DocumentUndo::getUndoSensitive(doc);
935 DocumentUndo::setUndoSensitive(doc, false);
936 sp_repr_set_boolean(repr, "showguides", v);
937 DocumentUndo::setUndoSensitive(doc, saved);
939 doc->setModifiedSinceSave();
940 }
942 void sp_namedview_show_grids(SPNamedView * namedview, bool show, bool dirty_document)
943 {
944 namedview->grids_visible = show;
946 SPDocument *doc = SP_OBJECT_DOCUMENT (namedview);
947 Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview);
949 bool saved = DocumentUndo::getUndoSensitive(doc);
950 DocumentUndo::setUndoSensitive(doc, false);
951 sp_repr_set_boolean(repr, "showgrid", namedview->grids_visible);
952 DocumentUndo::setUndoSensitive(doc, saved);
954 /* we don't want the document to get dirty on startup; that's when
955 we call this function with dirty_document = false */
956 if (dirty_document) {
957 doc->setModifiedSinceSave();
958 }
959 }
961 gchar const *SPNamedView::getName() const
962 {
963 SPException ex;
964 SP_EXCEPTION_INIT(&ex);
965 return SP_OBJECT(this)->getAttribute("id", &ex);
966 }
968 guint SPNamedView::getViewCount()
969 {
970 return ++viewcount;
971 }
973 GSList const *SPNamedView::getViewList() const
974 {
975 return views;
976 }
978 /* This should be moved somewhere */
980 static gboolean sp_str_to_bool(const gchar *str)
981 {
982 if (str) {
983 if (!g_strcasecmp(str, "true") ||
984 !g_strcasecmp(str, "yes") ||
985 !g_strcasecmp(str, "y") ||
986 (atoi(str) != 0)) {
987 return TRUE;
988 }
989 }
991 return FALSE;
992 }
994 static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color)
995 {
996 if (!str) {
997 return FALSE;
998 }
1000 gchar *u;
1001 gdouble v = g_ascii_strtod(str, &u);
1002 if (!u) {
1003 return FALSE;
1004 }
1005 v = CLAMP(v, 0.0, 1.0);
1007 *color = (*color & 0xffffff00) | (guint32) floor(v * 255.9999);
1009 return TRUE;
1010 }
1012 SPNamedView *sp_document_namedview(SPDocument *document, const gchar *id)
1013 {
1014 g_return_val_if_fail(document != NULL, NULL);
1016 SPObject *nv = sp_item_group_get_child_by_name((SPGroup *) document->root, NULL, "sodipodi:namedview");
1017 g_assert(nv != NULL);
1019 if (id == NULL) {
1020 return (SPNamedView *) nv;
1021 }
1023 while (nv && strcmp(nv->getId(), id)) {
1024 nv = sp_item_group_get_child_by_name((SPGroup *) document->root, nv, "sodipodi:namedview");
1025 }
1027 return (SPNamedView *) nv;
1028 }
1030 void SPNamedView::setGuides(bool v)
1031 {
1032 g_assert(this->getRepr() != NULL);
1033 sp_repr_set_boolean(this->getRepr(), "showguides", v);
1034 sp_repr_set_boolean(this->getRepr(), "inkscape:guide-bbox", v);
1035 }
1037 /**
1038 * Gets page fitting margin information from the namedview node in the XML.
1039 * \param nv_repr reference to this document's namedview
1040 * \param key the same key used by the RegisteredScalarUnit in
1041 * ui/widget/page-sizer.cpp
1042 * \param margin_units units for the margin
1043 * \param return_units units to return the result in
1044 * \param width width in px (for percentage margins)
1045 * \param height height in px (for percentage margins)
1046 * \param use_width true if the this key is left or right margins, false
1047 * otherwise. Used for percentage margins.
1048 * \return the margin size in px, else 0.0 if anything is invalid.
1049 */
1050 double SPNamedView::getMarginLength(gchar const * const key,
1051 SPUnit const * const margin_units,
1052 SPUnit const * const return_units,
1053 double const width,
1054 double const height,
1055 bool const use_width)
1056 {
1057 double value;
1058 if(!this->storeAsDouble(key,&value)) {
1059 return 0.0;
1060 }
1061 if (margin_units == &sp_unit_get_by_id (SP_UNIT_PERCENT)) {
1062 return (use_width)? width * value : height * value;
1063 }
1064 if (!sp_convert_distance (&value, margin_units, return_units)) {
1065 return 0.0;
1066 }
1067 return value;
1068 }
1071 /**
1072 * Returns namedview's default metric.
1073 */
1074 SPMetric SPNamedView::getDefaultMetric() const
1075 {
1076 if (doc_units) {
1077 return sp_unit_get_metric(doc_units);
1078 } else {
1079 return SP_PT;
1080 }
1081 }
1083 /**
1084 * Returns the first grid it could find that isEnabled(). Returns NULL, if none is enabled
1085 */
1086 Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedview)
1087 {
1088 for (GSList const * l = namedview->grids; l != NULL; l = l->next) {
1089 Inkscape::CanvasGrid * grid = (Inkscape::CanvasGrid*) l->data;
1090 if (grid->isEnabled())
1091 return grid;
1092 }
1094 return NULL;
1095 }
1097 void SPNamedView::translateGuides(Geom::Translate const &tr) {
1098 for (GSList *l = guides; l != NULL; l = l->next) {
1099 SPGuide &guide = *SP_GUIDE(l->data);
1100 Geom::Point point_on_line = guide.point_on_line;
1101 point_on_line[0] += tr[0];
1102 point_on_line[1] += tr[1];
1103 sp_guide_moveto(guide, point_on_line, true);
1104 }
1105 }
1107 void SPNamedView::scrollAllDesktops(double dx, double dy, bool is_scrolling) {
1108 for(GSList *l = views; l; l = l->next) {
1109 SPDesktop *desktop = static_cast<SPDesktop *>(l->data);
1110 desktop->scroll_world_in_svg_coords(dx, dy, is_scrolling);
1111 }
1112 }
1115 /*
1116 Local Variables:
1117 mode:c++
1118 c-file-style:"stroustrup"
1119 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
1120 indent-tabs-mode:nil
1121 fill-column:99
1122 End:
1123 */
1124 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :