diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/OGL_helper.h | 21 | ||||
-rw-r--r-- | src/PolySetCGALEvaluator.cc | 12 | ||||
-rw-r--r-- | src/PolySetCGALEvaluator.h | 8 | ||||
-rw-r--r-- | src/PolySetEvaluator.h | 4 | ||||
-rw-r--r-- | src/func.cc | 9 | ||||
-rw-r--r-- | src/linearextrude.cc (renamed from src/dxflinextrude.cc) | 18 | ||||
-rw-r--r-- | src/linearextrudenode.h (renamed from src/dxflinextrudenode.h) | 8 | ||||
-rw-r--r-- | src/qtcolorbutton/README.txt | 2 | ||||
-rw-r--r-- | src/qtcolorbutton/qtcolorbutton.cpp | 278 | ||||
-rw-r--r-- | src/qtcolorbutton/qtcolorbutton.h | 86 | ||||
-rw-r--r-- | src/qtcolorbutton/qtcolorbutton.pri | 4 | ||||
-rw-r--r-- | src/rotateextrude.cc (renamed from src/dxfrotextrude.cc) | 18 | ||||
-rw-r--r-- | src/rotateextrudenode.h (renamed from src/dxfrotextrudenode.h) | 8 | ||||
-rw-r--r-- | src/value.cc | 12 | ||||
-rw-r--r-- | src/visitor.h | 4 |
15 files changed, 72 insertions, 420 deletions
diff --git a/src/OGL_helper.h b/src/OGL_helper.h index 2764561..40a3e35 100644 --- a/src/OGL_helper.h +++ b/src/OGL_helper.h @@ -11,7 +11,7 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.7-branch/Nef_3/include/CGAL/Nef_3/OGL_helper.h $ +// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/trunk/Nef_3/include/CGAL/Nef_3/OGL_helper.h $ // $Id: OGL_helper.h 56667 2010-06-09 07:37:13Z sloriot $ // // @@ -246,19 +246,20 @@ namespace OGL { inline void CGAL_GLU_TESS_CALLBACK combineCallback(GLdouble coords[3], GLvoid *[4], GLfloat [4], GLvoid **dataOut) { static std::list<GLdouble*> pcache; if (dataOut) { - GLdouble *n = new GLdouble[3]; - n[0] = coords[0]; - n[1] = coords[1]; - n[2] = coords[2]; - pcache.push_back(n); - *dataOut = n; + GLdouble *n = new GLdouble[3]; + n[0] = coords[0]; + n[1] = coords[1]; + n[2] = coords[2]; + pcache.push_back(n); + *dataOut = n; } else { - for (std::list<GLdouble*>::const_iterator i = pcache.begin(); i != pcache.end(); i++) - delete[] *i; - pcache.clear(); + for (std::list<GLdouble*>::const_iterator i = pcache.begin(); i != pcache.end(); i++) + delete[] *i; + pcache.clear(); } } + enum { SNC_AXES}; enum { SNC_BOUNDARY, SNC_SKELETON }; diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index b019ad5..7f62d0a 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -4,8 +4,8 @@ #include "polyset.h" #include "CGALEvaluator.h" #include "projectionnode.h" -#include "dxflinextrudenode.h" -#include "dxfrotextrudenode.h" +#include "linearextrudenode.h" +#include "rotateextrudenode.h" #include "cgaladvnode.h" #include "rendernode.h" #include "dxfdata.h" @@ -251,7 +251,7 @@ static void add_slice(PolySet *ps, const DxfData &dxf, DxfData::Path &path, doub } } -PolySet *PolySetCGALEvaluator::evaluatePolySet(const DxfLinearExtrudeNode &node) +PolySet *PolySetCGALEvaluator::evaluatePolySet(const LinearExtrudeNode &node) { DxfData *dxf; @@ -283,7 +283,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const DxfLinearExtrudeNode &node) return ps; } -PolySet *PolySetCGALEvaluator::extrudeDxfData(const DxfLinearExtrudeNode &node, DxfData &dxf) +PolySet *PolySetCGALEvaluator::extrudeDxfData(const LinearExtrudeNode &node, DxfData &dxf) { PolySet *ps = new PolySet(); ps->convexity = node.convexity; @@ -349,7 +349,7 @@ PolySet *PolySetCGALEvaluator::extrudeDxfData(const DxfLinearExtrudeNode &node, return ps; } -PolySet *PolySetCGALEvaluator::evaluatePolySet(const DxfRotateExtrudeNode &node) +PolySet *PolySetCGALEvaluator::evaluatePolySet(const RotateExtrudeNode &node) { DxfData *dxf; @@ -398,7 +398,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const RenderNode &node) return ps; } -PolySet *PolySetCGALEvaluator::rotateDxfData(const DxfRotateExtrudeNode &node, DxfData &dxf) +PolySet *PolySetCGALEvaluator::rotateDxfData(const RotateExtrudeNode &node, DxfData &dxf) { PolySet *ps = new PolySet(); ps->convexity = node.convexity; diff --git a/src/PolySetCGALEvaluator.h b/src/PolySetCGALEvaluator.h index 2aa5b13..dddcfc5 100644 --- a/src/PolySetCGALEvaluator.h +++ b/src/PolySetCGALEvaluator.h @@ -13,14 +13,14 @@ public: PolySetCGALEvaluator(class CGALEvaluator &cgalevaluator); virtual ~PolySetCGALEvaluator() { } virtual PolySet *evaluatePolySet(const ProjectionNode &node); - virtual PolySet *evaluatePolySet(const DxfLinearExtrudeNode &node); - virtual PolySet *evaluatePolySet(const DxfRotateExtrudeNode &node); + virtual PolySet *evaluatePolySet(const LinearExtrudeNode &node); + virtual PolySet *evaluatePolySet(const RotateExtrudeNode &node); virtual PolySet *evaluatePolySet(const CgaladvNode &node); virtual PolySet *evaluatePolySet(const RenderNode &node); protected: - PolySet *extrudeDxfData(const DxfLinearExtrudeNode &node, class DxfData &dxf); - PolySet *rotateDxfData(const DxfRotateExtrudeNode &node, class DxfData &dxf); + PolySet *extrudeDxfData(const LinearExtrudeNode &node, class DxfData &dxf); + PolySet *rotateDxfData(const RotateExtrudeNode &node, class DxfData &dxf); CGALEvaluator &cgalevaluator; }; diff --git a/src/PolySetEvaluator.h b/src/PolySetEvaluator.h index 833b079..8d7d1a8 100644 --- a/src/PolySetEvaluator.h +++ b/src/PolySetEvaluator.h @@ -16,8 +16,8 @@ public: virtual shared_ptr<PolySet> getPolySet(const class AbstractNode &, bool cache); virtual PolySet *evaluatePolySet(const class ProjectionNode &) { return NULL; } - virtual PolySet *evaluatePolySet(const class DxfLinearExtrudeNode &) { return NULL; } - virtual PolySet *evaluatePolySet(const class DxfRotateExtrudeNode &) { return NULL; } + virtual PolySet *evaluatePolySet(const class LinearExtrudeNode &) { return NULL; } + virtual PolySet *evaluatePolySet(const class RotateExtrudeNode &) { return NULL; } virtual PolySet *evaluatePolySet(const class CgaladvNode &) { return NULL; } virtual PolySet *evaluatePolySet(const class RenderNode &) { return NULL; } diff --git a/src/func.cc b/src/func.cc index 52f04dd..b58a1b7 100644 --- a/src/func.cc +++ b/src/func.cc @@ -349,6 +349,14 @@ Value builtin_lookup(const Context *, const std::vector<std::string>&, const std return Value(high_v * f + low_v * (1-f)); } +#define QUOTE(x__) # x__ +#define QUOTED(x__) QUOTE(x__) + +Value builtin_version(const Context *, const std::vector<std::string>&, const std::vector<Value> &) +{ + return Value(std::string(QUOTED(OPENSCAD_VERSION))); +} + void initialize_builtin_functions() { builtin_functions["abs"] = new BuiltinFunction(&builtin_abs); @@ -373,6 +381,7 @@ void initialize_builtin_functions() builtin_functions["ln"] = new BuiltinFunction(&builtin_ln); builtin_functions["str"] = new BuiltinFunction(&builtin_str); builtin_functions["lookup"] = new BuiltinFunction(&builtin_lookup); + builtin_functions["version"] = new BuiltinFunction(&builtin_version); initialize_builtin_dxf_dim(); } diff --git a/src/dxflinextrude.cc b/src/linearextrude.cc index 8bb246f..4ce87db 100644 --- a/src/dxflinextrude.cc +++ b/src/linearextrude.cc @@ -24,7 +24,7 @@ * */ -#include "dxflinextrudenode.h" +#include "linearextrudenode.h" #include "module.h" #include "context.h" @@ -44,16 +44,16 @@ using namespace boost::assign; // bring 'operator+=()' into scope #include <QFileInfo> -class DxfLinearExtrudeModule : public AbstractModule +class LinearExtrudeModule : public AbstractModule { public: - DxfLinearExtrudeModule() { } + LinearExtrudeModule() { } virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const; }; -AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const +AbstractNode *LinearExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const { - DxfLinearExtrudeNode *node = new DxfLinearExtrudeNode(inst); + LinearExtrudeNode *node = new LinearExtrudeNode(inst); std::vector<std::string> argnames; argnames += "file", "layer", "height", "origin", "scale", "center", "twist", "slices"; @@ -120,11 +120,11 @@ AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleI void register_builtin_dxf_linear_extrude() { - builtin_modules["dxf_linear_extrude"] = new DxfLinearExtrudeModule(); - builtin_modules["linear_extrude"] = new DxfLinearExtrudeModule(); + builtin_modules["dxf_linear_extrude"] = new LinearExtrudeModule(); + builtin_modules["linear_extrude"] = new LinearExtrudeModule(); } -PolySet *DxfLinearExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const +PolySet *LinearExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const { if (!evaluator) { PRINTF("WARNING: No suitable PolySetEvaluator found for %s module!", this->name().c_str()); @@ -140,7 +140,7 @@ PolySet *DxfLinearExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) con return ps; } -std::string DxfLinearExtrudeNode::toString() const +std::string LinearExtrudeNode::toString() const { std::stringstream stream; diff --git a/src/dxflinextrudenode.h b/src/linearextrudenode.h index 360fd28..503f1bd 100644 --- a/src/dxflinextrudenode.h +++ b/src/linearextrudenode.h @@ -1,13 +1,13 @@ -#ifndef DXFLINEXTRUDENODE_H_ -#define DXFLINEXTRUDENODE_H_ +#ifndef LINEAREXTRUDENODE_H_ +#define LINEAREXTRUDENODE_H_ #include "node.h" #include "visitor.h" -class DxfLinearExtrudeNode : public AbstractPolyNode +class LinearExtrudeNode : public AbstractPolyNode { public: - DxfLinearExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) { + LinearExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) { convexity = slices = 0; fn = fs = fa = height = twist = 0; origin_x = origin_y = scale = 0; diff --git a/src/qtcolorbutton/README.txt b/src/qtcolorbutton/README.txt deleted file mode 100644 index 4b55f67..0000000 --- a/src/qtcolorbutton/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -The QtColorButton class is copied from the gradient editor in Qt's shared tool classes: -http://qt.gitorious.org/qt/qt/trees/master/tools/shared/qtgradienteditor diff --git a/src/qtcolorbutton/qtcolorbutton.cpp b/src/qtcolorbutton/qtcolorbutton.cpp deleted file mode 100644 index 21b9848..0000000 --- a/src/qtcolorbutton/qtcolorbutton.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtcolorbutton.h" -#include <QtGui/QColorDialog> -#include <QtGui/QPainter> -#include <QtCore/QMimeData> -#include <QtGui/QDragEnterEvent> -#include <QtGui/QApplication> - -QT_BEGIN_NAMESPACE - -class QtColorButtonPrivate -{ - QtColorButton *q_ptr; - Q_DECLARE_PUBLIC(QtColorButton) -public: - QColor m_color; -#ifndef QT_NO_DRAGANDDROP - QColor m_dragColor; - QPoint m_dragStart; - bool m_dragging; -#endif - bool m_backgroundCheckered; - - void slotEditColor(); - QColor shownColor() const; - QPixmap generatePixmap() const; -}; - -void QtColorButtonPrivate::slotEditColor() -{ - bool ok; - const QRgb rgba = QColorDialog::getRgba(m_color.rgba(), &ok, q_ptr); - if (!ok) - return; - const QColor c = QColor::fromRgba(rgba); - if (c == q_ptr->color()) - return; - q_ptr->setColor(c); - emit q_ptr->colorChanged(m_color); -} - -QColor QtColorButtonPrivate::shownColor() const -{ -#ifndef QT_NO_DRAGANDDROP - if (m_dragging) - return m_dragColor; -#endif - return m_color; -} - -QPixmap QtColorButtonPrivate::generatePixmap() const -{ - QPixmap pix(24, 24); - - int pixSize = 20; - QBrush br(shownColor()); - - QPixmap pm(2 * pixSize, 2 * pixSize); - QPainter pmp(&pm); - pmp.fillRect(0, 0, pixSize, pixSize, Qt::lightGray); - pmp.fillRect(pixSize, pixSize, pixSize, pixSize, Qt::lightGray); - pmp.fillRect(0, pixSize, pixSize, pixSize, Qt::darkGray); - pmp.fillRect(pixSize, 0, pixSize, pixSize, Qt::darkGray); - pmp.fillRect(0, 0, 2 * pixSize, 2 * pixSize, shownColor()); - br = QBrush(pm); - - QPainter p(&pix); - int corr = 1; - QRect r = pix.rect().adjusted(corr, corr, -corr, -corr); - p.setBrushOrigin((r.width() % pixSize + pixSize) / 2 + corr, (r.height() % pixSize + pixSize) / 2 + corr); - p.fillRect(r, br); - - p.fillRect(r.width() / 4 + corr, r.height() / 4 + corr, - r.width() / 2, r.height() / 2, - QColor(shownColor().rgb())); - p.drawRect(pix.rect().adjusted(0, 0, -1, -1)); - - return pix; -} - -/////////////// - -QtColorButton::QtColorButton(QWidget *parent) - : QToolButton(parent) -{ - d_ptr = new QtColorButtonPrivate; - d_ptr->q_ptr = this; - d_ptr->m_dragging = false; - d_ptr->m_backgroundCheckered = true; - - setAcceptDrops(true); - - connect(this, SIGNAL(clicked()), this, SLOT(slotEditColor())); - setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)); -} - -QtColorButton::~QtColorButton() -{ - delete d_ptr; -} - -void QtColorButton::setColor(const QColor &color) -{ - if (d_ptr->m_color == color) - return; - d_ptr->m_color = color; - update(); -} - -QColor QtColorButton::color() const -{ - return d_ptr->m_color; -} - -void QtColorButton::setBackgroundCheckered(bool checkered) -{ - if (d_ptr->m_backgroundCheckered == checkered) - return; - d_ptr->m_backgroundCheckered = checkered; - update(); -} - -bool QtColorButton::isBackgroundCheckered() const -{ - return d_ptr->m_backgroundCheckered; -} - -void QtColorButton::paintEvent(QPaintEvent *event) -{ - QToolButton::paintEvent(event); - if (!isEnabled()) - return; - - const int pixSize = 10; - QBrush br(d_ptr->shownColor()); - if (d_ptr->m_backgroundCheckered) { - QPixmap pm(2 * pixSize, 2 * pixSize); - QPainter pmp(&pm); - pmp.fillRect(0, 0, pixSize, pixSize, Qt::white); - pmp.fillRect(pixSize, pixSize, pixSize, pixSize, Qt::white); - pmp.fillRect(0, pixSize, pixSize, pixSize, Qt::black); - pmp.fillRect(pixSize, 0, pixSize, pixSize, Qt::black); - pmp.fillRect(0, 0, 2 * pixSize, 2 * pixSize, d_ptr->shownColor()); - br = QBrush(pm); - } - - QPainter p(this); - const int corr = 4; - QRect r = rect().adjusted(corr, corr, -corr, -corr); - p.setBrushOrigin((r.width() % pixSize + pixSize) / 2 + corr, (r.height() % pixSize + pixSize) / 2 + corr); - p.fillRect(r, br); - - //const int adjX = qRound(r.width() / 4.0); - //const int adjY = qRound(r.height() / 4.0); - //p.fillRect(r.adjusted(adjX, adjY, -adjX, -adjY), - // QColor(d_ptr->shownColor().rgb())); - /* - p.fillRect(r.adjusted(0, r.height() * 3 / 4, 0, 0), - QColor(d_ptr->shownColor().rgb())); - p.fillRect(r.adjusted(0, 0, 0, -r.height() * 3 / 4), - QColor(d_ptr->shownColor().rgb())); - */ - /* - const QColor frameColor0(0, 0, 0, qRound(0.2 * (0xFF - d_ptr->shownColor().alpha()))); - p.setPen(frameColor0); - p.drawRect(r.adjusted(adjX, adjY, -adjX - 1, -adjY - 1)); - */ - - const QColor frameColor1(0, 0, 0, 26); - p.setPen(frameColor1); - p.drawRect(r.adjusted(1, 1, -2, -2)); - const QColor frameColor2(0, 0, 0, 51); - p.setPen(frameColor2); - p.drawRect(r.adjusted(0, 0, -1, -1)); -} - -void QtColorButton::mousePressEvent(QMouseEvent *event) -{ -#ifndef QT_NO_DRAGANDDROP - if (event->button() == Qt::LeftButton) - d_ptr->m_dragStart = event->pos(); -#endif - QToolButton::mousePressEvent(event); -} - -void QtColorButton::mouseMoveEvent(QMouseEvent *event) -{ -#ifndef QT_NO_DRAGANDDROP - if (event->buttons() & Qt::LeftButton && - (d_ptr->m_dragStart - event->pos()).manhattanLength() > QApplication::startDragDistance()) { - QMimeData *mime = new QMimeData; - mime->setColorData(color()); - QDrag *drg = new QDrag(this); - drg->setMimeData(mime); - drg->setPixmap(d_ptr->generatePixmap()); - setDown(false); - event->accept(); - drg->start(); - return; - } -#endif - QToolButton::mouseMoveEvent(event); -} - -#ifndef QT_NO_DRAGANDDROP -void QtColorButton::dragEnterEvent(QDragEnterEvent *event) -{ - const QMimeData *mime = event->mimeData(); - if (!mime->hasColor()) - return; - - event->accept(); - d_ptr->m_dragColor = qvariant_cast<QColor>(mime->colorData()); - d_ptr->m_dragging = true; - update(); -} - -void QtColorButton::dragLeaveEvent(QDragLeaveEvent *event) -{ - event->accept(); - d_ptr->m_dragging = false; - update(); -} - -void QtColorButton::dropEvent(QDropEvent *event) -{ - event->accept(); - d_ptr->m_dragging = false; - if (d_ptr->m_dragColor == color()) - return; - setColor(d_ptr->m_dragColor); - emit colorChanged(color()); -} -#endif - -QT_END_NAMESPACE - -#include "moc_qtcolorbutton.cpp" diff --git a/src/qtcolorbutton/qtcolorbutton.h b/src/qtcolorbutton/qtcolorbutton.h deleted file mode 100644 index 26bdde0..0000000 --- a/src/qtcolorbutton/qtcolorbutton.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTCOLORBUTTON_H -#define QTCOLORBUTTON_H - -#include <QtGui/QToolButton> - -QT_BEGIN_NAMESPACE - -class QtColorButton : public QToolButton -{ - Q_OBJECT - Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered) -public: - QtColorButton(QWidget *parent = 0); - ~QtColorButton(); - - bool isBackgroundCheckered() const; - void setBackgroundCheckered(bool checkered); - - QColor color() const; - -public slots: - - void setColor(const QColor &color); - -signals: - void colorChanged(const QColor &color); -protected: - void paintEvent(QPaintEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); -#ifndef QT_NO_DRAGANDDROP - void dragEnterEvent(QDragEnterEvent *event); - void dragLeaveEvent(QDragLeaveEvent *event); - void dropEvent(QDropEvent *event); -#endif -private: - class QtColorButtonPrivate *d_ptr; - Q_DECLARE_PRIVATE(QtColorButton) - Q_DISABLE_COPY(QtColorButton) - Q_PRIVATE_SLOT(d_func(), void slotEditColor()) -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/qtcolorbutton/qtcolorbutton.pri b/src/qtcolorbutton/qtcolorbutton.pri deleted file mode 100644 index 0e41068..0000000 --- a/src/qtcolorbutton/qtcolorbutton.pri +++ /dev/null @@ -1,4 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD -SOURCES += $$PWD/qtcolorbutton.cpp -HEADERS += $$PWD/qtcolorbutton.h diff --git a/src/dxfrotextrude.cc b/src/rotateextrude.cc index 646b643..3a6eb55 100644 --- a/src/dxfrotextrude.cc +++ b/src/rotateextrude.cc @@ -24,7 +24,7 @@ * */ -#include "dxfrotextrudenode.h" +#include "rotateextrudenode.h" #include "module.h" #include "context.h" #include "printutils.h" @@ -42,16 +42,16 @@ using namespace boost::assign; // bring 'operator+=()' into scope #include <QFileInfo> -class DxfRotateExtrudeModule : public AbstractModule +class RotateExtrudeModule : public AbstractModule { public: - DxfRotateExtrudeModule() { } + RotateExtrudeModule() { } virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const; }; -AbstractNode *DxfRotateExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const +AbstractNode *RotateExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const { - DxfRotateExtrudeNode *node = new DxfRotateExtrudeNode(inst); + RotateExtrudeNode *node = new RotateExtrudeNode(inst); std::vector<std::string> argnames; argnames += "file", "layer", "origin", "scale"; @@ -96,11 +96,11 @@ AbstractNode *DxfRotateExtrudeModule::evaluate(const Context *ctx, const ModuleI void register_builtin_dxf_rotate_extrude() { - builtin_modules["dxf_rotate_extrude"] = new DxfRotateExtrudeModule(); - builtin_modules["rotate_extrude"] = new DxfRotateExtrudeModule(); + builtin_modules["dxf_rotate_extrude"] = new RotateExtrudeModule(); + builtin_modules["rotate_extrude"] = new RotateExtrudeModule(); } -PolySet *DxfRotateExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const +PolySet *RotateExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const { if (!evaluator) { PRINTF("WARNING: No suitable PolySetEvaluator found for %s module!", this->name().c_str()); @@ -116,7 +116,7 @@ PolySet *DxfRotateExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) con return ps; } -std::string DxfRotateExtrudeNode::toString() const +std::string RotateExtrudeNode::toString() const { std::stringstream stream; diff --git a/src/dxfrotextrudenode.h b/src/rotateextrudenode.h index e0ade82..613d44b 100644 --- a/src/dxfrotextrudenode.h +++ b/src/rotateextrudenode.h @@ -1,13 +1,13 @@ -#ifndef DXFROTEXTRUDENODE_H_ -#define DXFROTEXTRUDENODE_H_ +#ifndef ROTATEEXTRUDENODE_H_ +#define ROTATEEXTRUDENODE_H_ #include "node.h" #include "visitor.h" -class DxfRotateExtrudeNode : public AbstractPolyNode +class RotateExtrudeNode : public AbstractPolyNode { public: - DxfRotateExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) { + RotateExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) { convexity = 0; fn = fs = fa = 0; origin_x = origin_y = scale = 0; diff --git a/src/value.cc b/src/value.cc index 53fd6dc..685bf81 100644 --- a/src/value.cc +++ b/src/value.cc @@ -193,6 +193,9 @@ Value Value::operator < (const Value &v) const if (this->type == NUMBER && v.type == NUMBER) { return Value(this->num < v.num); } + else if (this->type == STRING && v.type == STRING) { + return Value(this->text < v.text); + } return Value(); } @@ -201,6 +204,9 @@ Value Value::operator <= (const Value &v) const if (this->type == NUMBER && v.type == NUMBER) { return Value(this->num <= v.num); } + else if (this->type == STRING && v.type == STRING) { + return Value(this->text <= v.text); + } return Value(); } @@ -240,6 +246,9 @@ Value Value::operator >= (const Value &v) const if (this->type == NUMBER && v.type == NUMBER) { return Value(this->num >= v.num); } + else if (this->type == STRING && v.type == STRING) { + return Value(this->text >= v.text); + } return Value(); } @@ -248,6 +257,9 @@ Value Value::operator > (const Value &v) const if (this->type == NUMBER && v.type == NUMBER) { return Value(this->num > v.num); } + else if (this->type == STRING && v.type == STRING) { + return Value(this->text > v.text); + } return Value(); } diff --git a/src/visitor.h b/src/visitor.h index f4846b8..fe350f8 100644 --- a/src/visitor.h +++ b/src/visitor.h @@ -22,10 +22,10 @@ public: virtual Response visit(class State &state, const class CsgNode &node) { return visit(state, (const class AbstractNode &)node); } - virtual Response visit(class State &state, const class DxfLinearExtrudeNode &node) { + virtual Response visit(class State &state, const class LinearExtrudeNode &node) { return visit(state, (const class AbstractPolyNode &)node); } - virtual Response visit(class State &state, const class DxfRotateExtrudeNode &node) { + virtual Response visit(class State &state, const class RotateExtrudeNode &node) { return visit(state, (const class AbstractPolyNode &)node); } virtual Response visit(class State &state, const class ImportNode &node) { |