From ede0a41d78c7e0b1c8ce43a4906451d046d10afe Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 7 Sep 2011 18:10:31 +0000 Subject: [PATCH] [ENHANCE] Enhance Project Manager. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@805 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.rc | 8 ++ PowerEditor/src/Parameters.h | 2 +- .../src/ScitillaComponent/FindReplaceDlg.cpp | 3 +- PowerEditor/src/ScitillaComponent/Printer.cpp | 2 + .../WinControls/ProjectPanel/ProjectPanel.cpp | 105 ++++++++++-------- .../WinControls/ProjectPanel/ProjectPanel.rc | 2 +- .../src/WinControls/ProjectPanel/TreeView.cpp | 18 +-- .../src/WinControls/ProjectPanel/TreeView.h | 2 +- .../src/WinControls/ProjectPanel/demo.xml | 19 +++- PowerEditor/src/icons/project_file.bmp | Bin 0 -> 822 bytes .../src/icons/project_file_invalid.bmp | Bin 0 -> 822 bytes .../src/icons/project_folder_close.bmp | Bin 0 -> 822 bytes PowerEditor/src/icons/project_folder_open.bmp | Bin 0 -> 822 bytes PowerEditor/src/icons/project_root.bmp | Bin 0 -> 568 bytes PowerEditor/src/resource.h | 6 + PowerEditor/visual.net/notepadPlus.vcproj | 4 +- 16 files changed, 106 insertions(+), 65 deletions(-) create mode 100644 PowerEditor/src/icons/project_file.bmp create mode 100644 PowerEditor/src/icons/project_file_invalid.bmp create mode 100644 PowerEditor/src/icons/project_folder_close.bmp create mode 100644 PowerEditor/src/icons/project_folder_open.bmp create mode 100644 PowerEditor/src/icons/project_root.bmp diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index cea69c6b..5c9ba4aa 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -172,6 +172,14 @@ IDI_MMPLAY_DIS_ICON ICON "icons\\playrecord_m_dis.ico" IDI_MMPLAY_OFF_ICON ICON "icons\\playrecord_m_off.ico" IDI_MMPLAY_ON_ICON ICON "icons\\playrecord_m_on.ico" + +IDI_PROJECT_ROOT BITMAP "icons\\project_root.bmp" +IDI_PROJECT_FOLDEROPEN BITMAP "icons\\project_folder_open.bmp" +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" + + IDR_M30_MENU MENU BEGIN POPUP "&File" diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index f1ce6219..d14340d8 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1040,7 +1040,7 @@ public : }; void addDefaultThemeFromXml(generic_string xmlFullPath) { - _themeList.push_back(pair(TEXT("Default (styles.xml)"), xmlFullPath)); + _themeList.push_back(pair(TEXT("Default (stylers.xml)"), xmlFullPath)); }; generic_string getThemeFromXmlFileName(const TCHAR *fn) const; diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 91f21c45..1c4913ec 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -1955,12 +1955,11 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri nppParamInst->_isFindReplacing = false; break; case IDD_FINDINFILES_FIND_BUTTON : - { nppParamInst->_isFindReplacing = true; findAllIn(FILES_IN_DIR); nppParamInst->_isFindReplacing = false; break; - } + case IDD_FINDINFILES_REPLACEINFILES : { generic_string msg = TEXT("Are you sure you want to replace all occurrences in :\r"); diff --git a/PowerEditor/src/ScitillaComponent/Printer.cpp b/PowerEditor/src/ScitillaComponent/Printer.cpp index 623d1feb..5a96a1a6 100644 --- a/PowerEditor/src/ScitillaComponent/Printer.cpp +++ b/PowerEditor/src/ScitillaComponent/Printer.cpp @@ -181,8 +181,10 @@ size_t Printer::doPrint(bool justDoIt) DOCINFO docInfo; docInfo.cbSize = sizeof(DOCINFO); + docInfo.fwType = 0; docInfo.lpszDocName = _pSEView->getCurrentBuffer()->getFullPathName(); docInfo.lpszOutput = NULL; + docInfo.lpszDatatype = NULL; if (::StartDoc(_pdlg.hDC, &docInfo) < 0) { diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp index a282bcdc..787f3e35 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp @@ -34,9 +34,9 @@ BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar { _treeView.init(_hInst, _hSelf, ID_PROJECTTREEVIEW); - _treeView.initImageList(IDR_WRAP, IDR_ZOOMIN, IDR_ZOOMOUT, IDR_FIND); + _treeView.initImageList(IDI_PROJECT_ROOT, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE); _treeView.display(); - openProject(TEXT("C:\\sources\\Notepad++\\trunk\\PowerEditor\\src\\WinControls\\ProjectPanel\\demo.xml")); + openProject(TEXT("D:\\source\\notepad++\\trunk\\PowerEditor\\src\\WinControls\\ProjectPanel\\demo.xml")); return TRUE; } @@ -114,7 +114,9 @@ bool ProjectPanel::buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem) } else if (lstrcmp(TEXT("File"), v) == 0) { - _treeView.addItem((childNode->ToElement())->Attribute(TEXT("name")), hParentItem, INDEX_LEAF); + const TCHAR *strValue = (childNode->ToElement())->Attribute(TEXT("name")); + TCHAR *strValueLabel = ::PathFindFileName(strValue); + _treeView.addItem(strValueLabel, hParentItem, INDEX_LEAF, strValue); //::MessageBox(NULL, (childNode->ToElement())->Attribute(TEXT("name")), TEXT("File"), MB_OK); } } @@ -123,51 +125,66 @@ bool ProjectPanel::buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem) void ProjectPanel::notified(LPNMHDR notification) { - //LPNMTREEVIEW - //TVITEM tv_item; - //TCHAR text_buffer[MAX_PATH]; - - switch (notification->code) + if((notification->hwndFrom == _treeView.getHSelf())) { - case NM_DBLCLK: + TCHAR text_buffer[MAX_PATH]; + TVITEM tvItem; + tvItem.mask = TVIF_TEXT | TVIF_PARAM; + tvItem.pszText = text_buffer; + tvItem.cchTextMax = MAX_PATH; + + switch (notification->code) { - //printStr(TEXT("double click")); - } - break; + case NM_DBLCLK: + { + tvItem.hItem = TreeView_GetSelection(_treeView.getHSelf()); + ::SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); + generic_string *fn = (generic_string *)tvItem.lParam; + if (fn) + ::SendMessage(_hParent, NPPM_DOOPEN, 0, (LPARAM)(fn->c_str())); + } + break; + + case TVN_ENDLABELEDIT: + { + LPNMTVDISPINFO tvnotif = (LPNMTVDISPINFO)notification; + printStr(tvnotif->item.pszText); + } + break; + + case TVN_ITEMEXPANDED: + { + LPNMTREEVIEW nmtv = (LPNMTREEVIEW)notification; + tvItem.hItem = nmtv->itemNew.hItem; + tvItem.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE; + ::SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); + if (tvItem.iImage != INDEX_PROJECT_ROOT) + { + if (nmtv->action == TVE_COLLAPSE) + { + tvItem.iImage = INDEX_CLOSED_NODE; + tvItem.iSelectedImage = INDEX_CLOSED_NODE; + TreeView_SetItem(_treeView.getHSelf(), &tvItem); + } + else if (nmtv->action == TVE_EXPAND) + { + tvItem.iImage = INDEX_OPEN_NODE; + tvItem.iSelectedImage = INDEX_OPEN_NODE; + TreeView_SetItem(_treeView.getHSelf(), &tvItem); + } + } + } + break; + /* - case NM_RCLICK: - { - //printStr(TEXT("right click")); - } - break; - - case TVN_SELCHANGED: - { - printStr(TEXT("TVN_SELCHANGED")); - } - break; -*/ - } - /* - if((notification->hdr).hwndFrom == _treeView.getHSelf()) - { - if((notification->hdr).code == TVN_SELCHANGED) - { - tv_item.hItem = notification->itemNew.hItem; - tv_item.mask = TVIF_TEXT | TVIF_PARAM; - tv_item.pszText = text_buffer; - tv_item.cchTextMax = MAX_PATH; - SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tv_item); - - - if(tv_item.lParam==DOMAIN_LEVEL) - ShowDomainContent(tv_item.pszText); - else if(tv_item.lParam==SERVER_LEVEL) - ShowServerContent(tv_item.pszText); - - } - } + case NM_RCLICK: + { + //printStr(TEXT("right click")); + } + break; */ + } + } } void ProjectPanel::showContextMenu(int x, int y) diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.rc b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.rc index 741622fb..73548f02 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.rc +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.rc @@ -26,5 +26,5 @@ EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE CAPTION "Project" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - CONTROL "",ID_PROJECTTREEVIEW,"SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,172,93 + CONTROL "",ID_PROJECTTREEVIEW,"SysTreeView32", TVS_HASBUTTONS | TVS_EDITLABELS | TVS_HASLINES | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,172,93 END diff --git a/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp b/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp index 766f2c47..ce2b455c 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp @@ -19,8 +19,9 @@ #include "TreeView.h" -#define CX_BITMAP 14 -#define CY_BITMAP 14 +#define CX_BITMAP 16 +#define CY_BITMAP 16 +#define CY_ITEMHEIGHT 18 #define NUM_BITMAPS 3 @@ -28,6 +29,7 @@ void TreeView::init(HINSTANCE hInst, HWND parent, int treeViewID) { Window::init(hInst, parent); _hSelf = ::GetDlgItem(parent, treeViewID); + TreeView_SetItemHeight(_hSelf, CY_ITEMHEIGHT); } BOOL TreeView::initImageList(int project_root_id, int open_node_id, int closed_node_id, int leaf_id) @@ -85,23 +87,21 @@ LRESULT TreeView::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) return ::CallWindowProc(_defaultProc, hwnd, Message, wParam, lParam); } -HTREEITEM TreeView::addItem(const TCHAR *itemName, HTREEITEM hParentItem, int iImage) +HTREEITEM TreeView::addItem(const TCHAR *itemName, HTREEITEM hParentItem, int iImage, const TCHAR *filePath) { TVITEM tvi; tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; - // Set the text of the item. + // Set the item label. tvi.pszText = (LPTSTR)itemName; tvi.cchTextMax = sizeof(tvi.pszText)/sizeof(tvi.pszText[0]); - // Assume the item is not a parent item, so give it a - // document image. + // Set icon tvi.iImage = iImage;//isNode?INDEX_CLOSED_NODE:INDEX_LEAF; tvi.iSelectedImage = iImage;//isNode?INDEX_OPEN_NODE:INDEX_LEAF; - // Save the heading level in the item's application-defined - // data area. - tvi.lParam = (LPARAM)0;//nLevel; + // Save the full path of file in the item's application-defined data area. + tvi.lParam = (filePath == NULL?0:(LPARAM)(new generic_string(filePath))); TVINSERTSTRUCT tvInsertStruct; tvInsertStruct.item = tvi; diff --git a/PowerEditor/src/WinControls/ProjectPanel/TreeView.h b/PowerEditor/src/WinControls/ProjectPanel/TreeView.h index c56102cc..0047f91f 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/TreeView.h +++ b/PowerEditor/src/WinControls/ProjectPanel/TreeView.h @@ -33,7 +33,7 @@ public: virtual ~TreeView() {}; virtual void init(HINSTANCE hInst, HWND parent, int treeViewID); virtual void destroy(); - HTREEITEM addItem(const TCHAR *itemName, HTREEITEM hParentItem, int iImage); + HTREEITEM addItem(const TCHAR *itemName, HTREEITEM hParentItem, int iImage, const TCHAR *filePath = NULL); BOOL initImageList(int project_root_id, int open_node_id, int closed_node_id, int leaf_id); protected: diff --git a/PowerEditor/src/WinControls/ProjectPanel/demo.xml b/PowerEditor/src/WinControls/ProjectPanel/demo.xml index f41defd9..98a626b0 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/demo.xml +++ b/PowerEditor/src/WinControls/ProjectPanel/demo.xml @@ -4,15 +4,24 @@ - - - + + + + + + + - + + + + + + - + diff --git a/PowerEditor/src/icons/project_file.bmp b/PowerEditor/src/icons/project_file.bmp new file mode 100644 index 0000000000000000000000000000000000000000..d97237d685d09bd452de1adaf9a1b91f7e3ba9f4 GIT binary patch literal 822 zcmaiy&1%9x6opf|FJ1N#`UE~e_kBz^A_gIg5R8ac(?(4eRz*Yv0}(~>C;r=*emGjJ zN$r7|z@6`&oIAFHRPIDdN(OB5t22!dX(S1y-7ZmLqLfB_@m z?RNWhQvkF89}WkMZ?dODuq(dP>9pJJR;$%)HtY5J=UMyxo*sD2!~UG2-ET$mjYgwZ ztJ$_)tyUT8{isr@wApMT`BTvIgSRjy`ir+L%QQ_43xz^1m(z7UlgVhBwpy+J^~W4r zNYC@;^LZq17)Cyy&t|i#sw#?-PN!3;R5FNY&IH=hQp!jx?!HV z$V^(CWm!%n67hIkIEek~{@3d@E$oQQ)9DmvNJdyJ7R6$*+wJmw5shS^NCqL2OeT}T mU;y9m_qi@$-}eR2kHl5{X>lBf7Tyx6EBG6Nx4XLl literal 0 HcmV?d00001 diff --git a/PowerEditor/src/icons/project_file_invalid.bmp b/PowerEditor/src/icons/project_file_invalid.bmp new file mode 100644 index 0000000000000000000000000000000000000000..2911b5e382e3313f94490f14a072ded93eeda832 GIT binary patch literal 822 zcmaKpKS%;$7>7^9#;DC83ZX$-+T4Pu*_LQ1TEd8+rUtFa&B1Wdp{X@$&`k&_$TN%7 z8XDT%I{2%pZL3@ZR&j_uO}@ZkLrY;zD)eO#K}TV>kK?oun7VlO&%K(+fNbj&=3yWQ@>4jYQM z-C;8ABaQ%B35w|a$73oID=d58LUHxxT|d53mX0!!Xu-_)zXc=V=*Qyj6Ex3=*@lET_|Hj^pUR!yp{cgfI9s=(8+42xFvFDq#d~8JQvY2Y7R!pa1{> literal 0 HcmV?d00001 diff --git a/PowerEditor/src/icons/project_folder_close.bmp b/PowerEditor/src/icons/project_folder_close.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6d6fad29a04edd0d12770e2ea1819769e9e4b992 GIT binary patch literal 822 zcmd6j&ubGw6vtP*i%0(g@gyFk5K`(7gyKQGh(ACNS_GA#5Fwx_S}-D1D#26{e_<8u zq4rSqQ1PHOhc?w_ZKC-x+jZMCH5<%scXoDmvpX~Eq?6#qtKj4N9>bf@eBaFMJVcqtF#3sy|F&gQJ?hPP`32tIlrm_B=^w^B84aLJ9Uc%b4O zDx&_p9g*SoFV@z%wJZ!cCivdR0Q&TG(|@72MpnJ#vYSxxY2X|wqWuLs`W5b&w?1?J zVb}jTz=X{}GGzwizx+q_)=<^GqT!f=Pn4a5-_gFjE!!kI+U3Up3qy~Fn1&7sZNf^J zr1_w#oA`mx0OxoK6%mQP?C_CSppJud!MrtZT>Pld>KGEnPw~1&m>Do5VBD~GqQmc= zP%NLORp+jP2EV~`*=B66k<6Rd7tG7DnaCOOoT0lx-=remyXTGK5;nZzrBvss=8P|4 z?ulr7gw^%;X?XO#*7={efU@>Po|J`r(Qt$FGqnq|D?(RuKX1tOcQq*ZW7FEnPs;Q(REe8G=Ncpb?E+ zVnn_9@g~uaoG=NCS_m%RUgqweGc!Bs#nhA=t`y%{c5<{6Zf1DyxDTeab>Q6R|F4CU z(3m?2f5I9;eEt@TpwWTj#}@3~z6xTJc>4Y457>F?Y(2C$@1l*X=1O@4u1S3+2urPj z^s=CzwEV93EEMwkA^&@~C+h83g{(0O@glDuECv>#w`2G8ROIdD!?ieSG9?*p!UUSI z%}4r5uuV&Y`wQq-3;mlTL6X(w%zSY?Pw8uydt8n6)dIi5(^Ciw`lwO!^e<=Y^qI>p gSu++$j|E7p0R6XOT=nZyEWks^na^c~CH!0P1&=J8YybcN literal 0 HcmV?d00001 diff --git a/PowerEditor/src/icons/project_root.bmp b/PowerEditor/src/icons/project_root.bmp new file mode 100644 index 0000000000000000000000000000000000000000..f50cbb9ecc55f4a4ac2a4d6cbee310e56c6c1014 GIT binary patch literal 568 zcma)3y=ucS5O(tbrE@?_22(O<@DR#@J$TR%Q!;qSAYu<0JY?{YA;W?5AOSszh=;z0 zz%Nqa-pNTxphG22NPK_NDgXSKMPaOHeW!Z6)l1k#(Twn~*Qo-Lmht@m+0~e!tn^S+PqSVX&$Y@trIwideI5RAK=ko>1zP%nyL)kUy%L!o*M>!A& zyfuePyWA^Lh{7vOD21k96Q1;~q3qq(WobF$NcZI(`-_70X-RKdivs2S%_!N0lOQHH znQmC;@=F3SbtiH8hy$|1!g$s