00001
00023 #ifndef GRAPHIC_VIEW_H
00024 #define GRAPHIC_VIEW_H
00025
00026 #include <QGraphicsView>
00027
00028 #include "config.h"
00029 #include "graphic_items.h"
00030 #include "graphic_scene.h"
00031 #include "lcdpaintengine.h"
00032 #include "xmlrw.h"
00033
00035 class GraphicView : public QGraphicsView
00036 {
00037 Q_OBJECT
00038
00039 public slots:
00040 void addGraphic(QGraphicsItem*);
00041 void setSize(const QSize&);
00042 void addScene(const QString& title=tr("untitled scene"), double time = 0);
00043 void deleteScene();
00044 void renameScene();
00045 void setSceneTime();
00046 void paintNextScene();
00047 void paint();
00048 void setTool(QAction*);
00049 void zoomIn();
00050 void zoomOut();
00051 void clear();
00052 void save();
00053 void saveAs();
00054 void load();
00055 void selectScene(int);
00056 void updateScene(const QList<QRectF>&);
00057 void remove();
00058 void copy();
00059 void cut();
00060 void paste();
00061
00062 signals:
00063 void updateSceneTime(double);
00064 void updateProperty(ModuleInterface*);
00065 void fileStatusChanged(const QString&);
00066 void sendPasteStatus(bool);
00067 void sendEditStatus(bool);
00068
00069 public:
00070 enum ToolBtn { Invalid=0, Arrow, Move, Zoom, Text, Image, Line, Polygon, Rectangle, Ellipse };
00071 GraphicView(QWidget* parent = 0);
00072 ~GraphicView();
00073 QTabBar* sceneBar();
00074
00075 protected:
00076 void mouseMoveEvent( QMouseEvent* );
00077 void mousePressEvent( QMouseEvent* );
00078 void dragMoveEvent( QDragMoveEvent* );
00079 void dropEvent( QDropEvent* );
00080
00081 void drawBackground(QPainter*, const QRectF&);
00082
00083 private:
00084 QMenu m_editMenu;
00085 QTabBar m_sceneBar;
00086 QString m_filename;
00087 QList<GraphicScene*> m_scenes;
00088 int m_paintSceneIndex;
00089 int m_toolBtn;
00090 QGraphicsItem* m_tmpGraphic;
00091 QList<QGraphicsItem *> m_pasteContainer;
00092 LCDPaintDevice m_lcdDev;
00093 };
00094
00095 #endif