From 09b3fec6024a3b654ac5fc48c56417ff561a6832 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Thu, 11 Sep 2008 20:56:54 +0000 Subject: [PATCH] Allow selecting clip under timeline cursor svn path=/branches/KDE4/; revision=2396 --- src/clipitem.cpp | 8 ++++---- src/customtrackview.cpp | 7 +++---- src/definitions.h | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/clipitem.cpp b/src/clipitem.cpp index 339843f3..f68a62c3 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -481,7 +481,7 @@ void ClipItem::paint(QPainter *painter, /*QPainterPath path = m_clipType == AV ? roundRectPathLower : resultClipPath;*/ QRectF mappedRect; if (m_clipType == AV) { - QRectF re = br; + QRectF re = br; re.setTop(re.y() + re.height() / 2); mappedRect = painter->matrix().mapRect(re); //painter->fillRect(mappedRect, QBrush(QColor(200, 200, 200, 140))); @@ -492,9 +492,9 @@ void ClipItem::paint(QPainter *painter, audioThumbCachePic.clear(); double cropLeft = m_cropStart.frames(m_fps); const int clipStart = mappedRect.x(); - const int mappedStartPixel = painter->matrix().map(QPointF(startpixel + cropLeft, 0)).x() - clipStart; - const int mappedEndPixel = painter->matrix().map(QPointF(endpixel + cropLeft, 0)).x() - clipStart; - cropLeft = cropLeft * scale; + const int mappedStartPixel = painter->matrix().map(QPointF(startpixel + cropLeft, 0)).x() - clipStart; + const int mappedEndPixel = painter->matrix().map(QPointF(endpixel + cropLeft, 0)).x() - clipStart; + cropLeft = cropLeft * scale; emit prepareAudioThumb(scale, mappedStartPixel, mappedEndPixel, channels); diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 18e8e241..66838e1b 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -88,7 +88,6 @@ CustomTrackView::CustomTrackView(KdenliveDoc *doc, CustomTrackScene* projectscen setContentsMargins(0, 0, 0, 0); if (projectscene) { m_cursorLine = projectscene->addLine(0, 0, 0, m_tracksHeight); - m_cursorLine->setFlags(QGraphicsItem::ItemIsMovable); m_cursorLine->setZValue(1000); } @@ -565,7 +564,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event) { if (m_dragItem && m_dragItem->type() == AVWIDGET) emit clipItemSelected((ClipItem*) m_dragItem); else emit clipItemSelected(NULL); - if (m_operationMode == NONE) QGraphicsView::mousePressEvent(event); + if (m_dragItem && m_operationMode == NONE) QGraphicsView::mousePressEvent(event); if (m_selectionGroup) { // delete selection group @@ -1061,9 +1060,9 @@ Qt::DropActions CustomTrackView::supportedDropActions() const { } void CustomTrackView::setDuration(int duration) { - kDebug() << "///////////// PRO DUR: " << duration << ", SCALE. " << (m_projectDuration + 500) << ", height: " << 50 * m_scene->m_tracksList.count(); + if (duration > sceneRect().width()) + setSceneRect(0, 0, (duration + 100), sceneRect().height()); m_projectDuration = duration; - setSceneRect(0, 0, (m_projectDuration + 100), sceneRect().height()); } int CustomTrackView::duration() const { diff --git a/src/definitions.h b/src/definitions.h index 5626552b..80f10581 100644 --- a/src/definitions.h +++ b/src/definitions.h @@ -25,8 +25,8 @@ #include "gentime.h" -#define FRAME_SIZE 90 -#define MAXCLIPDURATION 15000 +const int FRAME_SIZE = 90; +const int MAXCLIPDURATION = 15000; enum OPERATIONTYPE { NONE = 0, MOVE = 1, RESIZESTART = 2, RESIZEEND = 3, FADEIN = 4, FADEOUT = 5, TRANSITIONSTART = 6, TRANSITIONEND = 7, MOVEGUIDE = 8, KEYFRAME = 9}; enum CLIPTYPE { UNKNOWN = 0, AUDIO = 1, VIDEO = 2, AV = 3, COLOR = 4, IMAGE = 5, TEXT = 6, SLIDESHOW = 7, VIRTUAL = 8, PLAYLIST = 9, FOLDER = 10}; -- 2.39.2