summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-11-06 22:41:57 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-11-06 22:41:57 (GMT)
commitd44574184094893f61948c55610cbc39b159b09b (patch)
tree9736dc9615380e93456d580101d1340e481ab1ab
parent67106a40c7ab5baab8d879fb354e74bec722f5f6 (diff)
Clifford Wolf:
Some small fixes and improvements git-svn-id: http://svn.clifford.at/openscad/trunk@130 b57f626f-c46c-0410-a088-ec61d464b74c
-rw-r--r--mainwin.cc20
-rw-r--r--openscad.h2
2 files changed, 19 insertions, 3 deletions
diff --git a/mainwin.cc b/mainwin.cc
index cf17c88..fcf7098 100644
--- a/mainwin.cc
+++ b/mainwin.cc
@@ -237,7 +237,7 @@ MainWindow::MainWindow(const char *filename)
setCentralWidget(s1);
- connect(editor->document(), SIGNAL(contentsChanged()), this, SLOT(animateUpdate()));
+ connect(editor->document(), SIGNAL(contentsChanged()), this, SLOT(animateUpdateDocChanged()));
connect(screen, SIGNAL(doAnimateUpdate()), this, SLOT(animateUpdate()));
// display this window and check for OpenGL 2.0 (OpenCSG) support
@@ -410,13 +410,20 @@ void MainWindow::compile(bool procevents)
vpr.vec.append(new Value(fmodf(360 - screen->object_rot_z, 360)));
root_ctx.set_variable("$vpr", vpr);
- root_module = parse(editor->toPlainText().toAscii().data(), false);
+ last_compiled_doc = editor->toPlainText();
+ root_module = parse(last_compiled_doc.toAscii().data(), false);
delete highlighter;
highlighter = new Highlighter(editor->document());
- if (!root_module)
+ if (!root_module) {
+ if (!animate_panel->isVisible()) {
+ QTextCursor cursor = editor->textCursor();
+ cursor.setPosition(parser_error_pos);
+ editor->setTextCursor(cursor);
+ }
goto fail;
+ }
PRINT("Compiling design (CSG Tree generation)...");
if (procevents)
@@ -1217,6 +1224,13 @@ void MainWindow::viewModeAnimate()
}
}
+void MainWindow::animateUpdateDocChanged()
+{
+ QString current_doc = editor->toPlainText();
+ if (current_doc != last_compiled_doc)
+ animateUpdate();
+}
+
void MainWindow::animateUpdate()
{
if (animate_panel->isVisible()) {
diff --git a/openscad.h b/openscad.h
index 2b2fd77..17a22a1 100644
--- a/openscad.h
+++ b/openscad.h
@@ -735,6 +735,7 @@ public:
QVector<CSGTerm*> background_terms;
CSGChain *background_chain;
AbstractNode *root_node;
+ QString last_compiled_doc;
bool enableOpenCSG;
MainWindow(const char *filename = 0);
@@ -818,6 +819,7 @@ public slots:
void viewCenter();
void viewPerspective();
void viewOrthogonal();
+ void animateUpdateDocChanged();
void animateUpdate();
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
contact: Jan Huwald // Impressum