[ENHANCEMENT] Enhance GUI in function list (in progress).
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1135 f5eea248-9336-0410-98b8-ebc06183d4e3remotes/trunk
parent
7e6e8f6fba
commit
fbf9b8983a
|
@ -195,6 +195,9 @@ IDI_FUNCLIST_ROOT BITMAP "icons\\project_file.bmp"
|
||||||
IDI_FUNCLIST_NODE BITMAP "icons\\funcList_node.bmp"
|
IDI_FUNCLIST_NODE BITMAP "icons\\funcList_node.bmp"
|
||||||
IDI_FUNCLIST_LEAF BITMAP "icons\\funcList_leaf.bmp"
|
IDI_FUNCLIST_LEAF BITMAP "icons\\funcList_leaf.bmp"
|
||||||
|
|
||||||
|
IDI_FUNCLIST_SORTBUTTON BITMAP "icons\\funcList_node.bmp"
|
||||||
|
IDI_FUNCLIST_RELOADBUTTON BITMAP "icons\\funcList_leaf.bmp"
|
||||||
|
|
||||||
IDR_M30_MENU MENU
|
IDR_M30_MENU MENU
|
||||||
BEGIN
|
BEGIN
|
||||||
POPUP "&File"
|
POPUP "&File"
|
||||||
|
|
|
@ -397,41 +397,69 @@ void FunctionListPanel::notified(LPNMHDR notification)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL FunctionListPanel::setImageList(int root_id, int node_id, int leaf_id)
|
BOOL FunctionListPanel::setToolbarImageList(int sort_id, int reload_id)
|
||||||
|
{
|
||||||
|
HBITMAP hbmp;
|
||||||
|
|
||||||
|
const int nbBitmaps = 2;
|
||||||
|
|
||||||
|
// Creation of image list
|
||||||
|
if ((_hToolbarImaLst = ImageList_Create(CX_BITMAP, CY_BITMAP, ILC_COLOR32 | ILC_MASK, nbBitmaps, 0)) == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// Add the bmp in the list
|
||||||
|
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(sort_id));
|
||||||
|
if (hbmp == NULL)
|
||||||
|
return FALSE;
|
||||||
|
ImageList_Add(_hToolbarImaLst, hbmp, (HBITMAP)NULL);
|
||||||
|
DeleteObject(hbmp);
|
||||||
|
|
||||||
|
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(reload_id));
|
||||||
|
if (hbmp == NULL)
|
||||||
|
return FALSE;
|
||||||
|
ImageList_Add(_hToolbarImaLst, hbmp, (HBITMAP)NULL);
|
||||||
|
DeleteObject(hbmp);
|
||||||
|
|
||||||
|
SendMessage(_hToolbarMenu, TB_SETIMAGELIST, 0, (LPARAM)_hToolbarImaLst);
|
||||||
|
SendMessage(_hToolbarMenu, TB_LOADIMAGES, (WPARAM)IDB_STD_SMALL_COLOR, (LPARAM)HINST_COMMCTRL);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FunctionListPanel::setTreeViewImageList(int root_id, int node_id, int leaf_id)
|
||||||
{
|
{
|
||||||
HBITMAP hbmp;
|
HBITMAP hbmp;
|
||||||
|
|
||||||
const int nbBitmaps = 3;
|
const int nbBitmaps = 3;
|
||||||
|
|
||||||
// Creation of image list
|
// Creation of image list
|
||||||
if ((_hImaLst = ImageList_Create(CX_BITMAP, CY_BITMAP, ILC_COLOR32 | ILC_MASK, nbBitmaps, 0)) == NULL)
|
if ((_hTreeViewImaLst = ImageList_Create(CX_BITMAP, CY_BITMAP, ILC_COLOR32 | ILC_MASK, nbBitmaps, 0)) == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Add the bmp in the list
|
// Add the bmp in the list
|
||||||
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_id));
|
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_id));
|
||||||
if (hbmp == NULL)
|
if (hbmp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
|
ImageList_Add(_hTreeViewImaLst, hbmp, (HBITMAP)NULL);
|
||||||
DeleteObject(hbmp);
|
DeleteObject(hbmp);
|
||||||
|
|
||||||
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(node_id));
|
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(node_id));
|
||||||
if (hbmp == NULL)
|
if (hbmp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
|
ImageList_Add(_hTreeViewImaLst, hbmp, (HBITMAP)NULL);
|
||||||
DeleteObject(hbmp);
|
DeleteObject(hbmp);
|
||||||
|
|
||||||
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(leaf_id));
|
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(leaf_id));
|
||||||
if (hbmp == NULL)
|
if (hbmp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
|
ImageList_Add(_hTreeViewImaLst, hbmp, (HBITMAP)NULL);
|
||||||
DeleteObject(hbmp);
|
DeleteObject(hbmp);
|
||||||
|
|
||||||
if (ImageList_GetImageCount(_hImaLst) < nbBitmaps)
|
if (ImageList_GetImageCount(_hTreeViewImaLst) < nbBitmaps)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Set image list to the tree view
|
// Set image list to the tree view
|
||||||
TreeView_SetImageList(_treeView.getHSelf(), _hImaLst, TVSIL_NORMAL);
|
TreeView_SetImageList(_treeView.getHSelf(), _hTreeViewImaLst, TVSIL_NORMAL);
|
||||||
TreeView_SetImageList(_treeViewSearchResult.getHSelf(), _hImaLst, TVSIL_NORMAL);
|
TreeView_SetImageList(_treeViewSearchResult.getHSelf(), _hTreeViewImaLst, TVSIL_NORMAL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -537,6 +565,7 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||||
oldFunclstToolbarProc = (WNDPROC)::SetWindowLongPtr(_hToolbarMenu, GWLP_WNDPROC, (LONG_PTR)funclstToolbarProc);
|
oldFunclstToolbarProc = (WNDPROC)::SetWindowLongPtr(_hToolbarMenu, GWLP_WNDPROC, (LONG_PTR)funclstToolbarProc);
|
||||||
TBBUTTON tbButtons[3];
|
TBBUTTON tbButtons[3];
|
||||||
|
|
||||||
|
// Place holder of search text field
|
||||||
tbButtons[0].idCommand = 0;
|
tbButtons[0].idCommand = 0;
|
||||||
tbButtons[0].iBitmap = editWidth + 10;
|
tbButtons[0].iBitmap = editWidth + 10;
|
||||||
tbButtons[0].fsState = TBSTATE_ENABLED;
|
tbButtons[0].fsState = TBSTATE_ENABLED;
|
||||||
|
@ -544,16 +573,16 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||||
tbButtons[0].iString = 0;
|
tbButtons[0].iString = 0;
|
||||||
|
|
||||||
tbButtons[1].idCommand = IDC_SORTBUTTON_FUNCLIST;
|
tbButtons[1].idCommand = IDC_SORTBUTTON_FUNCLIST;
|
||||||
tbButtons[1].iBitmap = I_IMAGENONE;
|
tbButtons[1].iBitmap = 0;
|
||||||
tbButtons[1].fsState = TBSTATE_ENABLED;
|
tbButtons[1].fsState = TBSTATE_ENABLED;
|
||||||
tbButtons[1].fsStyle = BTNS_CHECK | BTNS_AUTOSIZE;
|
tbButtons[1].fsStyle = BTNS_CHECK | BTNS_AUTOSIZE;
|
||||||
tbButtons[1].iString = (INT_PTR)TEXT("Sort");
|
tbButtons[1].iString = (INT_PTR)TEXT("");
|
||||||
|
|
||||||
tbButtons[2].idCommand = IDC_RELOADBUTTON_FUNCLIST;
|
tbButtons[2].idCommand = IDC_RELOADBUTTON_FUNCLIST;
|
||||||
tbButtons[2].iBitmap = I_IMAGENONE;
|
tbButtons[2].iBitmap = 1;
|
||||||
tbButtons[2].fsState = TBSTATE_ENABLED;
|
tbButtons[2].fsState = TBSTATE_ENABLED;
|
||||||
tbButtons[2].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
|
tbButtons[2].fsStyle = /*BTNS_BUTTON | */BTNS_AUTOSIZE;
|
||||||
tbButtons[2].iString = (INT_PTR)TEXT("Reload");
|
tbButtons[2].iString = (INT_PTR)TEXT("");
|
||||||
|
|
||||||
SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
|
SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
|
||||||
SendMessage(_hToolbarMenu, TB_ADDBUTTONS, (WPARAM)sizeof(tbButtons) / sizeof(TBBUTTON), (LPARAM)&tbButtons);
|
SendMessage(_hToolbarMenu, TB_ADDBUTTONS, (WPARAM)sizeof(tbButtons) / sizeof(TBBUTTON), (LPARAM)&tbButtons);
|
||||||
|
@ -572,7 +601,8 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
_treeViewSearchResult.init(_hInst, _hSelf, IDC_LIST_FUNCLIST_AUX);
|
_treeViewSearchResult.init(_hInst, _hSelf, IDC_LIST_FUNCLIST_AUX);
|
||||||
_treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST);
|
_treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST);
|
||||||
setImageList(IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF);
|
setTreeViewImageList(IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF);
|
||||||
|
setToolbarImageList(IDI_FUNCLIST_SORTBUTTON, IDI_FUNCLIST_RELOADBUTTON);
|
||||||
_treeView.display();
|
_treeView.display();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,13 +123,15 @@ private:
|
||||||
std::vector<FuncInfo> _funcInfos;
|
std::vector<FuncInfo> _funcInfos;
|
||||||
std::vector< std::pair<int, int> > _skipZones;
|
std::vector< std::pair<int, int> > _skipZones;
|
||||||
std::vector<TreeParams> _treeParams;
|
std::vector<TreeParams> _treeParams;
|
||||||
HIMAGELIST _hImaLst;
|
HIMAGELIST _hTreeViewImaLst;
|
||||||
|
HIMAGELIST _hToolbarImaLst;
|
||||||
generic_string parseSubLevel(size_t begin, size_t end, std::vector< generic_string > dataToSearch, int & foundPos);
|
generic_string parseSubLevel(size_t begin, size_t end, std::vector< generic_string > dataToSearch, int & foundPos);
|
||||||
size_t getBodyClosePos(size_t begin, const TCHAR *bodyOpenSymbol, const TCHAR *bodyCloseSymbol);
|
size_t getBodyClosePos(size_t begin, const TCHAR *bodyOpenSymbol, const TCHAR *bodyCloseSymbol);
|
||||||
void notified(LPNMHDR notification);
|
void notified(LPNMHDR notification);
|
||||||
void addInStateArray(TreeStateNode tree2Update, const TCHAR *searchText);
|
void addInStateArray(TreeStateNode tree2Update, const TCHAR *searchText);
|
||||||
TreeParams* getFromStateArray(generic_string fullFilePath);
|
TreeParams* getFromStateArray(generic_string fullFilePath);
|
||||||
BOOL setImageList(int root_id, int node_id, int leaf_id);
|
BOOL setTreeViewImageList(int root_id, int node_id, int leaf_id);
|
||||||
|
BOOL setToolbarImageList(int sort_id, int reload_id);
|
||||||
bool openSelection(const TreeView &treeView);
|
bool openSelection(const TreeView &treeView);
|
||||||
bool shouldSort();
|
bool shouldSort();
|
||||||
};
|
};
|
||||||
|
|
|
@ -149,6 +149,9 @@
|
||||||
#define IDI_FUNCLIST_NODE 621
|
#define IDI_FUNCLIST_NODE 621
|
||||||
#define IDI_FUNCLIST_LEAF 622
|
#define IDI_FUNCLIST_LEAF 622
|
||||||
|
|
||||||
|
#define IDI_FUNCLIST_SORTBUTTON 631
|
||||||
|
#define IDI_FUNCLIST_RELOADBUTTON 632
|
||||||
|
|
||||||
#define IDC_MY_CUR 1402
|
#define IDC_MY_CUR 1402
|
||||||
#define IDC_UP_ARROW 1403
|
#define IDC_UP_ARROW 1403
|
||||||
#define IDC_DRAG_TAB 1404
|
#define IDC_DRAG_TAB 1404
|
||||||
|
|
Loading…
Reference in New Issue