Exemplo n.º 1
0
void PropertiesPalette_Line::setDoc(ScribusDoc *d)
{
	if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning()))
		return;

	if (m_doc)
	{
		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
	}

	m_doc  = d;
	m_item = NULL;
	m_unitRatio   = m_doc->unitRatio();
	m_unitIndex   = m_doc->unitIndex();
	int precision = unitGetPrecisionFromIndex(m_unitIndex);

	m_haveDoc  = true;
	m_haveItem = false;

	lineWidth->setMaximum( 300 );
	lineWidth->setMinimum( 0 );

	updateLineStyles(m_doc);
	startArrow->rebuildList(&m_doc->arrowStyles());
	endArrow->rebuildList(&m_doc->arrowStyles());

	connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
	connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
}
Exemplo n.º 2
0
QString value2String(double unitValue, int unitIndex, bool round2Precision, bool appendSuffix)
{
	QString s;
	if (round2Precision)
		s=QString::number(pts2value(unitValue, unitIndex), 'f', unitGetPrecisionFromIndex(unitIndex));
	else
		s=QString::number(pts2value(unitValue, unitIndex));
	if (appendSuffix)
		s += unitGetStrFromIndex(unitIndex);
	return s;
}
Exemplo n.º 3
0
void AlignDistributePalette::enableGuideButtons()
{
	QString suffix="";
	double unitRatio=1.0;
	int precision=1;
	if (currDoc!=NULL)
	{
		suffix=unitGetSuffixFromIndex(currDoc->unitIndex());
		unitRatio=unitGetRatioFromIndex(currDoc->unitIndex());
		precision=unitGetPrecisionFromIndex(currDoc->unitIndex());
	}
	bool setterH=true, setterV=true;
	switch(guideDirection)
	{
		case -1:
			guideInfoText = guideInfoTextNone;
			if (currAlignTo==ScribusDoc::alignGuide)
				setterH=setterV=false;
			break;
		case 0:
			guideInfoText = tr("Y: %1%2").arg(guidePosition * unitRatio, 0, 'f', precision).arg(suffix);
			if (currAlignTo==ScribusDoc::alignGuide)
			{
				setterV=false;
				setterH=true;
			}
			break;
		case 1:
			guideInfoText = tr("X: %1%2").arg(guidePosition * unitRatio, 0, 'f', precision).arg(suffix);
			if (currAlignTo==ScribusDoc::alignGuide)
			{
				setterV=true;
				setterH=false;
			}
			break;
	}
	bool setterO=true;
	if (currAlignTo==ScribusDoc::alignGuide)
		setterO=false;
		
	alignLeftInToolButton->setEnabled(setterV);
	alignLeftOutToolButton->setEnabled(setterO);
	alignRightInToolButton->setEnabled(setterV);
	alignRightOutToolButton->setEnabled(setterO);	
	alignCenterHorToolButton->setEnabled(setterV);

	alignTopInToolButton->setEnabled(setterH);
	alignTopOutToolButton->setEnabled(setterO);
	alignBottomInToolButton->setEnabled(setterH);
	alignBottomOutToolButton->setEnabled(setterO);
	alignCenterVerToolButton->setEnabled(setterH);
	
	alignGuideLineEdit->setText(guideInfoText);
}
Exemplo n.º 4
0
void ScrSpinBox::init(int unitIndex)
{
	m_unitIndex=unitIndex;
	m_tabAdvance=true;
	setSuffix(unitGetSuffixFromIndex(m_unitIndex));
	setDecimals(unitGetPrecisionFromIndex(m_unitIndex));
	setSingleStep(1.0);
	lineEdit()->setValidator(0);
	disconnect(this, SIGNAL(valueChanged(const QString &)), this, SLOT(textChanged()));
	connect(this, SIGNAL(valueChanged(const QString &)), this, SLOT(textChanged()));
	installEventFilter(this);
}
Exemplo n.º 5
0
void TabGuides::unitChange(QString unit, int docUnitIndex, double invUnitConversion)
{
	double oldMin, oldMax, val;
	int decimalsOld;
	int decimal = unitGetPrecisionFromIndex(docUnitIndex);

	minorSpace->setSuffix(unit);
	majorSpace->setSuffix(unit);
	
	minorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
	minorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimal, val * invUnitConversion);
	majorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
	majorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimal, val * invUnitConversion);
}
Exemplo n.º 6
0
void ScrSpinBox::setNewUnit(int unitIndex)
{
	double oldUnitRatio=unitGetRatioFromIndex(m_unitIndex);
	double oldVal = value() / oldUnitRatio;
	double oldMax = maximum() / oldUnitRatio;
	double oldMin = minimum() / oldUnitRatio;
	setSuffix(unitGetSuffixFromIndex(unitIndex));
	setDecimals(unitGetPrecisionFromIndex(unitIndex));
	double newUnitRatio=unitGetRatioFromIndex(unitIndex);
	setMinimum(oldMin * newUnitRatio);
	setMaximum(oldMax * newUnitRatio);
	setSingleStep(1.0);
	m_unitIndex=unitIndex;
 	setValue(oldVal * newUnitRatio);
}
void PropertiesPalette_Shadow::setDoc(ScribusDoc *d)
{
	if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning()))
		return;

	if (m_doc)
	{
		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
	}

	m_doc  = d;
	m_item = NULL;
	m_unitRatio   = m_doc->unitRatio();
	m_unitIndex   = m_doc->unitIndex();
	int precision = unitGetPrecisionFromIndex(m_unitIndex);
	double maxXYWHVal =  200 * m_unitRatio;
	double minXYVal   = -200 * m_unitRatio;

	m_haveDoc = true;
	m_haveItem = false;
	softShadowXOffset->setUnitValue(m_unitIndex);
	softShadowXOffset->setDecimalsValue(precision);
	softShadowXOffset->setMinMaxValues(minXYVal, maxXYWHVal);
	softShadowXOffset->setDoubleValue(minXYVal);

	softShadowYOffset->setUnitValue(m_unitIndex);
	softShadowYOffset->setDecimalsValue(precision);
	softShadowYOffset->setMinMaxValues(minXYVal, maxXYWHVal);
	softShadowYOffset->setDoubleValue(minXYVal);

	softShadowBlurRadius->setUnitValue(m_unitIndex);
	softShadowBlurRadius->setDecimalsValue(1);
	softShadowBlurRadius->setMinMaxValues(0.0, 20.0);
	softShadowBlurRadius->setDoubleValue(5);

	softShadowShade->setDecimalsValue(0);
	softShadowShade->setMinMaxValues(0, 100);
	softShadowShade->setIntValue(100);

	softShadowOpacity->setDecimalsValue(0);
	softShadowOpacity->setMinMaxValues(0, 100);
	softShadowOpacity->setIntValue(100);
	updateColorList();

	connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
	connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
}
Exemplo n.º 8
0
void TabGuides::restoreDefaults(struct GuidesPrefs *prefsData, struct TypoPrefs *prefsData2, int unitIndex)
{
	QString unit = unitGetSuffixFromIndex(unitIndex);
	double unitRatio = unitGetRatioFromIndex(unitIndex);
	int decimals = unitGetPrecisionFromIndex(unitIndex);

	QPixmap pm3(54, 14);
	pm3.fill(prefsData->guideColor);
	colorGuides = prefsData->guideColor;
	guideColor->setIcon(pm3);
	QPixmap pm6(54, 14);
	pm6.fill(prefsData->marginColor);
	colorMargin = prefsData->marginColor;
	marginColor->setIcon(pm6);
	QPixmap pm1(54, 14);
	pm1.fill(prefsData->majorGridColor);
	colorMajorGrid = prefsData->majorGridColor;
	majorGridColor->setIcon(pm1);
	QPixmap pm(54, 14);
	pm.fill(prefsData->minorGridColor);
	colorMinorGrid = prefsData->minorGridColor;
	minorGridColor->setIcon(pm);
	QPixmap pm4(54, 14);
	pm4.fill(prefsData->baselineGridColor);
	colorBaselineGrid = prefsData->baselineGridColor;
	baselineColor->setIcon(pm4);
	minorSpace->setDecimals( decimals );
	minorSpace->setValue(prefsData->minorGridSpacing  * unitRatio);
	minorSpace->setSuffix( unit );
	majorSpace->setDecimals( decimals );
	majorSpace->setValue(prefsData->majorGridSpacing * unitRatio);
	majorSpace->setSuffix( unit );
	snapDistance->setValue(qRound(prefsData->guideRad));
	snapDistance->setSuffix( " " + tr( "px" ) );
	grabDistance->setValue(prefsData->grabRadius);
	grabDistance->setSuffix( " " + tr( " px" ) );
	baseGrid->setValue(prefsData->valueBaselineGrid);
	baseOffset->setValue(prefsData->offsetBaselineGrid);
	inBackground->setChecked( prefsData->guidePlacement );
	inForeground->setChecked( !prefsData->guidePlacement );
	baselineBox->setChecked(prefsData->baselineGridShown);
	checkGrid->setChecked(prefsData->gridShown);
	marginBox->setChecked(prefsData->marginsShown);
	guideBox->setChecked(prefsData->guidesShown);
}
Exemplo n.º 9
0
void PropertiesPalette_XYZ::setDoc(ScribusDoc *d)
{
	if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning()))
		return;

	if (m_doc)
	{
		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
	}

	m_doc  = d;
	m_item = NULL;
	m_unitRatio   = m_doc->unitRatio();
	m_unitIndex   = m_doc->unitIndex();
	int precision = unitGetPrecisionFromIndex(m_unitIndex);
