[BUG_FiXED] Fix the crash issue while execute "Add Files from Directory" command (Project Manager).
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@835 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
bc3870e742
commit
e82e63d3a6
@ -45,7 +45,7 @@ void writeLog(const TCHAR *logFileName, const char *log2write)
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/callbackfunctions/browsecallbackproc.asp
|
||||
static int __stdcall BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM, LPARAM pData)
|
||||
{
|
||||
if (uMsg == BFFM_INITIALIZED)
|
||||
if (uMsg == BFFM_INITIALIZED && pData != 0)
|
||||
::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData);
|
||||
return 0;
|
||||
};
|
||||
@ -100,7 +100,7 @@ void folderBrowser(HWND parent, int outputCtrlID, const TCHAR *defaultStr)
|
||||
}
|
||||
|
||||
|
||||
generic_string getFolderName(HWND parent)
|
||||
generic_string getFolderName(HWND parent, const TCHAR *defaultDir)
|
||||
{
|
||||
generic_string folderName(TEXT(""));
|
||||
LPMALLOC pShellMalloc = 0;
|
||||
@ -115,6 +115,7 @@ generic_string getFolderName(HWND parent)
|
||||
info.lpszTitle = TEXT("Select a folder");
|
||||
info.ulFlags = 0;
|
||||
info.lpfn = BrowseCallbackProc;
|
||||
info.lParam = reinterpret_cast<LPARAM>(defaultDir);
|
||||
|
||||
// Execute the browsing dialog.
|
||||
LPITEMIDLIST pidl = ::SHBrowseForFolder(&info);
|
||||
|
@ -74,7 +74,7 @@ const bool dirDown = false;
|
||||
typedef std::basic_string<TCHAR> generic_string;
|
||||
|
||||
void folderBrowser(HWND parent, int outputCtrlID, const TCHAR *defaultStr = NULL);
|
||||
generic_string getFolderName(HWND parent);
|
||||
generic_string getFolderName(HWND parent, const TCHAR *defaultDir = NULL);
|
||||
|
||||
void printInt(int int2print);
|
||||
void printStr(const TCHAR *str2print);
|
||||
|
@ -1092,12 +1092,25 @@ void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTre
|
||||
|
||||
void ProjectPanel::addFilesFromDirectory(HTREEITEM hTreeItem)
|
||||
{
|
||||
generic_string folderName = getFolderName(_hSelf);
|
||||
if (folderName != TEXT(""))
|
||||
if (_selDirOfFilesFromDirDlg == TEXT("") && _workSpaceFilePath != TEXT(""))
|
||||
{
|
||||
recursiveAddFilesFrom(folderName.c_str(), hTreeItem);
|
||||
TCHAR dir[MAX_PATH];
|
||||
lstrcpy(dir, _workSpaceFilePath.c_str());
|
||||
::PathRemoveFileSpec(dir);
|
||||
_selDirOfFilesFromDirDlg = dir;
|
||||
}
|
||||
generic_string dirPath;
|
||||
if (_selDirOfFilesFromDirDlg != TEXT(""))
|
||||
dirPath = getFolderName(_hSelf, _selDirOfFilesFromDirDlg.c_str());
|
||||
else
|
||||
dirPath = getFolderName(_hSelf);
|
||||
|
||||
if (dirPath != TEXT(""))
|
||||
{
|
||||
recursiveAddFilesFrom(dirPath.c_str(), hTreeItem);
|
||||
_treeView.expand(hTreeItem);
|
||||
setWorkSpaceDirty(true);
|
||||
_selDirOfFilesFromDirDlg = dirPath;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,8 @@ class TiXmlNode;
|
||||
class ProjectPanel : public DockingDlgInterface {
|
||||
public:
|
||||
ProjectPanel(): DockingDlgInterface(IDD_PROJECTPANEL),\
|
||||
_hToolbarMenu(NULL), _hWorkSpaceMenu(NULL), _hProjectMenu(NULL), _hFolderMenu(NULL), _hFileMenu(NULL){};
|
||||
_hToolbarMenu(NULL), _hWorkSpaceMenu(NULL), _hProjectMenu(NULL),\
|
||||
_hFolderMenu(NULL), _hFileMenu(NULL){};
|
||||
|
||||
|
||||
void init(HINSTANCE hInst, HWND hPere) {
|
||||
@ -96,6 +97,7 @@ protected:
|
||||
HWND _hToolbarMenu;
|
||||
HMENU _hWorkSpaceMenu, _hProjectMenu, _hFolderMenu, _hFileMenu;
|
||||
generic_string _workSpaceFilePath;
|
||||
generic_string _selDirOfFilesFromDirDlg;
|
||||
bool _isDirty;
|
||||
|
||||
void initMenus();
|
||||
|
Loading…
Reference in New Issue
Block a user