85,128 → 85,32 |
m_haveDoc = false; |
m_haveItem = false; |
m_unitRatio = 1.0; |
|
m_tmpSelection = new Selection(this, false); |
m_tmpSelection->clear(); |
|
setupUi(this); |
setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); |
|
pageLayout_2 = new QVBoxLayout( this ); |
pageLayout_2->setSpacing( 5 ); |
pageLayout_2->setMargin( 0 ); |
roundRectLabel->setBuddy(roundRect); |
|
ShapeGroup = new QGroupBox( this ); |
ShapeGroupLayout = new QHBoxLayout( ShapeGroup ); |
ShapeGroupLayout->setSpacing( 2 ); |
ShapeGroupLayout->setMargin( 0 ); |
ShapeGroupLayout->setAlignment( Qt::AlignTop ); |
SRect = new QLabel( "Shape:", ShapeGroup ); |
ShapeGroupLayout->addWidget( SRect ); |
SCustom = new Autoforms( ShapeGroup ); |
ShapeGroupLayout->addWidget( SCustom ); |
|
EditShape = new QToolButton( ShapeGroup ); |
ShapeGroupLayout->addWidget( EditShape ); |
pageLayout_2->addWidget( ShapeGroup ); |
|
Layout13 = new QHBoxLayout; |
Layout13->setSpacing( 2 ); |
Layout13->setMargin( 0 ); |
|
RoundRect = new ScrSpinBox( this, 0 ); |
rndCornersLabel = new QLabel( "R&ound\nCorners:", this ); |
rndCornersLabel->setBuddy(RoundRect); |
Layout13->addWidget( rndCornersLabel ); |
Layout13->addWidget( RoundRect ); |
pageLayout_2->addLayout( Layout13 ); |
|
textFlowOptions = new QGroupBox( this ); |
textFlowOptionsLayout = new QVBoxLayout( textFlowOptions ); |
textFlowOptionsLayout->setSpacing( 5 ); |
textFlowOptionsLayout->setMargin( 5 ); |
textFlowOptionsLayout->setAlignment( Qt::AlignTop ); |
textFlowDisabled = new QToolButton( textFlowOptions ); |
textFlowDisabled->setCheckable( true ); |
textFlowDisabled->setAutoExclusive(true); |
textFlowDisabled->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); |
textFlowDisabled->setText( "Disabled" ); |
textFlowDisabled->setIcon(QIcon(loadIcon("flow-none.png"))); |
textFlowOptionsLayout->addWidget( textFlowDisabled ); |
textFlowUsesFrameShape = new QToolButton( textFlowOptions ); |
textFlowUsesFrameShape->setCheckable( true ); |
textFlowUsesFrameShape->setAutoExclusive(true); |
textFlowUsesFrameShape->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); |
textFlowUsesFrameShape->setText( "Use &Frame Shape" ); |
textFlowUsesFrameShape->setIcon(QIcon(loadIcon("flow-frame.png"))); |
textFlowOptionsLayout->addWidget( textFlowUsesFrameShape ); |
textFlowUsesBoundingBox = new QToolButton( textFlowOptions ); |
textFlowUsesBoundingBox->setCheckable( true ); |
textFlowUsesBoundingBox->setAutoExclusive(true); |
textFlowUsesBoundingBox->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); |
textFlowUsesBoundingBox->setText( "Use &Bounding Box" ); |
textFlowUsesBoundingBox->setIcon(QIcon(loadIcon("flow-bounding.png"))); |
textFlowOptionsLayout->addWidget( textFlowUsesBoundingBox ); |
textFlowUsesContourLine = new QToolButton( textFlowOptions ); |
textFlowUsesContourLine->setCheckable( true ); |
textFlowUsesContourLine->setAutoExclusive(true); |
textFlowUsesContourLine->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); |
textFlowUsesContourLine->setText( "&Use Contour Line" ); |
textFlowUsesContourLine->setIcon(QIcon(loadIcon("flow-contour.png"))); |
textFlowOptionsLayout->addWidget( textFlowUsesContourLine ); |
textFlowUsesImageClipping = new QToolButton( textFlowOptions ); |
textFlowUsesImageClipping->setCheckable( true ); |
textFlowUsesImageClipping->setAutoExclusive(true); |
textFlowUsesImageClipping->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); |
textFlowUsesImageClipping->setText( "Use Image Clip Path" ); |
textFlowUsesImageClipping->setIcon(QIcon(loadIcon("flow-contour.png"))); |
textFlowOptionsLayout->addWidget( textFlowUsesImageClipping ); |
pageLayout_2->addWidget( textFlowOptions ); |
textFlowDisabled->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
textFlowUsesFrameShape->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
textFlowUsesBoundingBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
textFlowUsesContourLine->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
textFlowUsesImageClipping->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
textFlowOptionsB = new QButtonGroup( this ); |
textFlowOptionsB->addButton(textFlowDisabled, 0); |
textFlowOptionsB->addButton(textFlowUsesFrameShape, 1); |
textFlowOptionsB->addButton(textFlowUsesBoundingBox, 2); |
textFlowOptionsB->addButton(textFlowUsesContourLine, 3); |
textFlowOptionsB->addButton(textFlowUsesImageClipping, 4); |
|
TabStack2 = new QStackedWidget( this ); |
|
page_2a = new QWidget( TabStack2 ); |
TabStack2->addWidget( page_2a ); |
|
page_2c = new QWidget( TabStack2 ); |
pageLayout_2c = new QVBoxLayout( page_2c ); |
pageLayout_2c->setSpacing( 5 ); |
pageLayout_2c->setMargin( 0 ); |
FillRuleGroup = new QGroupBox( page_2c ); |
FillRuleLayout = new QVBoxLayout( FillRuleGroup ); |
FillRuleLayout->setSpacing( 2 ); |
FillRuleLayout->setMargin( 5 ); |
FillRuleLayout->setAlignment( Qt::AlignTop ); |
EvenOdd = new QRadioButton( "Even-Odd", FillRuleGroup ); |
FillRuleLayout->addWidget( EvenOdd ); |
NonZero = new QRadioButton( "Non Zero", FillRuleGroup ); |
FillRuleLayout->addWidget( NonZero ); |
EvenOdd->setChecked( true ); |
FillRuleGroup->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); |
pageLayout_2c->addWidget(FillRuleGroup); |
TabStack2->addWidget( page_2c ); |
|
pageLayout_2->addWidget( TabStack2 ); |
|
languageChange(); |
|
connect(textFlowOptionsB , SIGNAL(buttonClicked(int)), this, SLOT(handleTextFlow())); |
connect(EditShape, SIGNAL(clicked()) , this, SLOT(handleShapeEdit())); |
connect(RoundRect, SIGNAL(valueChanged(double)) , this, SLOT(handleCornerRadius())); |
connect(EvenOdd , SIGNAL(clicked()) , this, SLOT(handleFillRule()) ); |
connect(NonZero , SIGNAL(clicked()) , this, SLOT(handleFillRule()) ); |
connect(SCustom , SIGNAL(FormSel(int, int, qreal *)), this, SLOT(handleNewShape(int, int, qreal *))); |
connect(textFlowBtnGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleTextFlow())); |
connect(editShape , SIGNAL(clicked()) , this, SLOT(handleShapeEdit())); |
connect(roundRect , SIGNAL(valueChanged(double)) , this, SLOT(handleCornerRadius())); |
connect(evenOdd , SIGNAL(clicked()) , this, SLOT(handleFillRule()) ); |
connect(nonZero , SIGNAL(clicked()) , this, SLOT(handleFillRule()) ); |
connect(customShape, SIGNAL(FormSel(int, int, qreal *)), this, SLOT(handleNewShape(int, int, qreal *))); |
|
RoundRect->showValue(0); |
TabStack2->setCurrentIndex(0); |
roundRect->showValue(0); |
stackedWidget->setCurrentIndex(0); |
} |
|
void PropertiesPalette_Shape::changeEvent(QEvent *e) |
247,7 → 151,7 |
m_haveDoc = true; |
m_haveItem = false; |
|
RoundRect->setValues( -300, 300, 2, 0); |
roundRect->setValues( -300, 300, 2, 0); |
|
connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); |
connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); |
266,9 → 170,9 |
m_doc = NULL; |
m_item = NULL; |
|
EditShape->setEnabled(false); |
RoundRect->setEnabled(false); |
RoundRect->showValue(0); |
editShape->setEnabled(false); |
roundRect->setEnabled(false); |
roundRect->showValue(0); |
setEnabled(false); |
} |
|
304,6 → 208,11 |
return currentItem; |
} |
|
void PropertiesPalette_Shape::setCustomShapeIcon(int submode) |
{ |
customShape->setIcon( customShape->getIconPixmap(submode) ); |
} |
|
void PropertiesPalette_Shape::setLocked(bool isLocked) |
{ |
QPalette pal(qApp->palette()); |
310,17 → 219,22 |
if (isLocked) |
pal.setCurrentColorGroup(QPalette::Disabled); |
|
EditShape->setEnabled(!isLocked); |
editShape->setEnabled(!isLocked); |
if ((m_haveDoc) && (m_haveItem)) |
{ |
SCustom->setEnabled(!m_item->asLine() && !m_item->asPolyLine() && !m_item->asPathText() && !isLocked); |
customShape->setEnabled(!m_item->asLine() && !m_item->asPolyLine() && !m_item->asPathText() && !isLocked); |
if (((m_item->asTextFrame()) || (m_item->asImageFrame()) || (m_item->asPolygon())) && (!m_item->ClipEdited) && ((m_item->FrameType == 0) || (m_item->FrameType == 2))) |
RoundRect->setEnabled(!isLocked); |
roundRect->setEnabled(!isLocked); |
else |
RoundRect->setEnabled(false); |
roundRect->setEnabled(false); |
} |
} |
|
void PropertiesPalette_Shape::setRoundRectEnabled(bool enabled) |
{ |
roundRect->setEnabled(enabled); |
} |
|
void PropertiesPalette_Shape::handleSelectionChanged() |
{ |
if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) |
329,7 → 243,7 |
PageItem* currItem = currentItemFromSelection(); |
if (m_doc->m_Selection->count() > 1) |
{ |
RoundRect->showValue(0); |
roundRect->showValue(0); |
} |
else |
{ |
338,20 → 252,20 |
m_haveItem = (itemType != -1); |
if (itemType != -1) |
{ |
EditShape->setEnabled(!currItem->locked()); |
SCustom->setEnabled(itemType != 5 && itemType!= 7 && itemType !=8 && !currItem->locked()); |
editShape->setEnabled(!currItem->locked()); |
customShape->setEnabled(itemType != 5 && itemType!= 7 && itemType !=8 && !currItem->locked()); |
} |
else |
{ |
EditShape->setEnabled(false); |
SCustom->setEnabled(false); |
editShape->setEnabled(false); |
customShape->setEnabled(false); |
} |
switch (itemType) |
{ |
case -1: |
setEnabled(false); |
RoundRect->setEnabled(false); |
RoundRect->showValue(0); |
roundRect->setEnabled(false); |
roundRect->showValue(0); |
break; |
case PageItem::ImageFrame: |
case PageItem::LatexFrame: |
359,31 → 273,31 |
if (currItem->asOSGFrame()) |
{ |
setEnabled(false); |
RoundRect->setEnabled(false); |
EditShape->setEnabled(false); |
SCustom->setEnabled(false); |
roundRect->setEnabled(false); |
editShape->setEnabled(false); |
customShape->setEnabled(false); |
} |
else |
{ |
setEnabled(true); |
if ((!currItem->ClipEdited) && ((currItem->FrameType == 0) || (currItem->FrameType == 2))) |
RoundRect->setEnabled(!currItem->locked()); |
roundRect->setEnabled(!currItem->locked()); |
else |
RoundRect->setEnabled(false); |
roundRect->setEnabled(false); |
if ((m_doc->m_Selection->itemAt(0)->FrameType == 0) || (m_doc->m_Selection->itemAt(0)->FrameType == 2)) |
RoundRect->setEnabled(!currItem->locked()); |
roundRect->setEnabled(!currItem->locked()); |
} |
break; |
case PageItem::TextFrame: |
setEnabled(true); |
if ((!currItem->ClipEdited) && ((currItem->FrameType == 0) || (currItem->FrameType == 2))) |
RoundRect->setEnabled(!currItem->locked()); |
roundRect->setEnabled(!currItem->locked()); |
else |
RoundRect->setEnabled(false); |
roundRect->setEnabled(false); |
break; |
case PageItem::Line: |
setEnabled(false); |
RoundRect->setEnabled(false); |
roundRect->setEnabled(false); |
break; |
case PageItem::ItemType1: |
case PageItem::ItemType3: |
390,24 → 304,24 |
case PageItem::Polygon: |
setEnabled(true); |
if ((!currItem->ClipEdited) && ((currItem->FrameType == 0) || (currItem->FrameType == 2))) |
RoundRect->setEnabled(!currItem->locked()); |
roundRect->setEnabled(!currItem->locked()); |
else |
RoundRect->setEnabled(false); |
roundRect->setEnabled(false); |
break; |
case PageItem::PolyLine: |
setEnabled(true); |
RoundRect->setEnabled(false); |
roundRect->setEnabled(false); |
break; |
case PageItem::PathText: |
setEnabled(true); |
RoundRect->setEnabled(false); |
roundRect->setEnabled(false); |
break; |
case PageItem::Symbol: |
setEnabled(false); |
if ((!currItem->ClipEdited) && ((currItem->FrameType == 0) || (currItem->FrameType == 2))) |
RoundRect->setEnabled(!currItem->locked()); |
roundRect->setEnabled(!currItem->locked()); |
else |
RoundRect->setEnabled(false); |
roundRect->setEnabled(false); |
break; |
} |
} |
437,48 → 351,48 |
m_item = item; |
|
if (m_item->FrameType == 0) |
SCustom->setIcon(SCustom->getIconPixmap(0)); |
customShape->setIcon(customShape->getIconPixmap(0)); |
if (m_item->FrameType == 1) |
SCustom->setIcon(SCustom->getIconPixmap(1)); |
customShape->setIcon(customShape->getIconPixmap(1)); |
if (m_item->FrameType > 3) |
SCustom->setIcon(SCustom->getIconPixmap(m_item->FrameType-2)); |
customShape->setIcon(customShape->getIconPixmap(m_item->FrameType-2)); |
|
RoundRect->setValue(m_item->cornerRadius()*m_unitRatio); |
roundRect->setValue(m_item->cornerRadius()*m_unitRatio); |
displayTextFlowMode(m_item->textFlowMode()); |
|
if (m_item->asPathText()) |
{ |
TabStack2->setCurrentIndex(0); |
stackedWidget->setCurrentIndex(0); |
} |
else if (m_item->asTextFrame()) |
{ |
TabStack2->setCurrentIndex(0); |
stackedWidget->setCurrentIndex(0); |
} |
else |
{ |
TabStack2->setCurrentIndex(1); |
FillRuleGroup->setVisible(m_item->itemType() != PageItem::ImageFrame); |
stackedWidget->setCurrentIndex(1); |
fillRuleGroup->setVisible(m_item->itemType() != PageItem::ImageFrame); |
} |
|
setLocked(m_item->locked()); |
NonZero->setChecked(!m_item->fillRule); |
EvenOdd->setChecked(m_item->fillRule); |
nonZero->setChecked(!m_item->fillRule); |
evenOdd->setChecked(m_item->fillRule); |
|
// Frame type 3 is obsolete: CR 2005-02-06 |
//if (((i->itemType() == PageItem::TextFrame) || (i->itemType() == PageItem::ImageFrame) || (i->itemType() == 3)) && (!i->ClipEdited)) |
if (((m_item->asTextFrame()) || (m_item->asImageFrame())) && (!m_item->ClipEdited) && ((m_item->FrameType == 0) || (m_item->FrameType == 2))) |
RoundRect->setEnabled(true); |
roundRect->setEnabled(true); |
else |
{ |
RoundRect->setEnabled ((m_item->asPolygon()) && (!m_item->ClipEdited) && ((m_item->FrameType == 0) || (m_item->FrameType == 2))); |
roundRect->setEnabled ((m_item->asPolygon()) && (!m_item->ClipEdited) && ((m_item->FrameType == 0) || (m_item->FrameType == 2))); |
} |
|
if (m_item->asOSGFrame()) |
{ |
setEnabled(false); |
RoundRect->setEnabled(false); |
EditShape->setEnabled(false); |
SCustom->setEnabled(false); |
roundRect->setEnabled(false); |
editShape->setEnabled(false); |
customShape->setEnabled(false); |
} |
|
if (m_item->asSymbolFrame()) |
523,7 → 437,7 |
{ |
m_tmpSelection->clear(); |
m_ScMW->view->requestMode(modeEditClip); |
RoundRect->setEnabled(false); |
roundRect->setEnabled(false); |
connect(m_ScMW->nodePalette, SIGNAL(paletteClosed()), this, SLOT(handleShapeEditEnded())); |
} |
} |
546,7 → 460,7 |
{ |
if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning()) |
return; |
m_item->setCornerRadius(RoundRect->value() / m_unitRatio); |
m_item->setCornerRadius(roundRect->value() / m_unitRatio); |
m_ScMW->view->SetFrameRounded(); |
emit DocChanged(); |
m_doc->regionsChanged()->update(QRect()); |
556,7 → 470,7 |
{ |
if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning()) |
return; |
m_item->fillRule = EvenOdd->isChecked(); |
m_item->fillRule = evenOdd->isChecked(); |
m_item->update(); |
emit DocChanged(); |
} |
578,12 → 492,12 |
|
if ((m_item->itemType() == PageItem::ImageFrame) || (m_item->itemType() == PageItem::TextFrame)) |
{ |
RoundRect->setEnabled(f == 0); |
roundRect->setEnabled(f == 0); |
return; |
} |
// m_item->convertTo(PageItem::Polygon); |
// newSelection(6); |
RoundRect->setEnabled(f == 0); |
roundRect->setEnabled(f == 0); |
} |
} |
|
614,18 → 528,18 |
{ |
QString ptSuffix = tr(" pt"); |
QString suffix = m_doc ? unitGetSuffixFromIndex(m_doc->unitIndex()) : ptSuffix; |
RoundRect->setSuffix(suffix); |
roundRect->setSuffix(suffix); |
|
SRect->setText( tr("Shape:")); |
SCustom->setToolTip( tr("Choose the shape of frame...")); |
EditShape->setText( tr("&Edit...")); |
RoundRect->setToolTip( tr("Set radius of corner rounding")); |
rndCornersLabel->setText( tr("R&ound\nCorners:")); |
FillRuleGroup->setTitle( tr("Fill Rule")); |
EvenOdd->setText( tr("Even-Odd")); |
NonZero->setText( tr("Non Zero")); |
shapeGroup->setTitle( tr("Shape:")); |
customShape->setToolTip( tr("Choose the shape of frame...")); |
editShape->setText( tr("&Edit...")); |
roundRect->setToolTip( tr("Set radius of corner rounding")); |
roundRectLabel->setText( tr("R&ound Corners:")); |
fillRuleGroup->setTitle( tr("Fill Rule")); |
evenOdd->setText( tr("Even-Odd")); |
nonZero->setText( tr("Non Zero")); |
|
textFlowOptions->setTitle( tr("Text &Flow Around Frame")); |
textFlowGroup->setTitle( tr("Text &Flow Around Frame")); |
textFlowDisabled->setText( tr("Disabled")); |
textFlowUsesFrameShape->setText( tr("Use Frame &Shape")); |
textFlowUsesBoundingBox->setText( tr("Use &Bounding Box")); |
642,7 → 556,7 |
m_unitRatio = m_doc->unitRatio(); |
m_unitIndex = m_doc->unitIndex(); |
|
RoundRect->blockSignals(true); |
RoundRect->setNewUnit( m_unitIndex ); |
RoundRect->blockSignals(false); |
roundRect->blockSignals(true); |
roundRect->setNewUnit( m_unitIndex ); |
roundRect->blockSignals(false); |
} |