Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 4484 → Rev 4485

/branches/Version13x/Scribus/scribus/printerutil.h
0,0 → 1,22
/*
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 PRINTERUTIL_H
#define PRINTERUTIL_H
 
#include "scribusapi.h"
 
class QStringList;
 
class SCRIBUS_API PrinterUtil
{
public:
PrinterUtil() {};
~PrinterUtil() {};
QStringList getPrinterNames();
};
 
#endif // DRUCK_H
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/prefs.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/prefs.cpp (revision 4484)
+++ branches/Version13x/Scribus/scribus/prefs.cpp (revision 4485)
@@ -297,7 +297,7 @@
marg.Bottom = prefsData->RandUnten;
marg.Left = prefsData->RandLinks;
marg.Right = prefsData->RandRechts;
- GroupRand = new MarginWidget(tab_7, tr( "Margin Guides" ), &marg, decimals, unitRatio, unitGetSuffixFromIndex(docUnitIndex) );
+ GroupRand = new MarginWidget(tab_7, tr( "Margin Guides" ), &marg, docUnitIndex );
GroupRand->setPageWidthHeight(prefsData->PageWidth, prefsData->PageHeight);
dsLayout4pv->addWidget( GroupRand );
dsLayout4p->addLayout( dsLayout4pv );
@@ -1054,6 +1054,7 @@
pageHeight->setValue(Pageho * unitRatio);
GroupRand->setPageHeight(Pageho);
GroupRand->setPageWidth(Pagebr);
+ GroupRand->setPageSize(gr);
connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
delete ps2;
Index: branches/Version13x/Scribus/scribus/margindialog.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/margindialog.cpp (revision 4484)
+++ branches/Version13x/Scribus/scribus/margindialog.cpp (revision 4485)
@@ -105,7 +105,7 @@
}
dialogLayout->addWidget( dsGroupBox7 );
- GroupRand = new MarginWidget(this, tr( "Margin Guides" ), &doc->currentPage->initialMargins, unitGetDecimalsFromIndex(doc->unitIndex()), doc->unitRatio(), unitGetSuffixFromIndex(doc->unitIndex()));
+ GroupRand = new MarginWidget(this, tr( "Margin Guides" ), &doc->currentPage->initialMargins, doc->unitIndex());
GroupRand->setPageWidthHeight(doc->currentPage->width(), doc->currentPage->height());
GroupRand->setFacingPages(!(doc->currentPageLayout == singlePage));
dialogLayout->addWidget( GroupRand );
/branches/Version13x/Scribus/scribus/useprintermarginsdialog.cpp
0,0 → 1,108
/*
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.
*/
/***************************************************************************
useprintermarginsdialog.cpp - description
-------------------
copyright : (C) 2006 by Craig Bradney
email : cbradney@zip.com.au
***************************************************************************/
 
#include "useprintermarginsdialog.h"
#include "useprintermarginsdialog.moc"
 
#include "scconfig.h"
 
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#ifdef HAVE_CUPS
#include <cups/cups.h>
#endif
 
#include "printerutil.h"
 
 
 
// This class implements only the non-GUI parts of the
// UsePrinterMargins dialog. Please use Qt Designer on
// useprintermarginsdialog.ui if you need to modify the layout,
// widget properties, etc.
 
