diff options
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r-- | src/mainwin.cc | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index 82a28c3..0c5537f 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -43,6 +43,7 @@ #endif #include "ProgressWidget.h" #include "ThrownTogetherRenderer.h" +#include "csgtermnormalizer.h" #include <QMenu> #include <QTime> @@ -181,7 +182,6 @@ MainWindow::MainWindow(const QString &filename) editor->setTabStopWidth(30); #endif editor->setLineWrapping(true); // Not designable - setFont("", 12); // Init default font this->glview->statusLabel = new QLabel(this); statusBar()->addWidget(this->glview->statusLabel); @@ -765,15 +765,8 @@ void MainWindow::compileCSG(bool procevents) if (procevents) QApplication::processEvents(); - this->root_norm_term = this->root_raw_term; - - // CSG normalization - while (1) { - shared_ptr<CSGTerm> n = CSGTerm::normalize(this->root_norm_term); - if (this->root_norm_term == n) break; - this->root_norm_term = n; - } - + CSGTermNormalizer normalizer; + this->root_norm_term = normalizer.normalize(this->root_raw_term); assert(this->root_norm_term); root_chain = new CSGChain(); @@ -787,11 +780,7 @@ void MainWindow::compileCSG(bool procevents) highlights_chain = new CSGChain(); for (unsigned int i = 0; i < highlight_terms.size(); i++) { - while (1) { - shared_ptr<CSGTerm> n = CSGTerm::normalize(highlight_terms[i]); - if (highlight_terms[i] == n) break; - highlight_terms[i] = n; - } + highlight_terms[i] = normalizer.normalize(highlight_terms[i]); highlights_chain->import(highlight_terms[i]); } } @@ -804,11 +793,7 @@ void MainWindow::compileCSG(bool procevents) background_chain = new CSGChain(); for (unsigned int i = 0; i < background_terms.size(); i++) { - while (1) { - shared_ptr<CSGTerm> n = CSGTerm::normalize(background_terms[i]); - if (background_terms[i] == n) break; - background_terms[i] = n; - } + background_terms[i] = normalizer.normalize(background_terms[i]); background_chain->import(background_terms[i]); } } @@ -1762,8 +1747,9 @@ MainWindow::preferences() void MainWindow::setFont(const QString &family, uint size) { - QFont font(editor->font()); + QFont font; if (!family.isEmpty()) font.setFamily(family); + else font.setFixedPitch(true); if (size > 0) font.setPointSize(size); font.setStyleHint(QFont::TypeWriter); editor->setFont(font); |