//qt4 FIXME here
	double maxXYWHVal =  16777215 * m_unitRatio;
	double minXYVal   = -16777215 * m_unitRatio;

	m_haveDoc = true;
	m_haveItem = false;

	QMap<QString, double>* docConstants = m_doc? &m_doc->constants()  : NULL;
	xposSpin->setValues( minXYVal, maxXYWHVal, precision, minXYVal);
	xposSpin->setConstants(docConstants);
	yposSpin->setValues( minXYVal, maxXYWHVal, precision, minXYVal);
	yposSpin->setConstants(docConstants);
	widthSpin->setValues( m_unitRatio, maxXYWHVal, precision, m_unitRatio);
	widthSpin->setConstants(docConstants);
	heightSpin->setValues( m_unitRatio, maxXYWHVal, precision, m_unitRatio);
	heightSpin->setConstants(docConstants);

	rotationSpin->setValues( 0, 359.99, 1, 0);

	updateSpinBoxConstants();

	connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
	connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
}
Exemplo n.º 10
0
void GuideManager::unitChange()
{
	if (!m_Doc)
		return;
	// a little bit magic to get Verticals (unit) into group boxes
	horizontalGroupBox->setTitle(horizontalGroupBox->title().remove(" ("+suffix.trimmed()+")"));
	verticalGroupBox->setTitle(verticalGroupBox->title().remove(" ("+suffix.trimmed()+")"));
	docUnitIndex = m_Doc->unitIndex();
	int docUnitDecimals = unitGetPrecisionFromIndex(docUnitIndex);

	suffix = unitGetSuffixFromIndex(docUnitIndex);
	horizontalAutoGapSpin->setNewUnit(docUnitIndex);
	verticalAutoGapSpin->setNewUnit(docUnitIndex);

	horizontalGroupBox->setTitle(horizontalGroupBox->title() + " ("+suffix.trimmed()+")");
	verticalGroupBox->setTitle(verticalGroupBox->title() + " ("+suffix.trimmed()+")");
	// models display
	horizontalModel->unitChange(docUnitIndex, docUnitDecimals);
	verticalModel->unitChange(docUnitIndex, docUnitDecimals);
	qobject_cast<GuidesHDelegate*>(horizontalView->itemDelegateForColumn(0))->setDoc(m_Doc);
	qobject_cast<GuidesVDelegate*>(verticalView->itemDelegateForColumn(0))->setDoc(m_Doc);
}
Exemplo n.º 11
0
QString value2String(double unitValue, int unitIndex, bool round2Precision, bool appendSuffix)
{
	QString s;
	if (unitIndex==SC_PICAS)
	{
		int a=(static_cast<int>(unitValue))/12;
		double b=fabs(fmod(unitValue, 12));
		QString prefix((a==0 && unitValue < 0.0) ? "-" : "");
		if (round2Precision)
			s=QString("%1%2%3%4").arg(prefix).arg(a).arg(unitGetStrFromIndex(unitIndex)).arg(QString::number(b, 'f', unitGetPrecisionFromIndex(unitIndex)));
		else
			s=QString("%1%2%3%4").arg(prefix).arg(a).arg(unitGetStrFromIndex(unitIndex)).arg(b);
	}
	else
	{
		if (round2Precision)
			s=QString::number(pts2value(unitValue, unitIndex), 'f', unitGetPrecisionFromIndex(unitIndex));
		else
			s=QString::number(pts2value(unitValue, unitIndex));
		if (appendSuffix)
			s += " "+unitGetStrFromIndex(unitIndex);
	}
	return s;
}
Exemplo n.º 12
0
void TabPrinter::restoreDefaults(struct ApplicationPrefs *prefsData)
{
	docUnitIndex = prefsData->docUnitIndex;
	unitRatio = unitGetRatioFromIndex(docUnitIndex);
	int decimals = unitGetPrecisionFromIndex(docUnitIndex);
	QString unitSuffix = unitGetSuffixFromIndex(docUnitIndex);
	bleedTop->setDecimals( decimals );
	bleedTop->setMinimum(0.0);
	bleedTop->setMaximum(3000*unitRatio);
	bleedTop->setSuffix(unitSuffix);
	bleedBottom->setDecimals( decimals );
	bleedBottom->setMinimum(0.0);
	bleedBottom->setMaximum(3000*unitRatio);
	bleedBottom->setSuffix(unitSuffix);
	bleedLeft->setDecimals( decimals );
	bleedLeft->setMinimum(0.0);
	bleedLeft->setMaximum(3000*unitRatio);
	bleedLeft->setSuffix(unitSuffix);
	bleedRight->setDecimals( decimals );
	bleedRight->setMinimum(0.0);
	bleedRight->setMaximum(3000*unitRatio);
	bleedRight->setSuffix(unitSuffix);
	offsetValue->setDecimals( decimals );
	offsetValue->setMinimum(0.0);
	offsetValue->setMaximum(3000*unitRatio);
	offsetValue->setSuffix(unitSuffix);

	defaultPrinter->setMinimumSize( QSize( 250, 22 ) );
	defaultPrinter->setMaximumSize( QSize( 260, 30 ) );
	defaultPrinter->setEditable(false);
	QString Pcap;
	QString printerName;
	QStringList printerNames = PrinterUtil::getPrinterNames();
	int numPrinters = printerNames.count();
	for( int i = 0; i < numPrinters; i++)
	{
		printerName = printerNames[i];
		defaultPrinter->addItem(printerName);
	}

	defaultPrinter->addItem( tr("File"));

	prefs = PrefsManager::instance()->prefsFile->getContext("print_options");

	QString selectedDest = prefs->get("CurrentPrn", "");
	int prnIndex = defaultPrinter->findText(selectedDest);
	if ((prnIndex > -1) && (prnIndex < defaultPrinter->count()))
		defaultPrinter->setCurrentIndex(prnIndex);
	useAltPrintCommand->setChecked(prefs->getBool("OtherCom", false));
	if (useAltPrintCommand->isChecked())
	{
		defaultPrinter->setEnabled(false);
		printerCommand->setEnabled(true);
	}
	else
	{
		defaultPrinter->setEnabled(true);
		printerCommand->setEnabled(false);
	}
	printerCommand->setText(prefs->get("Command", ""));
	bool iccInUse = prefs->getBool("ICCinUse", false);
	bool psPrinter = PrinterUtil::isPostscriptPrinter(defaultPrinter->currentText());
	useICC->setChecked( psPrinter ? iccInUse : false );
	useICC->setEnabled( psPrinter );
	bool seps = static_cast<bool>(prefs->getInt("Separations", 0));
	buttonNormal->setChecked(!seps);
	buttonSeparations->setChecked(seps);
	bool color = static_cast<bool>(prefs->getInt("PrintColor", 0));
	printGray->setChecked(color);
	printColor->setChecked(!color);
	psLevel->setCurrentIndex(prefs->getInt("PSLevel", 3)-1);
	mirrorH->setChecked(prefs->getBool("MirrorH", false));
	mirrorV->setChecked(prefs->getBool("MirrorV", false));
	setMedia->setChecked(prefs->getBool("doDev", false));
	doGCR->setChecked(prefs->getBool("DoGCR", false));
	setClip->setChecked(prefs->getBool("Clip", false));
	convertSpots->setChecked(!prefs->getBool("doSpot", true));
	bleedTop->setValue(prefs->getDouble("BleedTop",0.0)*unitRatio);
	bleedBottom->setValue(prefs->getDouble("BleedBottom",0.0)*unitRatio);
	bleedRight->setValue(prefs->getDouble("BleedRight",0.0)*unitRatio);
	bleedLeft->setValue(prefs->getDouble("BleedLeft",0.0)*unitRatio);
	offsetValue->setValue(prefs->getDouble("markOffset",0.0)*unitRatio);
	cropMarks->setChecked(prefs->getBool("cropMarks", false));
	bleedMarks->setChecked(prefs->getBool("bleedMarks", false));
	registrationMarks->setChecked(prefs->getBool("registrationMarks", false));
	colorMarks->setChecked(prefs->getBool("colorMarks", false));
	usePDFMarks->setChecked(prefs->getBool("includePDFMarks", true));
}
Exemplo n.º 13
0
InsertAFrame::InsertAFrame(QWidget* parent, ScribusDoc *doc) :
	QDialog(parent),
	m_Doc(doc)
{
	setupUi(this);
	//Hide some unused items for now
// 	radioButtonTable->setShown(false);
// 	radioButtonShape->setShown(false);
// 	radioButtonPolygon->setShown(false);
	
	placementPagesRangeButton->setIcon(QIcon(loadIcon("ellipsis.png")));
	
	//set tab order
	QWidget::setTabOrder(radioButtonCustomPosition, xPosScrSpinBox);
	QWidget::setTabOrder(xPosScrSpinBox, yPosScrSpinBox);
	QWidget::setTabOrder(radioButtonCustomSize, widthScrSpinBox);
	QWidget::setTabOrder(widthScrSpinBox, heightScrSpinBox);
	QWidget::setTabOrder(textColumnCountSpinBox, textColumnGapScrSpinBox);
	
	typeButtonGroup = new QButtonGroup(typeGroupBox);
	typeButtonGroup->addButton(radioButtonTextFrame,0);
	typeButtonGroup->addButton(radioButtonImageFrame,1);
	pagePlacementButtonGroup = new QButtonGroup(pagePlacementGroupBox);
	pagePlacementButtonGroup->addButton(radioButtonCurrentPage,0);
	pagePlacementButtonGroup->addButton(radioButtonAllPages,1);
	pagePlacementButtonGroup->addButton(radioButtonRangeOfPages,2);
	framePositionButtonGroup = new QButtonGroup(framePositionGroupBox);
	framePositionButtonGroup->addButton(radioButtonTopLeftOfMargins,0);
	framePositionButtonGroup->addButton(radioButtonTopLeftOfPage,1);
	framePositionButtonGroup->addButton(radioButtonTopLeftOfBleed,2);
	framePositionButtonGroup->addButton(radioButtonCustomPosition,3);
	sizeButtonGroup = new QButtonGroup(sizeGroupBox);
	sizeButtonGroup->addButton(radioButtonPageMarginSize,0);
	sizeButtonGroup->addButton(radioButtonPageSize,1);
	sizeButtonGroup->addButton(radioButtonBleedSize,2);
	sizeButtonGroup->addButton(radioButtonImageSize,3);
	sizeButtonGroup->addButton(radioButtonCustomSize,4);
	radioButtonTextFrame->setChecked(true);
	radioButtonCurrentPage->setChecked(true);
	radioButtonTopLeftOfMargins->setChecked(true);
	radioButtonPageMarginSize->setChecked(true);
	slotSelectType(0);
	slotSelectPagePlacement(0);
	slotSelectPosition(0);
	slotSelectSize(0);
	
	int docUnitIndex = m_Doc ? m_Doc->unitIndex() : SC_PT;
	int decimals = unitGetPrecisionFromIndex(docUnitIndex);
	QString unitSuffix(unitGetSuffixFromIndex(docUnitIndex));
	
	xPosScrSpinBox->setNewUnit(docUnitIndex);
	yPosScrSpinBox->setNewUnit(docUnitIndex);
	widthScrSpinBox->setNewUnit(docUnitIndex);
	heightScrSpinBox->setNewUnit(docUnitIndex);
	xPosScrSpinBox->setValues(0.0, 1000.0, decimals, 0.0);
	yPosScrSpinBox->setValues(0.0, 1000.0, decimals, 0.0);
	widthScrSpinBox->setValues(0.0, 1000.0, decimals, 0.0);
	heightScrSpinBox->setValues(0.0, 1000.0, decimals, 0.0);
	textColumnGapScrSpinBox->setValues(0.0, 1000.0, decimals, 0.0);
	xPosScrSpinBox->setSuffix(unitSuffix);
	yPosScrSpinBox->setSuffix(unitSuffix);
	widthScrSpinBox->setSuffix(unitSuffix);
	heightScrSpinBox->setSuffix(unitSuffix);
	textColumnGapScrSpinBox->setSuffix(unitSuffix);

	sourceDocLineEdit->setText("");
	
	if (m_Doc!=0)
	{
		pageItemMap=m_Doc->getDocItemNames(PageItem::TextFrame);
		comboBoxLinkToExistingFrameName->addItems(pageItemMap.values());
	}
	if (comboBoxLinkToExistingFrameName->count()==0)
		checkBoxLinkToExistingFrame->setEnabled(false);
	
	connect(typeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotSelectType(int)));
	connect(pagePlacementButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotSelectPagePlacement(int)));
	connect(placementPagesRangeButton, SIGNAL(clicked()), this, SLOT(slotCreatePageNumberRange()));
	connect(framePositionButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotSelectPosition(int)));
	connect(sizeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotSelectSize(int)));
	connect(selectImageFileButton, SIGNAL(clicked()), this, SLOT(locateImageFile()));
	connect(selectDocFileButton, SIGNAL(clicked()), this, SLOT(locateDocFile()));
	connect(checkBoxLinkToExistingFrame, SIGNAL(stateChanged(int)), this, SLOT(slotLinkToExistingFrame(int)));
}