UsePrinterMarginsDialog::UsePrinterMarginsDialog( QWidget* parent, const QString& pageSize, double unitRatio, const QString& suffix )
: UsePrinterMarginsDialogBase( parent, "UsePrinterMarginsDialog" )
{
m_ptsTopMargin=m_ptsBottomMargin=m_ptsLeftMargin=m_ptsRightMargin=0.0;
m_pageSize=pageSize;
m_unitRatio=unitRatio;
m_suffix=suffix;
PrinterUtil pu;
QStringList printerNames=pu.getPrinterNames();
printerComboBox->clear();
if (printerNames.count()>0 && !pageSize.isEmpty())
{
printerComboBox->insertStringList(printerNames);
getPrinterMarginValuesFromCUPS(printerNames.first());
marginsGroupBox->setTitle(tr("Minimum Margins for Page Size %1").arg(pageSize));
connect(printerComboBox, SIGNAL(activated(const QString&)), this, SLOT(getPrinterMarginValuesFromCUPS(const QString&)));
}
connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
 
UsePrinterMarginsDialog::~UsePrinterMarginsDialog()
{
}
 
void UsePrinterMarginsDialog::getNewPrinterMargins(double &topMargin,double &bottomMargin,double &leftMargin,double &rightMargin)
{
topMargin=m_ptsTopMargin;
bottomMargin=m_ptsBottomMargin;
leftMargin=m_ptsLeftMargin;
rightMargin=m_ptsRightMargin;
}
 
void UsePrinterMarginsDialog::getPrinterMarginValuesFromCUPS(const QString& printerName)
{
m_ptsTopMargin=m_ptsBottomMargin=m_ptsLeftMargin=m_ptsRightMargin=0.0;
#if defined(HAVE_CUPS)
const char *filename; /* tmp PPD filename */
filename=cupsGetPPD(printerName);
bool foundSize=false;
if (filename!=NULL)
{
ppd_file_t *ppd; /* PPD data */
ppd = ppdOpenFile(filename);
if (ppd!=NULL)
{
ppd_size_t *size; /* page size data, null if printer doesnt support selected size */
size = ppdPageSize(ppd, m_pageSize);
if (size!=NULL)
{
//Store in pts for returning via getNewPrinterMargins in pts
foundSize=true;
m_ptsTopMargin=size->length-size->top;
m_ptsBottomMargin=size->bottom;
m_ptsLeftMargin=size->left;
m_ptsRightMargin=size->width-size->right;
}
ppdClose(ppd);
}
}
#endif
topLineEdit->setEnabled(foundSize);
bottomLineEdit->setEnabled(foundSize);
leftLineEdit->setEnabled(foundSize);
rightLineEdit->setEnabled(foundSize);
okButton->setEnabled(foundSize);
topLineEdit->setText(QString::number(m_ptsTopMargin * m_unitRatio,'g',4)+m_suffix);
bottomLineEdit->setText(QString::number(m_ptsBottomMargin * m_unitRatio,'g',4)+m_suffix);
leftLineEdit->setText(QString::number(m_ptsLeftMargin * m_unitRatio,'g',4)+m_suffix);
rightLineEdit->setText(QString::number(m_ptsRightMargin * m_unitRatio,'g',4)+m_suffix);
}
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/docsections.h
===================================================================
--- branches/Version13x/Scribus/scribus/docsections.h (revision 4484)
+++ branches/Version13x/Scribus/scribus/docsections.h (revision 4485)
@@ -32,6 +32,7 @@
#include "docsectionsbase.h"
#include "pagestructs.h"
+
class DocSections : public DocSectionsBase
{
Q_OBJECT
/branches/Version13x/Scribus/scribus/Makefile.am
159,6 → 159,7
prefsreader.cpp \
prefstable.cpp \
preview.cpp \
printerutil.cpp \
pslib.cpp \
query.cpp \
rc4.c \
211,6 → 212,8
undostate.cpp \
units.cpp \
unzip.c \
useprintermarginsdialogbase.ui \
useprintermarginsdialog.cpp \
util.cpp \
vgradient.cpp \
vruler.cpp \
/branches/Version13x/Scribus/scribus/newfile.cpp
169,7 → 169,7
marg.Bottom = prefsManager->appPrefs.RandUnten;
marg.Left = prefsManager->appPrefs.RandLinks;
marg.Right = prefsManager->appPrefs.RandRechts;
GroupRand = new MarginWidget(newDocFrame, tr( "Margin Guides" ), &marg, precision, unitRatio, unitSuffix );
GroupRand = new MarginWidget(newDocFrame, tr( "Margin Guides" ), &marg, unitIndex );
GroupRand->setPageWidthHeight(prefsManager->appPrefs.PageWidth, prefsManager->appPrefs.PageHeight);
GroupRand->setFacingPages(prefsManager->appPrefs.FacingPages == doublePage);
Layout9->addWidget( GroupRand );
182,6 → 182,7
ComboBox1->setCurrentItem(sizeIndex);
else
ComboBox1->setCurrentItem(ComboBox1->count()-1);
GroupRand->setPageSize(ComboBox1->currentText());
bool hwEnabled=(ComboBox1->currentText()==customTextTR);
Breite->setEnabled(hwEnabled);
Hoehe->setEnabled(hwEnabled);
413,6 → 414,7
setSize(size);
setOrien(ComboBox2->currentItem());
}
GroupRand->setPageSize(size);
}
 
