diff options
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r-- | src/mainwin.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index 027f72a..5f9d633 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -488,17 +488,25 @@ void MainWindow::requestOpenFile(const QString &) void MainWindow::openFile(const QString &new_filename) { + QString actual_filename = new_filename; #ifdef ENABLE_MDI if (!editor->toPlainText().isEmpty()) { - new MainWindow(new_filename); + QFileInfo fi(new_filename); + if (fi.suffix().toLower().contains(QRegExp("^(stl|off|dxf)$"))) { + actual_filename = QString(); + } + new MainWindow(actual_filename); clearCurrentOutput(); return; } #endif - setFileName(new_filename); + setFileName(actual_filename); refreshDocument(); updateRecentFiles(); + if (actual_filename.isEmpty()) { + this->editor->setPlainText(QString("import(\"%1\");\n").arg(new_filename)); + } } void |