From d3afa41a9f7bf4024bc3e1127d2a97b128eebcd3 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Tue, 15 Oct 2013 12:00:10 +0000 Subject: [PATCH] [NEW_FEATURE] Add sort button in function list. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1133 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../FunctionList/functionListPanel.cpp | 20 ++++++++++++++++--- .../FunctionList/functionListPanel_rc.h | 5 +++-- PowerEditor/src/contextMenu.xml | 6 +++--- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index 94f33f52..b5e463e0 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -411,6 +411,7 @@ void FunctionListPanel::searchFuncAndSwitchView() { _treeViewSearchResult.display(false); _treeView.display(true); + _pTreeView = &_treeView; } else { @@ -424,6 +425,7 @@ void FunctionListPanel::searchFuncAndSwitchView() _treeViewSearchResult.display(true); _treeViewSearchResult.expand(_treeViewSearchResult.getRoot()); _treeView.display(false); + _pTreeView = &_treeViewSearchResult; // invalidate the editor rect ::InvalidateRect(_hSearchEdit, NULL, TRUE); @@ -484,7 +486,7 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM //::GetWindowLongPtr(_hToolbarMenu, GWL_WNDPROC); oldFunclstToolbarProc = (WNDPROC)::SetWindowLongPtr(_hToolbarMenu, GWLP_WNDPROC, (LONG_PTR)funclstToolbarProc); - TBBUTTON tbButtons[2]; + TBBUTTON tbButtons[3]; tbButtons[0].idCommand = 0; tbButtons[0].iBitmap = editWidth + 10; @@ -492,11 +494,17 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM tbButtons[0].fsStyle = BTNS_SEP; tbButtons[0].iString = 0; - tbButtons[1].idCommand = IDC_RELOADBUTTON_FUNCLIST; + tbButtons[1].idCommand = IDC_SORTBUTTON_FUNCLIST; tbButtons[1].iBitmap = I_IMAGENONE; tbButtons[1].fsState = TBSTATE_ENABLED; tbButtons[1].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE; - tbButtons[1].iString = (INT_PTR)TEXT("Reload"); + tbButtons[1].iString = (INT_PTR)TEXT("Sort"); + + tbButtons[2].idCommand = IDC_RELOADBUTTON_FUNCLIST; + tbButtons[2].iBitmap = I_IMAGENONE; + tbButtons[2].fsState = TBSTATE_ENABLED; + tbButtons[2].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE; + tbButtons[2].iString = (INT_PTR)TEXT("Reload"); SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); SendMessage(_hToolbarMenu, TB_ADDBUTTONS, (WPARAM)sizeof(tbButtons) / sizeof(TBBUTTON), (LPARAM)&tbButtons); @@ -542,6 +550,12 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM switch (LOWORD(wParam)) { + case IDC_SORTBUTTON_FUNCLIST: + { + ::SendMessage(_pTreeView->getHSelf(), TVM_SORTCHILDREN, TRUE, (LPARAM)_pTreeView->getRoot()); + } + return TRUE; + case IDC_RELOADBUTTON_FUNCLIST: { reload(); diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel_rc.h b/PowerEditor/src/WinControls/FunctionList/functionListPanel_rc.h index 5e1eae58..a32106da 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel_rc.h +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel_rc.h @@ -32,8 +32,9 @@ #define IDD_FUNCLIST_PANEL 3400 #define IDC_LIST_FUNCLIST (IDD_FUNCLIST_PANEL + 1) #define IDC_LIST_FUNCLIST_AUX (IDD_FUNCLIST_PANEL + 2) -#define IDC_RELOADBUTTON_FUNCLIST (IDD_FUNCLIST_PANEL + 3) -#define IDC_SEARCHFIELD_FUNCLIST (IDD_FUNCLIST_PANEL + 4) +#define IDC_SEARCHFIELD_FUNCLIST (IDD_FUNCLIST_PANEL + 3) +#define IDC_RELOADBUTTON_FUNCLIST (IDD_FUNCLIST_PANEL + 4) +#define IDC_SORTBUTTON_FUNCLIST (IDD_FUNCLIST_PANEL + 5) #endif //IDD_FUNCLISTPANEL_RC_H diff --git a/PowerEditor/src/contextMenu.xml b/PowerEditor/src/contextMenu.xml index 58f8341a..2063a3f1 100644 --- a/PowerEditor/src/contextMenu.xml +++ b/PowerEditor/src/contextMenu.xml @@ -60,9 +60,9 @@ http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Context_Menu - - - + + +