summaryrefslogtreecommitdiff
path: root/common/libman.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/libman.cpp')
-rw-r--r--common/libman.cpp52
1 files changed, 21 insertions, 31 deletions
diff --git a/common/libman.cpp b/common/libman.cpp
index 82d2fd3..fddf8e0 100644
--- a/common/libman.cpp
+++ b/common/libman.cpp
@@ -87,47 +87,37 @@ void LibraryManager::HandleCommand (int id, int param)
case LC_LIBDLG_FILE_MERGEUPDATE:
{
- char filename[LC_MAXPATH];
+// char filename[LC_MAXPATH];
// FIXME: file extension
- if (!SystemDoDialog (LC_DLG_FILE_OPEN, filename))
- return;
+// if (!SystemDoDialog (LC_DLG_FILE_OPEN, filename))
+// return;
- project->GetPiecesLibrary ()->LoadUpdate (filename);
+// project->GetPiecesLibrary ()->LoadUpdate (filename);
// FIXME: update m_pPieces
} break;
case LC_LIBDLG_FILE_IMPORTPIECE:
{
-/*
- char filename[LC_MAXPATH];
- LC_LDRAW_PIECE piece;
-
- // CFileDialog dlg(TRUE, ".dat\0", NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
- // "LDraw Files (*.dat)|*.dat|All Files (*.*)|*.*||",this);
- if (!SystemDoDialog (LC_DLG_FILE_OPEN, filename))
- return;
-
- BeginWait ();
-
- if (ReadLDrawPiece(filename, &piece))
- {
- if (project->GetPiecesLibrary ()->FindPieceInfo(piece.name) != NULL)
- Sys_MessageBox ("Piece already exists in the library !");
-
- if (SaveLDrawPiece(&piece))
- Sys_MessageBox ("Piece successfully imported.");
- else
- Sys_MessageBox ("Error saving library.");
- }
- else
- Sys_MessageBox ("Error reading file.");
-
- EndWait ();
- FreeLDrawPiece(&piece);
+ LC_FILEOPENDLG_OPTS opts;
+
+ strcpy(opts.path, Sys_ProfileLoadString ("Default", "LDraw Pieces Path", ""));
+ opts.type = LC_FILEOPENDLG_DAT;
+
+ if (!SystemDoDialog (LC_DLG_FILE_OPEN, &opts))
+ return;
+
+ for (int i = 0; i < opts.numfiles; i++)
+ {
+ project->GetPiecesLibrary ()->ImportLDrawPiece (opts.filenames[i]);
+ free (opts.filenames[i]);
+ }
+
+ free (opts.filenames);
+ Sys_ProfileSaveString ("Default", "LDraw Pieces Path", opts.path);
+
// FIXME: update m_pPieces
-*/
} break;
case LC_LIBDLG_FILE_RETURN: