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
stl_dim
kintel 2010-06-12 23:30:42 +00:00
parent fb0f3ed8d1
commit dfe808e7d4
2 changed files with 10 additions and 3 deletions

View File

@ -75,6 +75,7 @@ private:
void compile(bool procevents); void compile(bool procevents);
void compileCSG(bool procevents); void compileCSG(bool procevents);
bool maybeSave(); bool maybeSave();
bool checkModified();
static void consoleOutput(const QString &msg, void *userdata) { static void consoleOutput(const QString &msg, void *userdata) {
static_cast<MainWindow*>(userdata)->console->append(msg); static_cast<MainWindow*>(userdata)->console->append(msg);
} }

View File

@ -932,7 +932,7 @@ void MainWindow::actionSaveAs()
void MainWindow::actionReload() void MainWindow::actionReload()
{ {
load(); if (checkModified()) load();
} }
void MainWindow::hideEditor() void MainWindow::hideEditor()
@ -991,7 +991,7 @@ void MainWindow::autoReloadSet(bool on)
} }
} }
void MainWindow::actionReloadCompile() bool MainWindow::checkModified()
{ {
if (editor->isContentModified()) { if (editor->isContentModified()) {
QMessageBox::StandardButton ret; QMessageBox::StandardButton ret;
@ -1001,9 +1001,15 @@ void MainWindow::actionReloadCompile()
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (ret != QMessageBox::Yes) { if (ret != QMessageBox::Yes) {
designActionAutoReload->setChecked(false); designActionAutoReload->setChecked(false);
return; return false;
} }
} }
return true;
}
void MainWindow::actionReloadCompile()
{
if (!checkModified()) return;
console->clear(); console->clear();