[ENHANCEMENT] Add reload feature in function list.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1126 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-09-24 20:06:07 +00:00
parent 95de01147d
commit f1e75559b2
4 changed files with 36 additions and 16 deletions

View File

@ -396,6 +396,22 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
case WM_INITDIALOG : 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); _treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST);
setImageList(IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF); setImageList(IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF);
_treeView.display(); _treeView.display();
@ -403,6 +419,8 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
} }
case WM_DESTROY: case WM_DESTROY:
_treeView.destroy();
::DestroyWindow(_hToolbarMenu);
break; break;
case WM_COMMAND : case WM_COMMAND :
@ -423,8 +441,14 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
(*_ppEditView)->execute(SCI_GOTOPOS, pos); (*_ppEditView)->execute(SCI_GOTOPOS, pos);
} }
} }
return TRUE;
} }
return TRUE;
case IDC_RELOADBUTTON_FUNCLIST:
{
reload();
}
return TRUE;
} }
} }
break; break;
@ -439,24 +463,16 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
int width = LOWORD(lParam); int width = LOWORD(lParam);
int height = HIWORD(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(); HWND hwnd = _treeView.getHSelf();
if (hwnd) if (hwnd)
::MoveWindow(hwnd, 0, 0, width, height, TRUE); ::MoveWindow(hwnd, 0, toolbarMenuRect.bottom + 2, width, height - toolbarMenuRect.bottom - 2, TRUE);
break; 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 : default :
return DockingDlgInterface::run_dlgProc(message, wParam, lParam); return DockingDlgInterface::run_dlgProc(message, wParam, lParam);

View File

@ -96,6 +96,7 @@ protected:
virtual BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private: private:
HWND _hToolbarMenu;
TreeView _treeView; TreeView _treeView;
ScintillaEditView **_ppEditView; ScintillaEditView **_ppEditView;
FunctionParsersManager _funcParserMgr; FunctionParsersManager _funcParserMgr;

View File

@ -35,5 +35,6 @@ EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE
CAPTION "Function List" CAPTION "Function List"
FONT 8, "MS Sans Serif", 0, 0, 0x0 FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN BEGIN
//PUSHBUTTON "Reload",IDC_RELOADBUTTON_FUNCLIST, 3,3,38,14
//LISTBOX IDC_LIST_FUNCLIST,50,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP //LISTBOX IDC_LIST_FUNCLIST,50,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
END END

View File

@ -30,7 +30,9 @@
#define IDD_FUNCLISTPANEL_RC_H #define IDD_FUNCLISTPANEL_RC_H
#define IDD_FUNCLIST_PANEL 3400 #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 #endif //IDD_FUNCLISTPANEL_RC_H