From 9df4ec6b51d952e4d21c99b98d44ae5e879ab762 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 24 Feb 2013 11:29:05 +0000 Subject: [PATCH] [UPDATE] FunctionList in progress. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1026 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/installer/nppSetup.nsi | 5 ++ PowerEditor/src/Notepad_plus.cpp | 4 +- PowerEditor/src/Notepad_plus.rc | 3 + .../FunctionList/functionListPanel.cpp | 53 +++++++++++++++++- .../FunctionList/functionListPanel.h | 2 + .../FunctionList/functionParser.cpp | 9 ++- .../WinControls/ProjectPanel/ProjectPanel.cpp | 35 ++++++------ PowerEditor/src/icons/funcList_leaf.bmp | Bin 0 -> 822 bytes PowerEditor/src/icons/funcList_node.bmp | Bin 0 -> 822 bytes PowerEditor/src/resource.h | 4 ++ 10 files changed, 91 insertions(+), 24 deletions(-) create mode 100644 PowerEditor/src/icons/funcList_leaf.bmp create mode 100644 PowerEditor/src/icons/funcList_node.bmp diff --git a/PowerEditor/installer/nppSetup.nsi b/PowerEditor/installer/nppSetup.nsi index beede59aa..4878a6fee 100644 --- a/PowerEditor/installer/nppSetup.nsi +++ b/PowerEditor/installer/nppSetup.nsi @@ -551,6 +551,11 @@ Section -"Notepad++" mainSection Rename "$INSTDIR\plugins\NotepadSharp.dll" "$INSTDIR\plugins\disabled\NotepadSharp.dll" Delete "$INSTDIR\plugins\NotepadSharp.dll" + IfFileExists "$INSTDIR\plugins\PreviewHTML.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nPreviewHTML.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\PreviewHTML.dll" "$INSTDIR\plugins\disabled\PreviewHTML.dll" + Delete "$INSTDIR\plugins\PreviewHTML.dll" + ; Context Menu Management : removing old version of Context Menu module IfFileExists "$INSTDIR\nppcm.dll" 0 +3 Exec 'regsvr32 /u /s "$INSTDIR\nppcm.dll"' diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index d981f8280..637bfb76c 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -5199,7 +5199,7 @@ struct Quote{ const char *_quote; }; -const int nbQuote = 109; +const int nbQuote = 111; 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."}, @@ -5303,6 +5303,8 @@ Quote quotes[nbQuote] = { {"Anonymous #70", "If abortion is murder then are condoms kidnapping?"}, {"Anonymous #71", "Men also have feelings.\nFor example, they can feel hungry."}, {"Anonymous #72", "Project Manager:\nA person who thinks 9 women can deliver a baby in 1 month."}, +{"Anonymous #73", "If you try and don't succeed, cheat. Repeat until caught. Then lie."}, +{"Anonymous #74", "Olympics is the stupidest thing.\nPeople are so proud to be competing for their country.\nThey play their stupid song and raise some dumb flags.\nI'd love to see no flags raised, no song, no mention of country.\nOnly people."}, {"Apple fan boy", "I'll buy a second iPhone 5 and buy a lot of iOS applications so that Apple will be able to buy Samsung (this shitty company) to shut it down and all the Apple haters will be forced to have an iPhone. Muhahaha..."}, {"Motherf*cker", "Thousands of my potential children died on your mother's face last night."}, {"Hustle Man", "Politicians are like sperm.\nOne in a million turn out to be an actual human being."}, diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 0fb9b4c39..7a1191855 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -190,6 +190,9 @@ IDI_PROJECT_FOLDERCLOSE BITMAP "icons\\project_folder_close.bmp" IDI_PROJECT_FILE BITMAP "icons\\project_file.bmp" IDI_PROJECT_FILEINVALID BITMAP "icons\\project_file_invalid.bmp" +IDI_FUNCLIST_ROOT BITMAP "icons\\project_file.bmp" +IDI_FUNCLIST_NODE BITMAP "icons\\funcList_node.bmp" +IDI_FUNCLIST_LEAF BITMAP "icons\\funcList_leaf.bmp" IDR_M30_MENU MENU BEGIN diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index 1d620c9d8..08cded4b9 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -30,6 +30,13 @@ #include "functionListPanel.h" #include "ScintillaEditView.h" +#define CX_BITMAP 16 +#define CY_BITMAP 16 + +#define INDEX_ROOT 0 +#define INDEX_NODE 1 +#define INDEX_LEAF 2 + void FunctionListPanel::addEntry(const TCHAR *nodeName, const TCHAR *displayText, size_t pos) { HTREEITEM itemParent = NULL; @@ -42,13 +49,13 @@ void FunctionListPanel::addEntry(const TCHAR *nodeName, const TCHAR *displayText itemParent = _treeView.searchSubItemByName(nodeName, root); if (!itemParent) { - itemParent = _treeView.addItem(nodeName, root, NULL, TEXT("-1")); + itemParent = _treeView.addItem(nodeName, root, INDEX_NODE, TEXT("-1")); } } else itemParent = root; - _treeView.addItem(displayText, itemParent, NULL, posStr); + _treeView.addItem(displayText, itemParent, INDEX_LEAF, posStr); } void FunctionListPanel::removeAllEntries() @@ -190,7 +197,7 @@ void FunctionListPanel::reload() TCHAR *ext = ::PathFindExtension(fn); if (_funcParserMgr.parse(fi, ext)) - _treeView.addItem(fn, NULL, NULL, TEXT("-1")); + _treeView.addItem(fn, NULL, INDEX_ROOT, TEXT("-1")); for (size_t i = 0; i < fi.size(); i++) { @@ -269,6 +276,45 @@ void FunctionListPanel::notified(LPNMHDR notification) } + +BOOL FunctionListPanel::setImageList(int root_id, int node_id, int leaf_id) +{ + HBITMAP hbmp; + + const int nbBitmaps = 3; + + // Creation of image list + if ((_hImaLst = 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(root_id)); + if (hbmp == NULL) + return FALSE; + ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); + DeleteObject(hbmp); + + hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(node_id)); + if (hbmp == NULL) + return FALSE; + ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); + DeleteObject(hbmp); + + hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(leaf_id)); + if (hbmp == NULL) + return FALSE; + ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); + DeleteObject(hbmp); + + if (ImageList_GetImageCount(_hImaLst) < nbBitmaps) + return FALSE; + + // Set image list to the tree view + TreeView_SetImageList(_treeView.getHSelf(), _hImaLst, TVSIL_NORMAL); + + return TRUE; +} + BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) @@ -276,6 +322,7 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM case WM_INITDIALOG : { _treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST); + setImageList(IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF); _treeView.display(); return TRUE; } diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.h b/PowerEditor/src/WinControls/FunctionList/functionListPanel.h index f2b3587ef..ec80e509e 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.h +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.h @@ -102,10 +102,12 @@ private: std::vector _funcInfos; std::vector< std::pair > _skipZones; std::vector _treeStates; + HIMAGELIST _hImaLst; 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 addInTreeStateArray(TreeStateNode tree2Update); TreeStateNode* getFromTreeStateArray(generic_string fullFilePath); + BOOL setImageList(int root_id, int node_id, int leaf_id); }; #endif // FUNCLISTPANEL_H diff --git a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp index ba5e67ca6..202d533a0 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp @@ -485,7 +485,12 @@ void FunctionParser::getInvertZones(vector< pair > & destZones, vecto } else { - // todo : check the begin + // check the begin + if (int(begin) < sourceZones[0].first) + { + destZones.push_back(pair(begin, sourceZones[0].first - 1)); + } + size_t i = 0; for (; i < sourceZones.size() - 1; i++) { @@ -496,7 +501,7 @@ void FunctionParser::getInvertZones(vector< pair > & destZones, vecto } int lastBegin = sourceZones[i].second + 1; if (lastBegin < int(end)) - destZones.push_back(pair(lastBegin, end)); + destZones.push_back(pair(lastBegin, end)); } } diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp index 39697a6f3..08d9232f0 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp @@ -256,7 +256,6 @@ void ProjectPanel::initMenus() BOOL ProjectPanel::setImageList(int root_clean_id, int root_dirty_id, int project_id, int open_node_id, int closed_node_id, int leaf_id, int ivalid_leaf_id) { - int i; HBITMAP hbmp; const int nbBitmaps = 7; @@ -267,52 +266,52 @@ BOOL ProjectPanel::setImageList(int root_clean_id, int root_dirty_id, int projec // Add the bmp in the list hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_clean_id)); - if(hbmp == NULL) + if (hbmp == NULL) return FALSE; - i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); + ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); DeleteObject(hbmp); hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_dirty_id)); - if(hbmp == NULL) + if (hbmp == NULL) return FALSE; - i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); + ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); DeleteObject(hbmp); hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(project_id)); - if(hbmp == NULL) + if (hbmp == NULL) return FALSE; - i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); + ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); DeleteObject(hbmp); hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(open_node_id)); - if(hbmp == NULL) + if (hbmp == NULL) return FALSE; - i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); + ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); DeleteObject(hbmp); hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(closed_node_id)); - if(hbmp == NULL) + if (hbmp == NULL) return FALSE; - i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); + ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); DeleteObject(hbmp); hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(leaf_id)); - if(hbmp == NULL) + if (hbmp == NULL) return FALSE; - i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); + ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); DeleteObject(hbmp); hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(ivalid_leaf_id)); - if(hbmp == NULL) + if (hbmp == NULL) return FALSE; - i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); + ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL); DeleteObject(hbmp); if (ImageList_GetImageCount(_hImaLst) < nbBitmaps) return FALSE; // Set image list to the tree view - TreeView_SetImageList(_treeView.getHSelf(), _hImaLst, TVSIL_NORMAL); + TreeView_SetImageList(_treeView.getHSelf(), _hImaLst, TVSIL_NORMAL); return TRUE; } @@ -538,7 +537,7 @@ void ProjectPanel::openSelectFile() void ProjectPanel::notified(LPNMHDR notification) { - if((notification->hwndFrom == _treeView.getHSelf())) + if ((notification->hwndFrom == _treeView.getHSelf())) { TCHAR textBuffer[MAX_PATH]; TVITEM tvItem; @@ -742,7 +741,7 @@ void ProjectPanel::showContextMenu(int x, int y) ScreenToClient(_treeView.getHSelf(), &(tvHitInfo.pt)); hTreeItem = TreeView_HitTest(_treeView.getHSelf(), &tvHitInfo); - if(tvHitInfo.hItem != NULL) + if (tvHitInfo.hItem != NULL) { // Make item selected _treeView.selectItem(tvHitInfo.hItem); diff --git a/PowerEditor/src/icons/funcList_leaf.bmp b/PowerEditor/src/icons/funcList_leaf.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3c79301b22d49c3ff53230d79919301e6c001fab GIT binary patch literal 822 zcmZ?rHDhJ~12Z700mK4O%*Y@C7H5FULpTuf|BwQ2F1;yIDSUS388NPYd*kiOfE5h} z^`+{iuP?sFujR$X7pnqRo=HDlr&l-4VrsQ^)rYGeAX-*`_`dql(>3SLtlhnJ-SRm= z!6&Dl08PG}ed$Wx<$8m<`8M)2`=#%G&;Rv)?z`zh(`xi^n!h|? z8C3D?U%zMk`aSd4^BK=3`b~hl2WSh>igjDotee>d6g=N?{?YnJzgL45&-nFf!b_mY zmuFw#>d_b}Y~orZ?mR5m4p-vol|AsUfHZs2J!bp!q~ zEtrb=D(1npz}5eK^S4*G2dD*Z6p#T_22?Dw?HybTL_JXPW}8iS3T^|n0ND^N5XJtd zKbjnPufOj-Pf{aLF$CSrx$$f5uirC%A!`v?^|1Bf*X-+G0zg_m$ZmZH)B?Dva51?9r4wJ>u0#^+81=yA^+1Ef0 f6Q6Mc;v|SHnqp)vK);|VhR9+iA$~zN8B-Ym&OeSy literal 0 HcmV?d00001 diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index 9cc0dac4d..94c66cc82 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -144,6 +144,10 @@ #define IDI_PROJECT_FILE 606 #define IDI_PROJECT_FILEINVALID 607 +#define IDI_FUNCLIST_ROOT 620 +#define IDI_FUNCLIST_NODE 621 +#define IDI_FUNCLIST_LEAF 622 + #define IDC_MY_CUR 1402 #define IDC_UP_ARROW 1403 #define IDC_DRAG_TAB 1404