Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
4430 cbradney 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
*/
3 paul 7
#ifndef GUIDEMANAGER_H
8
#define GUIDEMANAGER_H
9
 
2969 craig 10
#include "scribusapi.h"
8602 cbradney 11
#include "scrspinbox.h"
8524 subik 12
#include "ui_guidemanager.h"
5087 subik 13
#include "guidemanagercore.h"
14
#include "scrpalettebase.h"
15
#include "scribusstructs.h"
16
#include "page.h"
3 paul 17
 
10205 subik 18
class GuidesModel;
5781 cbradney 19
class ScribusDoc;
4185 subik 20
 
5781 cbradney 21
 
5974 subik 22
 
5087 subik 23
/*! \brief GuideManager is the dialog for guides managing ;).
24
It's scribus non-modal palette now.
25
\warning Be careful with UI file guidemanagerbase.ui it uses ScrPaletteBase
6203 subik 26
as base class instead of QDialog. It should provide correct header file too.
4185 subik 27
 
7715 subik 28
\author Petr vanek <petr@scribus.info>
2215 subik 29
\author Alessandro Rimoldi
30
\author Franz Schmid
31
*/
8524 subik 32
class SCRIBUS_API GuideManager : public ScrPaletteBase, Ui::GuideManager
2143 subik 33
{
3 paul 34
    Q_OBJECT
35
 
36
public:
2164 subik 37
        GuideManager(QWidget* parent);
5087 subik 38
        ~GuideManager(){};
181 Franz 39
 
5781 cbradney 40
        /*! \brief Set the doc fo the guidemanager to work on. */
5794 mrdocs 41
        void setDoc(ScribusDoc* doc);
5781 cbradney 42
 
5087 subik 43
        /*! \brief Set the widgets on the page change.
44
        It has to be called on every page to page transition */
45
        void setupPage();
9069 subik 46
        void setupGui();
5339 subik 47
 
48
        /*! \brief Clear and reset the GUI horizontal list widget. */
49
        void clearRestoreHorizontalList();
50
        /*! \brief Clear and reset the GUI vertical list widget. */
51
        void clearRestoreVerticalList();
52
 
5087 subik 53
        /*! \brief Get selected standard guides from GUI list.
54
        Used in highlight painting.
55
        \retval Guides a list with double values */
56
        Guides selectedHorizontals();
57
        /*! \brief Get selected standard guides from GUI list.
58
        Used in highlight painting.
59
        \retval Guides a list with double values */
60
        Guides selectedVerticals();
5339 subik 61
 
5087 subik 62
        /*! \brief check the current page number to prevent drawing
6203 subik 63
        marks on the others pages. See GuideManagerCore::drawPage.
9855 jghali 64
        \retval int page no */
65
        int pageNr() const { return ((currentPage) ? currentPage->pageNr() : -1); }
5087 subik 66
 
10394 cbradney 67
        int currentIndex() { return tabWidget->currentIndex(); };
10903 cbradney 68
 
69
        virtual void changeEvent(QEvent *e);
8554 subik 70
 
2215 subik 71
private:
10224 subik 72
        //! \brief Store the guide values in the Qt4 model
10205 subik 73
        GuidesModel * horizontalModel;
10224 subik 74
        //! \brief Store the guide values in the Qt4 model
10205 subik 75
        GuidesModel * verticalModel;
76
 
5781 cbradney 77
        ScribusDoc* m_Doc;
5087 subik 78
        //! \brief a reference to the current pages
79
        Page * currentPage;
6203 subik 80
        //! \brief A flag to prevent guides drawing when it's not needed
81
        bool m_drawGuides;
2164 subik 82
 
5087 subik 83
        //! \brief Initialise the units. Spin boxes gets pt/mm/etc. extensions here.
2215 subik 84
        void unitChange();
85
 
4185 subik 86
        //! \brief Document measurements and metrics
87
        int docUnitIndex;
10229 subik 88
 
4185 subik 89
        //! \brief suffix of the unit [mm, ...]
90
        QString suffix;
181 Franz 91
 
5087 subik 92
        /*! \brief Copy guides from currentPage to all remaining.
93
        All gudes are deleted before copying.
94
        \param t a type to clear and copy.*/
95
        void copyGuidesToAllPages(GuideManagerCore::GuideType t);
5909 subik 96
 
97
        /*! \brief Save needed (Auto) values into GuideManagerCore.
5996 subik 98
        To be restored on the page return.
99
        \param page A reference to the page to store values. */
100
        void storePageValues(Page * page);
5909 subik 101
 
14732 jghali 102
        /*! \brief Save needed (Auto) values into GuideManagerCore.
103
        To be restored on the page return.
104
        \param page A reference to the page to store values. */
105
        void storePageValues(GuideManagerCore);
106
 
7710 subik 107
        /*! \brief Overriden QDialog method to operate selection related widgets.
108
        Auto guides tab. It disables the "selection" radio buttons when there
109
        is no selection on current page. */
110
        void windowActivationChange(bool oldActive);
111
 
7713 subik 112
        /*! \brief Create automatic horizontal guides.
113
        Calculates positions of the guides. */
114
        Guides getAutoHorizontals();
115
 
116
        /*! \brief Create automatic vertical guides.
117
        Calculates positions of the guides. */
118
        Guides getAutoVerticals();
119
 
7715 subik 120
        /*! \brief Recalculate the selection position and measurements for the current page.
7713 subik 121
        It's used for automatic guides position. It's called for every
7715 subik 122
        selection GUI widgets change to handle selection change only
123
        when needed. */
124
        void resetSelectionForPage();
7713 subik 125
 
10205 subik 126
        /*! \brief Draw guides into painter */
127
        void drawGuides();
128
 
10224 subik 129
        /*! \brief Theese methods simulate old button group behaviour.
130
        Is there a better way to do it? QButtonGroup? It's more code...
131
        */
132
        void setHorizontalRefer(int button);
133
        int horizontalRefer();
134
        void setVerticalRefer(int button);
135
        int verticalRefer();
10903 cbradney 136
        void languageChange();
10224 subik 137
 
12748 subik 138
private slots:
139
        //! Wrapper slot for drawGuides()
140
        void forceDrawGuides(const QItemSelection &, const QItemSelection &);
10206 subik 141
        void verticalModel_valueChanged();
142
        void horizontalModel_valueChanged();
5087 subik 143
        void addHorButton_clicked();
144
        void delHorButton_clicked();
145
        void addVerButton_clicked();
146
        void delVerButton_clicked();
147
        void applyToAllStdButton_clicked();
148
        void lockCheck_stateChanged( int );
149
        void horizontalAutoGapCheck_stateChanged( int );
150
        void verticalAutoGapCheck_stateChanged( int );
151
        void applyToAllAutoButton_clicked();
152
        void horizontalAutoCountSpin_valueChanged( int );
153
        void verticalAutoCountSpin_valueChanged( int );
8687 cbradney 154
        void horizontalAutoGapSpin_valueChanged(double);
155
        void verticalAutoGapSpin_valueChanged(double);
10224 subik 156
        void horizontalPageAutoButton_toggled(bool);
157
        void horizontalMarginsAutoButton_toggled(bool);
158
        void horizontalSelectionAutoButton_toggled(bool);
159
        void verticalPageAutoButton_toggled(bool);
160
        void verticalMarginsAutoButton_toggled(bool);
161
        void verticalSelectionAutoButton_toggled(bool);
5087 subik 162
        void tabWidget_currentChanged( QWidget * );
6212 subik 163
        void deletePageButton_clicked();
164
        void deleteAllGuides_clicked();
3 paul 165
};
166
 
167
#endif // GUIDEMANAGER_H