Scribus
Open source desktop publishing at your fingertips
curvewidget.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef CURVEWIDGET_H
8 #define CURVEWIDGET_H
9 
10 #include <QWidget>
11 #include <QEvent>
12 #include <QMouseEvent>
13 #include <QKeyEvent>
14 #include <QPaintEvent>
15 
16 class QEvent;
17 
18 #include "fpointarray.h"
19 #include "scribusapi.h"
20 
21 class QVBoxLayout;
22 class QHBoxLayout;
23 class QPushButton;
24 class QPixmap;
25 class QSpacerItem;
26 
27 class SCRIBUS_API KCurve : public QWidget
28 {
29  Q_OBJECT
30 
31 public:
32  KCurve(QWidget *parent);
33  virtual ~KCurve();
34 
35 protected:
36  void paintEvent(QPaintEvent *);
37  void keyPressEvent(QKeyEvent *);
38  void mousePressEvent (QMouseEvent * e);
39  void mouseReleaseEvent ( QMouseEvent * e );
40  void mouseMoveEvent ( QMouseEvent * e );
41 
42 public:
43  double getCurveValue(double x);
44  FPointArray getCurve();
45  void setCurve(FPointArray inlist);
46  void resetCurve();
47  void setLinear(bool setter);
48  bool isLinear();
49 
50 signals:
51  void modified();
52 
53 private:
54  double m_leftmost;
55  double m_rightmost;
56  FPoint m_grab_point;
57  int m_pos;
58  bool m_dragging;
59  bool m_linear;
60  double m_grabOffsetX;
61  double m_grabOffsetY;
62  FPointArray m_points;
63  FPointArray m_points_back;
64 };
65 
66 class SCRIBUS_API CurveWidget : public QWidget
67 {
68  Q_OBJECT
69 
70 public:
71  CurveWidget(QWidget* parent);
72  ~CurveWidget() {};
73 
74  virtual void changeEvent(QEvent *e);
75 
76  void setLinear(bool setter);
77  QPushButton* invertButton;
78  QPushButton* resetButton;
79  QPushButton *linearButton;
80  QPushButton* loadButton;
81  QPushButton* saveButton;
82  KCurve* cDisplay;
83 
84 private slots:
85  void doInvert();
86  void doReset();
87  void doLinear();
88  void doLoad();
89  void doSave();
90 
91 protected:
92  QHBoxLayout* CurveWidgetLayout;
93  QVBoxLayout* layout1;
94  QSpacerItem* spacer1;
95 
96 protected slots:
97  virtual void languageChange();
98 };
99 
100 #endif // CURVEWIDGET_H
A point with floating point precision.
Definition: fpoint.h:43
Definition: curvewidget.h:27
Definition: curvewidget.h:66
Definition: fpointarray.h:42