[aseprite] 148/308: Add option to keep the selection after Edit > Clear (fix #907)

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:45:04 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 3543b086d134cb423556902310e374f7ee528919
Author: David Capello <davidcapello at gmail.com>
Date:   Tue Dec 22 17:49:21 2015 -0300

    Add option to keep the selection after Edit > Clear (fix #907)
---
 data/pref.xml                    | 1 +
 data/widgets/options.xml         | 1 +
 src/app/commands/cmd_options.cpp | 4 ++++
 src/app/ui/document_view.cpp     | 6 +++++-
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/data/pref.xml b/data/pref.xml
index 32d9344..dc9d83c 100644
--- a/data/pref.xml
+++ b/data/pref.xml
@@ -149,6 +149,7 @@
       <option id="pivot_position" type="PivotPosition" default="PivotPosition::CENTER" />
       <option id="opaque" type="bool" default="false" />
       <option id="auto_opaque" type="bool" default="true" />
+      <option id="keep_selection_after_clear" type="bool" default="false" />
       <option id="transparent_color" type="app::Color" />
       <option id="rotation_algorithm" type="app::tools::RotationAlgorithm" default="app::tools::RotationAlgorithm::DEFAULT" />
       <option id="modify_selection_quantity" type="int" default="1" />
diff --git a/data/widgets/options.xml b/data/widgets/options.xml
index c962cbe..c64ac82 100644
--- a/data/widgets/options.xml
+++ b/data/widgets/options.xml
@@ -72,6 +72,7 @@
 
           <separator text="Selection" horizontal="true" />
           <check text="Adjust opaque/transparent mode automatically" id="auto_opaque" tooltip="Depending on the layer (background/transparent),
the pasted selection will be adjusted
automatically (opaque/transparent)" />
+          <check text="Keep selection after "Edit > Clear" command" id="keep_selection_after_clear" tooltip="Check this if you want to keep the selection
after deleting it." />
         </vbox>
 
         <!-- Timeline -->
diff --git a/src/app/commands/cmd_options.cpp b/src/app/commands/cmd_options.cpp
index 22655af..1164b2b 100644
--- a/src/app/commands/cmd_options.cpp
+++ b/src/app/commands/cmd_options.cpp
@@ -87,6 +87,9 @@ public:
     if (m_preferences.selection.autoOpaque())
       autoOpaque()->setSelected(true);
 
+    if (m_preferences.selection.keepSelectionAfterClear())
+      keepSelectionAfterClear()->setSelected(true);
+
     if (m_preferences.experimental.useNativeCursor())
       nativeCursor()->setSelected(true);
 
@@ -198,6 +201,7 @@ public:
     m_preferences.editor.rightClickMode(static_cast<app::gen::RightClickMode>(rightClickBehavior()->getSelectedItemIndex()));
     m_preferences.editor.cursorColor(m_cursorColor->getColor());
     m_preferences.selection.autoOpaque(autoOpaque()->isSelected());
+    m_preferences.selection.keepSelectionAfterClear(keepSelectionAfterClear()->isSelected());
 
     m_curPref->grid.color(m_gridColor->getColor());
     m_curPref->grid.opacity(gridOpacity()->getValue());
diff --git a/src/app/ui/document_view.cpp b/src/app/ui/document_view.cpp
index ea1df26..28fed28 100644
--- a/src/app/ui/document_view.cpp
+++ b/src/app/ui/document_view.cpp
@@ -21,6 +21,7 @@
 #include "app/document_access.h"
 #include "app/modules/editors.h"
 #include "app/modules/palettes.h"
+#include "app/pref/preferences.h"
 #include "app/transaction.h"
 #include "app/ui/editor/editor.h"
 #include "app/ui/editor/editor_customization_delegate.h"
@@ -524,8 +525,11 @@ bool DocumentView::onClear(Context* ctx)
   {
     Transaction transaction(writer.context(), "Clear");
     transaction.execute(new cmd::ClearMask(writer.cel()));
-    if (visibleMask)
+
+    if (visibleMask &&
+        !Preferences::instance().selection.keepSelectionAfterClear())
       transaction.execute(new cmd::DeselectMask(document));
+
     transaction.commit();
   }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list