[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
|
// 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)
|
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);
|
::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData);
|
||||||
return 0;
|
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(""));
|
generic_string folderName(TEXT(""));
|
||||||
LPMALLOC pShellMalloc = 0;
|
LPMALLOC pShellMalloc = 0;
|
||||||
@ -115,6 +115,7 @@ generic_string getFolderName(HWND parent)
|
|||||||
info.lpszTitle = TEXT("Select a folder");
|
info.lpszTitle = TEXT("Select a folder");
|
||||||
info.ulFlags = 0;
|
info.ulFlags = 0;
|
||||||
info.lpfn = BrowseCallbackProc;
|
info.lpfn = BrowseCallbackProc;
|
||||||
|
info.lParam = reinterpret_cast<LPARAM>(defaultDir);
|
||||||
|
|
||||||
// Execute the browsing dialog.
|
// Execute the browsing dialog.
|
||||||
LPITEMIDLIST pidl = ::SHBrowseForFolder(&info);
|
LPITEMIDLIST pidl = ::SHBrowseForFolder(&info);
|
||||||
|
@ -74,7 +74,7 @@ const bool dirDown = false;
|
|||||||
typedef std::basic_string<TCHAR> generic_string;
|
typedef std::basic_string<TCHAR> generic_string;
|
||||||
|
|
||||||
void folderBrowser(HWND parent, int outputCtrlID, const TCHAR *defaultStr = NULL);
|
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 printInt(int int2print);
|
||||||
void printStr(const TCHAR *str2print);
|
void printStr(const TCHAR *str2print);
|
||||||
|
@ -1092,12 +1092,25 @@ void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTre
|
|||||||
|
|
||||||
void ProjectPanel::addFilesFromDirectory(HTREEITEM hTreeItem)
|
void ProjectPanel::addFilesFromDirectory(HTREEITEM hTreeItem)
|
||||||
{
|
{
|
||||||
generic_string folderName = getFolderName(_hSelf);
|
if (_selDirOfFilesFromDirDlg == TEXT("") && _workSpaceFilePath != TEXT(""))
|
||||||
if (folderName != 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);
|
_treeView.expand(hTreeItem);
|
||||||
setWorkSpaceDirty(true);
|
setWorkSpaceDirty(true);
|
||||||
|
_selDirOfFilesFromDirDlg = dirPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,23 +33,23 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|||||||
#define PM_NEWFOLDERNAME TEXT("Folder Name")
|
#define PM_NEWFOLDERNAME TEXT("Folder Name")
|
||||||
#define PM_NEWPROJECTNAME TEXT("Project Name")
|
#define PM_NEWPROJECTNAME TEXT("Project Name")
|
||||||
|
|
||||||
#define PM_NEWWORKSPACE TEXT("New Workspace")
|
#define PM_NEWWORKSPACE TEXT("New Workspace")
|
||||||
#define PM_OPENWORKSPACE TEXT("Open Workspace")
|
#define PM_OPENWORKSPACE TEXT("Open Workspace")
|
||||||
#define PM_RELOADWORKSPACE TEXT("Reload Workspace")
|
#define PM_RELOADWORKSPACE TEXT("Reload Workspace")
|
||||||
#define PM_SAVEWORKSPACE TEXT("Save")
|
#define PM_SAVEWORKSPACE TEXT("Save")
|
||||||
#define PM_SAVEASWORKSPACE TEXT("Save As...")
|
#define PM_SAVEASWORKSPACE TEXT("Save As...")
|
||||||
#define PM_SAVEACOPYASWORKSPACE TEXT("Save a Copy As...")
|
#define PM_SAVEACOPYASWORKSPACE TEXT("Save a Copy As...")
|
||||||
#define PM_NEWPROJECTWORKSPACE TEXT("Add New Project")
|
#define PM_NEWPROJECTWORKSPACE TEXT("Add New Project")
|
||||||
|
|
||||||
#define PM_EDITRENAME TEXT("Rename")
|
#define PM_EDITRENAME TEXT("Rename")
|
||||||
#define PM_EDITNEWFOLDER TEXT("Add Folder")
|
#define PM_EDITNEWFOLDER TEXT("Add Folder")
|
||||||
#define PM_EDITADDFILES TEXT("Add Files...")
|
#define PM_EDITADDFILES TEXT("Add Files...")
|
||||||
#define PM_EDITADDFILESRECUSIVELY TEXT("Add Files from Directory...")
|
#define PM_EDITADDFILESRECUSIVELY TEXT("Add Files from Directory...")
|
||||||
#define PM_EDITREMOVE TEXT("Remove")
|
#define PM_EDITREMOVE TEXT("Remove")
|
||||||
#define PM_EDITMODIFYFILE TEXT("Modify File Path")
|
#define PM_EDITMODIFYFILE TEXT("Modify File Path")
|
||||||
|
|
||||||
#define PM_WORKSPACEMENUENTRY TEXT("Workspace")
|
#define PM_WORKSPACEMENUENTRY TEXT("Workspace")
|
||||||
#define PM_EDITMENUENTRY TEXT("Edit")
|
#define PM_EDITMENUENTRY TEXT("Edit")
|
||||||
|
|
||||||
enum NodeType {
|
enum NodeType {
|
||||||
nodeType_root = 0, nodeType_project = 1, nodeType_folder = 2, nodeType_file = 3
|
nodeType_root = 0, nodeType_project = 1, nodeType_folder = 2, nodeType_file = 3
|
||||||
@ -60,7 +60,8 @@ class TiXmlNode;
|
|||||||
class ProjectPanel : public DockingDlgInterface {
|
class ProjectPanel : public DockingDlgInterface {
|
||||||
public:
|
public:
|
||||||
ProjectPanel(): DockingDlgInterface(IDD_PROJECTPANEL),\
|
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) {
|
void init(HINSTANCE hInst, HWND hPere) {
|
||||||
@ -96,6 +97,7 @@ protected:
|
|||||||
HWND _hToolbarMenu;
|
HWND _hToolbarMenu;
|
||||||
HMENU _hWorkSpaceMenu, _hProjectMenu, _hFolderMenu, _hFileMenu;
|
HMENU _hWorkSpaceMenu, _hProjectMenu, _hFolderMenu, _hFileMenu;
|
||||||
generic_string _workSpaceFilePath;
|
generic_string _workSpaceFilePath;
|
||||||
|
generic_string _selDirOfFilesFromDirDlg;
|
||||||
bool _isDirty;
|
bool _isDirty;
|
||||||
|
|
||||||
void initMenus();
|
void initMenus();
|
||||||
|
Loading…
Reference in New Issue
Block a user