+ backgroundColor->setColor(titleConfig.readEntry("background_color", backgroundColor->color()));
+ backgroundAlpha->setValue(titleConfig.readEntry("background_alpha", backgroundAlpha->value()));
+}
+
+void TitleWidget::adjustFrameSize()
+{
+ m_frameWidth = m_titledocument.frameWidth();
+ m_frameHeight = m_titledocument.frameHeight();
+ m_frameBorder->setRect(0, 0, m_frameWidth, m_frameHeight);
+ displayBackgroundFrame();
+}
+
+void TitleWidget::slotAnimStart(bool anim)
+{
+ if (anim && anim_end->isChecked()) {
+ anim_end->setChecked(false);
+ m_endViewport->setZValue(-1000);
+ m_endViewport->setBrush(QBrush());
+ }
+ slotSelectTool();
+ QList<QGraphicsItem *> list = m_scene->items();
+ for (int i = 0; i < list.count(); ++i) {
+ if (list.at(i)->zValue() > -1000) {
+ list.at(i)->setFlag(QGraphicsItem::ItemIsMovable, !anim);
+ list.at(i)->setFlag(QGraphicsItem::ItemIsSelectable, !anim);
+ }
+ }
+ align_box->setEnabled(anim);
+ itemzoom->setEnabled(!anim);
+ itemrotatex->setEnabled(!anim);
+ itemrotatey->setEnabled(!anim);
+ itemrotatez->setEnabled(!anim);
+ frame_toolbar->setEnabled(!anim);
+ toolbar_stack->setEnabled(!anim);
+ if (anim) {
+ keep_aspect->setChecked(!m_startViewport->data(0).isNull());
+ m_startViewport->setZValue(1100);
+ QColor col = m_startViewport->pen().color();
+ col.setAlpha(100);
+ m_startViewport->setBrush(col);
+ m_startViewport->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+ m_startViewport->setSelected(true);
+ selectionChanged();
+ slotSelectTool();
+ if (m_startViewport->childItems().isEmpty()) addAnimInfoText();
+ } else {
+ m_startViewport->setZValue(-1000);
+ m_startViewport->setBrush(QBrush());
+ m_startViewport->setFlags(0);
+ if (!anim_end->isChecked()) deleteAnimInfoText();
+ }
+
+}
+
+void TitleWidget::slotAnimEnd(bool anim)
+{
+ if (anim && anim_start->isChecked()) {
+ anim_start->setChecked(false);
+ m_startViewport->setZValue(-1000);
+ m_startViewport->setBrush(QBrush());
+ }
+ slotSelectTool();
+ QList<QGraphicsItem *> list = m_scene->items();
+ for (int i = 0; i < list.count(); ++i) {
+ if (list.at(i)->zValue() > -1000) {
+ list.at(i)->setFlag(QGraphicsItem::ItemIsMovable, !anim);
+ list.at(i)->setFlag(QGraphicsItem::ItemIsSelectable, !anim);
+ }
+ }
+ align_box->setEnabled(anim);
+ itemzoom->setEnabled(!anim);
+ itemrotatex->setEnabled(!anim);
+ itemrotatey->setEnabled(!anim);
+ itemrotatez->setEnabled(!anim);
+ frame_toolbar->setEnabled(!anim);
+ toolbar_stack->setEnabled(!anim);
+ if (anim) {
+ keep_aspect->setChecked(!m_endViewport->data(0).isNull());
+ m_endViewport->setZValue(1100);
+ QColor col = m_endViewport->pen().color();
+ col.setAlpha(100);
+ m_endViewport->setBrush(col);
+ m_endViewport->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+ m_endViewport->setSelected(true);
+ selectionChanged();
+ slotSelectTool();
+ if (m_endViewport->childItems().isEmpty()) addAnimInfoText();
+ } else {
+ m_endViewport->setZValue(-1000);
+ m_endViewport->setBrush(QBrush());
+ m_endViewport->setFlags(0);
+ if (!anim_start->isChecked()) deleteAnimInfoText();
+ }
+}
+
+void TitleWidget::addAnimInfoText()
+{
+ // add text to anim viewport
+ QGraphicsTextItem *t = new QGraphicsTextItem(i18nc("Indicates the start of an animation", "Start"), m_startViewport);
+ QGraphicsTextItem *t2 = new QGraphicsTextItem(i18nc("Indicates the end of an animation", "End"), m_endViewport);
+ QFont font = t->font();
+ font.setPixelSize(m_startViewport->rect().width() / 10);
+ QColor col = m_startViewport->pen().color();
+ col.setAlpha(255);
+ t->setDefaultTextColor(col);
+ t->setFont(font);
+ font.setPixelSize(m_endViewport->rect().width() / 10);
+ col = m_endViewport->pen().color();
+ col.setAlpha(255);
+ t2->setDefaultTextColor(col);
+ t2->setFont(font);
+}
+
+void TitleWidget::updateInfoText()
+{
+ // update info text font
+ if (!m_startViewport->childItems().isEmpty()) {
+ QGraphicsTextItem *item = static_cast <QGraphicsTextItem *>(m_startViewport->childItems().at(0));
+ if (item) {
+ QFont font = item->font();
+ font.setPixelSize(m_startViewport->rect().width() / 10);
+ item->setFont(font);
+ }
+ }
+ if (!m_endViewport->childItems().isEmpty()) {
+ QGraphicsTextItem *item = static_cast <QGraphicsTextItem *>(m_endViewport->childItems().at(0));
+ if (item) {
+ QFont font = item->font();
+ font.setPixelSize(m_endViewport->rect().width() / 10);
+ item->setFont(font);
+ }
+ }
+}
+
+void TitleWidget::deleteAnimInfoText()
+{
+ // end animation editing, remove info text
+ while (!m_startViewport->childItems().isEmpty()) {
+ QGraphicsItem *item = m_startViewport->childItems().at(0);
+ m_scene->removeItem(item);
+ delete item;
+ }
+ while (!m_endViewport->childItems().isEmpty()) {
+ QGraphicsItem *item = m_endViewport->childItems().at(0);
+ m_scene->removeItem(item);
+ delete item;
+ }
+}
+
+void TitleWidget::slotKeepAspect(bool keep)
+{
+ if (m_endViewport->zValue() == 1100) {
+ m_endViewport->setData(0, keep == true ? m_frameWidth : QVariant());
+ m_endViewport->setData(1, keep == true ? m_frameHeight : QVariant());
+ } else {
+ m_startViewport->setData(0, keep == true ? m_frameWidth : QVariant());
+ m_startViewport->setData(1, keep == true ? m_frameHeight : QVariant());
+ }
+}
+
+void TitleWidget::slotResize50()
+{
+ if (m_endViewport->zValue() == 1100) {
+ m_endViewport->setRect(0, 0, m_frameWidth / 2, m_frameHeight / 2);
+ } else m_startViewport->setRect(0, 0, m_frameWidth / 2, m_frameHeight / 2);
+}
+
+void TitleWidget::slotResize100()
+{
+ if (m_endViewport->zValue() == 1100) {
+ m_endViewport->setRect(0, 0, m_frameWidth, m_frameHeight);
+ } else m_startViewport->setRect(0, 0, m_frameWidth, m_frameHeight);
+}
+
+void TitleWidget::slotResize200()
+{
+ if (m_endViewport->zValue() == 1100) {
+ m_endViewport->setRect(0, 0, m_frameWidth * 2, m_frameHeight * 2);
+ } else m_startViewport->setRect(0, 0, m_frameWidth * 2, m_frameHeight * 2);
+}
+
+void TitleWidget::slotAddEffect(int ix)
+{
+ QList<QGraphicsItem *> list = graphicsView->scene()->selectedItems();
+ int effect = effect_list->itemData(ix).toInt();
+
+ if (list.size() == 1) {
+ if (effect == NOEFFECT)
+ effect_stack->setHidden(true);
+ else {
+ effect_stack->setCurrentIndex(effect - 1);
+ effect_stack->setHidden(false);
+ }
+ } else // Hide the effects stack when more than one element is selected.
+ effect_stack->setHidden(true);
+
+ foreach(QGraphicsItem * item, list) {
+ switch (effect) {
+ case NOEFFECT:
+ item->setData(100, QVariant());
+#if QT_VERSION >= 0x040600
+ item->setGraphicsEffect(0);
+#endif
+ break;
+ case TYPEWRITEREFFECT:
+ /*
+ * Allow the user to set the typewriter effect to more than one
+ * element, but do not add it to non-text elements.
+ */
+ if (item->type() == TEXTITEM) {
+ QStringList effdata = QStringList() << "typewriter" << QString::number(typewriter_delay->value()) + ';' + QString::number(typewriter_start->value());
+ item->setData(100, effdata);
+ }
+ break;
+#if QT_VERSION >= 0x040600
+ // Do not remove the non-QGraphicsEffects.
+ case BLUREFFECT:
+ item->setGraphicsEffect(new QGraphicsBlurEffect());
+ break;
+ case SHADOWEFFECT:
+ item->setGraphicsEffect(new QGraphicsDropShadowEffect());
+ break;
+#endif
+ }
+ }
+}
+
+void TitleWidget::slotFontText(const QString& s)
+{
+ const QFont f(s);
+ if (f.exactMatch()) {
+ // Font really exists (could also just be a «d» if the user
+ // starts typing «dejavu» for example).
+ font_family->setCurrentFont(f);
+ }
+ // Note: Typing dejavu serif does not recognize the font (takes sans)
+ // in older Qt versions. Case must match there (except for first letter)
+}
+
+void TitleWidget::slotEditTypewriter(int /*ix*/)
+{
+ QList<QGraphicsItem*> l = graphicsView->scene()->selectedItems();
+ if (l.size() == 1) {
+ QStringList effdata = QStringList() << "typewriter" << QString::number(typewriter_delay->value()) + ';' + QString::number(typewriter_start->value());
+ l[0]->setData(100, effdata);
+ }
+}
+
+void TitleWidget::slotEditBlur(int ix)
+{
+#if QT_VERSION < 0x040600
+ return;
+#else
+ QList<QGraphicsItem*> l = graphicsView->scene()->selectedItems();
+ if (l.size() == 1) {
+ QGraphicsEffect *eff = l[0]->graphicsEffect();
+ QGraphicsBlurEffect *blur = static_cast <QGraphicsBlurEffect *>(eff);
+ if (blur) blur->setBlurRadius(ix);
+ }
+#endif
+}
+
+void TitleWidget::slotEditShadow()
+{
+#if QT_VERSION < 0x040600
+ return;
+#else
+ QList<QGraphicsItem*> l = graphicsView->scene()->selectedItems();
+ if (l.size() == 1) {
+ QGraphicsEffect *eff = l[0]->graphicsEffect();
+ QGraphicsDropShadowEffect *shadow = static_cast <QGraphicsDropShadowEffect *>(eff);
+ if (shadow) {
+ shadow->setBlurRadius(shadow_radius->value());
+ shadow->setOffset(shadow_x->value(), shadow_y->value());
+ }
+ }
+#endif
+}
+
+qreal TitleWidget::zIndexBounds(bool maxBound, bool intersectingOnly)
+{
+ qreal bound = maxBound ? -99 : 99;
+ QList<QGraphicsItem*> l = graphicsView->scene()->selectedItems();
+ if (l.size() > 0) {
+ QList<QGraphicsItem*> lItems;
+ // Get items (all or intersecting only)
+ if (intersectingOnly) {
+ lItems = graphicsView->scene()->items(l[0]->sceneBoundingRect(), Qt::IntersectsItemShape);
+ } else {
+ lItems = graphicsView->scene()->items();
+ }
+ if (lItems.size() > 0) {
+ int n = lItems.size();
+ qreal z;
+ if (maxBound) {
+ for (int i = 0; i < n; ++i) {
+ z = lItems[i]->zValue();
+ if (z > bound && !lItems[i]->isSelected()) {
+ bound = z;
+ } else if (z - 1 > bound) {
+ // To get the maximum index even if it is of an item of the current selection.
+ // Used when updating multiple items, to get all to the same level.
+ // Otherwise, the maximum would stay at -99 if the highest item is in the selection.
+ bound = z - 1;
+ }
+ }
+ } else {
+ // Get minimum z index.
+ for (int i = 0; i < n; ++i) {
+ z = lItems[i]->zValue();
+ if (z < bound && !lItems[i]->isSelected() && z > -999) {
+ // There are items at the very bottom (background e.g.) with z-index < -1000.
+ bound = z;
+ } else if (z + 1 < bound && z > -999) {
+ bound = z + 1;
+ }
+ }
+ }
+ }
+ }
+ return bound;
+}
+
+void TitleWidget::slotZIndexUp()
+{
+ QList<QGraphicsItem*> l = graphicsView->scene()->selectedItems();
+ if (l.size() >= 1) {
+ qreal currentZ = l[0]->zValue();
+ qreal max = zIndexBounds(true, true);
+ if (currentZ <= max) {
+ l[0]->setZValue(currentZ + 1);
+ updateDimension(l[0]);
+ }
+ }
+}
+
+void TitleWidget::slotZIndexTop()
+{
+ QList<QGraphicsItem*> l = graphicsView->scene()->selectedItems();
+ qreal max = zIndexBounds(true, false);
+ std::cout << "Max z-index is " << max << ".\n";
+ for (int i = 0; i < l.size(); ++i) {
+ qreal currentZ = l[i]->zValue();
+ if (currentZ <= max) {
+ std::cout << "Updating item " << i << ", is " << currentZ << ".\n";
+ l[i]->setZValue(max + 1);
+ } else {
+ std::cout << "Not updating " << i << ", is " << currentZ << ".\n";
+ }
+ }
+ // Update the z index value in the GUI
+ if (l.size() > 0) {
+ updateDimension(l[0]);
+ }
+}
+
+void TitleWidget::slotZIndexDown()
+{
+ QList<QGraphicsItem*> l = graphicsView->scene()->selectedItems();
+ if (l.size() >= 1) {
+ qreal currentZ = l[0]->zValue();
+ qreal min = zIndexBounds(false, true);
+ if (currentZ >= min) {
+ l[0]->setZValue(currentZ - 1);
+ updateDimension(l[0]);
+ }
+ }
+}
+
+void TitleWidget::slotZIndexBottom()
+{
+ QList<QGraphicsItem*> l = graphicsView->scene()->selectedItems();
+ qreal min = zIndexBounds(false, false);
+ for (int i = 0; i < l.size(); ++i) {
+ qreal currentZ = l[i]->zValue();
+ if (currentZ >= min) {
+ l[i]->setZValue(min - 1);
+ }
+ }
+ // Update the z index value in the GUI
+ if (l.size() > 0) {
+ updateDimension(l[0]);
+ }
+}
+
+void TitleWidget::slotSelectAll()
+{
+ QList<QGraphicsItem*> l = graphicsView->scene()->items();
+ for (int i = 0; i < l.size(); ++i) {
+ l.at(i)->setSelected(true);
+ }
+}
+
+void TitleWidget::selectItems(int itemType)
+{
+ QList<QGraphicsItem*> l;
+ if (graphicsView->scene()->selectedItems().size() > 0) {
+ l = graphicsView->scene()->selectedItems();
+ for (int i = 0; i < l.size(); ++i) {
+ if (l.at(i)->type() != itemType) {
+ l.at(i)->setSelected(false);
+ }
+ }
+ } else {
+ l = graphicsView->scene()->items();
+ for (int i = 0; i < l.size(); ++i) {
+ if (l.at(i)->type() == itemType) {
+ l.at(i)->setSelected(true);
+ }
+ }
+ }
+}
+
+void TitleWidget::slotSelectText()
+{
+ selectItems(TEXTITEM);
+}
+
+void TitleWidget::slotSelectRects()
+{
+ selectItems(RECTITEM);
+}
+
+void TitleWidget::slotSelectImages()
+{
+ selectItems(IMAGEITEM);
+}
+
+void TitleWidget::slotSelectNone()
+{
+ graphicsView->blockSignals(true);
+ QList<QGraphicsItem*> l = graphicsView->scene()->items();
+ for (int i = 0; i < l.size(); ++i) {
+ l.at(i)->setSelected(false);
+ }
+ graphicsView->blockSignals(false);
+ selectionChanged();
+}
+
+QString TitleWidget::getTooltipWithShortcut(const QString &text, QAction *button)
+{
+ return text + " <b>" + button->shortcut().toString() + "</b>";
+}
+
+void TitleWidget::prepareTools(QGraphicsItem *referenceItem)
+{
+ // Let some GUI elements block signals. We may want to change their values without any sideeffects.
+ // Additionally, store the previous blocking state to avoid side effects when this function is called from within another one.
+ // Note: Disabling an element also blocks signals. So disabled elements don't need to be set to blocking too.
+ bool blockOX = origin_x_left->signalsBlocked();
+ bool blockOY = origin_y_top->signalsBlocked();
+ bool blockEff = effect_list->signalsBlocked();
+ bool blockRX = itemrotatex->signalsBlocked();
+ bool blockRY = itemrotatey->signalsBlocked();
+ bool blockRZ = itemrotatez->signalsBlocked();
+ bool blockZoom = itemzoom->signalsBlocked();
+ bool blockX = value_x->signalsBlocked();
+ bool blockY = value_y->signalsBlocked();
+ bool blockW = value_w->signalsBlocked();
+ bool blockH = value_h->signalsBlocked();
+ origin_x_left->blockSignals(true);
+ origin_y_top->blockSignals(true);
+ effect_list->blockSignals(true);
+ itemrotatex->blockSignals(true);
+ itemrotatey->blockSignals(true);
+ itemrotatez->blockSignals(true);
+ itemzoom->blockSignals(true);
+ value_x->blockSignals(true);
+ value_y->blockSignals(true);
+ value_w->blockSignals(true);
+ value_h->blockSignals(true);
+
+ if (referenceItem == NULL) {
+ std::cout << "NULL item.\n";
+ effect_stack->setHidden(true);
+ effect_frame->setEnabled(false);
+ effect_list->setCurrentIndex(0);
+ origin_x_left->setChecked(false);
+ origin_y_top->setChecked(false);
+ updateTextOriginX();
+ updateTextOriginY();
+ enableToolbars(TITLE_SELECT);
+ showToolbars(TITLE_SELECT);
+
+ itemzoom->setEnabled(false);
+ itemrotatex->setEnabled(false);
+ itemrotatey->setEnabled(false);
+ itemrotatez->setEnabled(false);
+ frame_properties->setEnabled(false);
+ } else {
+ effect_frame->setEnabled(true);
+ frame_properties->setEnabled(true);
+ if (referenceItem != m_startViewport && referenceItem != m_endViewport) {
+ itemzoom->setEnabled(true);
+ itemrotatex->setEnabled(true);
+ itemrotatey->setEnabled(true);
+ itemrotatez->setEnabled(true);
+ } else {
+ itemzoom->setEnabled(false);
+ itemrotatex->setEnabled(false);
+ itemrotatey->setEnabled(false);
+ itemrotatez->setEnabled(false);
+ updateInfoText();
+ }
+ if (referenceItem->type() == TEXTITEM) {
+ showToolbars(TITLE_TEXT);
+ QGraphicsTextItem* i = static_cast <QGraphicsTextItem *>(referenceItem);
+ if (!i->toPlainText().isEmpty()) {
+ // We have an existing text item selected
+ if (!i->data(100).isNull()) {
+ // Item has an effect
+ QStringList effdata = i->data(100).toStringList();
+ QString effectName = effdata.takeFirst();
+ if (effectName == "typewriter") {
+ QStringList params = effdata.at(0).split(';');
+ typewriter_delay->setValue(params.at(0).toInt());
+ typewriter_start->setValue(params.at(1).toInt());
+ effect_list->setCurrentIndex(effect_list->findData((int) TYPEWRITEREFFECT));
+ effect_stack->setHidden(false);
+ }
+ } else {
+#if QT_VERSION >= 0x040600
+ if (i->graphicsEffect()) {
+ QGraphicsBlurEffect *blur = static_cast <QGraphicsBlurEffect *>(i->graphicsEffect());
+ if (blur) {
+ effect_list->setCurrentIndex(effect_list->findData((int) BLUREFFECT));
+ int rad = (int) blur->blurRadius();
+ blur_radius->setValue(rad);
+ effect_stack->setHidden(false);
+ } else {
+ QGraphicsDropShadowEffect *shad = static_cast <QGraphicsDropShadowEffect *>(i->graphicsEffect());
+ if (shad) {
+ effect_list->setCurrentIndex(effect_list->findData((int) SHADOWEFFECT));
+ shadow_radius->setValue(shad->blurRadius());
+ shadow_x->setValue(shad->xOffset());
+ shadow_y->setValue(shad->yOffset());
+ effect_stack->setHidden(false);
+ }
+ }
+ } else {
+ effect_list->setCurrentIndex(effect_list->findData((int) NOEFFECT));
+ effect_stack->setHidden(true);
+ }
+#else
+ effect_list->setCurrentIndex(effect_list->findData((int) NOEFFECT));
+ effect_stack->setHidden(true);
+#endif
+ }
+ font_size->blockSignals(true);
+ font_family->blockSignals(true);
+ font_weight_box->blockSignals(true);
+ buttonItalic->blockSignals(true);
+ buttonUnder->blockSignals(true);
+ fontColorButton->blockSignals(true);
+#if not KDE_IS_VERSION(4,5,0)
+ textAlpha->blockSignals(true);
+#endif
+ buttonAlignLeft->blockSignals(true);
+ buttonAlignRight->blockSignals(true);
+ buttonAlignNone->blockSignals(true);
+ buttonAlignCenter->blockSignals(true);
+
+ QFont font = i->font();
+ font_family->setCurrentFont(font);
+ font_size->setValue(font.pixelSize());
+ m_scene->slotUpdateFontSize(font.pixelSize());
+ buttonItalic->setChecked(font.italic());
+ buttonUnder->setChecked(font.underline());
+ setFontBoxWeight(font.weight());
+
+ QTextCursor cursor(i->document());
+ cursor.select(QTextCursor::Document);
+ QColor color = cursor.charFormat().foreground().color();
+#if not KDE_IS_VERSION(4,5,0)
+ textAlpha->setValue(color.alpha());
+ color.setAlpha(255);
+#endif
+ fontColorButton->setColor(color);
+
+ if (!i->data(101).isNull()) {
+ textOutline->blockSignals(true);
+ textOutline->setValue(i->data(101).toDouble() * 10);
+ textOutline->blockSignals(false);
+ }
+ if (!i->data(102).isNull()) {
+ textOutlineColor->blockSignals(true);
+ QVariant variant = i->data(102);
+ color = variant.value<QColor>();
+#if not KDE_IS_VERSION(4,5,0)
+ textOutlineAlpha->blockSignals(true);
+ textOutlineAlpha->setValue(color.alpha());
+ color.setAlpha(255);
+ textOutlineAlpha->blockSignals(false);
+#endif
+ textOutlineColor->setColor(color);
+ textOutlineColor->blockSignals(false);
+ }
+ QTextCursor cur = i->textCursor();
+ QTextBlockFormat format = cur.blockFormat();
+ if (i->textWidth() == -1) buttonAlignNone->setChecked(true);
+ else if (format.alignment() == Qt::AlignHCenter) buttonAlignCenter->setChecked(true);
+ else if (format.alignment() == Qt::AlignRight) buttonAlignRight->setChecked(true);
+ else if (format.alignment() == Qt::AlignLeft) buttonAlignLeft->setChecked(true);
+
+ font_size->blockSignals(false);
+ font_family->blockSignals(false);
+ font_weight_box->blockSignals(false);
+ buttonItalic->blockSignals(false);
+ buttonUnder->blockSignals(false);
+ fontColorButton->blockSignals(false);
+#if not KDE_IS_VERSION(4,5,0)
+ textAlpha->blockSignals(false);
+#endif
+ buttonAlignLeft->blockSignals(false);
+ buttonAlignRight->blockSignals(false);
+ buttonAlignNone->blockSignals(false);
+ buttonAlignCenter->blockSignals(false);
+
+ // mbt 1607: Select text if the text item is an unchanged template item.
+ if (i->property("isTemplate").isValid()) {
+ cur.setPosition(0, QTextCursor::MoveAnchor);
+ cur.select(QTextCursor::Document);
+ i->setTextCursor(cur);
+ // Make text editable now.
+ i->grabKeyboard();
+ i->setTextInteractionFlags(Qt::TextEditorInteraction);
+ }
+ }
+
+ updateAxisButtons(i);
+ updateCoordinates(i);
+ updateDimension(i);
+ enableToolbars(TITLE_TEXT);
+
+ } else if ((referenceItem)->type() == RECTITEM) {
+ showToolbars(TITLE_RECTANGLE);
+ settingUp = true;
+ QGraphicsRectItem *rec = static_cast <QGraphicsRectItem *>(referenceItem);
+ if (rec == m_startViewport || rec == m_endViewport) {
+ /*toolBox->setCurrentIndex(3);
+ toolBox->widget(0)->setEnabled(false);
+ toolBox->widget(1)->setEnabled(false);*/
+ enableToolbars(TITLE_SELECT);
+ } else {
+ /*toolBox->widget(0)->setEnabled(true);
+ toolBox->widget(1)->setEnabled(true);
+ toolBox->setCurrentIndex(0);*/
+ //toolBox->setItemEnabled(3, true);
+#if not KDE_IS_VERSION(4,5,0)
+ rectFAlpha->setValue(rec->pen().color().alpha());
+ rectBAlpha->setValue(rec->brush().color().alpha());
+#endif
+ //kDebug() << rec->brush().color().alpha();
+ QColor fcol = rec->pen().color();
+ QColor bcol = rec->brush().color();
+ //fcol.setAlpha(255);
+ //bcol.setAlpha(255);
+ rectFColor->setColor(fcol);
+ rectBColor->setColor(bcol);
+ settingUp = false;
+ rectLineWidth->setValue(rec->pen().width());
+ enableToolbars(TITLE_RECTANGLE);
+ }
+
+ updateAxisButtons(referenceItem);
+ updateCoordinates(rec);
+ updateDimension(rec);
+
+ } else if (referenceItem->type() == IMAGEITEM) {
+ showToolbars(TITLE_IMAGE);
+
+ updateCoordinates(referenceItem);
+ updateDimension(referenceItem);
+
+ enableToolbars(TITLE_IMAGE);
+
+ } else {
+ //toolBox->setCurrentIndex(0);
+ showToolbars(TITLE_SELECT);
+ enableToolbars(TITLE_SELECT);
+ frame_properties->setEnabled(false);
+ }
+ zValue->setValue((int)referenceItem->zValue());
+ if (!referenceItem->data(ZOOMFACTOR).isNull()) itemzoom->setValue(referenceItem->data(ZOOMFACTOR).toInt());
+ else itemzoom->setValue((int)(m_transformations.value(referenceItem).scalex * 100.0 + 0.5));
+ itemrotatex->setValue((int)(m_transformations.value(referenceItem).rotatex));
+ itemrotatey->setValue((int)(m_transformations.value(referenceItem).rotatey));
+ itemrotatez->setValue((int)(m_transformations.value(referenceItem).rotatez));
+ }
+