/usr/include/scribus/marginwidget.h is in scribus 1.4.0.dfsg+r17300-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | /*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef MARGINWIDGET_H
#define MARGINWIDGET_H
#include "scribusapi.h"
#include "scribusstructs.h"
#include <QComboBox>
#include <QTabWidget>
#include "linkbutton.h"
class QCheckBox;
class QPushButton;
class QLabel;
class QGridLayout;
class QHBoxLayout;
class ScrSpinBox;
/*! \brief This is inherited QComboBox widget used in MarginWidget as "Preset List".
It contains functionality for margins setting in various ways.
\author Petr Vanek, <petr@yarpen.cz>
*/
class SCRIBUS_API PresetLayout: public QComboBox
{
Q_OBJECT
public:
/*! \brief QComboBox like constructor. Values/names are set here. Tooltip etc. too. */
PresetLayout(QWidget *parent = 0);
~PresetLayout(){};
/*! \brief Compute the margins here.
\param index selected item
\param pageWidth width of the page. Taken from NewDoc dialog.
\param pageHeight height of the page. Taken from NewDoc dialog.
\param leftMargin leadin margin value. The others margins are set in various ratios related to this one.
*/
MarginStruct getMargins(int index, double pageWidth, double pageHeight, double leftMargin);
/*! \brief Integerized indexes for tr() strings*/
enum presetID
{
none = 0,
gutenberg = 1,
magazine = 2,
fibonacci = 3,
goldencut = 4,
nineparts = 5
};
/*! \brief returns updateMargins value */
bool needUpdate() const;
private:
/*! \brief Flag if is needed to recompute values and disable widgets */
bool updateMargins;
};
/*! \brief Widget for Margins setting.
Used e.g. in "New Doc Dialog" or "Preferences".
*/
class SCRIBUS_API MarginWidget : public QTabWidget
{
Q_OBJECT
public:
/*! \brief It creates an user interface for base margin settings for the document.
\param parent Parent widget (used as standard in Qt)
\param title Title of the Group box
\param margs A reference to the margins in the preferences.
\param unitIndex and index of the unit combobox
\param showChangeAll show "apply to all pages" related items
*/
MarginWidget( QWidget* parent, QString title, const MarginStruct* margs, int unitIndex, bool showChangeAll=false, bool showBleeds=true);
~MarginWidget() {};
/*! \brief Setup the labels by facing pages option */
void setFacingPages(bool facing, int pagetype = 0);
/*! \brief Setup the spinboxes properties (min/max value etc.) by width and height */
void setPageWidthHeight(double width, double height);
/*! \brief Setup the spinboxes properties (min/max value etc.) by width */
void setPageWidth(double width);
/*! \brief Setup the spinboxes properties (min/max value etc.) by height */
void setPageHeight(double heigth);
/*! \brief Setup the widgets by new options */
void setNewUnit(int newUnitIndex);
/*! \brief Set the page size for margin getting from cups */
void setPageSize(const QString& pageSize);
/*! \brief Margins
\retval MarginStruct data */
const MarginStruct& margins() const;
/*! \brief Top Margin
\retval double margin size */
double top() const;
/*! \brief Bottom Margin
\retval double margin size */
double bottom() const;
/*! \brief Left Margin
\retval double margin size */
double left() const;
/*! \brief Right Margin
\retval double margin size */
double right() const;
/*! \brief set new margin values for the dialog
It calls overridden setTop(), setBottom() etc. slots itself
via signals emitted from spinboxes.
\param m MarginStruct
*/
void setNewMargins(MarginStruct& m);
/*! \brief Setup the presetCombo without changing the margin values, only used by tabdocument */
void setMarginPreset(int p);
int getMarginPreset();
/*! \brief Top Bleed
\retval double bleed size */
double topBleed() const;
/*! \brief Bottom Bleed
\retval double bleed size */
double bottomBleed() const;
/*! \brief Left Bleed
\retval double bleed size */
double leftBleed() const;
/*! \brief Right Bleed
\retval double bleed size */
double rightBleed() const;
/*! \brief set new bleed values for the dialog
\param b MarginStruct
*/
void setNewBleeds(MarginStruct& b);
/*! \brief Return marginsForAllPages property
\retval bool true to apply for all pages */
bool getMarginsForAllPages() const;
bool getMarginsForAllMasterPages() const;
private:
/*! Tabs */
QWidget *marginPage;
QWidget* bleedPage;
/*! Spinboxes */
ScrSpinBox* topR;
ScrSpinBox* bottomR;
ScrSpinBox* rightR;
ScrSpinBox* leftR;
ScrSpinBox* BleedBottom;
ScrSpinBox* BleedLeft;
ScrSpinBox* BleedRight;
ScrSpinBox* BleedTop;
PresetLayout* presetCombo;
/*! Labels */
QLabel* lText;
QLabel* rText;
QLabel* tText;
QLabel* bText;
QLabel* presetLabel;
QLabel* marginsForPages;
QLabel* BleedTxt1;
QLabel* BleedTxt2;
QLabel* BleedTxt3;
QLabel* BleedTxt4;
QCheckBox* marginsForAllPages;
QCheckBox* marginsForAllMasterPages;
QPushButton* usePrinterMarginsButton;
LinkButton* linkBleeds;
LinkButton* linkMargins;
/*! \brief Margin values converted by unitRatio */
MarginStruct marginData;
/*
//! \brief Top margin value converted by unitRatio
double RandT;
//! \brief Bottom margin value converted by unitRatio
double RandB;
//! \brief Left margin value converted by unitRatio
double RandL;
//! \brief Right margin value converted by unitRatio
double RandR;
*/
/*! \brief Internally used page width */
double pageWidth;
/*! \brief Internally used page height */
double pageHeight;
public slots:
/*! \brief Recompute the values after spinbox change */
void setTop();
void setBottom();
void setLeft();
void setRight();
/*! \brief Recompute margins in PresetLayout combobox and disable/enable widgets. */
void setPreset();
void slotLinkBleeds();
void slotLinkMargins();
void changeBleeds();
protected slots:
virtual void setMarginsToPrinterMargins();
protected:
void updateMarginSpinValues();
QGridLayout* GroupLayout;
QHBoxLayout* marginsForPagesLayout;
QGridLayout* BleedGroupLayout;
QString m_pageSize;
int m_unitIndex;
double m_unitRatio;
//! \brief if the outer facing palette points to the facing pages item
bool facingPages;
bool useBleeds;
int pageType;
MarginStruct savedMargins;
int savedPresetItem;
};
#endif
|