[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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,23 +33,23 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#define PM_NEWFOLDERNAME TEXT("Folder Name")
|
||||
#define PM_NEWPROJECTNAME TEXT("Project Name")
|
||||
|
||||
#define PM_NEWWORKSPACE TEXT("New Workspace")
|
||||
#define PM_OPENWORKSPACE TEXT("Open Workspace")
|
||||
#define PM_RELOADWORKSPACE TEXT("Reload Workspace")
|
||||
#define PM_SAVEWORKSPACE TEXT("Save")
|
||||
#define PM_SAVEASWORKSPACE TEXT("Save As...")
|
||||
#define PM_SAVEACOPYASWORKSPACE TEXT("Save a Copy As...")
|
||||
#define PM_NEWPROJECTWORKSPACE TEXT("Add New Project")
|
||||
#define PM_NEWWORKSPACE TEXT("New Workspace")
|
||||
#define PM_OPENWORKSPACE TEXT("Open Workspace")
|
||||
#define PM_RELOADWORKSPACE TEXT("Reload Workspace")
|
||||
#define PM_SAVEWORKSPACE TEXT("Save")
|
||||
#define PM_SAVEASWORKSPACE TEXT("Save As...")
|
||||
#define PM_SAVEACOPYASWORKSPACE TEXT("Save a Copy As...")
|
||||
#define PM_NEWPROJECTWORKSPACE TEXT("Add New Project")
|
||||
|
||||
#define PM_EDITRENAME TEXT("Rename")
|
||||
#define PM_EDITNEWFOLDER TEXT("Add Folder")
|
||||
#define PM_EDITADDFILES TEXT("Add Files...")
|
||||
#define PM_EDITRENAME TEXT("Rename")
|
||||
#define PM_EDITNEWFOLDER TEXT("Add Folder")
|
||||
#define PM_EDITADDFILES TEXT("Add Files...")
|
||||
#define PM_EDITADDFILESRECUSIVELY TEXT("Add Files from Directory...")
|
||||
#define PM_EDITREMOVE TEXT("Remove")
|
||||
#define PM_EDITMODIFYFILE TEXT("Modify File Path")
|
||||
#define PM_EDITREMOVE TEXT("Remove")
|
||||
#define PM_EDITMODIFYFILE TEXT("Modify File Path")
|
||||
|
||||
#define PM_WORKSPACEMENUENTRY TEXT("Workspace")
|
||||
#define PM_EDITMENUENTRY TEXT("Edit")
|
||||
#define PM_WORKSPACEMENUENTRY TEXT("Workspace")
|
||||
#define PM_EDITMENUENTRY TEXT("Edit")
|
||||
|
||||
enum NodeType {
|
||||
nodeType_root = 0, nodeType_project = 1, nodeType_folder = 2, nodeType_file = 3
|
||||
@ -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