mirror of https://github.com/vitalif/openscad
bugfix: include dependency trackng didn't work for top-level includes. Reported by Gordon Wrigley
parent
c5703b4407
commit
70d9332902
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue