コード例 #1
0
ファイル: prefs_printer.cpp プロジェクト: JLuc/scribus
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));
}
コード例 #2
0
ファイル: newmarginwidget.cpp プロジェクト: gyuris/scribus
void NewMarginWidget::setPreset()
{
	if ((m_flags & ShowPreset) == 0)
		return;
	leftMarginSpinBox->blockSignals(true);
	rightMarginSpinBox->blockSignals(true);
	topMarginSpinBox->blockSignals(true);
	bottomMarginSpinBox->blockSignals(true);
	if (savedPresetItem==PresetLayout::none)
		savedMarginData=marginData;
	int item = presetLayoutComboBox->currentIndex();

	MarginStruct marg = presetLayoutComboBox->getMargins(item, pageWidth, pageHeight, leftMarginSpinBox->value() / m_unitRatio);
	facingPages ? presetLayoutComboBox->setEnabled(true) : presetLayoutComboBox->setEnabled(false);
	bool restoringValues=false;
	if (item==PresetLayout::none && savedPresetItem!=PresetLayout::none)
	{
		marg=savedMarginData;
		restoringValues=true;
	}
	if (restoringValues || (presetLayoutComboBox->needUpdate() && facingPages))
	{
		marginData.set(qMax(0.0, marg.top()), qMax(0.0, marg.left()), qMax(0.0, marg.bottom()), qMax(0.0, marg.right()));
		updateMarginSpinValues();

		bottomMarginSpinBox->setMaximum(qMax(0.0, pageHeight * m_unitRatio - topMarginSpinBox->value()));
		topMarginSpinBox->setMaximum(qMax(0.0, pageHeight * m_unitRatio - bottomMarginSpinBox->value()));
		rightMarginSpinBox->setMaximum(qMax(0.0, pageWidth * m_unitRatio - leftMarginSpinBox->value()));
		leftMarginSpinBox->setMaximum(qMax(0.0, pageWidth * m_unitRatio - rightMarginSpinBox->value()));
		rightMarginSpinBox->setEnabled(restoringValues);
		topMarginSpinBox->setEnabled(restoringValues);
		bottomMarginSpinBox->setEnabled(restoringValues);
	}
	else
	{
		rightMarginSpinBox->setEnabled(true);
		topMarginSpinBox->setEnabled(true);
		bottomMarginSpinBox->setEnabled(true);
	}
	if (pageType == 1)
		rightMarginSpinBox->setEnabled(false);
	leftMarginSpinBox->setEnabled(item != PresetLayout::nineparts);
	if (item!=PresetLayout::none)
		marginLinkButton->setChecked(false);
	marginLinkButton->setEnabled(item==PresetLayout::none || !presetLayoutComboBox->isEnabled());
	leftMarginSpinBox->blockSignals(false);
	rightMarginSpinBox->blockSignals(false);
	topMarginSpinBox->blockSignals(false);
	bottomMarginSpinBox->blockSignals(false);
	savedPresetItem=item;
}
コード例 #3
0
ファイル: marginwidget.cpp プロジェクト: QuLogic/scribus
void MarginWidget::setPreset()
{
	disconnect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop()));
	disconnect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom()));
	disconnect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft()));
	disconnect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight()));
	if (savedPresetItem==PresetLayout::none)
		savedMargins=marginData;
	int item = presetCombo->currentIndex();

	MarginStruct marg = presetCombo->getMargins(item, pageWidth, pageHeight, leftR->value() / m_unitRatio);
	presetCombo->setEnabled(facingPages);

	bool restoringValues=false;
	if (item==PresetLayout::none && savedPresetItem!=PresetLayout::none)
	{
		marg=savedMargins;
		restoringValues=true;
	}
	if (restoringValues || (presetCombo->needUpdate() && facingPages))
	{
		marginData.set(qMax(0.0, marg.top()), qMax(0.0, marg.left()), qMax(0.0, marg.bottom()), qMax(0.0, marg.right()));
		updateMarginSpinValues();
		
		bottomR->setMaximum(qMax(0.0, pageHeight * m_unitRatio - topR->value()));
		topR->setMaximum(qMax(0.0, pageHeight * m_unitRatio - bottomR->value()));
		rightR->setMaximum(qMax(0.0, pageWidth * m_unitRatio - leftR->value()));
		leftR->setMaximum(qMax(0.0, pageWidth * m_unitRatio - rightR->value()));
		rightR->setEnabled(restoringValues);
		topR->setEnabled(restoringValues);
		bottomR->setEnabled(restoringValues);
	}
	else
	{
		rightR->setEnabled(true);
		topR->setEnabled(true);
		bottomR->setEnabled(true);
	}
	if (pageType == 1)
		rightR->setEnabled(false);
	leftR->setEnabled(item != PresetLayout::nineparts);
	if (item!=PresetLayout::none)
		linkMargins->setChecked(false);
	linkMargins->setEnabled(item==PresetLayout::none || !presetCombo->isEnabled());
	connect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop()));
	connect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom()));
	connect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft()));
	connect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight()));
	savedPresetItem=item;
}
コード例 #4
0
ファイル: marginwidget.cpp プロジェクト: QuLogic/scribus
void MarginWidget::setNewBleeds(MarginStruct& b)
{
	disconnect(BleedLeft, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds()));
	disconnect(BleedRight, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds()));
	disconnect(BleedTop, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds()));
	disconnect(BleedBottom, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds()));
	BleedTop->setValue(b.top() * m_unitRatio);
	BleedBottom->setValue(b.bottom() * m_unitRatio);
	BleedLeft->setValue(b.left() * m_unitRatio);
	BleedRight->setValue(b.right() * m_unitRatio);
	connect(BleedLeft, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds()));
	connect(BleedRight, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds()));
	connect(BleedTop, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds()));
	connect(BleedBottom, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds()));
}
コード例 #5
0
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;
}