Code

Don't set inkscape:modified on startup when grids are shown/hidden.
authorcilix42 <cilix42@users.sourceforge.net>
Tue, 13 Nov 2007 14:24:25 +0000 (14:24 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Tue, 13 Nov 2007 14:24:25 +0000 (14:24 +0000)
src/desktop.cpp
src/desktop.h
src/sp-namedview.cpp
src/sp-namedview.h

index 4fc0e5f60725ca3497cf3ffebd524c815d5647f5..f12d0ffd799957e377ac7e0d11e5925b5f3392a7 100644 (file)
@@ -308,7 +308,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas)
     //   (Setting up after the connections are all in place, as it may use some of them)
     layer_manager = new Inkscape::LayerManager( this );
 
-    showGrids(namedview->grids_visible);
+    showGrids(namedview->grids_visible, false);
 }
 
 
@@ -1196,10 +1196,10 @@ void SPDesktop::toggleGrids()
     }
 }
 
-void SPDesktop::showGrids(bool show)
+void SPDesktop::showGrids(bool show, bool dirty_document)
 {
     grids_visible = show;
-    sp_namedview_show_grids(namedview, grids_visible);
+    sp_namedview_show_grids(namedview, grids_visible, dirty_document);
     if (show) {
         sp_canvas_item_show(SP_CANVAS_ITEM(gridgroup));
     } else {
index bee0243d5e17cf95e681c54bb912435fdc9bb19a..fa8b4f84e8aede1ad414e0ecfa4de4a2068b9b3e 100644 (file)
@@ -262,7 +262,7 @@ struct SPDesktop : public Inkscape::UI::View::View
     
     void toggleGrids();
     bool gridsEnabled() { return grids_visible; }
-    void showGrids(bool show);
+    void showGrids(bool show, bool dirty_document = true);
 
     bool is_iconified();
     bool is_maximized();
index 8b9bc008ec30895d3dd1a7d7831eb4ecd99b916a..9fba7bc99180bc6527efbe2f646f6c4842c5018c 100644 (file)
@@ -610,7 +610,7 @@ void SPNamedView::show(SPDesktop *desktop)
         }
     }
 
-    desktop->showGrids(grids_visible);
+    desktop->showGrids(grids_visible, false);
 }
 
 #define MIN_ONSCREEN_DISTANCE 50
@@ -782,7 +782,7 @@ void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr)
     sp_document_set_undo_sensitive(doc, saved);
 }
 
-void sp_namedview_show_grids(SPNamedView * namedview, bool show)
+void sp_namedview_show_grids(SPNamedView * namedview, bool show, bool dirty_document)
 {
     namedview->grids_visible = show;
 
@@ -794,7 +794,11 @@ void sp_namedview_show_grids(SPNamedView * namedview, bool show)
 
     sp_repr_set_boolean(repr, "showgrid", namedview->grids_visible);
 
-    doc->rroot->setAttribute("sodipodi:modified", "true");
+    /* we don't want the document to get dirty on startup; that's when
+       we call this function with dirty_document = false */
+    if (dirty_document) {
+        doc->rroot->setAttribute("sodipodi:modified", "true");
+    }
     sp_document_set_undo_sensitive(doc, saved);
 }
 
index dc5c164b8319aaba3ca9b7389eff8756304aedb3..3e1923f1dc26f33a71f6b887a972b21514de68bb 100644 (file)
@@ -101,7 +101,7 @@ void sp_namedview_document_from_window(SPDesktop *desktop);
 void sp_namedview_update_layers_from_document (SPDesktop *desktop);
 
 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
-void sp_namedview_show_grids(SPNamedView *namedview, bool show);
+void sp_namedview_show_grids(SPNamedView *namedview, bool show, bool dirty_document);
 
 #endif /* !INKSCAPE_SP_NAMEDVIEW_H */