From 09f834675e5535112142a9e7deb37f5c8cea7fa8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Thu, 10 May 2012 14:08:00 +0200 Subject: [PATCH] Improve manipulation of small items in timeline (Don't allow resize on very small clips) --- src/clipitem.cpp | 4 ++-- src/customtrackview.cpp | 12 ++++++++++-- src/renderwidget.cpp | 4 ---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/clipitem.cpp b/src/clipitem.cpp index 7570202b..e164959c 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -1002,11 +1002,11 @@ OPERATIONTYPE ClipItem::operationMode(QPointF pos) if (qAbs((int)(pos.x() - (rect.x() + m_startFade))) < maximumOffset && qAbs((int)(pos.y() - rect.y())) < 6) { return FADEIN; - } else if (pos.x() - rect.x() < maximumOffset && (rect.bottom() - pos.y() > addtransitionOffset)) { + } else if ((pos.x() <= rect.x() + rect.width() / 2) && pos.x() - rect.x() < maximumOffset && (rect.bottom() - pos.y() > addtransitionOffset)) { return RESIZESTART; } else if (qAbs((int)(pos.x() - (rect.x() + rect.width() - m_endFade))) < maximumOffset && qAbs((int)(pos.y() - rect.y())) < 6) { return FADEOUT; - } else if ((rect.right() - pos.x() < maximumOffset) && (rect.bottom() - pos.y() > addtransitionOffset)) { + } else if ((pos.x() >= rect.x() + rect.width() / 2) && (rect.right() - pos.x() < maximumOffset) && (rect.bottom() - pos.y() > addtransitionOffset)) { return RESIZEEND; } else if ((pos.x() - rect.x() < 16 / scale) && (rect.bottom() - pos.y() <= addtransitionOffset)) { return TRANSITIONSTART; diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 1538e679..2f08b8e7 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -621,7 +621,11 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) // all other modes break the selection, so the user probably wants to move it opMode = MOVE; } else { - opMode = clip->operationMode(mapToScene(event->pos())); + if (clip->rect().width() * transform().m11() < 15) { + // If the item is very small, only allow move + opMode = MOVE; + } + else opMode = clip->operationMode(mapToScene(event->pos())); } const double size = 5; @@ -1010,7 +1014,11 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event) // all other modes break the selection, so the user probably wants to move it m_operationMode = MOVE; } else { - m_operationMode = m_dragItem->operationMode(mapToScene(event->pos())); + if (m_dragItem->rect().width() * transform().m11() < 15) { + // If the item is very small, only allow move + m_operationMode = MOVE; + } + else m_operationMode = m_dragItem->operationMode(mapToScene(event->pos())); } m_controlModifier = (event->modifiers() == Qt::ControlModifier); diff --git a/src/renderwidget.cpp b/src/renderwidget.cpp index 23356a1b..0169ec9f 100644 --- a/src/renderwidget.cpp +++ b/src/renderwidget.cpp @@ -1919,15 +1919,11 @@ void RenderWidget::parseScriptFiles() item->setData(1, Qt::UserRole, KUrl(target).path()); item->setData(1, Qt::UserRole + 1, scriptpath.path()); } -// bool activate = false; QTreeWidgetItem *script = m_view.scripts_list->topLevelItem(0); if (script) { m_view.scripts_list->setCurrentItem(script); script->setSelected(true); -// activate = true; } -// m_view.start_script->setEnabled(activate); -// m_view.delete_script->setEnabled(activate); } void RenderWidget::slotCheckScript() -- 2.39.2