summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/MainWindow.h3
-rw-r--r--src/mainwin.cc25
2 files changed, 24 insertions, 4 deletions
diff --git a/src/MainWindow.h b/src/MainWindow.h
index ed12f34..a4835c2 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -77,11 +77,12 @@ private:
AbstractNode *find_root_tag(AbstractNode *n);
void updateTemporalVariables();
bool fileChangedOnDisk();
+ bool includesChanged();
bool compileTopLevelDocument(bool reload);
bool compile(bool reload, bool procevents);
void compileCSG(bool procevents);
bool maybeSave();
- bool checkModified();
+ bool checkEditorModified();
QString dumpCSGTree(AbstractNode *root);
static void consoleOutput(const std::string &msg, void *userdata);
void loadViewSettings();
diff --git a/src/mainwin.cc b/src/mainwin.cc
index be7c567..4b9a0e7 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -928,7 +928,7 @@ void MainWindow::actionSaveAs()
void MainWindow::actionReload()
{
- if (checkModified()) refreshDocument();
+ if (checkEditorModified()) refreshDocument();
}
void MainWindow::hideEditor()
@@ -1003,6 +1003,23 @@ bool MainWindow::fileChangedOnDisk()
return false;
}
+// FIXME: The following two methods are duplicated in ModuleCache.cc - refactor
+static bool is_modified(const std::string &filename, const time_t &mtime)
+{
+ struct stat st;
+ memset(&st, 0, sizeof(struct stat));
+ stat(filename.c_str(), &st);
+ return (st.st_mtime > mtime);
+}
+
+bool MainWindow::includesChanged()
+{
+ BOOST_FOREACH(const Module::IncludeContainer::value_type &item, this->root_module->includes) {
+ if (is_modified(item.first, item.second)) return true;
+ }
+ return false;
+}
+
/*!
If reload is true, does a timestamp check on the document and tries to reload it.
Otherwise, just reparses the current document and any dependencies, updates the
@@ -1014,7 +1031,9 @@ bool MainWindow::compileTopLevelDocument(bool reload)
{
bool shouldcompiletoplevel = !reload;
- if (reload && fileChangedOnDisk() && checkModified()) {
+ if (reload &&
+ (fileChangedOnDisk() && checkEditorModified()) ||
+ includesChanged()) {
shouldcompiletoplevel = true;
refreshDocument();
}
@@ -1083,7 +1102,7 @@ void MainWindow::autoReloadSet(bool on)
}
}
-bool MainWindow::checkModified()
+bool MainWindow::checkEditorModified()
{
if (editor->isContentModified()) {
QMessageBox::StandardButton ret;
contact: Jan Huwald // Impressum