mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 05:45:00 +02:00
[ENHANCEMENT] change the icon buttons of functionlist.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1136 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
fbf9b8983a
commit
641c1af0e1
@ -5223,7 +5223,7 @@ struct Quote{
|
||||
const char *_quote;
|
||||
};
|
||||
|
||||
const int nbQuote = 155;
|
||||
const int nbQuote = 161;
|
||||
Quote quotes[nbQuote] = {
|
||||
{"Notepad++", "Good programmers use Notepad++ to code.\nExtreme programmers use MS Word to code, in Comic Sans, center aligned."},
|
||||
{"Martin Golding", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."},
|
||||
@ -5369,6 +5369,12 @@ Quote quotes[nbQuote] = {
|
||||
{"Anonymous #111", "I love how the internet has improved people's grammar far more than any English teacher has.\nIf you write \"your\" instead of \"you're\" in English class, all you get is a red mark.\nMess up on the internet, and may God have mercy on your soul."},
|
||||
{"Anonymous #112", "#hulk {\n height: 200%;\n width: 200%;\n color: green;\n}"},
|
||||
{"Anonymous #113", "Open source is communism.\nAt least it is what communism was meant to be."},
|
||||
{"Anonymous #114", "How can you face your problem if your problem is your face?"},
|
||||
{"Anonymous #115", "YOLOLO:\nYou Only LOL Once."},
|
||||
{"Anonymous #116", "Every exit is an entrance to new experiences."},
|
||||
{"Anonymous #117", "A Native American was asked:\n\"Do you celebrate Columbus day?\"\nHe replied:\n\"I don't know, do Jews celebrate Hitler's birthday?\""},
|
||||
{"Anonymous #118", "I love necrophilia, but i can't stand the awkward silences."},
|
||||
{"Anonymous #119", "\"I'm gonna Google that. BING that, Bing that, sorry.\"\n- The CEO of Bing (many times per day still)"},
|
||||
{"Barack Obama", "Yes, we scan!"},
|
||||
{"George W. Bush", "Where is my Nobel prize?\nI bombed people too."},
|
||||
{"Gandhi", "Earth provides enough to satisfy every man's need, but not every man's greed."},
|
||||
|
@ -195,8 +195,8 @@ IDI_FUNCLIST_ROOT BITMAP "icons\\project_file.bmp"
|
||||
IDI_FUNCLIST_NODE BITMAP "icons\\funcList_node.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"
|
||||
IDI_FUNCLIST_SORTBUTTON BITMAP "icons\\funclstSort.bmp"
|
||||
IDI_FUNCLIST_RELOADBUTTON BITMAP "icons\\funclstReload.bmp"
|
||||
|
||||
IDR_M30_MENU MENU
|
||||
BEGIN
|
||||
@ -903,4 +903,4 @@ BEGIN
|
||||
END
|
||||
|
||||
// xp style
|
||||
1 RT_MANIFEST "notepad++.exe.manifest"
|
||||
//1 RT_MANIFEST "notepad++.exe.manifest"
|
||||
|
@ -156,7 +156,7 @@ generic_string FunctionListPanel::parseSubLevel(size_t begin, size_t end, std::v
|
||||
}
|
||||
}
|
||||
|
||||
void FunctionListPanel::addInStateArray(TreeStateNode tree2Update, const TCHAR *searchText)
|
||||
void FunctionListPanel::addInStateArray(TreeStateNode tree2Update, const TCHAR *searchText, bool isSorted)
|
||||
{
|
||||
bool found = false;
|
||||
for (size_t i = 0, len = _treeParams.size(); i < len; ++i)
|
||||
@ -164,6 +164,7 @@ void FunctionListPanel::addInStateArray(TreeStateNode tree2Update, const TCHAR *
|
||||
if (_treeParams[i]._treeState._extraData == tree2Update._extraData)
|
||||
{
|
||||
_treeParams[i]._searchParameters._text2Find = searchText;
|
||||
_treeParams[i]._searchParameters._doSort = isSorted;
|
||||
_treeParams[i]._treeState = tree2Update;
|
||||
found = true;
|
||||
}
|
||||
@ -173,6 +174,7 @@ void FunctionListPanel::addInStateArray(TreeStateNode tree2Update, const TCHAR *
|
||||
TreeParams params;
|
||||
params._treeState = tree2Update;
|
||||
params._searchParameters._text2Find = searchText;
|
||||
params._searchParameters._doSort = isSorted;
|
||||
_treeParams.push_back(params);
|
||||
}
|
||||
}
|
||||
@ -229,10 +231,12 @@ void FunctionListPanel::reload()
|
||||
{
|
||||
TCHAR text2Search[MAX_PATH];
|
||||
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, (LPARAM)text2Search);
|
||||
addInStateArray(currentTree, text2Search);
|
||||
bool isSorted = shouldSort();
|
||||
addInStateArray(currentTree, text2Search, isSorted);
|
||||
}
|
||||
removeAllEntries();
|
||||
::SendMessage(_hSearchEdit, WM_SETTEXT, 0, (LPARAM)TEXT(""));
|
||||
setSort(false);
|
||||
|
||||
vector<foundInfo> fi;
|
||||
|
||||
@ -280,15 +284,17 @@ void FunctionListPanel::reload()
|
||||
if (!previousParams)
|
||||
{
|
||||
::SendMessage(_hSearchEdit, WM_SETTEXT, 0, (LPARAM)TEXT(""));
|
||||
setSort(false);
|
||||
_treeView.expand(root);
|
||||
}
|
||||
else
|
||||
{
|
||||
::SendMessage(_hSearchEdit, WM_SETTEXT, 0, (LPARAM)(previousParams->_searchParameters)._text2Find.c_str());
|
||||
setSort((previousParams->_searchParameters)._doSort);
|
||||
_treeView.restoreFoldingStateFrom(previousParams->_treeState, root);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// invalidate the editor rect
|
||||
::InvalidateRect(_hSearchEdit, NULL, TRUE);
|
||||
}
|
||||
@ -396,35 +402,6 @@ void FunctionListPanel::notified(LPNMHDR notification)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
@ -522,6 +499,15 @@ bool FunctionListPanel::shouldSort()
|
||||
return (tbbuttonInfo.fsState & TBSTATE_CHECKED) != 0;
|
||||
}
|
||||
|
||||
void FunctionListPanel::setSort(bool isEnabled)
|
||||
{
|
||||
TBBUTTONINFO tbbuttonInfo;
|
||||
tbbuttonInfo.cbSize = sizeof(TBBUTTONINFO);
|
||||
tbbuttonInfo.dwMask = TBIF_STATE;
|
||||
tbbuttonInfo.fsState = isEnabled ? TBSTATE_ENABLED | TBSTATE_CHECKED : TBSTATE_ENABLED;
|
||||
::SendMessage(_hToolbarMenu, TB_SETBUTTONINFO, IDC_SORTBUTTON_FUNCLIST, (LPARAM)&tbbuttonInfo);
|
||||
}
|
||||
|
||||
BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
@ -557,7 +543,8 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
int editWidth = 100;
|
||||
int editHeight = 20;
|
||||
// Create toolbar menu
|
||||
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST;
|
||||
//int style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS |TBSTYLE_FLAT | CCS_TOP | BTNS_AUTOSIZE | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_NODIVIDER;
|
||||
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP;
|
||||
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
|
||||
0,0,0,0,_hSelf,(HMENU)0, _hInst, NULL);
|
||||
|
||||
@ -565,6 +552,13 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
oldFunclstToolbarProc = (WNDPROC)::SetWindowLongPtr(_hToolbarMenu, GWLP_WNDPROC, (LONG_PTR)funclstToolbarProc);
|
||||
TBBUTTON tbButtons[3];
|
||||
|
||||
// Add the bmap image into toolbar's imagelist
|
||||
TBADDBITMAP addbmp = {_hInst, 0};
|
||||
addbmp.nID = IDI_FUNCLIST_SORTBUTTON;
|
||||
::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, (LPARAM)&addbmp);
|
||||
addbmp.nID = IDI_FUNCLIST_RELOADBUTTON;
|
||||
::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, (LPARAM)&addbmp);
|
||||
|
||||
// Place holder of search text field
|
||||
tbButtons[0].idCommand = 0;
|
||||
tbButtons[0].iBitmap = editWidth + 10;
|
||||
@ -581,12 +575,14 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
tbButtons[2].idCommand = IDC_RELOADBUTTON_FUNCLIST;
|
||||
tbButtons[2].iBitmap = 1;
|
||||
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("");
|
||||
|
||||
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);
|
||||
|
||||
::SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
|
||||
::SendMessage(_hToolbarMenu, TB_SETBUTTONSIZE , (WPARAM)0, (LPARAM)MAKELONG (16, 16));
|
||||
::SendMessage(_hToolbarMenu, TB_ADDBUTTONS, (WPARAM)sizeof(tbButtons) / sizeof(TBBUTTON), (LPARAM)&tbButtons);
|
||||
::SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0);
|
||||
|
||||
ShowWindow(_hToolbarMenu, SW_SHOW);
|
||||
|
||||
_hSearchEdit = CreateWindowEx(0L, L"Edit", NULL,
|
||||
@ -602,7 +598,7 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
_treeViewSearchResult.init(_hInst, _hSelf, IDC_LIST_FUNCLIST_AUX);
|
||||
_treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST);
|
||||
setTreeViewImageList(IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF);
|
||||
setToolbarImageList(IDI_FUNCLIST_SORTBUTTON, IDI_FUNCLIST_RELOADBUTTON);
|
||||
|
||||
_treeView.display();
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -124,15 +124,14 @@ private:
|
||||
std::vector< std::pair<int, int> > _skipZones;
|
||||
std::vector<TreeParams> _treeParams;
|
||||
HIMAGELIST _hTreeViewImaLst;
|
||||
HIMAGELIST _hToolbarImaLst;
|
||||
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);
|
||||
void notified(LPNMHDR notification);
|
||||
void addInStateArray(TreeStateNode tree2Update, const TCHAR *searchText);
|
||||
void addInStateArray(TreeStateNode tree2Update, const TCHAR *searchText, bool isSorted);
|
||||
TreeParams* getFromStateArray(generic_string fullFilePath);
|
||||
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 shouldSort();
|
||||
void setSort(bool isEnabled);
|
||||
};
|
||||
#endif // FUNCLISTPANEL_H
|
||||
|
@ -269,7 +269,8 @@ void ToolBar::reset(bool create)
|
||||
}
|
||||
}
|
||||
|
||||
if (create) { //if the toolbar has been recreated, readd the buttons
|
||||
if (create)
|
||||
{ //if the toolbar has been recreated, readd the buttons
|
||||
size_t nrBtnToAdd = (_state == TB_STANDARD?_nrTotalButtons:_nrButtons);
|
||||
_nrCurrentButtons = nrBtnToAdd;
|
||||
WORD btnSize = (_state == TB_LARGE?32:16);
|
||||
@ -278,7 +279,8 @@ void ToolBar::reset(bool create)
|
||||
}
|
||||
::SendMessage(_hSelf, TB_AUTOSIZE, 0, 0);
|
||||
|
||||
if (_pRebar) {
|
||||
if (_pRebar)
|
||||
{
|
||||
_rbBand.hwndChild = getHSelf();
|
||||
_rbBand.cxMinChild = 0;
|
||||
_rbBand.cyIntegral = 1;
|
||||
|
BIN
PowerEditor/src/icons/funclstReload.bmp
Normal file
BIN
PowerEditor/src/icons/funclstReload.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
PowerEditor/src/icons/funclstSort.bmp
Normal file
BIN
PowerEditor/src/icons/funclstSort.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
x
Reference in New Issue
Block a user