summaryrefslogtreecommitdiff
path: root/common/project.cpp
diff options
context:
space:
mode:
authorleo2005-03-15 19:24:20 +0000
committerleo2005-03-15 19:24:20 +0000
commit25af63d7d7b85f99f5327d1b97a3ac24fbfd93f0 (patch)
treec3428f9ec542690fa86a9cfd388530804fc51593 /common/project.cpp
parent05ce44a61fcc3dad6e23977539ae06c678f46896 (diff)
Fixed drag and drop of files.
git-svn-id: http://svn.leocad.org/trunk@391 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/project.cpp')
-rw-r--r--common/project.cpp65
1 files changed, 27 insertions, 38 deletions
diff --git a/common/project.cpp b/common/project.cpp
index 8bb36c5..b478600 100644
--- a/common/project.cpp
+++ b/common/project.cpp
@@ -1597,6 +1597,31 @@ bool Project::OnNewDocument()
return true;
}
+bool Project::OpenProject(const char* FileName)
+{
+ if (!SaveModified())
+ return false; // Leave the original one
+
+// CWaitCursor wait;
+ bool WasModified = IsModified();
+ SetModifiedFlag(false); // Not dirty for open
+
+ if (!OnOpenDocument(FileName))
+ {
+ // Check if we corrupted the original document
+ if (!IsModified())
+ SetModifiedFlag(WasModified);
+ else
+ OnNewDocument();
+
+ return false; // Open failed
+ }
+
+ SetPathName(FileName, true);
+
+ return true;
+}
+
bool Project::OnOpenDocument (const char* lpszPathName)
{
FileDisk file;
@@ -3626,24 +3651,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
if (SystemDoDialog(LC_DLG_FILE_OPEN_PROJECT, filename))
{
- if (!SaveModified())
- return; // leave the original one
-
-// CWaitCursor wait;
- bool bWasModified = IsModified();
- SetModifiedFlag(false); // not dirty for open
-
- if (!OnOpenDocument(filename))
- {
- // check if we corrupted the original document
- if (!IsModified())
- SetModifiedFlag(bWasModified);
- else
- OnNewDocument();
-
- return; // open failed
- }
- SetPathName(filename, true);
+ OpenProject(filename);
}
} break;
@@ -4573,26 +4581,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
case LC_FILE_RECENT:
{
- if (!SaveModified())
- break; // leave the original one
-
-// CWaitCursor wait;
- bool bWasModified = IsModified();
- SetModifiedFlag(false); // not dirty for open
- String filename = main_window->GetMRU (nParam);
-
- if (!OnOpenDocument (filename))
- {
- // check if we corrupted the original document
- if (!IsModified ())
- SetModifiedFlag (bWasModified);
- else
- OnNewDocument ();
-
- main_window->RemoveFromMRU (nParam);
- return; // open failed
- }
- SetPathName (filename, true);
+ OpenProject(main_window->GetMRU(nParam));
} break;
case LC_EDIT_UNDO: