Stuff To Be Implemented/Fixed
-----------------------------
- - Add Arc
- Add Polygon
- Add Ellipse
- Add Spline
- Mirror tool
- Restrict movement horizontal/vertical tool
- Trim tool
+ - Fix Arc manipulator. Idea: split edge handles so that the inner half controls
+ 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)
Stuff That's Done
-----------------
- 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]
+
+
src/action.h \
src/applicationwindow.h \
src/arc.h \
+ src/baseunittab.h \
src/blockitemwidget.h \
src/blockwidget.h \
src/circle.h \
src/action.cpp \
src/applicationwindow.cpp \
src/arc.cpp \
+ src/baseunittab.cpp \
src/blockitemwidget.cpp \
src/blockwidget.cpp \
src/circle.cpp \
fprintf(file, "ARC (%lf,%lf) %lf, %lf, %lf\n", position.x, position.y, radius, startAngle, angleSpan);
}
+
+/*virtual*/ Object * Arc::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.
+*/
+ return new Arc(position, radius, startAngle, angleSpan, parent);
+}
+
virtual void PointerMoved(Vector);
virtual void PointerReleased(void);
virtual void Enumerate(FILE *);
+ virtual Object * Copy(void);
virtual QRectF Extents(void);
-// virtual Object * Copy(void);
// virtual ObjectType Type(void);
private:
--- /dev/null
+//
+// baseunittab.cpp: "Base Unit" tab on the settings dialog
+//
+// Part of the Architektonas Project
+// (C) 2011 Underground Software
+// See the README and GPLv3 files for licensing and warranty information
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// WHO WHEN WHAT
+// --- ---------- ------------------------------------------------------------
+// JLH 08/15/2011 Created this file
+
+#include "baseunittab.h"
+
+
+BaseUnitTab::BaseUnitTab(QWidget * parent/*= 0*/): QWidget(parent)
+{
+ antialiasChk = new QCheckBox(tr("Use Qt's built-in antialiasing"));
+
+ QVBoxLayout * layout = new QVBoxLayout;
+ layout->addWidget(antialiasChk);
+ setLayout(layout);
+}
+
+
+BaseUnitTab::~BaseUnitTab()
+{
+}
+
--- /dev/null
+#ifndef __BASEUNITTAB_H__
+#define __BASEUNITTAB_H__
+
+#include <QtGui>
+
+class BaseUnitTab: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ BaseUnitTab(QWidget * parent = 0);
+ ~BaseUnitTab();
+
+ public:
+ QCheckBox * antialiasChk;
+};
+
+#endif // __BASEUNITTAB_H__
fprintf(file, "CIRCLE (%lf,%lf) %lf\n", position.x, position.y, radius);
}
+
+/*virtual*/ Object * Circle::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.
+*/
+ return new Circle(position, radius, parent);
+}
+
virtual void PointerReleased(void);
virtual bool HitTest(Point);
virtual void Enumerate(FILE *);
+ virtual Object * Copy(void);
virtual QRectF Extents(void);
-// virtual Object * Copy(void);
// virtual ObjectType Type(void);
protected:
// Small problem with this approach: if the copied object goes out of scope,
// all of the objects we copied in here will be deleted. D'oh!
- for(uint i=0; i<from.objects.size(); i++)
+ // For this COPY constructor to be meaningful, we have to actually COPY the
+ // objects in this Container, not just MOVE a copy of the POINTER! D-:
+ std::vector<Object *>::const_iterator i;
+
+// for(uint i=0; i<from.objects.size(); i++)
+ for(i=from.objects.begin(); i!=from.objects.end(); i++)
{
- Object * object = from.objects[i];
+// Object * object = from.objects[i];
+ Object * object = (*i)->Copy();
- // Need to copy the object here...
+ // Need to actually COPY the object here, not copy the pointer only!!
+ // (which we do now, above :-P)
objects.push_back(object);
}
{
QRectF boundary;
+//int a=1;
for(std::vector<Object *>::iterator i=objects.begin(); i!=objects.end(); i++)
{
+//printf("Containter::Draw item #%i [%X]...\n", a++, *i);
(*i)->Draw(painter);
boundary = boundary.united((*i)->Extents());
}
}
+/*virtual*/ Object * Dimension::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.
+*/
+
+ Dimension * d = new Dimension(position, endpoint, dimensionType, parent);
+ d->size = size;
+ return d;
+}
+
+
// Dimensions are special: they contain exactly *two* points. Here, we check
// only for zero/non-zero in returning the correct points.
/*virtual*/ Vector Dimension::GetPointAtParameter(double parameter)
virtual void PointerMoved(Vector);
virtual void PointerReleased(void);
virtual void Enumerate(FILE *);
-// virtual Object * Copy(void);
+ virtual Object * Copy(void);
virtual Vector GetPointAtParameter(double parameter);
virtual void Connect(Object *, double);
virtual void Disconnect(Object *, double);
Vector point = Painter::QtToCartesianCoords(Vector(event->x(), event->y()));
// Problem with this: Can't select stuff very well with the snap grid on.
-// Completely screws things up.
+// Completely screws things up, as sometimes things don't fall on the grid.
+/*
+So, how to fix this? Have the Object check itself?
+Maybe we can fix this by having the initial point not be snapped, but when there's
+a drag, we substitute the snapped point 'oldPoint' which the Object keeps track of
+internally to know how far it was dragged...
+*/
if (Object::snapToGrid)
point = SnapPointToGrid(point);
setLayout(layout);
}
+
GeneralTab::~GeneralTab()
{
}
{
#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.
+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.
+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.
*/
return new Line(position, endpoint, parent);
}
}
-Object::Object(Vector v, Object * passedInParent/*= 0*/): position(v), parent(passedInParent),
- state(OSInactive), oldState(OSInactive), needUpdate(false)//, attachedDimension(0)
+Object::Object(Vector v, Object * passedInParent/*= 0*/): position(v),
+ parent(passedInParent), state(OSInactive), oldState(OSInactive),
+ needUpdate(false)//, attachedDimension(0)
{
}
/*virtual*/ void Object::Disconnect(Object * obj, double parameter)
{
+#if 0
for(uint i=0; i<connected.size(); i++)
{
if (connected[i].object == obj && connected[i].t == parameter)
return;
}
}
+#else
+ std::vector<Connection>::iterator i;
+
+ for(i=connected.begin(); i!=connected.end(); i++)
+ {
+ if (((*i).object == obj) && ((*i).t == parameter))
+ {
+ connected.erase(i);
+ return;
+ }
+ }
+#endif
}
/*virtual*/ void Object::DisconnectAll(Object * obj)
{
+#if 0
// According the std::vector docs, only items at position i and beyond are
// invalidated, everything before i is still valid. So we use that here.
for(uint i=0; i<connected.size();)
else
i++;
}
+#else
+ std::vector<Connection>::iterator i;
+
+ for(i=connected.begin(); i!=connected.end(); )
+ {
+ if ((*i).object == obj)
+ connected.erase(i);
+ else
+ i++;
+ }
+#endif
}
// JLH 06/04/2011 Created this file
#include "settingsdialog.h"
+#include "baseunittab.h"
#include "generaltab.h"
{
tabWidget = new QTabWidget;
generalTab = new GeneralTab(this);
+ baseunitTab = new BaseUnitTab(this);
tabWidget->addTab(generalTab, tr("General"));
+ tabWidget->addTab(baseunitTab, tr("Base Units"));
// tabWidget->addTab(new PermissionsTab(fileInfo), tr("Permissions"));
// tabWidget->addTab(new ApplicationsTab(fileInfo), tr("Applications"));
setWindowTitle(tr("Architektonas Settings"));
}
+
SettingsDialog::~SettingsDialog()
{
}
+
#include <QtGui>
class GeneralTab;
+class BaseUnitTab;
class SettingsDialog: public QDialog
{
public:
GeneralTab * generalTab;
+ BaseUnitTab * baseunitTab;
};
#endif // __SETTINGSDIALOG_H__