void NewDoc::setSize(QString gr)
/branches/Version13x/Scribus/scribus/reformdoc.cpp
165,8 → 165,9
dsGroupBox7Layout->addLayout( dsLayout4 );
dsLayout4pv->addWidget( dsGroupBox7 );
 
GroupRand = new MarginWidget(tabPage, tr( "Margin Guides" ), &doc->pageMargins, decimals, unitRatio, ein, true );
GroupRand = new MarginWidget(tabPage, tr( "Margin Guides" ), &doc->pageMargins, einheit, true );
GroupRand->setPageWidthHeight(pageWidth, pageHeight);
GroupRand->setPageSize(sizeQComboBox->currentText());
dsLayout4pv->addWidget( GroupRand );
dsLayout4p->addLayout( dsLayout4pv );
647,6 → 648,7
heightMSpinBox->setValue(pageHeight * unitRatio);
GroupRand->setPageHeight(pageHeight);
GroupRand->setPageWidth(pageWidth);
GroupRand->setPageSize(gr);
connect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
connect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
delete ps2;
/branches/Version13x/Scribus/scribus/useprintermarginsdialog.h
0,0 → 1,46
/*
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.
*/
/***************************************************************************
useprintermarginsdialog.cpp - description
-------------------
copyright : (C) 2006 by Craig Bradney
email : cbradney@zip.com.au
***************************************************************************/
 
#ifndef USEPRINTERMARGINSDIALOG_H
#define USEPRINTERMARGINSDIALOG_H
 
#include "useprintermarginsdialogbase.h"
 
#include "scribusapi.h"
 
class SCRIBUS_API UsePrinterMarginsDialog : public UsePrinterMarginsDialogBase
{
Q_OBJECT
 
public:
UsePrinterMarginsDialog(QWidget* parent, const QString& pageSize, double unitRatio, const QString& suffix);
~UsePrinterMarginsDialog();
/**
* Return the new printer sourced margins in PostScript points (72dpi).
* @param topMargin
* @param bottomMargin
* @param leftMargin
* @param rightMargin
*/
void getNewPrinterMargins(double &topMargin,double &bottomMargin,double &leftMargin,double &rightMargin);
protected slots:
void getPrinterMarginValuesFromCUPS(const QString& printerName);
protected:
QString m_pageSize;
double m_unitRatio;
QString m_suffix;
double m_ptsTopMargin,m_ptsBottomMargin,m_ptsLeftMargin,m_ptsRightMargin;
};
 
