lensdialog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef LENSDIALOG_H
00028 #define LENSDIALOG_H
00029
00030 #include <QDialog>
00031 #include <QList>
00032 #include <QPainterPath>
00033 #include <QGraphicsItem>
00034 #include <QGraphicsRectItem>
00035 #include <QGraphicsPathItem>
00036 #include <QGraphicsSceneMouseEvent>
00037 #include <QGraphicsSceneHoverEvent>
00038 #include "ui_lensdialogbase.h"
00039 #include "pluginapi.h"
00040 #include "scribusdoc.h"
00041 #include "scribus.h"
00042 class LensDialog;
00043
00044 class PLUGIN_API LensItem : public QGraphicsRectItem
00045 {
00046 public:
00047 LensItem(QRectF geom, LensDialog *parent);
00048 ~LensItem() {};
00049 void setStrength(double s);
00050 void updateEffect();
00051 QPainterPath lensDeform(const QPainterPath &source, const QPointF &offset, double m_radius, double s);
00052 void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget);
00053 double strength;
00054 double scaling;
00055 int handle;
00056 QPointF mousePoint;
00057 protected:
00058 QVariant itemChange(GraphicsItemChange change, const QVariant &value);
00059 void mousePressEvent(QGraphicsSceneMouseEvent *event);
00060 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00061 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00062 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
00063 void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
00064 void hoverLeaveEvent(QGraphicsSceneHoverEvent *);
00065 LensDialog *dialog;
00066 };
00067
00068 class PLUGIN_API LensDialog : public QDialog, Ui::LensDialogBase
00069 {
00070 Q_OBJECT
00071
00072 public:
00073 LensDialog(QWidget* parent, ScribusDoc *doc);
00074 ~LensDialog() {};
00075 void lensSelected(LensItem *item);
00076 void setLensPositionValues(QPointF p);
00077 QGraphicsScene scene;
00078 QList<QPainterPath> origPath;
00079 QList<QGraphicsPathItem*> origPathItem;
00080 QList<LensItem*> lensList;
00081 int currentLens;
00082 bool isFirst;
00083
00084 protected:
00085 void showEvent(QShowEvent *e);
00086
00087 private slots:
00088 void doZoomIn();
00089 void doZoomOut();
00090 void addLens();
00091 void removeLens();
00092 void changeLens();
00093 void selectionHasChanged();
00094 void setNewLensX(double x);
00095 void setNewLensY(double y);
00096 void setNewLensRadius(double radius);
00097 void setNewLensStrength(double s);
00098 };
00099
00100 #endif