r14451 by cbradney - More new PDF prefs work

scribus-commit scribus-commit at lists.scribus.net
Thu Dec 31 00:45:31 CET 2009


Revision: 14451
Author: cbradney
Date: 2009-12-30T11:15:28.519809Z
Commit message: More new PDF prefs work

Changeset: 
M  /trunk/Scribus/scribus/ui/newmarginwidget.cpp
M  /trunk/Scribus/scribus/ui/tabpdfoptions.cpp
M  /trunk/Scribus/scribus/ui/prefs_pdfexport.h
M  /trunk/Scribus/scribus/ui/prefs_pdfexportbase.ui
M  /trunk/Scribus/scribus/ui/newmarginwidgetbase.ui
M  /trunk/Scribus/scribus/ui/preferencesdialog.cpp
M  /trunk/Scribus/scribus/ui/prefs_pdfexport.cpp

Diffs:
Index: scribus/ui/prefs_pdfexport.cpp
===================================================================
--- scribus/ui/prefs_pdfexport.cpp	(revision 14450)
+++ scribus/ui/prefs_pdfexport.cpp	(revision 14451)
@@ -6,26 +6,219 @@
 */
 
 #include "ui/prefs_pdfexport.h"
+#include "ui/createrange.h"
 #include "prefsstructs.h"
 
+#include "scribuscore.h"
+#include "scribusdoc.h"
+#include "ui/scrspinbox.h"
+#include "units.h"
+#include "util_icon.h"
+
 Prefs_PDFExport::Prefs_PDFExport(QWidget* parent)
-	: Prefs_Pane(parent)
+	: Prefs_Pane(parent),
+	cmsEnabled(false),
+	m_doc(NULL)
 {
 	setupUi(this);
+	pageMirrorHorizontalToolButton->setIcon(QIcon(loadIcon("16/flip-object-horizontal.png")));
+	pageMirrorVerticalToolButton->setIcon(QIcon(loadIcon("16/flip-object-vertical.png")));
+	unitChange(0);
+	languageChange();
 
+	connect(exportChosenPagesRadioButton, SIGNAL(toggled(bool)), this, SLOT(enableRangeControls(bool)));
+	connect(exportRangeMorePushButton, SIGNAL(clicked()), this, SLOT(createPageNumberRange()));
+//	connect(DSColor, SIGNAL(clicked()), this, SLOT(DoDownsample()));
+//	connect(MirrorH, SIGNAL(clicked()), this, SLOT(PDFMirror()));
+//	connect(MirrorV, SIGNAL(clicked()), this, SLOT(PDFMirror()));
+//	connect(RotateDeg, SIGNAL(activated(int)), this, SLOT(Rotation(int)));
+//	connect(OutCombo, SIGNAL(activated(int)), this, SLOT(EnablePr(int)));
+//	connect(EmbedProfs, SIGNAL(clicked()), this, SLOT(EnablePG()));
+//	connect(EmbedProfs2, SIGNAL(clicked()), this, SLOT(EnablePGI()));
+//	connect(NoEmbedded, SIGNAL(clicked()), this, SLOT(EnablePGI2()));
+//	connect(PDFVersionCombo, SIGNAL(activated(int)), this, SLOT(EnablePDFX(int)));
+	connect(useEncryptionCheckBox, SIGNAL(clicked(bool)), this, SLOT(enableSecurityControls(bool)));
 }
 
 Prefs_PDFExport::~Prefs_PDFExport()
 {
 }
 