#endif
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/marginWidget.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/marginWidget.cpp (revision 4484)
+++ branches/Version13x/Scribus/scribus/marginWidget.cpp (revision 4485)
@@ -6,13 +6,16 @@
*/
#include "marginWidget.h"
#include "marginWidget.moc"
-#include "mspinbox.h"
#include <qcheckbox.h>
#include <qtooltip.h>
+#include "mspinbox.h"
+#include "units.h"
+#include "useprintermarginsdialog.h"
-MarginWidget::MarginWidget( QWidget* parent, QString title, MarginStruct* margs, int decimals, double unit, QString einh, bool showChangeAll) : QGroupBox( title, parent, "marginWidget")
+
+MarginWidget::MarginWidget( QWidget* parent, QString title, MarginStruct* margs, int unitIndex, bool showChangeAll) : QGroupBox( title, parent, "marginWidget")
{
setColumnLayout(0, Qt::Vertical );
layout()->setSpacing( 5 );
@@ -21,26 +24,30 @@
RandB = margs->Bottom;
RandR = margs->Right;
RandL = margs->Left;
- unitRatio = unit;
-
+
+ m_docUnitIndex=unitIndex;
+ m_unitRatio = unitGetRatioFromIndex(unitIndex);
+ m_suffix = unitGetSuffixFromIndex(unitIndex);
+ int decimals = unitGetDecimalsFromIndex(unitIndex);
+
presetCombo = new PresetLayout(this, "presetCombo");
presetLabel = new QLabel(presetCombo, tr("Preset Layouts:"), this, "presetLabel");
leftR = new MSpinBox( 0, 1000, this, decimals );
- leftR->setSuffix( einh );
- leftR->setValue(RandL * unitRatio);
+ leftR->setSuffix( m_suffix );
+ leftR->setValue(RandL * m_unitRatio);
rightR = new MSpinBox( 0, 1000, this, decimals );
- rightR->setSuffix( einh );
- rightR->setValue(RandR * unitRatio);
+ rightR->setSuffix( m_suffix );
+ rightR->setValue(RandR * m_unitRatio);
topR = new MSpinBox( 0, 1000, this, decimals );
- topR->setSuffix( einh );
- topR->setValue(RandT * unitRatio);
+ topR->setSuffix( m_suffix );
+ topR->setValue(RandT * m_unitRatio);
bottomR = new MSpinBox( 0, 1000, this, decimals );
- bottomR->setSuffix( einh );
- bottomR->setValue(RandB * unitRatio);
+ bottomR->setSuffix( m_suffix );
+ bottomR->setValue(RandB * m_unitRatio);
bText = new QLabel( bottomR, tr( "&Bottom:" ), this, "bText" );
tText = new QLabel( topR, tr( "&Top:" ), this, "tText" );
@@ -65,17 +72,24 @@
marginsForAllPages = new QCheckBox( this, "moveObjects" );
marginsForAllPages->setText( tr( "Apply margin settings to all pages" ) );
marginsForAllPages->setChecked( false );
- GroupLayout->addMultiCellWidget( marginsForAllPages, 5, 5, 0, 1);
+ //GroupLayout->addMultiCellWidget( marginsForAllPages, 5, 5, 0, 1);
+ GroupLayout->addWidget( marginsForAllPages, 5, 0 );
QToolTip::add( marginsForAllPages, "<qt>" + tr( "Apply the margin changes to all existing pages in the document" ) + "</qt>" );
+
}
else
marginsForAllPages=NULL;
-
+ usePrinterMarginsButton=NULL;
+ #ifdef HAVE_CUPS
+ usePrinterMarginsButton=new QPushButton( tr("Printer Margins..."),this, "usePrinterMarginsButton" );
+ GroupLayout->addWidget( usePrinterMarginsButton, 5, 1 );
+ #endif
// hints
QToolTip::add( topR, "<qt>" + tr( "Distance between the top margin guide and the edge of the page" ) + "</qt>");
QToolTip::add( bottomR, "<qt>" + tr( "Distance between the bottom margin guide and the edge of the page" ) + "</qt>");
QToolTip::add( leftR, "<qt>" + tr( "Distance between the left margin guide and the edge of the page. If Facing Pages is selected, this margin space can be used to achieve the correct margins for binding") + "</qt>");
QToolTip::add( rightR, "<qt>" +tr( "Distance between the right margin guide and the edge of the page. If Facing Pages is selected, this margin space can be used to achieve the correct margins for binding") + "</qt>");
+ QToolTip::add( usePrinterMarginsButton, "<qt>" +tr( "Import the margins from the selected printer." ) + "</qt>");
// signals&slots
connect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop()));
connect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom()));
@@ -82,6 +96,7 @@
connect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft()));
connect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight()));
connect(presetCombo, SIGNAL(activated(int)), this, SLOT(setPreset()));
+ connect(usePrinterMarginsButton, SIGNAL(clicked()), this, SLOT(setMarginsToPrinterMargins()));
}
void MarginWidget::setFacingPages(bool facing)
@@ -93,11 +108,11 @@
void MarginWidget::setPageWidthHeight(double width, double height)
{
- rightR->setMaxValue(width * unitRatio - leftR->value());
- leftR->setMaxValue(width * unitRatio - rightR->value());
+ rightR->setMaxValue(width * m_unitRatio - leftR->value());
+ leftR->setMaxValue(width * m_unitRatio - rightR->value());
pageWidth = width;
- topR->setMaxValue(height * unitRatio - bottomR->value());
- bottomR->setMaxValue(height * unitRatio - topR->value());
+ topR->setMaxValue(height * m_unitRatio - bottomR->value());
+ bottomR->setMaxValue(height * m_unitRatio - topR->value());
pageHeight = height;
setPreset();
}
@@ -104,8 +119,8 @@
void MarginWidget::setPageWidth(double width)
{
- rightR->setMaxValue(width * unitRatio - leftR->value());
- leftR->setMaxValue(width * unitRatio - rightR->value());
+ rightR->setMaxValue(width * m_unitRatio - leftR->value());
+ leftR->setMaxValue(width * m_unitRatio - rightR->value());
pageWidth = width;
setPreset();
}
@@ -112,8 +127,8 @@
void MarginWidget::setPageHeight(double height)
{
- topR->setMaxValue(height * unitRatio - bottomR->value());
- bottomR->setMaxValue(height * unitRatio - topR->value());
+ topR->setMaxValue(height * m_unitRatio - bottomR->value());
+ bottomR->setMaxValue(height * m_unitRatio - topR->value());
pageHeight = height;
setPreset();
}
@@ -120,29 +135,29 @@
void MarginWidget::setTop()
{
- RandT = topR->value() / unitRatio;
- bottomR->setMaxValue(pageHeight * unitRatio - topR->value());
+ RandT = topR->value() / m_unitRatio;
+ bottomR->setMaxValue(pageHeight * m_unitRatio - topR->value());
setPreset();
}
void MarginWidget::setBottom()
{
- RandB = bottomR->value() / unitRatio;
- topR->setMaxValue(pageHeight * unitRatio - bottomR->value());
+ RandB = bottomR->value() / m_unitRatio;
+ topR->setMaxValue(pageHeight * m_unitRatio - bottomR->value());
setPreset();
}
void MarginWidget::setLeft()
{
- RandL = leftR->value() / unitRatio;
- rightR->setMaxValue(pageWidth * unitRatio - leftR->value());
+ RandL = leftR->value() / m_unitRatio;
+ rightR->setMaxValue(pageWidth * m_unitRatio - leftR->value());
setPreset();
}
void MarginWidget::setRight()
{
- RandR = rightR->value() / unitRatio;
- leftR->setMaxValue(pageWidth * unitRatio - rightR->value());
+ RandR = rightR->value() / m_unitRatio;
+ leftR->setMaxValue(pageWidth * m_unitRatio - rightR->value());
setPreset();
}
@@ -153,7 +168,7 @@
disconnect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft()));
disconnect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight()));
int decimalsOld;
- double oldUnitRatio = unitRatio;
+ double oldUnitRatio = m_unitRatio;
double oldMin, oldMax, val;
topR->setSuffix(newSuffix);
bottomR->setSuffix(newSuffix);
@@ -168,7 +183,8 @@
leftR->setValues(0, oldMax * invUnitConversion, newDecimals, val * invUnitConversion);
rightR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
rightR->setValues(0, oldMax * invUnitConversion, newDecimals, val * invUnitConversion);
- unitRatio = newUnit;
+ m_unitRatio = newUnit;
+ m_suffix=newSuffix;
connect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop()));
connect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom()));
connect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft()));
@@ -182,7 +198,7 @@
disconnect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft()));
disconnect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight()));
int item = presetCombo->currentItem();
- MarginStruct marg = presetCombo->getMargins(item, pageWidth * unitRatio, pageHeight * unitRatio, leftR->value());
+ MarginStruct marg = presetCombo->getMargins(item, pageWidth * m_unitRatio, pageHeight * m_unitRatio, leftR->value());
if (presetCombo->needUpdate())
{
leftR->setValue(marg.Left);
@@ -189,14 +205,14 @@
rightR->setValue(marg.Right);
topR->setValue(marg.Top);
bottomR->setValue(marg.Bottom);
- RandT = topR->value() / unitRatio;
- RandB = bottomR->value() / unitRatio;
- RandL = leftR->value() / unitRatio;
- RandR = rightR->value() / unitRatio;
- bottomR->setMaxValue(pageHeight * unitRatio - topR->value());
- topR->setMaxValue(pageHeight * unitRatio - bottomR->value());
- rightR->setMaxValue(pageWidth * unitRatio - leftR->value());
- leftR->setMaxValue(pageWidth * unitRatio - rightR->value());
+ RandT = topR->value() / m_unitRatio;
+ RandB = bottomR->value() / m_unitRatio;
+ RandL = leftR->value() / m_unitRatio;
+ RandR = rightR->value() / m_unitRatio;
+ bottomR->setMaxValue(pageHeight * m_unitRatio - topR->value());
+ topR->setMaxValue(pageHeight * m_unitRatio - bottomR->value());
+ rightR->setMaxValue(pageWidth * m_unitRatio - leftR->value());
+ leftR->setMaxValue(pageWidth * m_unitRatio - rightR->value());
rightR->setEnabled(false);
topR->setEnabled(false);
bottomR->setEnabled(false);
@@ -213,6 +229,41 @@
connect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight()));
}
+void MarginWidget::setPageSize(const QString& pageSize)
+{
+ m_pageSize=pageSize;
+}
+
+void MarginWidget::setMarginsToPrinterMargins()
+{
+ UsePrinterMarginsDialog upm(parentWidget(), m_pageSize, m_unitRatio, m_suffix);
+ if (upm.exec())
+ {
+ double t,b,l,r;
+ upm.getNewPrinterMargins(t,b,l,r);
+ presetCombo->setCurrentItem(PresetLayout::none);
+ topR->setValue(t * m_unitRatio);
+ bottomR->setValue(b * m_unitRatio);
+ leftR->setValue(l * m_unitRatio);
+ rightR->setValue(r * m_unitRatio);
+
+ RandT = t;
+ RandB = b;
+ RandL = l;
+ RandR = r;
+
+ bottomR->setMaxValue((pageHeight - t) * m_unitRatio);
+ topR->setMaxValue((pageHeight - b) * m_unitRatio);
+ rightR->setMaxValue((pageWidth - l) * m_unitRatio);
+ leftR->setMaxValue((pageWidth - r) * m_unitRatio);
+
+ rightR->setEnabled(true);
+ topR->setEnabled(true);
+ bottomR->setEnabled(true);
+ }
+}
+
+
/*
* presets
*/
/branches/Version13x/Scribus/scribus/docsections.cpp
39,6 → 39,7
 
