+}
+
+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);
+ itemrotate->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);
+ itemrotate->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(i18n("Start"), m_startViewport);
+ QGraphicsTextItem *t2 = new QGraphicsTextItem(i18n("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;
+ }
+}