MarginStruct PresetLayout::getMargins(int index, double pageWidth, double pageHeight, double leftMargin) { MarginStruct ret; updateMargins = true; switch (index) { case PresetLayout::magazine: ret.set(leftMargin, leftMargin, leftMargin, leftMargin); break; case PresetLayout::gutenberg: { double ratio = pageHeight / pageWidth; ret.setLeft(leftMargin); ret.setTop(leftMargin * ratio); ret.setRight(leftMargin * 2.0); ret.setBottom(ret.right() * ratio); } break; case PresetLayout::fibonacci: ret.setLeft(leftMargin); ret.setTop(leftMargin / 2.0 * 3.0); ret.setRight(leftMargin / 2.0 * 5.0); ret.setBottom(leftMargin / 2.0 * 8.0); break; case PresetLayout::goldencut: ret.setLeft(leftMargin); ret.setTop(leftMargin / 2.0 * 3.4); ret.setRight(leftMargin / 2.0 * 4.8); ret.setBottom(leftMargin / 2.0 * 6.8); break; case PresetLayout::nineparts: ret.setLeft(pageWidth / 9.0); ret.setTop(pageHeight / 9.0); ret.setRight(pageWidth / 9.0 * 2.0); ret.setBottom(pageHeight / 9.0 * 2.0); break; default: updateMargins = false; ret.set(-1.0, -1.0, -1.0, -1.0); } return ret; }
void Prefs_Printer::restoreDefaults(struct ApplicationPrefs *prefsData) { int docUnitIndex = prefsData->docSetupPrefs.docUnitIndex; unitChange(docUnitIndex); double unitRatio = unitGetRatioFromIndex(docUnitIndex); QString Pcap; QString printerName; QStringList printerNames = PrinterUtil::getPrinterNames(); int numPrinters = printerNames.count(); for( int i = 0; i < numPrinters; i++) { printerName = printerNames[i]; destinationComboBox->addItem(printerName); } destinationComboBox->addItem( tr("File")); PrefsContext* prefs = PrefsManager::instance()->prefsFile->getContext("print_options"); QString selectedDest = prefs->get("CurrentPrn", ""); int prnIndex = destinationComboBox->findText(selectedDest); if ((prnIndex > -1) && (prnIndex < destinationComboBox->count())) destinationComboBox->setCurrentIndex(prnIndex); useAltPrinterCmdCheckBox->setChecked(prefs->getBool("OtherCom", false)); selOtherComm(); altPrinterCmdLineEdit->setText(prefs->get("Command", "")); bool iccInUse = prefs->getBool("ICCinUse", false); bool psPrinter = PrinterUtil::isPostscriptPrinter(destinationComboBox->currentText()); applyICCProfilesCheckBox->setChecked( psPrinter ? iccInUse : false ); applyICCProfilesCheckBox->setEnabled( psPrinter ); outputComboBox->setCurrentIndex(prefs->getInt("Separations", 0)); postscriptPrintToColorComboBox->setCurrentIndex(prefs->getInt("PrintColor", 0)); postscriptLevelComboBox->setCurrentIndex(prefs->getInt("PSLevel", 3)-1); pageMirrorHorizontallyCheckBox->setChecked(prefs->getBool("MirrorH", false)); pageMirrorVerticallyCheckBox->setChecked(prefs->getBool("MirrorV", false)); setMediaSizeCheckBox->setChecked(prefs->getBool("doDev", false)); applyUnderColorRemovalCheckBox->setChecked(prefs->getBool("DoGCR", false)); clipToPrinterMarginsCheckBox->setChecked(prefs->getBool("Clip", false)); convertSpotsToProcessCheckBox->setChecked(!prefs->getBool("doSpot", true)); MarginStruct bleeds; bleeds.set(prefs->getDouble("BleedTop",0.0), prefs->getDouble("BleedBottom", 0.0), prefs->getDouble("BleedRight", 0.0), prefs->getDouble("BleedLeft", 0.0)); bleedsWidget->setup(bleeds, 0, docUnitIndex, false, false); bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth); bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight); markLengthSpinBox->setValue(prefs->getDouble("markLength", 20.0) * unitRatio); markOffsetSpinBox->setValue(prefs->getDouble("markOffset", 0.0) * unitRatio); cropMarksCheckBox->setChecked(prefs->getBool("cropMarks", false)); bleedMarksCheckBox->setChecked(prefs->getBool("bleedMarks", false)); registrationMarksCheckBox->setChecked(prefs->getBool("registrationMarks", false)); colorBarsCheckBox->setChecked(prefs->getBool("colorMarks", false)); includePDFAnnotationsCheckBox->setChecked(prefs->getBool("includePDFMarks", true)); }