summaryrefslogtreecommitdiff
path: root/src/mainwin.cc
diff options
context:
space:
mode:
authorDon Bright <hugh.m.bright@gmail.com>2013-05-20 04:31:18 (GMT)
committerDon Bright <hugh.m.bright@gmail.com>2013-05-20 04:31:18 (GMT)
commit8a83e334abceda6f5c119872f922da7cc99c7210 (patch)
treebbe1f2e20fa599ebfad4f89aebd5e46905630ead /src/mainwin.cc
parent77a598ab7267d04f0b1fc0277e0314c3780313c0 (diff)
try to refactor the 'is_modified( includefile )' code
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r--src/mainwin.cc27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc
index e1369bf..b4261de 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -615,7 +615,9 @@ void MainWindow::refreshDocument()
*/
bool MainWindow::compile(bool reload, bool procevents)
{
+ PRINT("compile");
if (!compileTopLevelDocument(reload)) return false;
+ PRINT("init render");
// Invalidate renderers before we kill the CSG tree
this->qglview->setRenderer(NULL);
@@ -1018,29 +1020,18 @@ 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)
-{
- bool modified = false;
- struct stat st;
- memset(&st, 0, sizeof(struct stat));
- bool success = stat(filename.c_str(), &st)==0;
- std::cout <<"success" << success << ":" << filename << "\n";
- if (success) modified = st.st_mtime > mtime;
- else modified = true;
- return modified;
-}
-
-#include <iostream>
bool MainWindow::includesChanged()
{
+ PRINT("includes changed?");
if (this->root_module) {
BOOST_FOREACH(const FileModule::IncludeContainer::value_type &item, this->root_module->includes) {
- std::cout<< item.first << "second" << item.second << "\n";
- std::cout<< (is_modified(item.first, item.second)) <<"\n";
- if (is_modified(item.first, item.second)) return true;
+ //std::cout<< item.first << "second" << item.second << "\n";
+ //std::cout<< (is_modified(item.first, item.second)) <<"\n";
+ if (this->root_module.include_modified(item))
+ return true;
}
}
+ PRINT("includes not changed");
return false;
}
@@ -1053,6 +1044,7 @@ bool MainWindow::includesChanged()
*/
bool MainWindow::compileTopLevelDocument(bool reload)
{
+ PRINT("compile top level");
bool shouldcompiletoplevel = !reload;
if (includesChanged()) shouldcompiletoplevel = true;
@@ -1063,6 +1055,7 @@ bool MainWindow::compileTopLevelDocument(bool reload)
}
if (shouldcompiletoplevel) {
+ PRINT("shouldcompile top level");
console->clear();
updateTemporalVariables();
contact: Jan Huwald // Impressum