summaryrefslogtreecommitdiffstats
path: root/src/document-undo.cpp
diff options
context:
space:
mode:
authorMichael G. Sloan <mgsloan@gmail.com>2006-08-26 01:31:22 +0000
committermgsloan <mgsloan@users.sourceforge.net>2006-08-26 01:31:22 +0000
commit36a1242bc96b3afee539421ec2c38d9934dd5095 (patch)
tree0148b856984f87a8229675a65753d5ca451d1565 /src/document-undo.cpp
parentFixed a crash in modifying filter parameters in XML editor. (diff)
downloadinkscape-36a1242bc96b3afee539421ec2c38d9934dd5095.tar.gz
inkscape-36a1242bc96b3afee539421ec2c38d9934dd5095.zip
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)
Diffstat (limited to 'src/document-undo.cpp')
-rw-r--r--src/document-undo.cpp19
1 files changed, 13 insertions, 6 deletions
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);