Logo Search packages:      
Sourcecode: kdenlive version File versions  Download package

void Gui::TrackViewMarkerDecorator::paintClip ( double  startX,
double  endX,
QPainter &  painter,
DocClipRef *  clip,
QRect &  rect,
bool  selected 
) [virtual]

This function will paint a clip on screen. This funtion must be provided by a derived class.

Parameters:
startX - The x coordinate of the start of the clip. This is not necessarily in the painting rectangle.
endX - The x coordinate of the end of the clip. This is not necessarily in the painting rectangle.
painter - The QPainter that should be used to draw.
clip - The clip that we should be drawing.
rect - The bounding rectangle of the draw area.
selected - True if the clip is selected, false otherwise.

Implements Gui::TrackViewDecorator.

Definition at line 44 of file trackviewmarkerdecorator.cpp.

References KdenliveDoc::framesPerSecond(), and KdenliveDoc::showAllMarkers().

                     {
      int sx = (int)startX;
      int ex = (int)endX;

      if (sx < rect.x()) {
          sx = rect.x();
      }
      if (ex > rect.x() + rect.width()) {
          ex = rect.x() + rect.width();
      }
      ex -= sx;
      bool showMarkers = document()->showAllMarkers();
      if (!showMarkers)
          painter.setClipRect(sx, rect.y(), ex, rect.height());

      QValueVector < CommentedTime > markers = clip->commentedTrackSnapMarkers();

      QValueVector < CommentedTime >::iterator itt = markers.begin();

      while (itt != markers.end()) {
          int x =
            (int) timeline()->mapValueToLocal(((*itt).time()).
            frames(document()->framesPerSecond()));

          if (((x >= sx - 7) && (x <= sx + ex + 7))  || showMarkers) {
            QPen currentPen = painter.pen();
            QBrush currentBrush = painter.brush();

            painter.setPen(Qt::black);
            //painter.drawLine(x, rect.y() + 6, x, rect.y() + rect.height() - 6);

            painter.drawPixmap(x - 4, rect.y() + 1, m_markerUpPixmap);
            painter.drawPixmap(x - 4, rect.y() + rect.height() - 6, m_markerDownPixmap);

            if (showMarkers) {
                // Display all markers on timeline
                QString txt = (*itt).comment();
            
                QRect textBound = painter.boundingRect(0, 0, rect.width(), rect.height(), Qt::AlignLeft, txt);

                painter.setBrush(Qt::yellow);
                //painter.setPen(QPen(Qt::black, 0, Qt::DotLine));
                painter.drawRect(x, rect.y() + 7, textBound.width() + 5, textBound.height());
                painter.setPen(Qt::black);
                  painter.drawText(x, rect.y() + 7, textBound.width() + 5, textBound.height(), Qt::AlignCenter, txt);
            }

            painter.setPen(currentPen);
            painter.setBrush(currentBrush);
          }

          ++itt;
      }

      painter.setClipping(false);
    }


Generated by  Doxygen 1.6.0   Back to index