summaryrefslogtreecommitdiff
path: root/win/System.cpp
diff options
context:
space:
mode:
authorleo2002-12-21 05:05:30 +0000
committerleo2002-12-21 05:05:30 +0000
commit168c7cc98f87aa9e37553cbaf580743aabb6f2a5 (patch)
tree7102968552f22d160982b60153d119c1bd444188 /win/System.cpp
parenta3f30483bd20556a1e01e718950ba3989df8862b (diff)
More PLM cross platform improvements
git-svn-id: http://svn.leocad.org/trunk@321 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win/System.cpp')
-rw-r--r--win/System.cpp71
1 files changed, 68 insertions, 3 deletions
diff --git a/win/System.cpp b/win/System.cpp
index bdd5795..4a161c8 100644
--- a/win/System.cpp
+++ b/win/System.cpp
@@ -1064,7 +1064,7 @@ bool SystemDoDialog(int nMode, void* param)
{
switch (nMode)
{
- case LC_DLG_FILE_OPEN:
+ case LC_DLG_FILE_OPEN_PROJECT:
{
char *defdir = (char*)param;
if (strlen(defdir))
@@ -1086,7 +1086,7 @@ bool SystemDoDialog(int nMode, void* param)
}
} break;
- case LC_DLG_FILE_SAVE:
+ case LC_DLG_FILE_SAVE_PROJECT:
{
CFileDialog dlg(FALSE, "*.lcd", (char*)param, OFN_HIDEREADONLY|OFN_PATHMUSTEXIST|OFN_OVERWRITEPROMPT|OFN_ENABLEHOOK|OFN_ENABLETEMPLATE,
"LeoCAD Projects (*.lcd)|*.lcd|LDraw Files (*.dat)|*.dat|All Files (*.*)|*.*||");
@@ -1104,7 +1104,7 @@ bool SystemDoDialog(int nMode, void* param)
}
} break;
- case LC_DLG_FILE_MERGE:
+ case LC_DLG_FILE_MERGE_PROJECT:
{
char *defdir = (char*)param;
if (strlen(defdir))
@@ -1125,6 +1125,71 @@ bool SystemDoDialog(int nMode, void* param)
}
} break;
+ case LC_DLG_FILE_OPEN:
+ {
+ LC_FILEOPENDLG_OPTS* opts = (LC_FILEOPENDLG_OPTS*)param;
+
+ if (opts->type == LC_FILEOPENDLG_DAT)
+ {
+ CString filename;
+
+ // FIXME: Use the PLM window as parent.
+ CFileDialog dlg(TRUE, ".dat\0", NULL,OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST,
+ "LDraw Files (*.dat)|*.dat|All Files (*.*)|*.*||",AfxGetMainWnd());
+ dlg.m_ofn.lpstrFile = filename.GetBuffer(_MAX_PATH * 32);
+ dlg.m_ofn.nMaxFile = _MAX_PATH;
+
+ if (dlg.DoModal() == IDOK)
+ {
+ POSITION pos = dlg.GetStartPosition ();
+ int count = 0;
+
+ while (pos != NULL)
+ {
+ dlg.GetNextPathName (pos);
+ count++;
+ }
+
+ opts->filenames = (char**)malloc(count*sizeof(char*));
+ opts->numfiles = count;
+
+ pos = dlg.GetStartPosition ();
+ count = 0;
+
+ while (pos != NULL)
+ {
+ CString str = dlg.GetNextPathName (pos);
+ opts->filenames[count] = (char*)malloc(LC_MAXPATH);
+ strcpy (opts->filenames[count], str);
+ count++;
+ }
+
+ // Get the file path.
+ strcpy (opts->path, opts->filenames[0]);
+ if (strlen (opts->path) > 0)
+ {
+ char* ptr = strrchr(opts->path, '/');
+ if (ptr == NULL)
+ ptr = strrchr(opts->path, '\\');
+ if (ptr)
+ {
+ ptr++;
+ *ptr = 0;
+ }
+ }
+
+ return true;
+ }
+ }
+ else
+ {
+// if (opts->type == LC_FILEOPENDLG_LGF
+// LC_FILEOPENDLG_LUP
+ // Not Implemented yet.
+ }
+
+ } break;
+
case LC_DLG_PICTURE_SAVE:
{
CFileDialog dlg(FALSE, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ENABLEHOOK|OFN_ENABLETEMPLATE|OFN_EXPLORER,