]> git.sesse.net Git - kdenlive/commitdiff
Allow selecting clip under timeline cursor
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 11 Sep 2008 20:56:54 +0000 (20:56 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 11 Sep 2008 20:56:54 +0000 (20:56 +0000)
svn path=/branches/KDE4/; revision=2396

src/clipitem.cpp
src/customtrackview.cpp
src/definitions.h

index 339843f3c1bb3a1e75a3a614b5c0e130fda41a6d..f68a62c3f45fc692db3703064cf6822d359b32ee 100644 (file)
@@ -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);
 
index 18e8e241ad8d739796f7dc00d43be6e845533518..66838e1b7a9f1d1e830a6bf084f9a33be1c3d493 100644 (file)
@@ -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 {
index 5626552bb0aab32b519ef7f9cfa674ba09172e22..80f10581c51cdad755a4a8c6ecef9fe4862e0629 100644 (file)
@@ -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};