summaryrefslogtreecommitdiff
path: root/src/mainwin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r--src/mainwin.cc25
1 files changed, 22 insertions, 3 deletions
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