+
+void Prefs_PDFExport::unitChange(int unitIndex)
+{
+	double unitRatio = unitGetRatioFromIndex(unitIndex);
+	registrationMarkOffsetSpinBox->setNewUnit(unitIndex);
+	registrationMarkOffsetSpinBox->setMinimum(0);
+	registrationMarkOffsetSpinBox->setMaximum(3000 * unitRatio);
+}
+
 void Prefs_PDFExport::languageChange()
 {
+	int i=0;
+	i = rotationComboBox->currentIndex();
+	rotationComboBox->clear();
+	rotationComboBox->addItem(QString::fromUtf8("0 °"));
+	rotationComboBox->addItem(QString::fromUtf8("90 °"));
+	rotationComboBox->addItem(QString::fromUtf8("180 °"));
+	rotationComboBox->addItem(QString::fromUtf8("270 °"));
+	rotationComboBox->setCurrentIndex(i);
+
+	i = imageCompressionMethodComboBox->currentIndex();
+	imageCompressionMethodComboBox->clear();
+	imageCompressionMethodComboBox->addItem( tr( "Automatic" ) );
+	imageCompressionMethodComboBox->addItem( tr( "Lossy - JPEG" ) );
+	imageCompressionMethodComboBox->addItem( tr( "Lossless - Zip" ) );
+	imageCompressionMethodComboBox->addItem( tr( "None" ) );
+	imageCompressionMethodComboBox->setCurrentIndex(i);
+
+	i = imageCompressionQualityComboBox->currentIndex();
+	imageCompressionQualityComboBox->clear();
+	imageCompressionQualityComboBox->addItem( tr( "Maximum" ) );
+	imageCompressionQualityComboBox->addItem( tr( "High" ) );
+	imageCompressionQualityComboBox->addItem( tr( "Medium" ) );
+	imageCompressionQualityComboBox->addItem( tr( "Low" ) );
+	imageCompressionQualityComboBox->addItem( tr( "Minimum" ) );
+	imageCompressionQualityComboBox->setCurrentIndex(i);
+
+	i = pdfVersionComboBox->currentIndex();
+	pdfVersionComboBox->clear();
+	pdfVersionComboBox->addItem("PDF 1.3 (Acrobat 4)");
+	pdfVersionComboBox->addItem("PDF 1.4 (Acrobat 5)");
+	pdfVersionComboBox->addItem("PDF 1.5 (Acrobat 6)");
+	if (cmsEnabled)// && (!PDFXProfiles.isEmpty()))
+	{
+		pdfVersionComboBox->addItem("PDF/X-1a");
+		pdfVersionComboBox->addItem("PDF/X-3");
+		pdfVersionComboBox->addItem("PDF/X-4");
+	}
+	pdfVersionComboBox->setCurrentIndex(i);
+
+	i = pageBindingComboBox->currentIndex();
+	pageBindingComboBox->clear();
+	pageBindingComboBox->addItem( tr("Left Margin"));
+	pageBindingComboBox->addItem( tr("Right Margin"));
+	pageBindingComboBox->setCurrentIndex(i);
+
+	i = outputIntentionCheckBox->currentIndex();
+	outputIntentionCheckBox->clear();
+	outputIntentionCheckBox->addItem( tr( "Screen / Web" ) );
+	outputIntentionCheckBox->addItem( tr( "Printer" ) );
+	outputIntentionCheckBox->addItem( tr( "Grayscale" ) );
+	outputIntentionCheckBox->setCurrentIndex(i);
+
+//	LPIfunc->clear();
+//	LPIfunc->addItem( tr( "Simple Dot" ) );
+//	LPIfunc->addItem( tr( "Line" ) );
+//	LPIfunc->addItem( tr( "Round" ) );
+//	LPIfunc->addItem( tr( "Ellipse" ) );
+
+//	QString tmp_ip[] = { tr("Perceptual"), tr("Relative Colorimetric"), tr("Saturation"), tr("Absolute Colorimetric")};
+//	size_t ar_ip = sizeof(tmp_ip) / sizeof(*tmp_ip);
+//	for (uint a = 0; a < ar_ip; ++a)
+//		IntendS->addItem(tmp_ip[a]);
+//	for (uint a = 0; a < ar_ip; ++a)
+//		IntendI->addItem(tmp_ip[a]);
 }
 
 void Prefs_PDFExport::restoreDefaults(struct ApplicationPrefs *prefsData)
 {
+	int unitIndex = prefsData->docSetupPrefs.docUnitIndex;
+	double unitRatio = unitGetRatioFromIndex(unitIndex);
+	unitChange(unitIndex);
+/*
+	tabPDF = new TabPDFOptions( prefsWidgets,
+								prefsData->pdfPrefs,
+								prefsData->fontPrefs.AvailFonts,
+								ScCore->PDFXProfiles,
+								DocFonts,
+								prefsData->pdfPrefs.PresentVals,
+								docUnitIndex,
+								prefsData->docSetupPrefs.pageHeight,
+								prefsData->docSetupPrefs.pageWidth,
+								0 );
 
+void TabPDFOptions::restoreDefaults(PDFOptions & Optionen,
+									const SCFonts &AllFonts,
+									const ProfilesL & PDFXProfiles,
+									const QMap<QString, int> & DocFonts,
+									const QList<PDFPresentationData> & Eff,
+									int unitIndex, double PageH, double PageB,
+									ScribusDoc * mdoc, bool exporting)
+*/
+
+	exportAllPagesRadioButton->setChecked(true);
+	enableRangeControls(false);
+	rotationComboBox->setCurrentIndex(prefsData->pdfPrefs.RotateDeg / 90);
+	pageMirrorHorizontalToolButton->setChecked(prefsData->pdfPrefs.MirrorH);
+	pageMirrorVerticalToolButton->setChecked(prefsData->pdfPrefs.MirrorV);
+	clipToPrinterMarginsCheckBox->setChecked(prefsData->pdfPrefs.doClip);
+	bool cmsUse = m_doc ? (ScCore->haveCMS() && m_doc->HasCMS) : false;
+	int newCMSIndex=0;
+	if (cmsUse)
+	{
+		if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_X1a)
+			newCMSIndex=3;
+		if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_X3)
+			newCMSIndex=4;
+		if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_X4)
+			newCMSIndex=5;
+	}
+	if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_13)
+		newCMSIndex=0;
+	if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_14)
+		newCMSIndex=1;
+	if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_15)
+		newCMSIndex=2;
+	pdfVersionComboBox->setCurrentIndex(newCMSIndex);
+	pageBindingComboBox->setCurrentIndex(prefsData->pdfPrefs.Binding);
+	generateThumbnailsCheckBox->setChecked(prefsData->pdfPrefs.Thumbnails);
+	saveLinkedTextFramesAsArticlesCheckBox->setChecked(prefsData->pdfPrefs.Articles);
+	includeBookmarksCheckBox->setChecked(prefsData->pdfPrefs.Bookmarks);
+	includeLayersCheckBox->setChecked(prefsData->pdfPrefs.useLayers);
+	includeLayersCheckBox->setEnabled(prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_15 || prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_X4);
+
+	epsExportResolutionSpinBox->setValue(prefsData->pdfPrefs.Resolution);
+	embedPDFAndEPSFiles->setChecked(prefsData->pdfPrefs.embedPDF);
+	compressTextAndVectorGraphicsCheckBox->setChecked( prefsData->pdfPrefs.Compress );
+	imageCompressionMethodComboBox->setCurrentIndex(prefsData->pdfPrefs.CompressMethod);
+	imageCompressionQualityComboBox->setCurrentIndex(prefsData->pdfPrefs.Quality);
+	maxResolutionLimitCheckBox->setChecked(prefsData->pdfPrefs.RecalcPic);
+	maxExportResolutionSpinBox->setValue(prefsData->pdfPrefs.PicRes);
+	maxExportResolutionSpinBox->setEnabled(prefsData->pdfPrefs.RecalcPic);
+
+	useEncryptionCheckBox->setChecked( prefsData->pdfPrefs.Encrypt );
+	passwordOwnerLineEdit->setText(prefsData->pdfPrefs.PassOwner);
+	passwordUserLineEdit->setText(prefsData->pdfPrefs.PassUser);
+	allowPrintingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 4 );
+	allowChangingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 8 );
+	allowCopyingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 16 );
+	allowAnnotatingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 32 );
+	enableSecurityControls(prefsData->pdfPrefs.Encrypt);
+
+	if (prefsData->pdfPrefs.UseRGB)
+		outputIntentionCheckBox->setCurrentIndex(0);
+	else
+	{
+		if (prefsData->pdfPrefs.isGrayscale)
+			outputIntentionCheckBox->setCurrentIndex(2);
+		else
+			outputIntentionCheckBox->setCurrentIndex(1);
+	}
+	convertSpotsToProcessCheckBox->setChecked(!prefsData->pdfPrefs.UseSpotColors);
+
+	bleedsWidget->setup(prefsData->pdfPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, false, false);
+	bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
+	bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
+	bleedsWidget->setPageSize(prefsData->docSetupPrefs.pageSize);
+	bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
+
+	registrationMarkOffsetSpinBox->setValue(prefsData->pdfPrefs.markOffset*unitRatio);
+	printCropMarksCheckBox->setChecked(prefsData->pdfPrefs.cropMarks);
+	printBleedMarksCheckBox->setChecked(prefsData->pdfPrefs.bleedMarks);
+	printRegistrationMarksCheckBox->setChecked(prefsData->pdfPrefs.registrationMarks);
+	printColorBarsCheckBox->setChecked(prefsData->pdfPrefs.colorMarks);
+	printPageInfoCheckBox->setChecked(prefsData->pdfPrefs.docInfoMarks);
 }
 
 
