void PropertiesPalette_Shadow::setCurrentItem(PageItem *i) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; if (!m_doc) setDoc(i->doc()); m_haveItem = false; m_item = i; hasSoftShadow->setBoolValue(i->hasSoftShadow()); softShadowXOffset->setDoubleValue(i->softShadowXOffset() * m_unitRatio); softShadowYOffset->setDoubleValue(i->softShadowYOffset() * m_unitRatio); softShadowBlurRadius->setDoubleValue(i->softShadowBlurRadius() * m_unitRatio); softShadowColor->setStringValue(i->softShadowColor()); softShadowShade->setIntValue(i->softShadowShade()); softShadowOpacity->setDoubleValue(qRound(100 - (i->softShadowOpacity() * 100))); softShadowBlendMode->setIntValue(i->softShadowBlendMode()); softShadowErase->setBoolValue(i->softShadowErasedByObject()); softShadowObjTrans->setBoolValue(i->softShadowHasObjectTransparency()); m_haveItem = true; updateSpinBoxConstants(); }
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())); }
void PropertiesPalette_XYZ::setCurrentItem(PageItem *i) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; //CB We shouldnt really need to process this if our item is the same one //maybe we do if the item has been changed by scripter.. but that should probably //set some status if so. //FIXME: This wont work until when a canvas deselect happens, m_item must be NULL. //if (m_item == i) // return; if (!m_doc) setDoc(i->doc()); disconnect(nameEdit, SIGNAL(Leaved()), this, SLOT(handleNewName())); m_haveItem = false; m_item = i; nameEdit->setText(m_item->itemName()); QString tm; levelLabel->setText(tm.setNum(m_item->ItemNr + 1)); connect(nameEdit, SIGNAL(Leaved()), this, SLOT(handleNewName())); //CB replaces old emits from PageItem::emitAllToGUI() disconnect(xposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewX())); disconnect(yposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewY())); disconnect(widthSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewW())); disconnect(heightSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewH())); disconnect(doLock, SIGNAL(clicked()), this, SLOT(handleLock())); disconnect(noPrint, SIGNAL(clicked()), this, SLOT(handlePrint())); disconnect(noResize, SIGNAL(clicked()), this, SLOT(handleLockSize())); disconnect(flipH, SIGNAL(clicked()), this, SLOT(handleFlipH())); disconnect(flipV, SIGNAL(clicked()), this, SLOT(handleFlipV())); disconnect(rotationSpin, SIGNAL(valueChanged(double)), this, SLOT(handleRotation())); double selX = m_item->xPos(); double selY = m_item->yPos(); double selW = m_item->width(); double selH = m_item->height(); if (m_doc->m_Selection->count() > 1) m_doc->m_Selection->getGroupRect(&selX, &selY, &selW, &selH); displayXY(selX, selY); displayWH(selW, selH); bool checkableFlip = (i->isImageFrame() || i->isTextFrame() || i->isLatexFrame() || i->isOSGFrame() || i->isSymbol() || i->isGroup() || i->isSpiral()); flipH->setCheckable(checkableFlip); flipV->setCheckable(checkableFlip); noPrint->setChecked(!i->printEnabled()); displayFlippedH(i->imageFlippedH()); displayFlippedV(i->imageFlippedV()); m_oldRotation = i->rotation(); double rr = i->rotation(); if (i->rotation() > 0) rr = 360 - rr; rotationSpin->setValue(fabs(rr)); //CB TODO reconnect PP signals from here connect(xposSpin , SIGNAL(valueChanged(double)), this, SLOT(handleNewX())); connect(yposSpin , SIGNAL(valueChanged(double)), this, SLOT(handleNewY())); connect(widthSpin , SIGNAL(valueChanged(double)), this, SLOT(handleNewW())); connect(heightSpin , SIGNAL(valueChanged(double)), this, SLOT(handleNewH())); connect(doLock , SIGNAL(clicked()), this, SLOT(handleLock())); connect(noPrint , SIGNAL(clicked()), this, SLOT(handlePrint())); connect(noResize, SIGNAL(clicked()), this, SLOT(handleLockSize())); connect(flipH , SIGNAL(clicked()), this, SLOT(handleFlipH())); connect(flipV , SIGNAL(clicked()), this, SLOT(handleFlipV())); connect(rotationSpin, SIGNAL(valueChanged(double)), this, SLOT(handleRotation())); bool setter = false; if ((m_item->isTableItem) && (m_item->isSingleSel)) { setter = true; rotationSpin->setEnabled(false); } xposSpin->setEnabled(!setter); yposSpin->setEnabled(!setter); levelGroup->setEnabled(!setter); if ((m_item->isGroup()) && (!m_item->isSingleSel)) { setEnabled(true); } if ((m_item->itemType() == PageItem::Line) && m_lineMode) { xposLabel->setText( tr( "&X1:" ) ); widthLabel->setText( tr( "X&2:" ) ); yposLabel->setText( tr( "Y&1:" ) ); heightLabel->setText( tr( "&Y2:" ) ); rotationSpin->setEnabled(false); } else { xposLabel->setText( tr( "&X-Pos:" ) ); widthLabel->setText( tr( "&Width" ) ); yposLabel->setText( tr( "&Y-Pos:" ) ); heightLabel->setText( tr( "&Height:" ) ); rotationSpin->setEnabled(!((m_item->isTableItem) && (m_item->isSingleSel))); } m_haveItem = true; if (m_item->asLine()) { keepFrameWHRatioButton->setEnabled(false); heightSpin->setEnabled(m_lineMode && !m_item->locked()); } else { heightSpin->setEnabled(true); keepFrameWHRatioButton->setEnabled(true); } displayXY(selX, selY); displayWH(selW, selH); displayLocked(i->locked()); displaySizeLocked(i->sizeLocked()); double rrR = i->imageRotation(); if (i->imageRotation() > 0) rrR = 360 - rrR; noResize->setEnabled(!m_item->isArc()); doGroup->setEnabled(false); doUnGroup->setEnabled(false); if (m_doc->m_Selection->count() > 1) doGroup->setEnabled(true); if (m_doc->m_Selection->count() == 1) doUnGroup->setEnabled(m_item->isGroup()); if (m_item->asOSGFrame()) { setEnabled(true); rotationSpin->setEnabled(false); } if (m_item->asSymbolFrame()) { setEnabled(true); } updateSpinBoxConstants(); }