summaryrefslogtreecommitdiff
path: root/win/System.cpp
diff options
context:
space:
mode:
authorleo2002-12-21 19:47:35 +0000
committerleo2002-12-21 19:47:35 +0000
commit36de24f851f8367d1fdf6777d6b031fc36a1f084 (patch)
tree321f85e1a992f3f750be514b01922c44cffc4fbb /win/System.cpp
parentb4d27e60d73035b65fca00d911b9d8e6f00802d0 (diff)
More PLM options are working again.
git-svn-id: http://svn.leocad.org/trunk@323 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win/System.cpp')
-rw-r--r--win/System.cpp51
1 files changed, 46 insertions, 5 deletions
diff --git a/win/System.cpp b/win/System.cpp
index 4a161c8..d1c8777 100644
--- a/win/System.cpp
+++ b/win/System.cpp
@@ -1129,13 +1129,15 @@ bool SystemDoDialog(int nMode, void* param)
{
LC_FILEOPENDLG_OPTS* opts = (LC_FILEOPENDLG_OPTS*)param;
+ if (strlen(opts->path))
+ _chdir(opts->path);
+
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());
+ "LDraw Files (*.dat)|*.dat|All Files (*.*)|*.*||",NULL);
dlg.m_ofn.lpstrFile = filename.GetBuffer(_MAX_PATH * 32);
dlg.m_ofn.nMaxFile = _MAX_PATH;
@@ -1180,12 +1182,51 @@ bool SystemDoDialog(int nMode, void* param)
return true;
}
+
+ return false;
}
else
{
-// if (opts->type == LC_FILEOPENDLG_LGF
-// LC_FILEOPENDLG_LUP
- // Not Implemented yet.
+ const char *ext, *filter;
+
+ if (opts->type == LC_FILEOPENDLG_LGF)
+ {
+ ext = ".lgf\0";
+ filter = "LeoCAD Group Files (*.lgf)|*.lgf|All Files (*.*)|*.*||";
+ }
+ else
+ {
+ ext = ".lup\0";
+ filter = "LeoCAD Library Updates (*.lup)|*.lup|All Files (*.*)|*.*||";
+ }
+
+ CFileDialog dlg(TRUE, ext, NULL,OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter, NULL);
+
+ if (dlg.DoModal() == IDOK)
+ {
+ opts->numfiles = 1;
+ opts->filenames = (char**)malloc(sizeof(char*));
+ opts->filenames[0] = (char*)malloc(LC_MAXPATH);
+ strcpy (opts->filenames[0], dlg.GetPathName ());
+
+ // 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;
+ }
+
+ return false;
}
} break;