#ifndef __DRAWINGVIEW_H__
#define __DRAWINGVIEW_H__
-#include <QtGui>
+#include <QtWidgets>
#include <stdint.h>
-#include "action.h"
-#include "container.h"
+#include "structs.h"
+
+class Painter;
class DrawingView: public QWidget
{
DrawingView(QWidget * parent = NULL);
public:
- void SetRotateToolActive(bool state = true);
- void SetAddLineToolActive(bool state = true);
- void SetAddCircleToolActive(bool state = true);
- void SetAddDimensionToolActive(bool state = true);
+// void SetToolActive(Action * action);
+ void SetGridSize(uint32_t);
void UpdateGridBackground(void);
+ Point SnapPointToGrid(Point);
+ void RenderObjects(Painter *, Container *);
+ void DeleteSelectedItems(void);
+ void ClearSelection(void);
+ void AddHoveredToSelection(void);
+ void GetSelection(std::vector<void *> &);
+ void GetHovered(std::vector<void *> &);
public slots:
void AddNewObjectToDocument(Object *);
+ void HandleActionUpdate(void);
+ void SetCurrentLayer(int);
protected:
void paintEvent(QPaintEvent * event);
+ void resizeEvent(QResizeEvent * event);
void mousePressEvent(QMouseEvent * event);
void mouseMoveEvent(QMouseEvent * event);
void mouseReleaseEvent(QMouseEvent * event);
+ void wheelEvent(QWheelEvent * event);
+ void keyPressEvent(QKeyEvent * event);
+ void keyReleaseEvent(QKeyEvent * event);
private:
QPoint GetAdjustedMousePosition(QMouseEvent * event);
public:
bool useAntialiasing;
+ uint32_t numSelected;
+ uint32_t numHovered;
+ bool shiftDown;
+ bool ctrlDown;
private:
-// QBrush * backgroundBrush;
QPixmap gridBackground;
double scale; // Window scaling factor
int32_t offsetX, offsetY; // Window offsets
public:
Container document;
- double gridSpacing;
+ uint32_t gridPixels; // Grid size in pixels
private:
bool collided;
-//Should this go into Object's class variables???
- bool rotateTool;
- double rx, ry;
bool scrollDrag;
Vector oldPoint;
- bool addLineTool;
- bool addCircleTool;
- bool addDimensionTool;
-// bool selectionInProgress;
-// QRectF selection;
public:
- Action * toolAction;
+ std::vector<void *> select;
+ std::vector<void *> hover;
+// Action * toolAction;
+
+// public:
+// static Container document;
};
#endif // __DRAWINGVIEW_H__
+