Code

Disabling transientize callback - it's currently causing some data loss
[inkscape.git] / src / desktop.cpp
index c0548a8d2065accd8b7c829e3e04a7b669e31d53..5590633b8bf9cecbbf920df0245f977ec88739d0 100644 (file)
@@ -9,8 +9,9 @@
  *   bulia byak <buliabyak@users.sf.net>
  *   Ralf Stephan <ralf@ark.in-berlin.de>
  *   John Bintz <jcoswell@coswellproductions.org>
+ *   Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
  *
- * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
+ * Copyright (C) 2006-2007 Johan Engelen
  * Copyright (C) 2006 John Bintz
  * Copyright (C) 2004 MenTaLguY
  * Copyright (C) 1999-2002 Lauris Kaplinski
@@ -128,7 +129,8 @@ SPDesktop::SPDesktop()
     is_fullscreen = false;
 
     gr_item = NULL;
-    gr_point_num = 0;
+    gr_point_type = 0;
+    gr_point_i = 0;
     gr_fill_or_stroke = true;
 
     _layer_hierarchy = NULL;
@@ -188,9 +190,13 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas)
 
     SP_CANVAS_ARENA (drawing)->arena->delta = prefs_get_double_attribute ("options.cursortolerance", "value", 1.0); // default is 1 px
 
-    // Start always in normal mode
-    SP_CANVAS_ARENA (drawing)->arena->rendermode = RENDERMODE_NORMAL;
-    canvas->rendermode = RENDERMODE_NORMAL; // canvas needs that for choosing the best buffer size
+    if (prefs_get_int_attribute("options.startmode", "outline", 0)) {
+        // Start in outline mode
+        setDisplayModeOutline();
+    } else {
+        // Start in normal mode, default
+        setDisplayModeNormal();
+    }
 
     grid = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
     guides = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
@@ -341,16 +347,30 @@ SPDesktop::~SPDesktop() {}
 
 void SPDesktop::setDisplayModeNormal()
 {
+    prefs_set_int_attribute("options.outlinemode", "value", 0);
     SP_CANVAS_ARENA (drawing)->arena->rendermode = RENDERMODE_NORMAL;
     canvas->rendermode = RENDERMODE_NORMAL; // canvas needs that for choosing the best buffer size
+    displayMode = RENDERMODE_NORMAL;
     sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw
+    _widget->setTitle(SP_DOCUMENT_NAME(sp_desktop_document(this)));
 }
 
 void SPDesktop::setDisplayModeOutline()
 {
+    prefs_set_int_attribute("options.outlinemode", "value", 1);
     SP_CANVAS_ARENA (drawing)->arena->rendermode = RENDERMODE_OUTLINE;
     canvas->rendermode = RENDERMODE_OUTLINE; // canvas needs that for choosing the best buffer size
+    displayMode = RENDERMODE_OUTLINE;
     sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw
+    _widget->setTitle(SP_DOCUMENT_NAME(sp_desktop_document(this)));
+}
+
+void SPDesktop::displayModeToggle()
+{
+    if (prefs_get_int_attribute("options.outlinemode", "value", prefs_get_int_attribute("options.startmode", "outline", 0)))
+        setDisplayModeNormal();
+    else 
+        setDisplayModeOutline();
 }
 
 /**