[ENHANCE] Enhance Project Manager.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@805 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-09-07 18:10:31 +00:00
parent f88cbf265e
commit ede0a41d78
16 changed files with 106 additions and 65 deletions

View File

@ -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"

View File

@ -1040,7 +1040,7 @@ public :
};
void addDefaultThemeFromXml(generic_string xmlFullPath) {
_themeList.push_back(pair<generic_string, generic_string>(TEXT("Default (styles.xml)"), xmlFullPath));
_themeList.push_back(pair<generic_string, generic_string>(TEXT("Default (stylers.xml)"), xmlFullPath));
};
generic_string getThemeFromXmlFileName(const TCHAR *fn) const;

View File

@ -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");

View File

@ -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)
{

View File

@ -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];
if((notification->hwndFrom == _treeView.getHSelf()))
{
TCHAR text_buffer[MAX_PATH];
TVITEM tvItem;
tvItem.mask = TVIF_TEXT | TVIF_PARAM;
tvItem.pszText = text_buffer;
tvItem.cchTextMax = MAX_PATH;
switch (notification->code)
{
case NM_DBLCLK:
{
//printStr(TEXT("double click"));
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);
}
}
*/
}
}
}
void ProjectPanel::showContextMenu(int x, int y)

View File

@ -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

View File

@ -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;

View File

@ -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:

View File

@ -4,15 +4,24 @@
<Project name="Notepad++" >
<Folder name="Power Editor">
<Folder name="src">
<Folder name="src2">
<Folder name="src3">
<File name="C:\toto.txt"/>
<Folder name="WinControls">
<Folder name="ProjectPanel">
<File name="D:\source\notepad++\trunk\PowerEditor\src\WinControls\ProjectPanel\ProjectPanel.h"/>
<File name="D:\source\notepad++\trunk\PowerEditor\src\WinControls\ProjectPanel\ProjectPanel.cpp"/>
<File name="D:\source\notepad++\trunk\PowerEditor\src\WinControls\ProjectPanel\ProjectPanel.rc"/>
<File name="D:\source\notepad++\trunk\PowerEditor\src\WinControls\ProjectPanel\TreeView.h"/>
<File name="D:\source\notepad++\trunk\PowerEditor\src\WinControls\ProjectPanel\TreeView.cpp"/>
</Folder>
<Folder name="src3-B">
<Folder name="AboutDlg">
</Folder>
<File name="D:\source\notepad++\trunk\PowerEditor\src\WinControls\Window.h"/>
<File name="D:\source\notepad++\trunk\PowerEditor\src\WinControls\WindowInterface.h"/>
</Folder>
<File name="D:\source\notepad++\trunk\PowerEditor\src\Notepad_plus.h"/>
<File name="D:\source\notepad++\trunk\PowerEditor\src\Notepad_plus.cpp"/>
<File name="D:\source\notepad++\trunk\PowerEditor\src\Notepad_plus.rc"/>
</Folder>
<File name="C:\sources\Notepad++\trunk\PowerEditor\license.txt"/>
<File name="D:\source\notepad++\trunk\PowerEditor\license.txt"/>
</Folder>
<Folder name="Scintilla">
</Folder>

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

View File

@ -125,6 +125,12 @@
#define IDI_READONLY_ICON 503
#define IDI_FIND_RESULT_ICON 504
#define IDI_PROJECT_ROOT 601
#define IDI_PROJECT_FOLDEROPEN 602
#define IDI_PROJECT_FOLDERCLOSE 603
#define IDI_PROJECT_FILE 604
#define IDI_PROJECT_FILEINVALID 605
#define IDC_MY_CUR 1402
#define IDC_UP_ARROW 1403
#define IDC_DRAG_TAB 1404

View File

@ -1611,11 +1611,11 @@
>
</File>
<File
RelativePath="..\src\WinControls\Preference\resource.h"
RelativePath="..\src\resource.h"
>
</File>
<File
RelativePath="..\src\resource.h"
RelativePath="..\src\WinControls\Preference\resource.h"
>
</File>
<File