} else if (m_operationMode == RESIZESTART && move) {
double snappedPos = getSnapPointForPos(mappedXPos);
+ m_document->renderer()->pause();
m_dragItem->resizeStart((int)(snappedPos));
} else if (m_operationMode == RESIZEEND && move) {
double snappedPos = getSnapPointForPos(mappedXPos);
+ m_document->renderer()->pause();
m_dragItem->resizeEnd((int)(snappedPos));
} else if (m_operationMode == FADEIN && move) {
((ClipItem*) m_dragItem)->setFadeIn((int)(mappedXPos - m_dragItem->startPos().frames(m_document->fps())));
}
AbstractClipItem *clip = static_cast <AbstractClipItem *>(m_dragItem);
RazorClipCommand* command = new RazorClipCommand(this, clip->info(), GenTime((int)(mapToScene(event->pos()).x()), m_document->fps()), true);
+ m_document->renderer()->pause();
m_commandStack->push(command);
m_document->setModified(true);
m_dragItem = NULL;
void CustomTrackView::deleteClip(const QString &clipId) {
QList<QGraphicsItem *> itemList = items();
+ QUndoCommand *deleteCommand = new QUndoCommand();
+ deleteCommand->setText(i18n("Delete timeline clips"));
+ int count = 0;
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = (ClipItem *)itemList.at(i);
if (item->clipProducer() == clipId) {
- AddTimelineClipCommand *command = new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), item->info(), item->effectList(), true, true);
- m_commandStack->push(command);
+ count++;
+ new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), item->info(), item->effectList(), true, true, deleteCommand);
//delete item;
}
}
}
+ if (count > 0) m_commandStack->push(deleteCommand);
+ else delete deleteCommand;
}
void CustomTrackView::setCursorPos(int pos, bool seek) {
}
QUndoCommand *deleteSelected = new QUndoCommand();
deleteSelected->setText(i18n("Delete selected items"));
+ bool resetGroup = false;
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
+ if (item->parentItem()) resetGroup = true;
new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), item->info(), item->effectList(), true, true, deleteSelected);
} else if (itemList.at(i)->type() == TRANSITIONWIDGET) {
Transition *item = static_cast <Transition *>(itemList.at(i));
+ if (item->parentItem()) resetGroup = true;
ItemInfo info;
info.startPos = item->startPos();
info.endPos = item->endPos();
}
}
m_commandStack->push(deleteSelected);
+ if (resetGroup) resetSelectionGroup();
}
void CustomTrackView::changeClipSpeed() {
}
info.track = m_document->tracksCount() - item->track();
int endPos = m_document->renderer()->mltChangeClipSpeed(info, speed, oldspeed, baseclip->producer());
- kDebug() << "//CH CLIP SPEED: " << speed << "x" << oldspeed << ", END POS: " << endPos;
- item->setSpeed(speed);
- item->updateRectGeometry();
- if (item->cropDuration().frames(m_document->fps()) > endPos)
- item->AbstractClipItem::resizeEnd(info.startPos.frames(m_document->fps()) + endPos, speed);
- m_document->setModified(true);
+ if (endPos >= 0) {
+ item->setSpeed(speed);
+ item->updateRectGeometry();
+ if (item->cropDuration().frames(m_document->fps()) > endPos)
+ item->AbstractClipItem::resizeEnd(info.startPos.frames(m_document->fps()) + endPos, speed);
+ m_document->setModified(true);
+ } else emit displayMessage(i18n("Invalid clip"), ErrorMessage);
}
void CustomTrackView::cutSelectedClips() {