#include "pagestructs.h"
 
 
DocSections::DocSections( QWidget* parent )
: DocSectionsBase( parent, "DocSections" )
{
/branches/Version13x/Scribus/scribus/marginWidget.h
14,6 → 14,7
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
 
class QCheckBox;
 
77,7 → 78,7
\param unit mainly doc->unitRatio
\param einh unit text to display in the spin boxes (mm, pt etc)
*/
MarginWidget( QWidget* parent, QString title, MarginStruct* margs, int decimals, double unitRatio, QString einh, bool showChangeAll=false);
MarginWidget( QWidget* parent, QString title, MarginStruct* margs, int unitIndex, bool showChangeAll=false);
~MarginWidget() {};
/*! Setup the labels by facing pages option */
void setFacingPages(bool facing);
89,6 → 90,8
void setPageHeight(double heigth);
/*! Setup the widgets by new options */
void unitChange(double newUnit, int newDecimals, QString newSuffix);
/*! Set the page size for margin getting from cups */
void setPageSize(const QString& pageSize);
/*! Spinboxes */
MSpinBox* topR;
103,6 → 106,7
QLabel* bText;
QLabel* presetLabel;
QCheckBox* marginsForAllPages;
QPushButton* usePrinterMarginsButton;
/*! Top margin value converted by unitRatio */
double RandT;
/*! Bottom margin value converted by unitRatio */
111,14 → 115,10
double RandL;
/*! Right margin value converted by unitRatio */
double RandR;
/*! Self contained ratio taken in constructor */
double unitRatio;
/*! Internally used page width */
double pageWidth;
/*! Internally used page height */
double pageHeight;
/*! unused */
int docUnitIndex;
 
public slots:
/*! Recompute the values after spinbox change */
128,9 → 128,16
void setRight();
/*! Recompute margins in PresetLayout combobox and disable/enable widgets. */
void setPreset();
protected slots:
virtual void setMarginsToPrinterMargins();
 
protected:
QGridLayout* GroupLayout;
QString m_pageSize;
QString m_suffix;
double m_unitRatio;
int m_docUnitIndex;
};
 
