diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp index f10304c86..585d7f005 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp @@ -917,7 +917,7 @@ void ProjectPanel::popupMenuCmd(int cmdID) } FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL)); - fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL); + setFileExtFilter(fDlg); if (TCHAR *fn = fDlg.doOpenSingleFileDlg()) { if (!openWorkSpace(fn)) @@ -1043,7 +1043,8 @@ void ProjectPanel::popupMenuCmd(int cmdID) bool ProjectPanel::saveWorkSpaceAs(bool saveCopyAs) { FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL)); - fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL); + setFileExtFilter(fDlg); + fDlg.setExtIndex(0); // 0 index for "custom extention" type if any else for "All types *.*" if (TCHAR *fn = fDlg.doSaveDlg()) { @@ -1058,6 +1059,20 @@ bool ProjectPanel::saveWorkSpaceAs(bool saveCopyAs) return false; } +void ProjectPanel::setFileExtFilter(FileDialog & fDlg) +{ + const TCHAR *ext = NppParameters::getInstance()->getNppGUI()._definedWorkspaceExt.c_str(); + generic_string workspaceExt = TEXT(""); + if (*ext != '\0') + { + if (*ext != '.') + workspaceExt += TEXT("."); + workspaceExt += ext; + fDlg.setExtFilter(TEXT("Workspace file"), workspaceExt.c_str(), NULL); + } + fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL); +} + void ProjectPanel::addFiles(HTREEITEM hTreeItem) { FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL)); diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h index c22cb8b61..aa1763a27 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h @@ -26,14 +26,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#ifndef PROJECTPANEL_H -#define PROJECTPANEL_H +#pragma once -//#include -#ifndef DOCKINGDLGINTERFACE_H #include "DockingDlgInterface.h" -#endif //DOCKINGDLGINTERFACE_H - #include "TreeView.h" #include "ProjectPanel_rc.h" @@ -68,6 +63,7 @@ enum NodeType { }; class TiXmlNode; +class FileDialog; class ProjectPanel : public DockingDlgInterface { public: @@ -141,6 +137,7 @@ protected: void showContextMenu(int x, int y); generic_string getAbsoluteFilePath(const TCHAR * relativePath); void openSelectFile(); + void setFileExtFilter(FileDialog & fDlg); }; class FileRelocalizerDlg : public StaticDialog @@ -167,5 +164,3 @@ private : generic_string _fullFilePath; }; - -#endif // PROJECTPANEL_H