- Add fill/hatch to Objects
- Fix zooming to be more intuitive
- Add other Dimension types, like radial, diametric, leader
- - Mirror tool
+ - Mirror tool (started, needs actual mirroring implementation)
- Restrict movement horizontal/vertical tool
- Trim tool
- Fix Arc manipulator. Idea: split edge handles so that the inner half controls
ReadSettings();
setUnifiedTitleAndToolBarOnMac(true);
Object::SetFont(new QFont("Verdana", 15, QFont::Bold));
+
+ connect(lw, SIGNAL(LayerSelected(int)), drawing, SLOT(SetCurrentLayer(int)));
}
document(Vector(0, 0)),
/*gridSpacing(12.0),*/ gridPixels(0), collided(false), rotateTool(false),
rx(150.0), ry(150.0),
- scrollDrag(false), addLineTool(false), addCircleTool(false),
- addDimensionTool(false),
+// scrollDrag(false), addLineTool(false), addCircleTool(false),
+// addDimensionTool(false),
toolAction(NULL)
{
document.isTopLevelContainer = true;
}
+void DrawingView::SetCurrentLayer(int layer)
+{
+ Object::currentLayer = layer;
+//printf("DrawingView::CurrentLayer = %i\n", layer);
+}
+
+
QPoint DrawingView::GetAdjustedMousePosition(QMouseEvent * event)
{
// This is undoing the transform, e.g. going from client coords to local coords.
public:
void SetRotateToolActive(bool state = true);
-#if 0
- void SetAddLineToolActive(bool state = true);
- void SetAddCircleToolActive(bool state = true);
- void SetAddArcToolActive(bool state = true);
- void SetAddDimensionToolActive(bool state = true);
-#endif
-// void SetToolActive(Action * action, bool state = true);
- void SetToolActive(Action * action);//, bool state = true);
+ void SetToolActive(Action * action);
void SetGridSize(uint32_t);
void UpdateGridBackground(void);
public slots:
void AddNewObjectToDocument(Object *);
+ void SetCurrentLayer(int);
protected:
void paintEvent(QPaintEvent * event);
private:
QPoint GetAdjustedMousePosition(QMouseEvent * event);
QPoint GetAdjustedClientPosition(int x, int y);
-// Vector SnapPointToGrid(Vector);
public:
bool useAntialiasing;
private:
-// QBrush * backgroundBrush;
QPixmap gridBackground;
double scale; // Window scaling factor
int32_t offsetX, offsetY; // Window offsets
public:
Container document;
-// double gridSpacing; // Grid spacing in base units
uint32_t gridPixels; // Grid size in pixels
-// double gridBaseUnits; // Grid size in base units
private:
bool collided;
//Should this go into Object's class variables???
double rx, ry;
bool scrollDrag;
Vector oldPoint;
- bool addLineTool;
- bool addCircleTool;
- bool addDimensionTool;
+// bool addLineTool;
+// bool addCircleTool;
+// bool addDimensionTool;
public:
Action * toolAction;
#include "layeritemwidget.h"
-LayerWidget::LayerWidget(void): QWidget()
+LayerWidget::LayerWidget(void): QWidget(),
+ list(new QListWidget)
{
LayerItemWidget * liw1 = new LayerItemWidget("Guidelines");
LayerItemWidget * liw2 = new LayerItemWidget("Floor #1");
LayerItemWidget * liw4 = new LayerItemWidget("List Widget");
LayerItemWidget * liw5 = new LayerItemWidget("Background");
- QListWidget * qlw = new QListWidget;
- QListWidgetItem * qli1 = new QListWidgetItem(qlw);
- QListWidgetItem * qli2 = new QListWidgetItem(qlw);
- QListWidgetItem * qli3 = new QListWidgetItem(qlw);
- QListWidgetItem * qli4 = new QListWidgetItem(qlw);
- QListWidgetItem * qli5 = new QListWidgetItem(qlw);
- qlw->setItemWidget(qli1, liw1);
- qlw->setItemWidget(qli2, liw2);
- qlw->setItemWidget(qli3, liw3);
- qlw->setItemWidget(qli4, liw4);
- qlw->setItemWidget(qli5, liw5);
+// QListWidget * qlw = new QListWidget;
+ QListWidgetItem * qli1 = new QListWidgetItem(list);
+ QListWidgetItem * qli2 = new QListWidgetItem(list);
+ QListWidgetItem * qli3 = new QListWidgetItem(list);
+ QListWidgetItem * qli4 = new QListWidgetItem(list);
+ QListWidgetItem * qli5 = new QListWidgetItem(list);
+ list->setItemWidget(qli1, liw1);
+ list->setItemWidget(qli2, liw2);
+ list->setItemWidget(qli3, liw3);
+ list->setItemWidget(qli4, liw4);
+ list->setItemWidget(qli5, liw5);
+#if 0
QPushButton * pb1 = new QPushButton("+");
QPushButton * pb2 = new QPushButton("-");
QPushButton * pb3 = new QPushButton("Edit");
QPushButton * pb4 = new QPushButton("^");
QPushButton * pb5 = new QPushButton("v");
+#else
+ QToolButton * pb1 = new QToolButton;
+ QToolButton * pb2 = new QToolButton;
+ QToolButton * pb3 = new QToolButton;
+ QToolButton * pb4 = new QToolButton;
+ QToolButton * pb5 = new QToolButton;
+
+ pb1->setIcon(QIcon(":/res/generic-tool.png"));
+ pb2->setIcon(QIcon(":/res/generic-tool.png"));
+ pb3->setIcon(QIcon(":/res/generic-tool.png"));
+ pb4->setIcon(QIcon(":/res/generic-tool.png"));
+ pb5->setIcon(QIcon(":/res/generic-tool.png"));
+#endif
QHBoxLayout * hbox1 = new QHBoxLayout;
hbox1->addWidget(pb1);
hbox1->addStretch();
QVBoxLayout * mainLayout = new QVBoxLayout;
- mainLayout->addWidget(qlw);
+ mainLayout->addWidget(list);
mainLayout->addLayout(hbox1);
setLayout(mainLayout);
+
+ connect(list, SIGNAL(currentRowChanged(int)), this, SLOT(HandleLayerSelected(int)));
+ list->setCurrentRow(4);
+ connect(pb1, SIGNAL(clicked()), this, SLOT(AddLayer()));
+ connect(pb2, SIGNAL(clicked()), this, SLOT(DeleteLayer()));
+ connect(pb3, SIGNAL(clicked()), this, SLOT(EditLayer()));
+ connect(pb4, SIGNAL(clicked()), this, SLOT(MoveLayerUp()));
+ connect(pb5, SIGNAL(clicked()), this, SLOT(MoveLayerDown()));
}
{
}
+
+void LayerWidget::HandleLayerSelected(int currentRow)
+{
+//printf("LayerWidget::HandleLayerSelected(): currentRow = %i\n", currentRow);
+ emit(LayerSelected(currentRow));
+}
+
+
+void LayerWidget::AddLayer(void)
+{
+ int count = list->count();
+ QString text = QString("Layer #%1").arg(count);
+ LayerItemWidget * liw = new LayerItemWidget(text);
+ QListWidgetItem * qlwi = new QListWidgetItem();
+ list->insertItem(0, qlwi);
+ list->setItemWidget(qlwi, liw);
+}
+
+
+void LayerWidget::DeleteLayer(void)
+{
+}
+
+
+void LayerWidget::EditLayer(void)
+{
+}
+
+
+void LayerWidget::MoveLayerUp(void)
+{
+}
+
+
+void LayerWidget::MoveLayerDown(void)
+{
+}
+
LayerWidget(void);
~LayerWidget();
+ private slots:
+ void HandleLayerSelected(int);
+ void AddLayer(void);
+ void DeleteLayer(void);
+ void EditLayer(void);
+ void MoveLayerUp(void);
+ void MoveLayerDown(void);
+
+ signals:
+ void LayerSelected(int);
+
+ private:
+ QListWidget * list;
};
#endif // __LAYERWIDGET_H__
+
#include "mirroraction.h"
#include "line.h"
+#include "mathconstants.h"
#include "painter.h"
//#include "vector.h"
painter->DrawLine(p1, p2);
painter->DrawHandle(p2);
- QString text = tr("Length: %1 in.");
- text = text.arg(Vector::Magnitude(p1, p2));
+ double absAngle = (Vector(p2 - p1).Angle()) * RADIANS_TO_DEGREES;
+// double absLength = Vector(position - endpoint).Magnitude();
+
+ QString text = QChar(0x2221) + QObject::tr(": %1");
+ text = text.arg(absAngle);
+// QString text = tr("Length: %1 in.");
+// text = text.arg(Vector::Magnitude(p1, p2));
painter->DrawInformativeText(text);
}
}
bool Object::selectionInProgress = false;
QRectF Object::selection;
double Object::gridSpacing;
+int Object::currentLayer = 0;
Object::Object(): position(Vector(0, 0)), parent(0), type(OTObject),
- state(OSInactive), oldState(OSInactive), needUpdate(false)
+ state(OSInactive), layer(0), oldState(OSInactive), needUpdate(false)
//, attachedDimension(0)
{
}
Object::Object(Vector v, Object * passedInParent/*= 0*/): position(v),
- parent(passedInParent), state(OSInactive), oldState(OSInactive),
+ parent(passedInParent), state(OSInactive), layer(0), oldState(OSInactive),
needUpdate(false)//, attachedDimension(0)
{
}
public:
ObjectType type;
ObjectState state;
+ unsigned int layer;
protected:
ObjectState oldState;
bool needUpdate;
static bool selectionInProgress;
static QRectF selection;
static double gridSpacing; // Grid spacing in base units
+ static int currentLayer;
};
#endif // __OBJECT_H__