return;
}
- if (event->button() == Qt::LeftButton && collisionList.count() == 1 && collisionList.at(0)->type() == GUIDEITEM) {
- // a guide item was pressed
- collisionList.at(0)->setFlag(QGraphicsItem::ItemIsMovable, true);
- m_dragItem = NULL;
- m_dragGuide = (Guide *) collisionList.at(0);
- collision = true;
- m_operationMode = MOVEGUIDE;
- // deselect all clips so that only the guide will move
- m_scene->clearSelection();
- resetSelectionGroup();
- updateSnapPoints(NULL);
- QGraphicsView::mousePressEvent(event);
- return;
+ for (int i = 0; event->button() == Qt::LeftButton && i < collisionList.count(); ++i) {
+ // if a guide and a clip were pressed, just move the guide
+ if (collisionList.at(i)->type() == GUIDEITEM) {
+ // a guide item was pressed
+ collisionList.at(i)->setFlag(QGraphicsItem::ItemIsMovable, true);
+ m_dragItem = NULL;
+ m_dragGuide = (Guide *) collisionList.at(i);
+ collision = true;
+ m_operationMode = MOVEGUIDE;
+ // deselect all clips so that only the guide will move
+ m_scene->clearSelection();
+ resetSelectionGroup(false);
+ updateSnapPoints(NULL);
+ QGraphicsView::mousePressEvent(event);
+ return;
+ }
}
// Find first clip, transition or group under mouse
if (m_dragItem->type() == AVWIDGET && !m_dragItem->isItemLocked()) emit clipItemSelected((ClipItem*) m_dragItem);
else emit clipItemSelected(NULL);
- if (event->modifiers() != Qt::ControlModifier && (m_dragItem->isSelected() || (dragGroup && dragGroup->isSelected()))) {
- // If clicked item is selected, allow move
- if (dragGroup) dragGroup->setSelected(true);
- //event->accept();
- if (m_operationMode == NONE) QGraphicsView::mousePressEvent(event);
- } else {
+ if (event->modifiers() == Qt::ControlModifier || !(m_dragItem->isSelected() || (dragGroup && dragGroup->isSelected()))) {
resetSelectionGroup();
if (event->modifiers() != Qt::ControlModifier) m_scene->clearSelection();
dragGroup = NULL;
m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
}
+ // If clicked item is selected, allow move
+ //event->accept();
+ if (event->modifiers() != Qt::ControlModifier && (m_dragItem->isSelected() || (dragGroup && dragGroup->isSelected())) && m_operationMode == NONE) QGraphicsView::mousePressEvent(event);
+
m_clickPoint = QPoint((int)(mapToScene(event->pos()).x() - m_dragItem->startPos().frames(m_document->fps())), (int)(event->pos().y() - m_dragItem->pos().y()));
m_operationMode = m_dragItem->operationMode(mapToScene(event->pos()));
return (*g1).position() < (*g2).position();
}
+int CustomTrackView::hasGuide(int pos, int offset)
+{
+ for (int i = 0; i < m_guides.count(); i++) {
+ int guidePos = m_guides.at(i)->position().frames(m_document->fps());
+ if (qAbs(guidePos - pos) < offset) return guidePos;
+ else if (guidePos > pos) return -1;
+ }
+ return -1;
+}
+
void CustomTrackView::editGuide(const GenTime oldPos, const GenTime pos, const QString &comment)
{
if (oldPos > GenTime() && pos > GenTime()) {
}
}
-void CustomTrackView::slotEditGuide()
+void CustomTrackView::slotEditGuide(int guidePos)
{
- GenTime pos = GenTime(m_cursorPos, m_document->fps());
+ GenTime pos;
+ if (guidePos == -1) pos = GenTime(m_cursorPos, m_document->fps());
+ else pos = GenTime(guidePos, m_document->fps());
bool found = false;
for (int i = 0; i < m_guides.count(); i++) {
if (m_guides.at(i)->position() == pos) {
}
}
-void CustomTrackView::slotDeleteGuide()
+void CustomTrackView::slotDeleteGuide(int guidePos)
{
- GenTime pos = GenTime(m_cursorPos, m_document->fps());
+ GenTime pos;
+ if (guidePos == -1) pos = GenTime(m_cursorPos, m_document->fps());
+ else pos = GenTime(guidePos, m_document->fps());
bool found = false;
for (int i = 0; i < m_guides.count(); i++) {
if (m_guides.at(i)->position() == pos) {
view.track_nb->setValue(ix);
d.setWindowTitle(i18n("Change Track Type"));
+ if (m_document->trackInfoAt(m_document->tracksCount() - ix - 1).type == VIDEOTRACK)
+ view.video_track->setChecked(true);
+ else
+ view.audio_track->setChecked(true);
+
if (d.exec() == QDialog::Accepted) {
TrackInfo info;
info.isLocked = false;
break;
}
}
+ clip->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
m_document->clipManager()->removeGroup(grp);
scene()->destroyItemGroup(grp);
}