From f1e75559b22c08fbcbf7d07c0647e9d9c81267c7 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Tue, 24 Sep 2013 20:06:07 +0000 Subject: [PATCH] [ENHANCEMENT] Add reload feature in function list. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1126 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../FunctionList/functionListPanel.cpp | 46 +++++++++++++------ .../FunctionList/functionListPanel.h | 1 + .../FunctionList/functionListPanel.rc | 1 + .../FunctionList/functionListPanel_rc.h | 4 +- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index f5fa4c38..6e11458f 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -396,6 +396,22 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM { case WM_INITDIALOG : { + // Create toolbar menu + int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST; + _hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style, + 0,0,0,0,_hSelf,(HMENU)0, _hInst, NULL); + TBBUTTON tbButtons[1]; + tbButtons[0].idCommand = IDC_RELOADBUTTON_FUNCLIST; + tbButtons[0].iBitmap = I_IMAGENONE; + tbButtons[0].fsState = TBSTATE_ENABLED; + tbButtons[0].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE; + tbButtons[0].iString = (INT_PTR)TEXT("Reload"); + + SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); + SendMessage(_hToolbarMenu, TB_ADDBUTTONS, (WPARAM)sizeof(tbButtons) / sizeof(TBBUTTON), (LPARAM)&tbButtons); + SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0); + ShowWindow(_hToolbarMenu, SW_SHOW); + _treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST); setImageList(IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF); _treeView.display(); @@ -403,6 +419,8 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM } case WM_DESTROY: + _treeView.destroy(); + ::DestroyWindow(_hToolbarMenu); break; case WM_COMMAND : @@ -423,8 +441,14 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM (*_ppEditView)->execute(SCI_GOTOPOS, pos); } } - return TRUE; } + return TRUE; + + case IDC_RELOADBUTTON_FUNCLIST: + { + reload(); + } + return TRUE; } } break; @@ -439,24 +463,16 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM { int width = LOWORD(lParam); int height = HIWORD(lParam); - //::MoveWindow(::GetDlgItem(_hSelf, IDC_LIST_FUNCLIST), 0, 0, width, height, TRUE); + RECT toolbarMenuRect; + ::GetClientRect(_hToolbarMenu, &toolbarMenuRect); + + ::MoveWindow(_hToolbarMenu, 0, 0, width, toolbarMenuRect.bottom, TRUE); + HWND hwnd = _treeView.getHSelf(); if (hwnd) - ::MoveWindow(hwnd, 0, 0, width, height, TRUE); + ::MoveWindow(hwnd, 0, toolbarMenuRect.bottom + 2, width, height - toolbarMenuRect.bottom - 2, TRUE); break; } -/* - case WM_VKEYTOITEM: - { - if (LOWORD(wParam) == VK_RETURN) - { - int i = ::SendDlgItemMessage(_hSelf, IDC_LIST_CLIPBOARD, LB_GETCURSEL, 0, 0); - printInt(i); - return TRUE; - }//return TRUE; - break; - } -*/ default : return DockingDlgInterface::run_dlgProc(message, wParam, lParam); diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.h b/PowerEditor/src/WinControls/FunctionList/functionListPanel.h index 0092d4ab..f30a9b6c 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.h +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.h @@ -96,6 +96,7 @@ protected: virtual BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); private: + HWND _hToolbarMenu; TreeView _treeView; ScintillaEditView **_ppEditView; FunctionParsersManager _funcParserMgr; diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.rc b/PowerEditor/src/WinControls/FunctionList/functionListPanel.rc index 30f2c94d..5a19871c 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.rc +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.rc @@ -35,5 +35,6 @@ EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE CAPTION "Function List" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN + //PUSHBUTTON "Reload",IDC_RELOADBUTTON_FUNCLIST, 3,3,38,14 //LISTBOX IDC_LIST_FUNCLIST,50,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP END diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel_rc.h b/PowerEditor/src/WinControls/FunctionList/functionListPanel_rc.h index dbaa5fb3..7a02cacf 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel_rc.h +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel_rc.h @@ -30,7 +30,9 @@ #define IDD_FUNCLISTPANEL_RC_H #define IDD_FUNCLIST_PANEL 3400 -#define IDC_LIST_FUNCLIST (IDD_FUNCLIST_PANEL + 1) +#define IDC_LIST_FUNCLIST (IDD_FUNCLIST_PANEL + 1) +#define IDC_RELOADBUTTON_FUNCLIST (IDD_FUNCLIST_PANEL + 2) +#define IDC_SEARCHFIELD_FUNCLIST (IDD_FUNCLIST_PANEL + 3) #endif //IDD_FUNCLISTPANEL_RC_H