1 /******************************************************************* 2 3 Part of the Fritzing project - http://fritzing.org 4 Copyright (c) 2007-2014 Fachhochschule Potsdam - http://fh-potsdam.de 5 6 Fritzing is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 Fritzing is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with Fritzing. If not, see <http://www.gnu.org/licenses/>. 18 19 ******************************************************************** 20 21 $Revision: 6984 $: 22 $Author: irascibl@gmail.com $: 23 $Date: 2013-04-22 23:44:56 +0200 (Mo, 22. Apr 2013) $ 24 25 ********************************************************************/ 26 27 #ifndef RULER_H 28 #define RULER_H 29 30 #include <QRectF> 31 #include <QPainterPath> 32 #include <QPixmap> 33 #include <QVariant> 34 #include <QComboBox> 35 #include <QDoubleValidator> 36 37 #include "paletteitem.h" 38 39 class Ruler : public PaletteItem 40 { 41 Q_OBJECT 42 43 public: 44 // after calling this constructor if you want to render the loaded svg (either from model or from file), MUST call <renderImage> 45 Ruler(ModelPart *, ViewLayer::ViewID, const ViewGeometry & viewGeometry, long id, QMenu * itemMenu, bool doLabel); 46 ~Ruler(); 47 48 void resizeMM(double magnitude, double unitsFlag, const LayerHash & viewLayers); 49 QString retrieveSvg(ViewLayer::ViewLayerID, QHash<QString, QString> & svgHash, bool blackOnly, double dpi, double & factor); 50 bool collectExtraInfo(QWidget * parent, const QString & family, const QString & prop, const QString & value, bool swappingEnabled, QString & returnProp, QString & returnValue, QWidget * & returnWidget, bool & hide); 51 bool hasCustomSVG(); 52 bool stickyEnabled(); 53 bool hasPartLabel(); 54 PluralType isPlural(); 55 void addedToScene(bool temporary); 56 bool hasPartNumberProperty(); 57 bool canFindConnectorsUnder(); 58 59 public slots: 60 void widthEntry(); 61 void unitsEntry(const QString &); 62 63 protected: 64 QString makeSvg(double inches); 65 ViewLayer::ViewID useViewIDForPixmap(ViewLayer::ViewID, bool swappingEnabled); 66 67 protected: 68 QPointer<QLineEdit> m_widthEditor; 69 QPointer<QComboBox> m_unitsEditor; 70 QPointer<QDoubleValidator> m_widthValidator; 71 }; 72 73 #endif 74