From 36a1242bc96b3afee539421ec2c38d9934dd5095 Mon Sep 17 00:00:00 2001 From: "Michael G. Sloan" Date: Sat, 26 Aug 2006 01:31:22 +0000 Subject: gboolean -> bool conversion commit 1. Modifies code to do with getting the undo system to ignore actions, as well as SVG/XML save/load. Shouldn't cause problems though. (bzr r1639) --- src/document-undo.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/document-undo.cpp') diff --git a/src/document-undo.cpp b/src/document-undo.cpp index 09bb4e857..c7da41080 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -75,18 +75,18 @@ * Since undo sensitivity needs to be nested, setting undo sensitivity * should be done like this: *\verbatim - gboolean saved = sp_document_get_undo_sensitive(document); - sp_document_set_undo_sensitive(document, FALSE); + bool saved = sp_document_get_undo_sensitive(document); + sp_document_set_undo_sensitive(document, false); ... do stuff ... sp_document_set_undo_sensitive(document, saved); \endverbatim */ void -sp_document_set_undo_sensitive (SPDocument *doc, gboolean sensitive) +sp_document_set_undo_sensitive (SPDocument *doc, bool sensitive) { g_assert (doc != NULL); g_assert (doc->priv != NULL); - if ( !(sensitive) == !(doc->priv->sensitive) ) + if ( sensitive == doc->priv->sensitive ) return; if (sensitive) { @@ -98,10 +98,17 @@ sp_document_set_undo_sensitive (SPDocument *doc, gboolean sensitive) ); } - doc->priv->sensitive = !!sensitive; + doc->priv->sensitive = sensitive; } -gboolean sp_document_get_undo_sensitive(SPDocument const *document) { +/*TODO: Throughout the inkscape code tree set/get_undo_sensitive are used for + * as is shown above. Perhaps it makes sense to create new functions, + * undo_ignore, and undo_recall to replace the start and end parts of the above. + * The main complexity with this is that they have to nest, so you have to store + * the saved bools in a stack. Perhaps this is why the above solution is better. + */ + +bool sp_document_get_undo_sensitive(SPDocument const *document) { g_assert(document != NULL); g_assert(document->priv != NULL); -- cgit v1.2.3