From 641c1af0e1a96657c8227b4e9660f42a99288fd7 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 20 Oct 2013 21:41:22 +0000 Subject: [PATCH] [ENHANCEMENT] change the icon buttons of functionlist. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1136 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 8 +- PowerEditor/src/Notepad_plus.rc | 6 +- .../FunctionList/functionListPanel.cpp | 74 +++++++++--------- .../FunctionList/functionListPanel.h | 5 +- .../src/WinControls/ToolBar/ToolBar.cpp | 6 +- PowerEditor/src/icons/funclstReload.bmp | Bin 0 -> 1146 bytes PowerEditor/src/icons/funclstSort.bmp | Bin 0 -> 1146 bytes 7 files changed, 51 insertions(+), 48 deletions(-) create mode 100644 PowerEditor/src/icons/funclstReload.bmp create mode 100644 PowerEditor/src/icons/funclstSort.bmp diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 3bc3fc46e..eb0711267 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -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."}, diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index b63ac698b..80fe1782f 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -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" diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index 7f1b3cdbc..d3e31d079 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -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 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; } diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.h b/PowerEditor/src/WinControls/FunctionList/functionListPanel.h index 77ae3d57c..22d176a5f 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.h +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.h @@ -124,15 +124,14 @@ private: std::vector< std::pair > _skipZones; std::vector _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 diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp index 54e838c26..33ddbe910 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp @@ -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; diff --git a/PowerEditor/src/icons/funclstReload.bmp b/PowerEditor/src/icons/funclstReload.bmp new file mode 100644 index 0000000000000000000000000000000000000000..37994570d1dc611108ba53f86e6fb570695cad6b GIT binary patch literal 1146 zcmbtQe^Aq97=PDyh~Gi7Ya|Vti(dlrb087nY3(%aT9Tcact%A_E4w5jmvqXNmnjy8 zAe>^Cg@T-hFh=Ov&f_-VFe$o-;iTfn7~?iJ#&=^3n4iAOzMa=!-Syl(@AKT}{d_*} z^SttBOZeokC}GdH*%bbrJn{(JvBBPpg6`&BfDrk{=ilS{|61?+7co;K$hsGb{+No1 zJV+HuDk)<`C2@<-5=MH4%%;?n-i*^knOI5ad->w306h2!Rp!T5R`XRWFD*g*uR(|! zqY-WnK$wXj%t|0(Yg8XWTrHVOIziTP9`QFry^@~g5FR9+*v??2+r)U(B0}1D0FuU+ zB5ooOktPZcj}U}gSg&D%6=w-jYe=@=Bl(92X5;*N$Sl#=Fr5sAEfM*y^-#_1!?xR5 zc)VvB(gp;GW@nL%vid&=ga+25jCj+|5W$*(1V-ii5CyJ0>~d~K>0&Wn>fMRtMt;L% zmxHobf5Vr`YWWpwuL)eMOo0eD@*uoL@IWiUs?Uh>iQiM06ZjIUxnk^_+k=vYH}UFt z0pgoNx)Lr?QQV%2b~^Q`&if%9TZ)i=3iM3^@gbghtts7AkMD6FEv!p3%9(1^SnD9y z$?rtg6a9vtgu$H0nr8ZZOgD{)4nCG&`@dE9IxW&EDfut&$L}>B*=(@2egLL(547({fl3+Bz6HLPr{PvVgWrzDf_tz3 zP+V|d=?eX5^X@y&{;x4>sDfwk0H(FMur`LFeFt$l^*bjp(*syf0k&F9ek-3dmdB=Y z9=bO~Q9mEf=(6i~!~R_k%ykls)Cgdz=HqHU#n@YA%Ed7atGx){=rJq~AHh&XlB+3q zS;aYdko060o!ziW&|uOOVW#V4Ok7BS`CKH%zY4*%SC%l2wj6=8W2+aQA^66susCuU zzL8H^ZUHP!xp3$T;W2&z*NxX;Rp(%`F%6^D5|~f3`usq~Kc~GVJ=@(|48I2~b(l9E zfY(qAZ+{`&H}c`^P+fw$9n{!qkFE1E2K@ ze3k|*3?GMg=qNk``(eAX6}OJBM%UhOm0zRI6P2~?2>Iu){g_>oNl&RWln(9oUdQ#f hW}W&XX0rK3x9NhyXedu9`fKLIhw?0NtI literal 0 HcmV?d00001 diff --git a/PowerEditor/src/icons/funclstSort.bmp b/PowerEditor/src/icons/funclstSort.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c28f0967404800d683967c8911f8876e94f399b0 GIT binary patch literal 1146 zcmb8s(MwZN9Ki9jU6~tcCaX@}mm~(_n-B!OELcQ=M9^PQJp_VJR!|$1Z&nbf5OiU% zw;sY5;X+XQ5SCDcU?j;1QdmR}l0J06Iiy>QemDNxm!iz!Fnk=3>nvG%QRr-a2u&;?h~1+p zSN386r(*r&9wfd_fA_a4zT+4@7t#GiU-eBE)$CMJy^@+{;(pnDI=`90LM$U|E?!($ z8*?M-kC57}@66})?;~iS>UwYPsycqXt)w=wAvIQ9e`g-@n}aZrzcPw~mrEabQUSA3f2(lD?{%s;u@>ESWXZ$FgJ7ZIRPf7+{IV3C-Y zndjHi<5+>`&Y%uqko#IYs$pQUYyS0Z)q`~`<3ntV9Ljl(XTFAk#jbhT^Zvd!iUw}r z(fqA+lRPZFAJZo^3@rAXUwW9$U=3$542$Ufug{#+FtFHjUherkb?_=)BE-C`N&E~8 k8U_|^=f4Db4