From 4e79386a2855b3d5256c29f014b441dae100fefd Mon Sep 17 00:00:00 2001 From: unodgs Date: Mon, 17 Jan 2011 22:58:32 +0000 Subject: [PATCH] TabBar: Fixed some corner dnd and stacking issues git-svn-id: svn://ultimatepp.org/upp/trunk@3035 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/TabBar/TabBar.cpp | 16 ++++++++++++---- uppsrc/TabBar/TabBar.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/uppsrc/TabBar/TabBar.cpp b/uppsrc/TabBar/TabBar.cpp index d380941df..e82bb7165 100644 --- a/uppsrc/TabBar/TabBar.cpp +++ b/uppsrc/TabBar/TabBar.cpp @@ -1132,7 +1132,7 @@ void TabBar::Paint(Draw &w) Image TabBar::GetDragSample() { - int h = highlight; + int h = drag_highlight; if(stacking) h = FindStackHead(tabs[h].stack); return GetDragSample(h); @@ -1448,6 +1448,7 @@ int TabBar::GetPrev(int n, bool drag) const void TabBar::Clear() { highlight = -1; + drag_highlight = -1; active = -1; target = -1; cross = -1; @@ -1870,16 +1871,19 @@ void TabBar::SetIcon(int n, Image icon) void TabBar::LeftDown(Point p, dword keyflags) { + SetCapture(); + if(keyflags & K_SHIFT) { highlight = -1; Refresh(); - SetCapture(); Fix(p); oldp = p; return; } + drag_highlight = highlight; + isctrl = keyflags & K_CTRL; if(isctrl) return; @@ -2024,7 +2028,7 @@ void TabBar::SetHighlight(int n) void TabBar::MouseMove(Point p, dword keyflags) { - if(HasCapture()) + if(HasCapture() && (keyflags & K_SHIFT)) { Fix(p); sc.AddPos(p.x - oldp.x, true); @@ -2033,6 +2037,9 @@ void TabBar::MouseMove(Point p, dword keyflags) return; } + if(HasCapture()) + return; + if(ProcessMouse(active, p)) return; @@ -2066,7 +2073,7 @@ void TabBar::DragAndDrop(Point p, PasteClip& d) { Fix(p); int c = GetTargetTab(p); - int tab = isctrl ? highlight : active; + int tab = isctrl ? drag_highlight : active; if (&GetInternal(d) != this || tabsort || c < 0 || !allowreorder) return; @@ -2141,6 +2148,7 @@ void TabBar::LeftDrag(Point p, dword keyflags) if(highlight < 0) return; + Sync(); isdrag = true; dragtab = GetDragSample(); DoDragAndDrop(InternalClip(*this, "tabs")); diff --git a/uppsrc/TabBar/TabBar.h b/uppsrc/TabBar/TabBar.h index e529ba89a..621d2321b 100644 --- a/uppsrc/TabBar/TabBar.h +++ b/uppsrc/TabBar/TabBar.h @@ -233,6 +233,7 @@ protected: private: int highlight; + int drag_highlight; int target; int cross; bool crosses;