- Manipulate Dimension
- Object connections
- Group selection (kind done, needs more work though)
- - Take movement code out of Objects and put it into top level Container
+ - Take movement code out of Objects and put it into top level Container (actually
+ I think this should be more of the state code handling. Have to see.)
- Add OSD routines so they don't have to be implemented in Objects
- Add OSD to Object creation
- Add layers
arc sizing, outer half controls rotation. That way you can grab either handle
and know what it's supposed to do.
- Fix loading and saving code
- - Fix snap to grid to allow picking up of handles when they are not on a grid
- point.
- Add Drawing Properties dialog (separate from Application Settings)
- Fix snap to grid to honor both states (right now, it's a weird mix of states)
[Shamus 2013-08-11]
- Add Arc [Shamus 2013-08-14]
+ - Fix snap to grid to allow picking up of handles when they are not on a grid
+ point. [Shamus 2013-08-18]
text = text.arg(radius, 0, 'd', 4).arg(radius / oldRadius * 100.0, 0, 'd', 0);
}
+#if 0
pen = QPen(QColor(0x00, 0xFF, 0x00), 1.0, Qt::SolidLine);
painter->SetPen(pen);
painter->SetBrush(QBrush(QColor(0x40, 0xFF, 0x40, 0x9F)));
pen = QPen(QColor(0x00, 0x5F, 0xDF));
painter->SetPen(pen);
painter->DrawText(textRect, Qt::AlignVCenter, text);
+#else
+ painter->DrawInformativeText(text);
+#endif
}
}
{
QString text = QObject::tr("Radius: %1\nScale: %2%");
text = text.arg(radius, 0, 'd', 4).arg(radius / oldRadius * 100.0, 0, 'd', 0);
-
+#if 0
QPen pen = QPen(QColor(0x00, 0xFF, 0x00), 1.0, Qt::SolidLine);
painter->SetPen(pen);
painter->SetBrush(QBrush(QColor(0x40, 0xFF, 0x40, 0x9F)));
pen = QPen(QColor(0x00, 0x5F, 0xDF));
painter->SetPen(pen);
painter->DrawText(textRect, Qt::AlignVCenter, text);
+#else
+ painter->DrawInformativeText(text);
+#endif
}
}
}
}
+ if (snapToGrid)
+ point = SnapPointToGrid(point);
+
// We check to see if the container we're trying to access is the
// DrawingView's document. If so, we ignore the state of the container.
// Otherwise, we care about the state of the container. :-)
fprintf(file, "ENDCONTAINER\n");
}
+
+/*virtual*/ Object * Container::Copy(void)
+{
+#warning "!!! This doesn't take care of attached Dimensions !!!"
+/*
+This is a real problem. While having a pointer in the Dimension to this line's points
+is fast & easy, it creates a huge problem when trying to replicate an object like this.
+
+Maybe a way to fix that then, is to have reference numbers instead of pointers. That
+way, if you copy them, ... you might still have problems. Because you can't be sure if
+a copy will be persistant or not, you then *definitely* do not want them to have the
+same reference number.
+*/
+ Container * c = new Container(position, parent);
+ *c = *this;
+ return c;
+}
+
virtual void Add(Object *);
virtual QRectF Extents(void);
virtual void Enumerate(FILE *);
+ virtual Object * Copy(void);
void Delete(Object *);
void DeleteSelectedItems(void);
void Clear(void);
update(); // Do an update if collided with at least *one* object in the document
if (toolAction)
+ {
+ if (Object::snapToGrid)
+ point = Object::SnapPointToGrid(point);
+
toolAction->MouseDown(point);
+ }
// Didn't hit any object and not using a tool, so do a selection rectangle
if (!(collided || toolAction))
{
painter->DrawLine(p1, p2);
painter->DrawHandle(p2);
+
+ QString text = tr("Length: %1 in.");
+ text = text.arg(Vector::Magnitude(p1, p2));
+ painter->DrawInformativeText(text);
}
}
double absAngle = (Vector(endpoint - position).Angle()) * RADIANS_TO_DEGREES;
double absLength = Vector(position - endpoint).Magnitude();
- QString text;
-
- text = QObject::tr("Length: %1 in.\n") + QChar(0x2221) + QObject::tr(": %2");
+ QString text = QObject::tr("Length: %1 in.\n") + QChar(0x2221) + QObject::tr(": %2");
text = text.arg(absLength).arg(absAngle);
-
+#if 0
QPen pen = QPen(QColor(0x00, 0xFF, 0x00), 1.0, Qt::SolidLine);
painter->SetPen(pen);
painter->SetBrush(QBrush(QColor(0x40, 0xFF, 0x40, 0x9F)));
pen = QPen(QColor(0x00, 0x5F, 0xDF));
painter->SetPen(pen);
painter->DrawText(textRect, Qt::AlignVCenter, text);
+#else
+ painter->DrawInformativeText(text);
+#endif
}
}
std::vector<Connection> connected;
// Class variables
+ public:
static QFont * font;
+ protected:
static bool fixedAngle;
static bool fixedLength;
static int viewportHeight;
#include "painter.h"
#include "mathconstants.h"
+#include "object.h"
// Set class variable defaults
painter->drawLine(screenPoint.x, 0, screenPoint.x, screenSize.y);
}
+
+void Painter::DrawInformativeText(QString text)
+{
+ painter->setFont(*Object::font);
+ QRectF bounds = painter->boundingRect(QRectF(), Qt::AlignVCenter, text);
+ bounds.moveTo(17.0, 17.0);
+ QRectF textRect = bounds;
+ textRect.adjust(-7.0, -7.0, 7.0, 7.0);
+
+ QPen pen = QPen(QColor(0x00, 0xFF, 0x00), 1.0, Qt::SolidLine);
+ painter->setPen(pen);
+ painter->setBrush(QBrush(QColor(0x40, 0xFF, 0x40, 0x9F)));
+ painter->drawRoundedRect(textRect, 7.0, 7.0);
+
+ pen = QPen(QColor(0x00, 0x5F, 0xDF));
+ painter->setPen(pen);
+ painter->drawText(bounds, Qt::AlignVCenter, text);
+}
+
void DrawText(QRectF, int, QString);
void DrawArrowhead(Vector, Vector, double);
void DrawCrosshair(Vector);
+ void DrawInformativeText(QString);
public:
static Vector CartesianToQtCoords(Vector);