@@ -33,3 +226,37 @@
 {
 
 }
+
+void Prefs_PDFExport::enableRangeControls(bool enabled)
+{
+	exportPageListLineEdit->setEnabled( enabled );
+	exportRangeMorePushButton->setEnabled( enabled );
+	if (enabled == false)
+		includeBookmarksCheckBox->setChecked(false);
+}
+
+void Prefs_PDFExport::enableSecurityControls(bool enabled)
+{
+	passwordOwnerLineEdit->setEnabled(enabled);
+	passwordUserLineEdit->setEnabled(enabled);
+	allowPrintingCheckBox->setEnabled(enabled);
+	allowChangingCheckBox->setEnabled(enabled);
+	allowCopyingCheckBox->setEnabled(enabled);
+	allowAnnotatingCheckBox->setEnabled(enabled);
+}
+
+void Prefs_PDFExport::createPageNumberRange()
+{
+	if (m_doc!=0)
+	{
+		CreateRange cr(exportPageListLineEdit->text(), m_doc->DocPages.count(), this);
+		if (cr.exec())
+		{
+			CreateRangeData crData;
+			cr.getCreateRangeData(crData);
+			exportPageListLineEdit->setText(crData.pageRange);
+			return;
+		}
+	}
+	exportPageListLineEdit->setText(QString::null);
+}
Index: scribus/ui/prefs_pdfexport.h
===================================================================
--- scribus/ui/prefs_pdfexport.h	(revision 14450)
+++ scribus/ui/prefs_pdfexport.h	(revision 14451)
@@ -12,6 +12,8 @@
 #include "prefs_pane.h"
 #include "scribusapi.h"
 
