KIcon razorIcon("edit-cut");
m_razorCursor = QCursor(razorIcon.pixmap(22, 22));
+ verticalScrollBar()->setTracking(true);
+ connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(slotRefreshGuides()));
}
CustomTrackView::~CustomTrackView() {
m_commandStack->push(command);
updateEffect(m_tracksList.count() - item->track(), item->startPos(), item->selectedEffect(), item->selectedEffectIndex());
}
- } else {
+ } else if (m_dragItem) {
ClipDurationDialog d(m_dragItem, m_document->timecode(), this);
if (d.exec() == QDialog::Accepted) {
if (d.startPos() != m_dragItem->startPos()) {
}
}
}
+ } else {
+ QList<QGraphicsItem *> collisionList = items(event->pos());
+ if (collisionList.count() == 1 && collisionList.at(0)->type() == GUIDEITEM) {
+ Guide *editGuide = (Guide *) collisionList.at(0);
+ if (editGuide) slotEditGuide(editGuide->info());
+ }
}
}
return;
}
m_document->renderer()->mltUpdateTransition(oldTransition.attribute("tag"), transition.attribute("tag"), transition.attribute("transition_btrack").toInt(), m_tracksList.count() - transition.attribute("transition_atrack").toInt(), item->startPos(), item->endPos(), transition);
+ item->setTransitionParameters(transition);
m_document->setModified(true);
}
}
void CustomTrackView::moveCursorPos(int delta) {
+ if (m_cursorPos + delta < 0) delta = 0 - m_cursorPos;
emit cursorMoved((int)(m_cursorPos * m_scale), (int)((m_cursorPos + delta) * m_scale));
m_cursorPos += delta;
m_cursorLine->setPos(m_cursorPos * m_scale, 0);
m_dragGuide->setFlag(QGraphicsItem::ItemIsMovable, false);
EditGuideCommand *command = new EditGuideCommand(this, m_dragGuide->position(), m_dragGuide->label(), GenTime(m_dragGuide->pos().x() / m_scale, m_document->fps()), m_dragGuide->label(), false);
m_commandStack->push(command);
- m_dragGuide->update(GenTime(m_dragGuide->pos().x() / m_scale, m_document->fps()));
+ m_dragGuide->updateGuide(GenTime(m_dragGuide->pos().x() / m_scale, m_document->fps()));
m_dragGuide = NULL;
m_dragItem = NULL;
return;
}
}
setCursorPos((int) res.frames(m_document->fps()));
+ checkScrolling();
}
void CustomTrackView::slotSeekToNextSnap() {
}
}
setCursorPos((int) res.frames(m_document->fps()));
+ checkScrolling();
+}
+
+void CustomTrackView::clipStart() {
+ QList<QGraphicsItem *> itemList = scene()->selectedItems();
+ for (int i = 0; i < itemList.count(); i++) {
+ if (itemList.at(i)->type() == AVWIDGET) {
+ ClipItem *item = (ClipItem *) itemList.at(i);
+ setCursorPos((int) item->startPos().frames(m_document->fps()));
+ checkScrolling();
+ break;
+ }
+ }
+}
+
+void CustomTrackView::clipEnd() {
+ QList<QGraphicsItem *> itemList = scene()->selectedItems();
+ for (int i = 0; i < itemList.count(); i++) {
+ if (itemList.at(i)->type() == AVWIDGET) {
+ ClipItem *item = (ClipItem *) itemList.at(i);
+ setCursorPos((int) item->endPos().frames(m_document->fps()));
+ checkScrolling();
+ break;
+ }
+ }
}
void CustomTrackView::slotAddClipMarker() {
if (oldPos > GenTime() && pos > GenTime()) {
// move guide
for (int i = 0; i < m_guides.count(); i++) {
- kDebug() << "// LOOKING FOR GUIDE (" << i << "): " << m_guides.at(i)->position().frames(25) << ", LOOK: " << oldPos.frames(25) << "x" << pos.frames(25);
if (m_guides.at(i)->position() == oldPos) {
Guide *item = m_guides.at(i);
- item->update(pos, comment);
- item->updatePosition(m_scale);
+ item->updateGuide(pos, comment);
break;
}
}
}
void CustomTrackView::slotAddGuide() {
- if (addGuide(GenTime(m_cursorPos, m_document->fps()), i18n("guide"))) {
- EditGuideCommand *command = new EditGuideCommand(this, GenTime(), QString(), GenTime(m_cursorPos, m_document->fps()), i18n("guide"), false);
+ CommentedTime marker(GenTime(m_cursorPos, m_document->fps()), i18n("Guide"));
+ MarkerDialog d(NULL, marker, m_document->timecode(), this);
+ if (d.exec() != QDialog::Accepted) return;
+ if (addGuide(d.newMarker().time(), d.newMarker().comment())) {
+ EditGuideCommand *command = new EditGuideCommand(this, GenTime(), QString(), d.newMarker().time(), d.newMarker().comment(), false);
+ m_commandStack->push(command);
+ }
+}
+
+void CustomTrackView::slotEditGuide() {
+ GenTime pos = GenTime(m_cursorPos, m_document->fps());
+ bool found = false;
+ for (int i = 0; i < m_guides.count(); i++) {
+ if (m_guides.at(i)->position() == pos) {
+ slotEditGuide(m_guides.at(i)->info());
+ found = true;
+ break;
+ }
+ }
+ if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
+}
+
+void CustomTrackView::slotEditGuide(CommentedTime guide) {
+ MarkerDialog d(NULL, guide, m_document->timecode(), this);
+ if (d.exec() == QDialog::Accepted) {
+ EditGuideCommand *command = new EditGuideCommand(this, guide.time(), guide.comment(), d.newMarker().time(), d.newMarker().comment(), true);
m_commandStack->push(command);
}
}
+
void CustomTrackView::slotDeleteGuide() {
GenTime pos = GenTime(m_cursorPos, m_document->fps());
bool found = false;
verticalScrollBar()->setValue(vert);
}
+void CustomTrackView::slotRefreshGuides() {
+ if (KdenliveSettings::showmarkers()) {
+ kDebug() << "// refresh GUIDES";
+ for (int i = 0; i < m_guides.count(); i++) {
+ m_guides.at(i)->update();
+ }
+ }
+}
+
void CustomTrackView::drawBackground(QPainter * painter, const QRectF & rect) {
QRect rectInView = viewport()->rect();
rectInView.moveTo(horizontalScrollBar()->value(), verticalScrollBar()->value());
void CustomTrackView::initSearchStrings() {
m_searchPoints.clear();
-
QList<QGraphicsItem *> itemList = items();
for (int i = 0; i < itemList.count(); i++) {
+ // parse all clip names
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
GenTime start = item->startPos();
CommentedTime t(start, item->clipName());
m_searchPoints.append(t);
-
+ // add all clip markers
QList < CommentedTime > markers = item->commentedSnapMarkers();
m_searchPoints += markers;
}
}
+
+ // add guides
+ for (int i = 0; i < m_guides.count(); i++) {
+ m_searchPoints.append(m_guides.at(i)->info());
+ }
+
+ qSort(m_searchPoints);
}
void CustomTrackView::clearSearchStrings() {