diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-11-06 22:41:57 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-11-06 22:41:57 (GMT) |
commit | d44574184094893f61948c55610cbc39b159b09b (patch) | |
tree | 9736dc9615380e93456d580101d1340e481ab1ab | |
parent | 67106a40c7ab5baab8d879fb354e74bec722f5f6 (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.cc | 20 | ||||
-rw-r--r-- | openscad.h | 2 |
2 files changed, 19 insertions, 3 deletions
@@ -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()) { @@ -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); |