review request for implementation of wish 195519 - don't record layer's visibility and lock changes in undo history

View: New views
3 Messages — Rating Filter:   Alert me  

review request for implementation of wish 195519 - don't record layer's visibility and lock changes in undo history

by Bugzilla from boud@valdyas.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This checks whether the property changes are for visibility or locked,
and in that case doesn't create the undo action. I've assumed that opacity
or blending mode changes should still be recorded.

Query: what should I do with alpha lock when that's implemented? Also not
record? It's a simple toggle, too.
--
Boudewijn Rempt | http://www.valdyas.org

[0001-Implement-wish-195519-don-t-record-layer-s-visibili.patch]

From 2bb4d1a3ad62e469bc058622422b4ee96e81d6ed Mon Sep 17 00:00:00 2001
From: Boudewijn Rempt <boud@...>
Date: Sun, 8 Nov 2009 11:30:02 +0100
Subject: [PATCH] Implement wish 195519: don't record layer's visibility and lock changes in undo history

Check whether the changes in the properties are for visibility or locking
and in that that case don't add undo actions to the command list.
---
 krita/ui/kis_node_model.cpp |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/krita/ui/kis_node_model.cpp b/krita/ui/kis_node_model.cpp
index 9acc907..0a90960 100644
--- a/krita/ui/kis_node_model.cpp
+++ b/krita/ui/kis_node_model.cpp
@@ -273,8 +273,6 @@ bool KisNodeModel::setData(const QModelIndex &index, const QVariant &value, int
     Q_ASSERT(index.internalPointer());
 
     KisNode *node = static_cast<KisNode*>(index.internalPointer());
-    bool wasVisible;
-    bool visible;
     PropertyList proplist;
 
     switch (role) {
@@ -284,13 +282,21 @@ bool KisNodeModel::setData(const QModelIndex &index, const QVariant &value, int
         emit dataChanged(index, index);
         return true;
     case PropertiesRole:
-        proplist = value.value<PropertyList>();
-        wasVisible = node->visible();
-        visible = proplist.at(0).state.toBool();
-
-        m_d->image->undoAdapter()->addCommand(new KisNodePropertyListCommand(node, proplist));
-        emit dataChanged(index, index);
-        return true;
+        {
+            proplist = value.value<PropertyList>();
+
+            // don't record undo/redo for visibility or locked
+            if (   node->visible() != proplist.at(0).state.toBool()
+                || node->userLocked() != proplist.at(1).state.toBool()) {
+                node->setSectionModelProperties(proplist);
+                node->setDirty();
+            }
+            else {
+                m_d->image->undoAdapter()->addCommand(new KisNodePropertyListCommand(node, proplist));
+            }
+            emit dataChanged(index, index);
+            return true;
+        }
     case ActiveRole:
         if (value.toBool()) {
             emit nodeActivated(node);
--
1.6.0.2



_______________________________________________
kimageshop mailing list
kimageshop@...
https://mail.kde.org/mailman/listinfo/kimageshop

Re: review request for implementation of wish 195519 - don't record layer's visibility and lock changes in undo history

by Bugzilla from lukast.dev@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sunday 08 November 2009 11:32:53 Boudewijn Rempt wrote:
> This checks whether the property changes are for visibility or locked,
> and in that case doesn't create the undo action. I've assumed that opacity
> or blending mode changes should still be recorded.
>
> Query: what should I do with alpha lock when that's implemented? Also not
> record? It's a simple toggle, too.
>

Also fine I think. I would not record the alpha locking if we don't record
layer's visibility.
_______________________________________________
kimageshop mailing list
kimageshop@...
https://mail.kde.org/mailman/listinfo/kimageshop

Re: review request for implementation of wish 195519 - don't record layer's visibility and lock changes in undo history

by Bugzilla from boud@valdyas.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sunday 08 November 2009, LukasT.dev@... wrote:

> On Sunday 08 November 2009 11:32:53 Boudewijn Rempt wrote:
> > This checks whether the property changes are for visibility or locked,
> > and in that case doesn't create the undo action. I've assumed that
> > opacity or blending mode changes should still be recorded.
> >
> > Query: what should I do with alpha lock when that's implemented? Also not
> > record? It's a simple toggle, too.
>
> Also fine I think. I would not record the alpha locking if we don't record
> layer's visibility.

Fixed -- I'll commit today.

--
Boudewijn Rempt | http://www.valdyas.org

_______________________________________________
kimageshop mailing list
kimageshop@...
https://mail.kde.org/mailman/listinfo/kimageshop