Subversion Repositories Scribus

Rev

Rev 4185 | Rev 4215 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 paul 1
#ifndef GUIDEMANAGER_H
2
#define GUIDEMANAGER_H
3
 
2969 craig 4
#include "scribusapi.h"
3 paul 5
#include "mspinbox.h"
6
 
4185 subik 7
class QWidget;
8
class QGroupBox;
9
class QListView;
10
class QListViewItem;
11
class QPushButton;
12
class QLabel;
13
class QString;
14
class QCheckBox;
15
class QHButtonGroup;
181 Franz 16
 
4185 subik 17
 
3620 subik 18
/*! \brief \brief GuideManager is the dialog for guides managing ;).
2215 subik 19
Its public interface is used in scrubus.cpp
4026 craig 20
ScribusMainWindow::ManageGuides() via refreshDoc().
2215 subik 21
Guides are applied via void Page::addXGuides(QValueList<double>& guides)
22
and void Page::addYGuides(QValueList<double>& guides).
4185 subik 23
 
24
\note Current limitations: Applying the guides on all pages with
25
automatic rows or columns removes old guides. To prevent guides
26
multiplications.
27
 
2215 subik 28
\author Petr Vanek <petr@yarpen.cz>
29
\author Alessandro Rimoldi
30
\author Franz Schmid
31
*/
2969 craig 32
class SCRIBUS_API GuideManager : public QDialog
2143 subik 33
{
3 paul 34
    Q_OBJECT
35
 
36
public:
2164 subik 37
        GuideManager(QWidget* parent);
4198 subik 38
        ~GuideManager();
181 Franz 39
 
2215 subik 40
private:
4185 subik 41
        //! \brief If there is a selection on the current page
42
        bool selected;
43
        //! \brief width of the current page
3620 subik 44
        double locPageWidth;
4185 subik 45
        //! \brief height of the current page
3620 subik 46
        double locPageHeight;
4185 subik 47
        //! \brief top margin of the current page
3620 subik 48
        double locTop;
4185 subik 49
        //! \brief bottom margin of the current page
3620 subik 50
        double locBottom;
4185 subik 51
        //! \brief right margin of the current page
3620 subik 52
        double locRight;
4185 subik 53
        //! \brief left margin of the current page
3620 subik 54
        double locLeft;
4185 subik 55
        //! \brief position of the group of selected objects
2164 subik 56
        double gx, gy, gw, gh;
57
 
4185 subik 58
        //! \brief vertical guides GUI
59
        QGroupBox* verGroup;
60
        QListView* verList;
242 Franz 61
        QLabel* TextLabel1;
4185 subik 62
        MSpinBox* verSpin;
63
        QPushButton* verSet;
64
        QPushButton* verDel;
2143 subik 65
 
4185 subik 66
        //! \brief horizontal guides GUI
67
        QGroupBox* horGroup;
68
        QListView* horList;
242 Franz 69
        QLabel* TextLabel2;
4185 subik 70
        MSpinBox* horSpin;
71
        QPushButton* horSet;
72
        QPushButton* horDel;
2143 subik 73
 
4185 subik 74
        //! \brief auto guides GUI
75
        QSpinBox* colSpin;
76
        QSpinBox* rowSpin;
77
        QHButtonGroup *bGroup;
2143 subik 78
 
4185 subik 79
        //! \brief lock the guides GUI
80
        QCheckBox* lockedCheckBox;
2143 subik 81
 
3620 subik 82
        /*! \brief Set the guides and exit */
2215 subik 83
        QPushButton* okButton;
3620 subik 84
        /*! \brief Exit without setting */
2237 subik 85
        QPushButton* cancelButton;
3620 subik 86
        /*! \brief Set the guides and keep the dialog open */
2237 subik 87
        QPushButton* setButton;
181 Franz 88
 
3620 subik 89
        /*! \brief Guide Gap widgets */
2200 subik 90
        QCheckBox* useRowGap;
91
        QCheckBox* useColGap;
92
 
3816 subik 93
        /*! \brief Apply selected guides on all pages */
94
        QCheckBox* allPages;
95
 
3620 subik 96
        /*! \brief Gaps between guides.
4185 subik 97
        User can create automatic guides with an optional two gapped instead one guide.
2215 subik 98
        For example: 100mm size - guide - 100mm size will be 95mm size - guide - 10mm gap
99
        - guide - 95mm size (with 10mm gap) */
100
        MSpinBox* rowGap;
101
        MSpinBox* colGap;
3 paul 102
 
3620 subik 103
        /*! \brief Initialise the units. Spin boxes gets pt/mm/etc. extensions here. */
2215 subik 104
        void unitChange();
105
 
4185 subik 106
        //! \brief Document measurements and metrics
1843 cbradney 107
        double docUnitRatio;
4185 subik 108
        int docUnitIndex;
109
        int docUnitDecimals;
110
        //! \brief how much 0.xx
111
        int docUnitPrecision;
112
        //! \brief suffix of the unit [mm, ...]
113
        QString suffix;
181 Franz 114
 
3816 subik 115
        /*! \brief Refresh the guides in the document while the dialog is still opened.
116
        Or closed (of course). */
117
        void refreshDoc();
118
 
119
        /*! \brief Create actual guides on all pages in document */
120
        void refreshWholeDoc();
121
 
4185 subik 122
        /*! \brief Sets the guides from the common list into the GUI.
123
        \param w a widget to set the values. Horizontal or vertical guides list.
124
        \param guides a list with values. E.g. the real document guide list.
2200 subik 125
        */
4185 subik 126
        void setGuidesFromList(QListView *w, QValueList<double> guides);
2215 subik 127
 
4185 subik 128
        /*! \brief Create a list with guides from GUI list.
129
        \param w a widget with list of guides.
130
        \retval QValueList<double> a list to set as document guides.
2200 subik 131
        */
4185 subik 132
        QValueList<double> getValuesFromList(QListView *w);
2200 subik 133
 
4185 subik 134
        /*! \brief Recalculate the margins and measurements for the current page.
135
        It's used for automatic guides position. It's called for every
136
        page when is "apply to all pages" switched on */
137
        void resetMarginsForPage();
181 Franz 138
 
4198 subik 139
        /*! \brief Add a value from spin box to the list.
140
        It's called by "add" slots AddHorVal and AddVerVal.
141
        \param list a reference to the QListView to add a value.
142
        \param spin a reference to the spin box to take a value.
143
        \retval bool false on no add (duplicate etc.), true on success.
144
        */
145
        bool addValueToList(QListView *list, MSpinBox *spin);
146
 
4185 subik 147
protected slots:
148
 
149
        /*! \brief delete horizontal value */
181 Franz 150
        void DelHorVal();
4185 subik 151
        /*! \brief delete vertical value */
181 Franz 152
        void DelVerVal();
153
 
4185 subik 154
        /*! \brief add horizontal value */
181 Franz 155
        void AddHorVal();
4185 subik 156
        /*! \brief add horizontal value */
181 Franz 157
        void AddVerVal();
158
 
4185 subik 159
        /*! \brief change horizontal value by spinbox */
181 Franz 160
        void ChangeHorVal();
4185 subik 161
        /*! \brief change horizontal value by spinbox */
181 Franz 162
        void ChangeVerVal();
2200 subik 163
 
4185 subik 164
        /*! \brief Set the spin box by selected list value.
165
        \param item current (new) item */
166
        void verList_currentChanged(QListViewItem *item);
167
        /*! \brief Set the spin box by selected list value.
168
        \param item current (new) item */
169
        void horList_currentChanged(QListViewItem *item);
170
 
171
        /*! \brief Create automatic vertical guides.
172
        Calculates positions of the guides.
173
        This algorithm is used for guides creating and deleting too.
174
        */
2215 subik 175
        void addRows();
4185 subik 176
 
177
        /*! \brief Create automatic horizontal guides.
178
        Calculates positions of the guides.
179
        This algorithm is used for guides creating and deleting too.
180
        */
2215 subik 181
        void addCols();
182
 
3620 subik 183
        /*! \brief Gap related widget handling (enable/disable)
2200 subik 184
        \param state enable/disable gaps */
185
        void useRowGap_clicked(bool state);
2215 subik 186
 
3620 subik 187
        /*! \brief Gap related widget handling (enable/disable)
2200 subik 188
        \param state enable/disable gaps */
189
        void useColGap_clicked(bool state);
2237 subik 190
 
3620 subik 191
        /*! \brief Commits all chasnges on exit */
2237 subik 192
        void commitChanges();
193
 
3620 subik 194
        /*! \brief Commits all chasnges and keep the dialog open */
2237 subik 195
        void commitEditChanges();
3 paul 196
};
197
 
198
#endif // GUIDEMANAGER_H