+class ScribusDoc;
+
 class SCRIBUS_API Prefs_PDFExport : public Prefs_Pane, Ui::Prefs_PDFExport
 {
 	Q_OBJECT
@@ -24,6 +26,16 @@
 
 	public slots:
 		void languageChange();
+		void unitChange(int);
+
+	protected slots:
+		void enableRangeControls(bool);
+		void enableSecurityControls(bool);
+		void createPageNumberRange();
+
+	protected:
+		bool cmsEnabled;
+		ScribusDoc* m_doc;
 };
 
 #endif // PREFS_PDFEXPORT_H
Index: scribus/ui/newmarginwidget.cpp
===================================================================
--- scribus/ui/newmarginwidget.cpp	(revision 14450)
+++ scribus/ui/newmarginwidget.cpp	(revision 14451)
@@ -43,17 +43,24 @@
 	if (!showPreset)
 	{
 		presetLayoutComboBox->blockSignals(true);
+		presetLayoutComboBox->resize(0,0);
+		presetLayoutLabel->resize(0,0);
 		presetLayoutComboBox->hide();
 		presetLayoutLabel->hide();
+		formLayout->removeWidget(presetLayoutComboBox);
+		formLayout->removeWidget(presetLayoutLabel);
 	}
 	if (!showPrinterMargins)
 	{
 		printerMarginsPushButton->blockSignals(true);
+		printerMarginsPushButton->resize(0,0);
 		printerMarginsPushButton->hide();
+		formLayout->removeWidget(printerMarginsPushButton);
 	}
-
 	setFacingPages(!(layoutType == singlePage));
 
+	formLayout->invalidate();
+
 	connect(topMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setTop()));
 	connect(bottomMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setBottom()));
 	connect(leftMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setLeft()));
Index: scribus/ui/tabpdfoptions.cpp
===================================================================
--- scribus/ui/tabpdfoptions.cpp	(revision 14450)
+++ scribus/ui/tabpdfoptions.cpp	(revision 14451)
@@ -40,7 +40,7 @@
 #include "scconfig.h"
 #include "units.h"
 #include "usertaskstructs.h"
-#include "scrspinbox.h"
+#include "ui/scrspinbox.h"
 #include "util_icon.h"
 #include "scribuscore.h"
 #include "util.h"
Index: scribus/ui/prefs_pdfexportbase.ui
===================================================================
--- scribus/ui/prefs_pdfexportbase.ui	(revision 14450)
+++ scribus/ui/prefs_pdfexportbase.ui	(revision 14451)
@@ -77,6 +77,9 @@
          <property name="text">
           <string>All Pages</string>
          </property>
+         <attribute name="buttonGroup">
+          <string>rangeButtonGroup</string>
+         </attribute>
         </widget>
        </item>
        <item>
@@ -84,6 +87,9 @@
          <property name="text">
           <string>Choose Pages</string>
          </property>
+         <attribute name="buttonGroup">
+          <string>rangeButtonGroup</string>
+         </attribute>
         </widget>
        </item>
        <item>
@@ -190,6 +196,9 @@
            <property name="text">
             <string>...</string>
            </property>
