Scribus
Open source desktop publishing at your fingertips
hruler.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 /***************************************************************************
8  hruler.h - description
9  -------------------
10  begin : Tue Apr 10 2001
11  copyright : (C) 2001 by Franz Schmid
12  email : Franz.Schmid@altmuehlnet.de
13 ***************************************************************************/
14 
15 /***************************************************************************
16 * *
17 * This program is free software; you can redistribute it and/or modify *
18 * it under the terms of the GNU General Public License as published by *
19 * the Free Software Foundation; either version 2 of the License, or *
20 * (at your option) any later version. *
21 * *
22 ***************************************************************************/
23 
24 #ifndef HRULER_H
25 #define HRULER_H
26 
27 #include <QWidget>
28 
29 #include "scribusapi.h"
30 #include "styles/paragraphstyle.h"
31 
32 class PageItem;
33 
34 class QPaintEvent;
35 class QMouseEvent;
36 class PrefsManager;
37 class RulerGesture;
38 class ScribusView;
39 class ScribusDoc;
40 class ScribusMainWindow;
41 
45 class SCRIBUS_API Hruler : public QWidget
46 {
47  Q_OBJECT
48 
49 public:
50  Hruler(ScribusView *pa, ScribusDoc *doc);
51  ~Hruler() {};
52 private:
53  bool textEditMode;
54  double ColGap;
55  double lineCorr;
56  int Cols;
57  double RExtra;
58  double Extra;
59  double Indent;
60  double First;
61  double RMargin;
62  bool Revers;
63  QList<ParagraphStyle::TabRecord> TabValues;
64  PageItem * currItem;
65 
66  double ItemPos;
67  double ItemEndPos;
68  double offs;
69  double itemScale;
70 public:
71  double ruleSpacing();
72  void setItem(PageItem * item);
73  void textMode(bool state) { textEditMode = state; }
74  double textBase() const; // left text edge in canvas coord
75  double textWidth() const;
76  double textPosToCanvas(double x) const;
77  int textPosToLocal(double x) const;
78  double localToTextPos(int x) const;
79  void shift(double pos); // using canvas coord
80  void shiftRel(double dist); // using canvas coord
81  double offset() const { return offs; }
82 
83 private:
84  int findRulerHandle(QPoint mp, double grabRadius);
85 
86  virtual void paintEvent(QPaintEvent *e);
87  virtual void mousePressEvent(QMouseEvent *m);
88  virtual void mouseReleaseEvent(QMouseEvent *);
89  virtual void mouseMoveEvent(QMouseEvent *m);
90  virtual void enterEvent(QEvent *m);
91  virtual void leaveEvent(QEvent *m);
92 
93  void drawMarks(QPainter& p);
94  void drawTextMarks(double pos, double endPos, QPainter& p);
95  void drawMarker(QPainter& p);
96  void drawNumber(QString num, int startx, int starty, QPainter & p);
97  void UpdateTabList();
98 
99  int Markp;
100  int oldMark;
101  bool Mpressed;
102  int ActCol;
103  int ActTab;
104  double Scaling;
105  int RulerCode;
106  int MouseX;
107 
108  ScribusDoc *m_doc;
109  ScribusView *m_view;
110 
111 public slots: // Public slots
114  void Draw(int where);
115  void unitChange();
116 
117 signals:
118  void DocChanged(bool);
119  void MarkerMoved(double base, double xp);
120 
121 private:
122  double iter, iter2;
123  double cor;
124  int whereToDraw;
125  bool drawMark;
126  PrefsManager *prefsManager;
127  RulerGesture* rulerGesture;
128 };
129 
130 #endif
Definition: canvasgesture_rulermove.h:46
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
the Document Class
Definition: scribusdoc.h:90
Horizontal ruler.
Definition: hruler.h:45
Definition: pageitem.h:92
Definition: scribusview.h:87
Manage Scribus preferences here, and here alone Start to move the preferences out of scribus...
Definition: prefsmanager.h:43