From 2fc63e10608d5596c6e43680ceb1a23fa2111d55 Mon Sep 17 00:00:00 2001 From: cilix42 Date: Tue, 13 Nov 2007 14:24:25 +0000 Subject: [PATCH] Don't set inkscape:modified on startup when grids are shown/hidden. --- src/desktop.cpp | 6 +++--- src/desktop.h | 2 +- src/sp-namedview.cpp | 10 +++++++--- src/sp-namedview.h | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/desktop.cpp b/src/desktop.cpp index 4fc0e5f60..f12d0ffd7 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -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 { diff --git a/src/desktop.h b/src/desktop.h index bee0243d5..fa8b4f84e 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -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(); diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 8b9bc008e..9fba7bc99 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -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); } diff --git a/src/sp-namedview.h b/src/sp-namedview.h index dc5c164b8..3e1923f1d 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -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 */ -- 2.30.2