[aseprite] 21/51: Improve UI response when we clone tabs with Ctrl or Alt

Tobias Hansen thansen at moszumanska.debian.org
Mon Jul 11 21:35:16 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 262bc0f16e4d6ad53765177c8d98303945963ff2
Author: David Capello <davidcapello at gmail.com>
Date:   Wed Jun 29 12:02:41 2016 -0300

    Improve UI response when we clone tabs with Ctrl or Alt
---
 src/app/ui/tabs.cpp | 32 +++++++++++++++++---------------
 src/app/ui/tabs.h   |  3 ++-
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/app/ui/tabs.cpp b/src/app/ui/tabs.cpp
index 071181e..8848ed0 100644
--- a/src/app/ui/tabs.cpp
+++ b/src/app/ui/tabs.cpp
@@ -299,6 +299,7 @@ bool Tabs::onProcessMessage(Message* msg)
 
     case kMouseMoveMessage:
       calculateHot();
+      updateDragCopyCursor(msg);
 
       if (hasCapture() && m_selected) {
         MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
@@ -442,19 +443,9 @@ bool Tabs::onProcessMessage(Message* msg)
       break;
 
     case kKeyDownMessage:
-    case kKeyUpMessage: {
-      TabPtr tab = (m_isDragging ? m_dragTab: m_hot);
-
-      bool oldDragCopy = m_dragCopy;
-      m_dragCopy = ((msg->ctrlPressed() || msg->altPressed()) &&
-                    (tab && m_delegate && m_delegate->canCloneTab(this, tab->view)));
-
-      if (oldDragCopy != m_dragCopy) {
-        updateDragTabIndexes(get_mouse_position().x, true);
-        updateMouseCursor();
-      }
+    case kKeyUpMessage:
+      updateDragCopyCursor(msg);
       break;
-    }
 
     case kSetCursorMessage:
       updateMouseCursor();
@@ -790,7 +781,6 @@ void Tabs::startDrag()
   updateTabs();
 
   m_isDragging = true;
-  m_dragCopy = false;
   m_dragTab.reset(new Tab(m_selected->view));
   m_dragTab->oldX = m_dragTab->x = m_dragTabX = m_selected->x;
   m_dragTab->oldWidth = m_dragTab->width = m_selected->width;
@@ -826,7 +816,6 @@ void Tabs::stopDrag(DropTabResult result)
         localCopy = true;
       }
 
-      m_dragCopy = false;
       m_dragCopyIndex = -1;
 
       startReorderTabsAnimation();
@@ -854,7 +843,6 @@ void Tabs::stopDrag(DropTabResult result)
     case DropTabResult::REMOVE:
       m_floatingTab.reset();
       m_removedTab.reset();
-      m_dragCopy = false;
       m_dragCopyIndex = -1;
       destroyFloatingTab();
 
@@ -1010,4 +998,18 @@ void Tabs::updateDragTabIndexes(int mouseX, bool startAni)
     startReorderTabsAnimation();
 }
 
+void Tabs::updateDragCopyCursor(ui::Message* msg)
+{
+  TabPtr tab = (m_isDragging ? m_dragTab: m_hot);
+
+  bool oldDragCopy = m_dragCopy;
+  m_dragCopy = ((msg->ctrlPressed() || msg->altPressed()) &&
+                (tab && m_delegate && m_delegate->canCloneTab(this, tab->view)));
+
+  if (oldDragCopy != m_dragCopy) {
+    updateDragTabIndexes(get_mouse_position().x, true);
+    updateMouseCursor();
+  }
+}
+
 } // namespace app
diff --git a/src/app/ui/tabs.h b/src/app/ui/tabs.h
index 81d4045..97c7e17 100644
--- a/src/app/ui/tabs.h
+++ b/src/app/ui/tabs.h
@@ -1,5 +1,5 @@
 // Aseprite
-// Copyright (C) 2001-2015  David Capello
+// Copyright (C) 2001-2016  David Capello
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License version 2 as
@@ -201,6 +201,7 @@ namespace app {
     void destroyFloatingOverlay();
     void updateMouseCursor();
     void updateDragTabIndexes(int mouseX, bool force_animation);
+    void updateDragCopyCursor(ui::Message* msg);
 
     // Specific variables about the style
     int m_border;           // Pixels used from the left side to draw the first tab

-- 
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