From dfe808e7d4329dc96e9fa99d7e2561af2180b4ab Mon Sep 17 00:00:00 2001 From: kintel Date: Sat, 12 Jun 2010 23:30:42 +0000 Subject: fixed check-before-reload, also for the Reload (F3) function git-svn-id: http://svn.clifford.at/openscad/trunk@556 b57f626f-c46c-0410-a088-ec61d464b74c diff --git a/src/MainWindow.h b/src/MainWindow.h index 6b15889..c0a9844 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -75,6 +75,7 @@ private: void compile(bool procevents); void compileCSG(bool procevents); bool maybeSave(); + bool checkModified(); static void consoleOutput(const QString &msg, void *userdata) { static_cast(userdata)->console->append(msg); } diff --git a/src/mainwin.cc b/src/mainwin.cc index cdd7c6f..f6b7a53 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -932,7 +932,7 @@ void MainWindow::actionSaveAs() void MainWindow::actionReload() { - load(); + if (checkModified()) load(); } void MainWindow::hideEditor() @@ -991,7 +991,7 @@ void MainWindow::autoReloadSet(bool on) } } -void MainWindow::actionReloadCompile() +bool MainWindow::checkModified() { if (editor->isContentModified()) { QMessageBox::StandardButton ret; @@ -1001,9 +1001,15 @@ void MainWindow::actionReloadCompile() QMessageBox::Yes | QMessageBox::No); if (ret != QMessageBox::Yes) { designActionAutoReload->setChecked(false); - return; + return false; } } + return true; +} + +void MainWindow::actionReloadCompile() +{ + if (!checkModified()) return; console->clear(); -- cgit v0.10.1