if (event->button() == Qt::MidButton) {
m_document->renderer()->switchPlay();
m_blockRefresh = false;
+ m_operationMode = NONE;
return;
}
setDragMode(QGraphicsView::ScrollHandDrag);
QGraphicsView::mousePressEvent(event);
m_blockRefresh = false;
+ m_operationMode = NONE;
return;
}
setDragMode(QGraphicsView::RubberBandDrag);
QGraphicsView::mousePressEvent(event);
m_blockRefresh = false;
+ m_operationMode = RUBBERSELECTION;
return;
}
resetSelectionGroup();
if (event->modifiers() != Qt::ControlModifier) m_scene->clearSelection();
m_dragItem->setSelected(!m_dragItem->isSelected());
- QList<QGraphicsItem *> selection = m_scene->selectedItems();
- if (selection.count() > 1) {
- m_selectionGroup = new AbstractGroupItem(m_document->fps());
- scene()->addItem(m_selectionGroup);
- for (int i = 0; i < selection.count(); i++) {
- if (selection.at(i)->type() == AVWIDGET || selection.at(i)->type() == TRANSITIONWIDGET) {
- m_selectionGroup->addToGroup(selection.at(i));
- selection.at(i)->setFlags(QGraphicsItem::ItemIsSelectable);
- }
- }
- }
- if (m_selectionGroup) {
- QPointF top = m_selectionGroup->boundingRect().topLeft();
- const int width = m_selectionGroup->boundingRect().width();
- const int height = m_selectionGroup->boundingRect().height();
- m_selectionGroup->setPos(top);
- m_selectionGroup->translate(-top.x(), -top.y() + 1);
- m_selectionGroupInfo.startPos = GenTime(m_selectionGroup->scenePos().x(), m_document->fps());
- m_selectionGroupInfo.track = m_selectionGroup->track();
- }
+ groupSelectedItems();
}
m_clickPoint = QPoint((int)(mapToScene(event->pos()).x() - m_dragItem->startPos().frames(m_document->fps())), (int)(event->pos().y() - m_dragItem->pos().y()));
}
}
+void CustomTrackView::groupSelectedItems() {
+ QList<QGraphicsItem *> selection = m_scene->selectedItems();
+ if (selection.count() > 1) {
+ m_selectionGroup = new AbstractGroupItem(m_document->fps());
+ scene()->addItem(m_selectionGroup);
+ for (int i = 0; i < selection.count(); i++) {
+ if (selection.at(i)->type() == AVWIDGET || selection.at(i)->type() == TRANSITIONWIDGET) {
+ m_selectionGroup->addToGroup(selection.at(i));
+ selection.at(i)->setFlags(QGraphicsItem::ItemIsSelectable);
+ }
+ }
+
+ if (m_selectionGroup) {
+ QPointF top = m_selectionGroup->boundingRect().topLeft();
+ const int width = m_selectionGroup->boundingRect().width();
+ const int height = m_selectionGroup->boundingRect().height();
+ m_selectionGroup->setPos(top);
+ m_selectionGroup->translate(-top.x(), -top.y() + 1);
+ m_selectionGroupInfo.startPos = GenTime(m_selectionGroup->scenePos().x(), m_document->fps());
+ m_selectionGroupInfo.track = m_selectionGroup->track();
+ }
+ }
+}
+
void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event) {
kDebug() << "++++++++++++ DBL CLK";
if (m_dragItem && m_dragItem->hasKeyFrames()) {
}
void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) {
+ kDebug() << "// MOUSE RELEASED, MODE: " << m_moveOpMode;
if (m_moveOpMode == SEEK) m_moveOpMode = NONE;
QGraphicsView::mouseReleaseEvent(event);
if (m_scrollTimer.isActive()) m_scrollTimer.stop();
m_document->renderer()->mltInsertSpace(GenTime(mappedClick, m_document->fps()), track, GenTime(diff, m_document->fps()));
resetSelectionGroup();
m_operationMode = NONE;
+ } else if (m_operationMode == RUBBERSELECTION) {
+ resetSelectionGroup();
+ groupSelectedItems();
+ m_operationMode = NONE;
}
if (m_dragItem == NULL && m_selectionGroup == NULL) {
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, SEEK = 10, SPACER = 11};
+enum OPERATIONTYPE { NONE = 0, MOVE = 1, RESIZESTART = 2, RESIZEEND = 3, FADEIN = 4, FADEOUT = 5, TRANSITIONSTART = 6, TRANSITIONEND = 7, MOVEGUIDE = 8, KEYFRAME = 9, SEEK = 10, SPACER = 11, RUBBERSELECTION = 12};
enum CLIPTYPE { UNKNOWN = 0, AUDIO = 1, VIDEO = 2, AV = 3, COLOR = 4, IMAGE = 5, TEXT = 6, SLIDESHOW = 7, VIRTUAL = 8, PLAYLIST = 9, FOLDER = 10};
enum GRAPHICSRECTITEM { AVWIDGET = 70000 , LABELWIDGET , TRANSITIONWIDGET , GROUPWIDGET};