+           <property name="checkable">
+            <bool>true</bool>
+           </property>
           </widget>
          </item>
          <item>
@@ -197,6 +206,9 @@
            <property name="text">
             <string>...</string>
            </property>
+           <property name="checkable">
+            <bool>true</bool>
+           </property>
           </widget>
          </item>
          <item>
@@ -250,7 +262,7 @@
           </widget>
          </item>
          <item row="0" column="1">
-          <widget class="QComboBox" name="pdfCompatibilityComboBox"/>
+          <widget class="QComboBox" name="pdfVersionComboBox"/>
          </item>
          <item row="1" column="0">
           <widget class="QLabel" name="label_10">
@@ -278,6 +290,12 @@
            <property name="suffix">
             <string> dpi</string>
            </property>
+           <property name="minimum">
+            <number>35</number>
+           </property>
+           <property name="maximum">
+            <number>4000</number>
+           </property>
           </widget>
          </item>
          <item>
@@ -425,8 +443,11 @@
            <property name="suffix">
             <string> dpi</string>
            </property>
+           <property name="minimum">
+            <number>35</number>
+           </property>
            <property name="maximum">
-            <number>10000</number>
+            <number>4000</number>
            </property>
           </widget>
          </item>
@@ -533,7 +554,11 @@
           </widget>
          </item>
          <item row="0" column="1">
-          <widget class="QLineEdit" name="passwordOwnerLineEdit"/>
+          <widget class="QLineEdit" name="passwordOwnerLineEdit">
+           <property name="echoMode">
+            <enum>QLineEdit::Password</enum>
+           </property>
+          </widget>
          </item>
          <item row="1" column="0">
           <widget class="QLabel" name="label_14">
@@ -543,7 +568,11 @@
           </widget>
          </item>
          <item row="1" column="1">
-          <widget class="QLineEdit" name="passwordUserLineEdit"/>
+          <widget class="QLineEdit" name="passwordUserLineEdit">
+           <property name="echoMode">
+            <enum>QLineEdit::Password</enum>
+           </property>
+          </widget>
          </item>
         </layout>
        </item>
@@ -825,7 +854,7 @@
         </layout>
        </item>
        <item>
-        <spacer name="verticalSpacer_9">
+        <spacer name="bleedSettingsVerticalSpacer">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
@@ -922,6 +951,6 @@
  <resources/>
  <connections/>
  <buttongroups>
-  <buttongroup name="exportRangeButtonGroup"/>
+  <buttongroup name="rangeButtonGroup"/>
  </buttongroups>
 </ui>
Index: scribus/ui/newmarginwidgetbase.ui
===================================================================
--- scribus/ui/newmarginwidgetbase.ui	(revision 14450)
+++ scribus/ui/newmarginwidgetbase.ui	(revision 14451)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>270</width>
-    <height>258</height>
+    <width>246</width>
+    <height>230</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -20,6 +20,9 @@
    <string>Form</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="margin">
+    <number>0</number>
+   </property>
    <item>
     <layout class="QFormLayout" name="formLayout">
      <item row="0" column="0">
Index: scribus/ui/preferencesdialog.cpp
===================================================================
--- scribus/ui/preferencesdialog.cpp	(revision 14450)
+++ scribus/ui/preferencesdialog.cpp	(revision 14451)
@@ -119,6 +119,7 @@
 	prefs_OperatorTools->restoreDefaults(&localPrefs);
 	prefs_Hyphenator->restoreDefaults(&localPrefs);
 	prefs_Fonts->restoreDefaults(&localPrefs);
+	prefs_PDFExport->restoreDefaults(&localPrefs);
 	prefs_Printer->restoreDefaults(&localPrefs);
 	prefs_ColorManagement->restoreDefaults(&localPrefs);
 	prefs_ColorManagement->setProfiles(&localPrefs, &ScCore->InputProfiles, &ScCore->InputProfilesCMYK, &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
@@ -138,6 +139,7 @@
 	prefs_OperatorTools->saveGuiToPrefs(&localPrefs);
 	prefs_Hyphenator->saveGuiToPrefs(&localPrefs);
 	prefs_Fonts->saveGuiToPrefs(&localPrefs);
+	prefs_PDFExport->saveGuiToPrefs(&localPrefs);
 	prefs_Printer->saveGuiToPrefs(&localPrefs);
 	prefs_ColorManagement->saveGuiToPrefs(&localPrefs);
 	prefs_Scrapbook->saveGuiToPrefs(&localPrefs);




More information about the scribus-commit mailing list