Scribus
Open source desktop publishing at your fingertips
tabruler.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 TABRULER_H
8 #define TABRULER_H
9 
10 #include <QVariant>
11 #include <QWidget>
12 #include <QHBoxLayout>
13 #include <QPaintEvent>
14 #include <QGridLayout>
15 #include <QLabel>
16 #include <QMouseEvent>
17 #include <QEvent>
18 #include <QVBoxLayout>
19 
20 #include "scribusapi.h"
21 #include "sctextstruct.h"
22 
23 class QComboBox;
24 class QPushButton;
25 class ScrSpinBox;
26 class QToolButton;
27 
28 class SCRIBUS_API RulerT : public QWidget
29 {
30  Q_OBJECT
31 
32 public:
33  RulerT(QWidget* parent, int ein, QList<ParagraphStyle::TabRecord> Tabs, bool ind, double wid);
34  ~RulerT() {};
35  void setTabs(QList<ParagraphStyle::TabRecord> Tabs, int dEin);
36  void updateTabList();
37  bool mousePressed;
38  QList<ParagraphStyle::TabRecord> tabValues;
39  bool haveInd;
40  int unitIndex;
41  int offset;
42  int actTab;
43  double leftIndent;
44  double firstLine;
45  double Width;
46  int rulerCode;
47  int mouseX;
48  int offsetIncrement;
49 
50 public slots:
51  void resetOffsetInc();
52  void decreaseOffset();
53  void increaseOffset();
54  void changeTab(int t);
55  void changeTabChar(QChar t);
56  void moveTab(double t);
57  void removeActTab();
58  void moveFirstLine(double t);
59  void moveLeftIndent(double t);
60 
61 signals:
62  void tabMoved(double);
63  void typeChanged(int);
64  void fillCharChanged(QChar);
65  void leftIndentMoved(double);
66  void firstLineMoved(double);
67  void noTabs();
68  void newTab();
69  void mouseReleased();
70  void tabSelected();
71 
72 protected:
73  virtual void paintEvent(QPaintEvent *);
74  virtual void mousePressEvent(QMouseEvent *m);
75  virtual void mouseReleaseEvent(QMouseEvent *);
76  virtual void mouseMoveEvent(QMouseEvent *m);
77  virtual void leaveEvent(QEvent*);
78 
79 private:
80  double iter, iter2;
81 };
82 
83 class SCRIBUS_API Tabruler : public QWidget
84 {
85  Q_OBJECT
86 
87 public:
88  Tabruler( QWidget* parent,
89  bool haveFirst = true,
90  int dEin = 1,
91  QList<ParagraphStyle::TabRecord> Tabs = QList<ParagraphStyle::TabRecord>(),
92  double wid = -1);
93  ~Tabruler() {};
94 
95  virtual void setTabs(QList<ParagraphStyle::TabRecord> Tabs, int dEin);
96 
97  QList<ParagraphStyle::TabRecord> getTabVals();
98  bool haveF;
99  double getFirstLine();
100  double getLeftIndent();
101  double getRightIndent();
102 
103 public slots:
104  void resetOFfL();
105  void resetOFfR();
106  void clearAll();
107  void clearOne();
108  void tabAdded();
109  void lastTabRemoved();
110  void setTabType(int t);
111  void setType();
112  void setTabData(double t);
113  void setTab();
114  void setFirstLineData(double t);
115  void setFirstLine();
116  void setLeftIndentData(double t);
117  void setLeftIndent();
118  void setRightIndentData(double t);
119  void setRightIndent();
120  void setTabFillChar(QChar t);
121  void setFillChar();
122  void setCustomFillChar(const QString &txt);
123 
124 signals:
127  void tabrulerChanged();
128 
130  void tabsChanged();
132  void leftIndentChanged(double);
134  void rightIndentChanged(double);
136  void firstLineChanged(double);
137  void mouseReleased();
138 
139 protected:
140  QVBoxLayout* tabrulerLayout;
141  QHBoxLayout* layout2;
142  QHBoxLayout* layout1;
143  QHBoxLayout* indentLayout;
144  QVBoxLayout* layout3;
145  QHBoxLayout *layout4;
146  QComboBox* typeCombo;
147  QComboBox* tabFillCombo;
148  QLabel* tabFillComboT;
149  RulerT* ruler;
150  QToolButton* rulerScrollL;
151  QToolButton* rulerScrollR;
152  QLabel* positionLabel;
153  QLabel* firstLineLabel;
154  QLabel* leftIndentLabel;
155  QLabel* rightIndentLabel;
156  ScrSpinBox* tabData;
157  ScrSpinBox* firstLineData;
158  ScrSpinBox* leftIndentData;
159  ScrSpinBox* rightIndentData;
160  QPushButton* clearButton;
161  QPushButton* clearOneButton;
162 
163  double docUnitRatio;
164 protected slots:
165  void slotMouseReleased();
166 };
167 
168 #endif // TABRULER_H
Definition: tabruler.h:83
Definition: tabruler.h:28
ScrSpinBox is a Qt4 replacement for our old ScrSpinBox using Qt3.
Definition: scrspinbox.h:21