diff options
author | kintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-07-02 20:59:16 (GMT) |
---|---|---|
committer | kintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-07-02 20:59:16 (GMT) |
commit | 3efd99e4af55bfb53101d6de3fd146044ee5cd3c (patch) | |
tree | 8d4ad6c3497b96cc1e09e770c5ba03786a45b0ed /src/mainwin.cc | |
parent | 6eff371329ddc79809494d3dbe688acb8c406374 (diff) |
Some fixes by Jestin Stoffel
git-svn-id: http://svn.clifford.at/openscad/trunk@566 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r-- | src/mainwin.cc | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index f6b7a53..ef738fc 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -812,6 +812,9 @@ void MainWindow::actionNew() #ifdef ENABLE_MDI new MainWindow(QString()); #else + if (!maybeSave()) + return; + setFileName(""); editor->setPlainText(""); #endif @@ -819,18 +822,35 @@ void MainWindow::actionNew() void MainWindow::actionOpen() { - setCurrentOutput(); QString new_filename = QFileDialog::getOpenFileName(this, "Open File", "", "OpenSCAD Designs (*.scad)"); - if (!new_filename.isEmpty()) openFile(new_filename); - clearCurrentOutput(); +#ifdef ENABLE_MDI + new MainWindow(new_filename); +#else + if (!new_filename.isEmpty()) { + if (!maybeSave()) + return; + + setCurrentOutput(); + openFile(new_filename); + clearCurrentOutput(); + } +#endif } void MainWindow::actionOpenRecent() { QAction *action = qobject_cast<QAction *>(sender()); + +#ifdef ENABLE_MDI + new MainWindow(action->data().toString()); +#else + if (!maybeSave()) + return; + if (action) { openFile(action->data().toString()); } +#endif } void MainWindow::clearRecentFiles() @@ -1800,8 +1820,7 @@ MainWindow::helpManual() } /*! - FIXME: In SDI mode, this should be called also on New and Open - In MDI mode; also call on both reload functions? + FIXME: In MDI mode, should this be called on both reload functions? */ bool MainWindow::maybeSave() |