Back to index

scribus-ng  1.3.4.dfsg+svn20071115
marginWidget.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef MARGINWIDGET_H
00008 #define MARGINWIDGET_H
00009 
00010 #include "scribusapi.h"
00011 #include "scribusstructs.h"
00012 
00013 #include <qcombobox.h>
00014 #include <qgroupbox.h>
00015 #include <qlabel.h>
00016 #include <qlayout.h>
00017 #include <qpushbutton.h>
00018 #include <qtabwidget.h>
00019 #include "linkbutton.h"
00020 class QCheckBox;
00021 
00022 class MSpinBox;
00023 
00024 
00029 class SCRIBUS_API PresetLayout: public QComboBox
00030 {
00031        Q_OBJECT
00032 
00033 public:
00035        PresetLayout(QWidget *parent = 0, const char * name = 0);
00036        ~PresetLayout(){};
00037 
00044        MarginStruct getMargins(int index, double pageWidth, double pageHeight, double leftMargin);
00045 
00047        enum presetID
00048        {
00049               none = 0,
00050               gutenberg = 1,
00051               magazine = 2,
00052               fibonacci = 3,
00053               goldencut = 4,
00054               nineparts = 5
00055        };
00056 
00058        bool needUpdate();
00059 
00060 private:
00062        bool updateMargins;
00063 };
00064 
00065 
00069 class SCRIBUS_API MarginWidget : public QTabWidget
00070 {
00071        Q_OBJECT
00072 
00073 public:
00081        MarginWidget( QWidget* parent, QString title, const MarginStruct* margs, int unitIndex, bool showChangeAll=false, bool showBleeds=true);
00082        ~MarginWidget() {};
00084        void setFacingPages(bool facing, int pagetype = 0);
00086        void setPageWidthHeight(double width, double height);
00088        void setPageWidth(double width);
00090        void setPageHeight(double heigth);
00092        void unitChange(double newUnit, int newDecimals, QString newSuffix);
00094        void setPageSize(const QString& pageSize);
00095        
00098        double top();
00101        double bottom();
00104        double left();
00107        double right();
00108 
00114        void setNewMargins(MarginStruct& m);
00115        
00118        double topBleed();
00121        double bottomBleed();
00124        double leftBleed();
00127        double rightBleed();
00128 
00132        void setNewBleeds(MarginStruct& b);
00133        
00136        bool getMarginsForAllPages();
00137        bool getMarginsForAllMasterPages();
00138 
00139 private:
00141        QWidget *marginPage;
00142        QWidget* bleedPage;
00144        MSpinBox* topR;
00145        MSpinBox* bottomR;
00146        MSpinBox* rightR;
00147        MSpinBox* leftR;
00148        MSpinBox* BleedBottom;
00149        MSpinBox* BleedLeft;
00150        MSpinBox* BleedRight;
00151        MSpinBox* BleedTop;
00152        PresetLayout* presetCombo;
00154        QLabel* lText;
00155        QLabel* rText;
00156        QLabel* tText;
00157        QLabel* bText;
00158        QLabel* presetLabel;
00159        QLabel* marginsForPages;
00160        QLabel* BleedTxt1;
00161        QLabel* BleedTxt2;
00162        QLabel* BleedTxt3;
00163        QLabel* BleedTxt4;
00164        QCheckBox* marginsForAllPages;
00165        QCheckBox* marginsForAllMasterPages;
00166        QPushButton* usePrinterMarginsButton;
00167        LinkButton* linkBleeds;
00169        double RandT;
00171        double RandB;
00173        double RandL;
00175        double RandR;
00177        double pageWidth;
00179        double pageHeight;
00180 
00181 public slots:
00183        void setTop();
00184        void setBottom();
00185        void setLeft();
00186        void setRight();
00188        void setPreset();
00189        void ToggleKette();
00190        void changeBleeds();
00191        
00192 protected slots:     
00193        virtual void setMarginsToPrinterMargins();
00194 
00195 protected:
00196        QGridLayout* GroupLayout;
00197        QHBoxLayout* marginsForPagesLayout;
00198        QGridLayout* BleedGroupLayout;
00199        QString m_pageSize;
00200        QString m_suffix;
00201        double m_unitRatio;
00202        int m_docUnitIndex;
00204        bool facingPages;
00205        bool useBleeds;
00206        int pageType;
00207 };
00208 
00209 #endif