#endif
/branches/Version13x/Scribus/scribus/printerutil.cpp
0,0 → 1,73
/*
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.
*/
#include "printerutil.h"
 
#if defined( HAVE_CUPS )
#include <cups/cups.h>
#elif defined(_WIN32)
#include <windows.h>
#include <winspool.h>
#endif
 
#include <qstringlist.h>
 
#include "util.h"
 
QStringList PrinterUtil::getPrinterNames()
{
QString printerName;
QStringList printerNames;
#if defined (HAVE_CUPS)
cups_dest_t *dests;
int num_dests = cupsGetDests(&dests);
for (int pr = 0; pr < num_dests; ++pr)
{
printerName = QString(dests[pr].name);
printerNames.append(printerName);
}
cupsFreeDests(num_dests, dests);
#elif defined(_WIN32)
DWORD size;
DWORD numPrinters;
PRINTER_INFO_2* printerInfos = NULL;
EnumPrinters ( PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS , NULL, 2, NULL, 0, &size, &numPrinters );
printerInfos = (PRINTER_INFO_2*) malloc(size);
if ( EnumPrinters ( PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS, NULL, 2, (LPBYTE) printerInfos, size, &size, &numPrinters ) )
{
for ( uint i = 0; i < numPrinters; i++)
{
printerName = printerInfos[i].pPrinterName;
printerNames.append(printerName);
}
printerNames.sort();
}
if ( printerInfos) free(printerInfos);
#else
QString tmp;
QString Pcap;
QStringList wt;
if (loadText("/etc/printcap", &Pcap))
{
QTextStream ts(&Pcap, IO_ReadOnly);
while(!ts.atEnd())
{
tmp = ts.readLine();
if (tmp.isEmpty())
continue;
if ((tmp[0] != '#') && (tmp[0] != ' ') && (tmp[0] != '\n') && (tmp[0] != '\t'))
{
tmp = tmp.stripWhiteSpace();
tmp = tmp.left(tmp.length() - (tmp.right(2) == ":\\" ? 2 : 1));
wt = QStringList::split("|", tmp);
printerName = wt[0];
printerNames.append(printerName);
}
}
}
#endif
return printerNames;
}
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/useprintermarginsdialogbase.ui
===================================================================
--- branches/Version13x/Scribus/scribus/useprintermarginsdialogbase.ui (nonexistent)
+++ branches/Version13x/Scribus/scribus/useprintermarginsdialogbase.ui (revision 4485)
@@ -0,0 +1,241 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>UsePrinterMarginsDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>UsePrinterMarginsDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>376</width>
+ <height>179</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Use Printer Margins</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout16</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>selectPrinterLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Select &amp;Printer:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>printerComboBox</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>printerComboBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>marginsGroupBox</cstring>
+ </property>
+ <property name="title">
+ <string>Margins</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit" row="0" column="4">
+ <property name="name">
+ <cstring>bottomLineEdit</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="3">
+ <property name="name">
+ <cstring>rightLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Right:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>rightLineEdit</cstring>
+ </property>
+ </widget>
+ <spacer row="1" column="2">
+ <property name="name">
+ <cstring>spacer2_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLineEdit" row="1" column="4">
+ <property name="name">
+ <cstring>rightLineEdit</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>leftLineEdit</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>topLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Top:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>topLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>bottomLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Bottom:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>bottomLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>leftLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Left:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>leftLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>topLineEdit</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>212</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string>Alt+O</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string>Alt+C</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
/branches/Version13x/Scribus/scribus/useprintermarginsdialogbase.ui
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property