Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

lensdialog.h

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008 *   Copyright (C) 2007 by Franz Schmid                                     *
00009 *   franz.schmid@altmuehlnet.de                                            *
00010 *                                                                          *
00011 *   This program is free software; you can redistribute it and/or modify   *
00012 *   it under the terms of the GNU General Public License as published by   *
00013 *   the Free Software Foundation; either version 2 of the License, or      *
00014 *   (at your option) any later version.                                    *
00015 *                                                                          *
00016 *   This program is distributed in the hope that it will be useful,        *
00017 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00018 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00019 *   GNU General Public License for more details.                           *
00020 *                                                                          *
00021 *   You should have received a copy of the GNU General Public License      *
00022 *   along with this program; if not, write to the                          *
00023 *   Free Software Foundation, Inc.,                                        *
00024 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
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
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.