<file>quit.png</file>
<file>zoom-in.png</file>
<file>zoom-out.png</file>
+ <file>eye-open.png</file>
+ <file>eye-closed.png</file>
</qresource>
</RCC>
#include "applicationwindow.h"
#include "about.h"
+#include "blockwidget.h"
#include "drawingview.h"
#include "fileio.h"
#include "generaltab.h"
+#include "layerwidget.h"
#include "painter.h"
#include "settingsdialog.h"
CreateMenus();
CreateToolbars();
+ // Create Dock widgets
+ QDockWidget * dock1 = new QDockWidget(tr("Layers"), this);
+ LayerWidget * lw = new LayerWidget;
+ dock1->setWidget(lw);
+ addDockWidget(Qt::RightDockWidgetArea, dock1);
+ QDockWidget * dock2 = new QDockWidget(tr("Blocks"), this);
+// BlockWidget * bw = new BlockWidget;
+// dock2->setWidget(bw);
+ addDockWidget(Qt::RightDockWidgetArea, dock2);
+
// Create status bar
zoomIndicator = new QLabel("Grid: 12.0\" Zoom: 12.5%");
statusBar()->addPermanentWidget(zoomIndicator);
statusBar()->showMessage(tr("Ready"));
ReadSettings();
-
-// connect(textEdit->document(), SIGNAL(contentsChanged()),
-// this, SLOT(documentWasModified()));
-
-// setCurrentFile("");
setUnifiedTitleAndToolBarOnMac(true);
-
-// ((TTEdit *)qApp)->charWnd->show();//eh?
Object::SetFont(new QFont("Verdana", 15, QFont::Bold));
}
}
-/*virtual*/ QRectF Circle::Extents(void)
-{
- return QRectF(QPointF(position.x - radius, position.y - radius), QPointF(position.x + radius, position.y + radius));
-}
-
-
-#if 0
-/*virtual*/ ObjectType Circle::Type(void)
-{
- return OTCircle;
-}
-#endif
-
-
-bool Circle::HitTest(Point point)
+/*virtual*/ bool Circle::HitTest(Point point)
{
SaveState();
hitCenter = hitCircle = false;
}
+/*virtual*/ QRectF Circle::Extents(void)
+{
+ return QRectF(QPointF(position.x - radius, position.y - radius), QPointF(position.x + radius, position.y + radius));
+}
+
+
void Circle::SaveState(void)
{
oldHitCenter = hitCenter;
virtual bool Collided(Vector);
virtual void PointerMoved(Vector);
virtual void PointerReleased(void);
+ virtual bool HitTest(Point);
virtual void Enumerate(FILE *);
virtual QRectF Extents(void);
// virtual Object * Copy(void);
// virtual ObjectType Type(void);
protected:
- bool HitTest(Point);
void SaveState(void);
bool StateChanged(void);
// every object for collision.
/*virtual*/ void Container::PointerMoved(Vector point)
{
+ if (!isTopLevelContainer)
+ {
+ // check for selection rectangle too
+
+
+ needUpdate = true;
+
+ for(std::vector<Object *>::iterator i=objects.begin(); i!=objects.end(); i++)
+ {
+ if ((*i)->HitTest(point))
+ {
+ state = OSSelected;
+ return;
+ }
+ }
+
+ state = OSInactive;
+ return;
+ }
+
// objectWasDragged = true;
//printf("CONTAINER: PointerMoved()\n");
/*virtual*/ bool Container::NeedsUpdate(void)
{
+ // If this is *not* a top level container, then we treat it as an
+ // aggregate object.
+ if (!isTopLevelContainer)
+ {
+ return needUpdate;
+ }
+
// Search through objects for one that needs an update; if one is found,
// return immediately.
for(std::vector<Object *>::iterator i=objects.begin(); i!=objects.end(); i++)
//
#include "layerwidget.h"
+
+
+#if 0
+OK, what it seems like we should do here, is instead of deriving from QDockWidget,
+we should derive from QWidget (or QScrollArea or somesuch). Then, when creating
+the dockwidget in the main window, we add the LayerWidget as the QDockWidget's
+main widget.
+#endif
+
+LayerWidget::LayerWidget(void): QWidget()
+{
+
+ // Make a QScrollArea, put in a QVBoxLayout.
+ // Use line widget (two checkboxes, one label), use setIcon() on the
+ // checkboxes to change their look (eye open/closed for visibility,
+ // lock open/closed for layer lock).
+
+ QIcon visibleChecked(":/res/eye-open.png");
+// QIcon visibleUnchecked(":/res/eye-closed.png");
+ visibleChecked.addFile(":/res/eye-closed.png", QSize(16, 16), QIcon::Normal, QIcon::On);
+
+ QVBoxLayout * mainLayout = new QVBoxLayout;
+ QCheckBox * box1 = new QCheckBox("bleah");
+ box1->setIcon(visibleChecked);
+ mainLayout->addWidget(box1);
+ QPushButton * button1 = new QPushButton;//(visibleChecked);
+ button1->setFlat(true);
+ button1->setIcon(visibleChecked);
+ button1->setCheckable(true);
+ mainLayout->addWidget(button1);
+//printf("LayerWidget: About to set layout...\n");
+ setLayout(mainLayout);
+}
+
+
+LayerWidget::~LayerWidget()
+{
+}
+
+#ifndef __LAYERWIDGET_H__
+#define __LAYERWIDGET_H__
+
+#include <QtGui>
+
+class LayerWidget: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ LayerWidget(void);
+ ~LayerWidget();
+
+};
+
+#endif // __LAYERWIDGET_H__
}
-bool Line::HitTest(Point point)
+/*virtual*/ bool Line::HitTest(Point point)
{
SaveState();
virtual bool Collided(Vector);
virtual void PointerMoved(Vector);
virtual void PointerReleased(void);
+ virtual bool HitTest(Point);
virtual void Enumerate(FILE *);
// virtual Object * Copy(void);
virtual Vector GetPointAtParameter(double parameter);