[ENHANCE] Enhance Project Manager.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@819 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-09-26 22:45:42 +00:00
parent 7c71960fda
commit b040f8ccef
2 changed files with 16 additions and 3 deletions

View File

@ -399,14 +399,27 @@ bool ProjectPanel::buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem)
else if (lstrcmp(TEXT("File"), v) == 0) else if (lstrcmp(TEXT("File"), v) == 0)
{ {
const TCHAR *strValue = (childNode->ToElement())->Attribute(TEXT("name")); const TCHAR *strValue = (childNode->ToElement())->Attribute(TEXT("name"));
generic_string fullPath = getAbsoluteFilePath(strValue);
TCHAR *strValueLabel = ::PathFindFileName(strValue); TCHAR *strValueLabel = ::PathFindFileName(strValue);
int iImage = ::PathFileExists(strValue)?INDEX_LEAF:INDEX_LEAF_INVALID; int iImage = ::PathFileExists(fullPath.c_str())?INDEX_LEAF:INDEX_LEAF_INVALID;
_treeView.addItem(strValueLabel, hParentItem, iImage, strValue); _treeView.addItem(strValueLabel, hParentItem, iImage, fullPath.c_str());
} }
} }
return true; return true;
} }
generic_string ProjectPanel::getAbsoluteFilePath(const TCHAR * relativePath)
{
if (!::PathIsRelative(relativePath))
return relativePath;
TCHAR absolutePath[MAX_PATH];
lstrcpy(absolutePath, _workSpaceFilePath.c_str());
::PathRemoveFileSpec(absolutePath);
::PathAppend(absolutePath, relativePath);
return absolutePath;
}
void ProjectPanel::notified(LPNMHDR notification) void ProjectPanel::notified(LPNMHDR notification)
{ {
if((notification->hwndFrom == _treeView.getHSelf())) if((notification->hwndFrom == _treeView.getHSelf()))

View File

@ -90,6 +90,6 @@ protected:
bool buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem); bool buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem);
void notified(LPNMHDR notification); void notified(LPNMHDR notification);
void showContextMenu(int x, int y); void showContextMenu(int x, int y);
generic_string getAbsoluteFilePath(const TCHAR * relativePath);
}; };
#endif // PROJECTPANEL_H #endif // PROJECTPANEL_H