diff options
author | George Hazan <george.hazan@gmail.com> | 2016-01-21 11:19:18 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-01-21 11:19:18 +0000 |
commit | 385e9fc6fffe35fff080fdcb564b835a334c8feb (patch) | |
tree | 0f58ead5811a6570e53347c1a5405e098c345eb2 /src/mir_core | |
parent | e0a53609f587b1fd1b1daff2ae96feb8f39b62e1 (diff) |
fix for moving menu item to the first position in a submenu
git-svn-id: http://svn.miranda-ng.org/main/trunk@16132 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/src/mir_core.def | 2 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 2 | ||||
-rw-r--r-- | src/mir_core/src/ui_utils.cpp | 17 |
3 files changed, 13 insertions, 8 deletions
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index c5ff0c1fbc..3263fd854b 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -933,7 +933,7 @@ mir_wstrcmpi @280 ?SelectRange@CCtrlTreeView@@QAEXPAU_TREEITEM@@0@Z @1091 NONAME
?Unselect@CCtrlTreeView@@QAEXPAU_TREEITEM@@@Z @1092 NONAME
?UnselectAll@CCtrlTreeView@@QAEXXZ @1093 NONAME
-?MoveItemAbove@CCtrlTreeView@@AAEPAU_TREEITEM@@PAU2@0@Z @1094 NONAME
+?MoveItemAbove@CCtrlTreeView@@AAEPAU_TREEITEM@@PAU2@00@Z @1094 NONAME
?GetCurrPage@CCtrlPages@@AAEPAUTPageInfo@1@XZ @1095 NONAME
?Fail@CDlgBase@@QAEXXZ @1096 NONAME
?OnApply@CCtrlPages@@MAEXXZ @1097 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 3d660b330c..5fa704f8d9 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -933,7 +933,7 @@ mir_wstrcmpi @280 ?SelectRange@CCtrlTreeView@@QEAAXPEAU_TREEITEM@@0@Z @1091 NONAME
?Unselect@CCtrlTreeView@@QEAAXPEAU_TREEITEM@@@Z @1092 NONAME
?UnselectAll@CCtrlTreeView@@QEAAXXZ @1093 NONAME
-?MoveItemAbove@CCtrlTreeView@@AEAAPEAU_TREEITEM@@PEAU2@0@Z @1094 NONAME
+?MoveItemAbove@CCtrlTreeView@@AEAAPEAU_TREEITEM@@PEAU2@00@Z @1094 NONAME
?GetCurrPage@CCtrlPages@@AEAAPEAUTPageInfo@1@XZ @1095 NONAME
?Fail@CDlgBase@@QEAAXXZ @1096 NONAME
?OnApply@CCtrlPages@@MEAAXXZ @1097 NONAME
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp index 9559a7fabd..de9d41bb11 100644 --- a/src/mir_core/src/ui_utils.cpp +++ b/src/mir_core/src/ui_utils.cpp @@ -1383,7 +1383,7 @@ void CCtrlTreeView::OnInit() Subclass();
}
-HTREEITEM CCtrlTreeView::MoveItemAbove(HTREEITEM hItem, HTREEITEM hInsertAfter)
+HTREEITEM CCtrlTreeView::MoveItemAbove(HTREEITEM hItem, HTREEITEM hInsertAfter, HTREEITEM hParent)
{
if (hItem == NULL || hInsertAfter == NULL)
return NULL;
@@ -1411,7 +1411,7 @@ HTREEITEM CCtrlTreeView::MoveItemAbove(HTREEITEM hItem, HTREEITEM hInsertAfter) tvis.itemex.stateMask = tvis.itemex.state;
tvis.itemex.lParam = saveOldData;
- tvis.hParent = (hInsertAfter == TVI_FIRST) ? NULL : GetParent(hInsertAfter);
+ tvis.hParent = hParent;
tvis.hInsertAfter = hInsertAfter;
return InsertItem(&tvis);
}
@@ -1460,26 +1460,31 @@ LRESULT CCtrlTreeView::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam) else if (hti.flags & TVHT_BELOW)
hti.hItem = TVI_LAST;
+ HTREEITEM insertAfter = hti.hItem;
+ HTREEITEM hParent = (insertAfter == TVI_FIRST) ? NULL : GetParent(insertAfter);
+ if (GetChild(insertAfter) != NULL) {
+ hParent = insertAfter;
+ insertAfter = TVI_FIRST;
+ }
+
HTREEITEM FirstItem = NULL;
if (m_bMultiSelect) {
LIST<_TREEITEM> arItems(10);
GetSelected(arItems);
// Proceed moving
- HTREEITEM insertAfter = hti.hItem;
- HTREEITEM hParent = GetParent(hti.hItem);
for (int i = 0; i < arItems.getCount(); i++) {
if (!insertAfter)
break;
if (GetParent(arItems[i]) != hParent) // prevent subitems from being inserted at the same level
continue;
- insertAfter = MoveItemAbove(arItems[i], insertAfter);
+ insertAfter = MoveItemAbove(arItems[i], insertAfter, hParent);
if (!i)
FirstItem = insertAfter;
}
}
- else FirstItem = MoveItemAbove(m_hDragItem, hti.hItem);
+ else FirstItem = MoveItemAbove(m_hDragItem, insertAfter, hParent);
if (FirstItem)
SelectItem(FirstItem);
|