#include <QInputDialog>
+bool sortGuidesList(const Guide *g1 , const Guide *g2)
+{
+ return (*g1).position() < (*g2).position();
+}
+
+
//TODO:
// disable animation if user asked it in KDE's global settings
// http://lists.kde.org/?l=kde-commits&m=120398724717624&w=2
verticalScrollBar()->setMaximum(maxWidth);
m_cursorLine = projectscene->addLine(0, 0, 0, maxWidth);
m_cursorLine->setZValue(1000);
+ QPen pen1;
+ pen1.setWidthF(1.0);
+ pen1.setCosmetic(true);
+ m_cursorLine->setPen(pen1);
KIcon razorIcon("edit-cut");
m_razorCursor = QCursor(razorIcon.pixmap(22, 22));
pos = (br.bottom() - pos) * maxh;
m_dragItem->updateKeyFramePos(keyFramePos, pos);
}
-
+ m_animationTimer->stop();
delete m_animation;
m_animation = NULL;
delete m_visualTip;
m_visualTip = NULL;
return;
} else if (m_operationMode == MOVEGUIDE) {
+ m_animationTimer->stop();
delete m_animation;
m_animation = NULL;
delete m_visualTip;
AbstractClipItem *clip = static_cast <AbstractClipItem*>(item);
if (m_tool == RAZORTOOL) {
// razor tool over a clip, display current frame in monitor
- if (!m_blockRefresh && item->type() == AVWIDGET) {
+ if (false && /*!m_blockRefresh && */item->type() == AVWIDGET) {
//TODO: solve crash when showing frame when moving razor over clip
- //emit showClipFrame(((ClipItem *) item)->baseClip(), mappedXPos - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
+ emit showClipFrame(((ClipItem *) item)->baseClip(), mappedXPos - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
}
event->accept();
return;
// virtual
void CustomTrackView::mousePressEvent(QMouseEvent * event)
{
- //kDebug() << "mousePressEvent STARTED";
setFocus(Qt::MouseFocusReason);
m_menuPosition = QPoint();
}
if (event->modifiers() & Qt::ShiftModifier) {
+ // Rectangle selection
setDragMode(QGraphicsView::RubberBandDrag);
if (!(event->modifiers() & Qt::ControlModifier)) {
resetSelectionGroup();
}
m_blockRefresh = true;
- m_dragItem = NULL;
m_dragGuide = NULL;
bool collision = false;
QList<QGraphicsItem *> collisionList = items(m_clickEvent);
if (event->modifiers() == Qt::ControlModifier && m_tool != SPACERTOOL && collisionList.count() == 0) {
+ // Pressing Ctrl + left mouse button in an empty area scrolls the timeline
setDragMode(QGraphicsView::ScrollHandDrag);
QGraphicsView::mousePressEvent(event);
m_blockRefresh = false;
// Find first clip, transition or group under mouse (when no guides selected)
int ct = 0;
AbstractGroupItem *dragGroup = NULL;
+ AbstractClipItem *collisionClip = NULL;
+ bool found = false;
while (!m_dragGuide && ct < collisionList.count()) {
if (collisionList.at(ct)->type() == AVWIDGET || collisionList.at(ct)->type() == TRANSITIONWIDGET) {
- m_dragItem = static_cast <AbstractClipItem *>(collisionList.at(ct));
+ collisionClip = static_cast <AbstractClipItem *>(collisionList.at(ct));
+ if (collisionClip == m_dragItem) {
+ collisionClip = NULL;
+ } else m_dragItem = collisionClip;
+ found = true;
m_dragItemInfo = m_dragItem->info();
if (m_dragItem->parentItem() && m_dragItem->parentItem()->type() == GROUPWIDGET && m_dragItem->parentItem() != m_selectionGroup) {
// kDebug()<<"// KLIK FOUND GRP: "<<m_dragItem->sceneBoundingRect();
}
ct++;
}
+ if (!found) m_dragItem = NULL;
if (m_dragItem && m_dragItem->type() == TRANSITIONWIDGET) {
// update transition menu action
kDebug() << "SELELCTING ELEMENTS WITHIN =" << event->pos().x() << "/" << 1 << ", " << mapFromScene(sceneRect().width(), 0).x() - event->pos().x() << "/" << sceneRect().height();
}
+ QList <GenTime> offsetList;
for (int i = 0; i < selection.count(); i++) {
- if (selection.at(i)->type() == AVWIDGET || selection.at(i)->type() == TRANSITIONWIDGET || selection.at(i)->type() == GROUPWIDGET) {
+ if (selection.at(i)->type() == AVWIDGET || selection.at(i)->type() == TRANSITIONWIDGET) {
+ AbstractClipItem *item = static_cast<AbstractClipItem *>(selection.at(i));
+ offsetList.append(item->startPos());
+ offsetList.append(item->endPos());
selection.at(i)->setSelected(true);
}
+ if (selection.at(i)->type() == GROUPWIDGET) {
+ QList<QGraphicsItem *> children = selection.at(i)->childItems();
+ for (int j = 0; j < children.count(); j++) {
+ AbstractClipItem *item = static_cast<AbstractClipItem *>(children.at(j));
+ offsetList.append(item->startPos());
+ offsetList.append(item->endPos());
+ }
+ selection.at(i)->setSelected(true);
+ }
+ }
+
+ if (!offsetList.isEmpty()) {
+ qSort(offsetList);
+ QList <GenTime> cleandOffsetList;
+ GenTime startOffset = offsetList.takeFirst();
+ for (int k = 0; k < offsetList.size(); k++) {
+ GenTime newoffset = offsetList.at(k) - startOffset;
+ if (newoffset != GenTime() && !cleandOffsetList.contains(newoffset)) {
+ cleandOffsetList.append(newoffset);
+ }
+ }
+ updateSnapPoints(NULL, cleandOffsetList, true);
}
groupSelectedItems(true);
m_operationMode = SPACER;
} else setCursorPos((int)(mapToScene(event->x(), 0).x()));
QGraphicsView::mousePressEvent(event);
- kDebug() << "END mousePress EVENT ";
return;
}
return;
}
- if (dragGroup == NULL) updateSnapPoints(m_dragItem);
+ bool itemSelected = false;
+ if (m_dragItem->isSelected()) itemSelected = true;
+ else if (m_dragItem->parentItem() && m_dragItem->parentItem()->isSelected()) itemSelected = true;
+ else if (dragGroup && dragGroup->isSelected()) itemSelected = true;
+
+ if (event->modifiers() == Qt::ControlModifier || itemSelected == false) {
+ if (event->modifiers() != Qt::ControlModifier) {
+ m_scene->clearSelection();
+ resetSelectionGroup(false);
+ } else resetSelectionGroup();
+ dragGroup = NULL;
+ if (m_dragItem->parentItem() && m_dragItem->parentItem()->type() == GROUPWIDGET) {
+ //kDebug()<<"// KLIK FOUND GRP: "<<m_dragItem->sceneBoundingRect();
+ dragGroup = static_cast <AbstractGroupItem *>(m_dragItem->parentItem());
+ }
+ bool selected = !m_dragItem->isSelected();
+ if (dragGroup) dragGroup->setSelected(selected);
+ else m_dragItem->setSelected(selected);
+
+ groupSelectedItems();
+ ClipItem *clip = static_cast <ClipItem *>(m_dragItem);
+ updateClipTypeActions(dragGroup == NULL ? clip : NULL);
+ m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
+ }
+
+ // Update snap points
+ if (m_selectionGroup == NULL) updateSnapPoints(m_dragItem);
else {
QList <GenTime> offsetList;
- QList<QGraphicsItem *> children = dragGroup->childItems();
+ QList<QGraphicsItem *> children = m_selectionGroup->childItems();
for (int i = 0; i < children.count(); i++) {
if (children.at(i)->type() == AVWIDGET || children.at(i)->type() == TRANSITIONWIDGET) {
AbstractClipItem *item = static_cast <AbstractClipItem *>(children.at(i));
}
}
- if (m_dragItem->type() == AVWIDGET && !m_dragItem->isItemLocked()) emit clipItemSelected((ClipItem*) m_dragItem);
- else emit clipItemSelected(NULL);
-
- bool itemSelected = false;
- if (m_dragItem->isSelected()) itemSelected = true;
- else if (m_dragItem->parentItem() && m_dragItem->parentItem()->isSelected()) itemSelected = true;
- else if (dragGroup && dragGroup->isSelected()) itemSelected = true;
- if (event->modifiers() == Qt::ControlModifier || itemSelected == false) {
- resetSelectionGroup();
- if (event->modifiers() != Qt::ControlModifier) m_scene->clearSelection();
- dragGroup = NULL;
- if (m_dragItem->parentItem() && m_dragItem->parentItem()->type() == GROUPWIDGET) {
- //kDebug()<<"// KLIK FOUND GRP: "<<m_dragItem->sceneBoundingRect();
- dragGroup = static_cast <AbstractGroupItem *>(m_dragItem->parentItem());
- }
- bool selected = !m_dragItem->isSelected();
- if (dragGroup) dragGroup->setSelected(selected);
- else m_dragItem->setSelected(selected);
-
- groupSelectedItems();
- ClipItem *clip = static_cast <ClipItem *>(m_dragItem);
- updateClipTypeActions(dragGroup == NULL ? clip : NULL);
- m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
+ if (collisionClip != NULL || m_dragItem == NULL) {
+ if (m_dragItem && m_dragItem->type() == AVWIDGET && !m_dragItem->isItemLocked()) {
+ ClipItem *selected = static_cast <ClipItem*>(m_dragItem);
+ emit clipItemSelected(selected);
+ } else emit clipItemSelected(NULL);
}
// If clicked item is selected, allow move
void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
{
- kDebug() << "++++++++++++ DBL CLK";
if (m_dragItem && m_dragItem->hasKeyFrames()) {
if (m_moveOpMode == KEYFRAME) {
// user double clicked on a keyframe, open edit dialog
QDialog d(parentWidget());
Ui::KeyFrameDialog_UI view;
view.setupUi(&d);
- view.kfr_position->setText(m_document->timecode().getTimecode(GenTime(m_dragItem->selectedKeyFramePos(), m_document->fps()) - m_dragItem->cropStart(), m_document->fps()));
+ view.kfr_position->setText(m_document->timecode().getTimecode(GenTime(m_dragItem->selectedKeyFramePos(), m_document->fps()) - m_dragItem->cropStart()));
view.kfr_value->setValue(m_dragItem->selectedKeyFrameValue());
view.kfr_value->setFocus();
if (d.exec() == QDialog::Accepted) {
- int pos = m_document->timecode().getFrameCount(view.kfr_position->text(), m_document->fps());
+ int pos = m_document->timecode().getFrameCount(view.kfr_position->text());
m_dragItem->updateKeyFramePos(GenTime(pos, m_document->fps()) + m_dragItem->cropStart(), (double) view.kfr_value->value() * m_dragItem->keyFrameFactor());
- ClipItem *item = (ClipItem *)m_dragItem;
+ ClipItem *item = static_cast <ClipItem *>(m_dragItem);
QString previous = item->keyframes(item->selectedEffectIndex());
item->updateKeyframeEffect();
QString next = item->keyframes(item->selectedEffectIndex());
// add keyframe
GenTime keyFramePos = GenTime((int)(mapToScene(event->pos()).x()), m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
- ClipItem * item = (ClipItem *) m_dragItem;
+ ClipItem * item = static_cast <ClipItem *>(m_dragItem);
QString previous = item->keyframes(item->selectedEffectIndex());
item->updateKeyframeEffect();
QString next = item->keyframes(item->selectedEffectIndex());
m_selectionGroup = new AbstractGroupItem(m_document->fps());
QPoint pos;
DocClipBase *clip = m_document->getBaseClip(list.at(0));
- if (clip == NULL) kDebug() << " WARNING))))))))) CLIP NOT FOUND : " << list.at(0);
+ if (clip == NULL) {
+ kDebug() << " WARNING))))))))) CLIP NOT FOUND : " << list.at(0);
+ return;
+ }
ItemInfo info;
info.startPos = GenTime();
info.cropStart = GenTime(list.at(1).toInt(), m_document->fps());
QList <GenTime> offsetList;
for (int i = 0; i < ids.size(); ++i) {
DocClipBase *clip = m_document->getBaseClip(ids.at(i));
- if (clip == NULL) kDebug() << " WARNING))))))))) CLIP NOT FOUND : " << ids.at(i);
+ if (clip == NULL) {
+ kDebug() << " WARNING))))))))) CLIP NOT FOUND : " << ids.at(i);
+ return;
+ }
ItemInfo info;
info.startPos = start;
info.endPos = info.startPos + clip->duration();
if (strobe == 0) strobe = 1;
doChangeClipSpeed(info, speed, 1.0, strobe, clip->baseClip()->getId());
clip->addEffect(effect);
- emit clipItemSelected(clip);
+ if (clip->isSelected()) emit clipItemSelected(clip);
return;
}
- if (!m_document->renderer()->mltAddEffect(track, pos, clip->addEffect(effect)))
+ EffectsParameterList params = clip->addEffect(effect);
+ if (!m_document->renderer()->mltAddEffect(track, pos, params))
emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
- emit clipItemSelected(clip);
+ if (clip->isSelected()) emit clipItemSelected(clip);
} else emit displayMessage(i18n("Cannot find clip to add effect"), ErrorMessage);
}
int count = 0;
if (track == -1) itemList = scene()->selectedItems();
if (itemList.isEmpty()) {
- ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, track);
+ ClipItem *clip = getClipItemAt((int) pos.frames(m_document->fps()), track);
if (clip) itemList.append(clip);
else emit displayMessage(i18n("Select a clip if you want to apply an effect"), ErrorMessage);
}
kDebug() << "// REQUESTING EFFECT ON CLIP: " << pos.frames(25) << ", TRK: " << track << "SELECTED ITEMS: " << itemList.count();
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
- ClipItem *item = (ClipItem *)itemList.at(i);
+ ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
if (effect.attribute("type") == "audio") {
// Don't add audio effects on video clips
if (item->isVideoOnly() || (item->clipType() != AUDIO && item->clipType() != AV && item->clipType() != PLAYLIST)) {
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_document->tracksCount() - track);
if (clip) {
-
// Special case: speed effect
if (effect.attribute("id") == "speed") {
ItemInfo info = clip->info();
return;
}
-
-
-
EffectsParameterList effectParams = clip->getEffectArgs(effect);
if (effect.attribute("tag") == "ladspa") {
// Update the ladspa affect file
void CustomTrackView::moveEffect(int track, GenTime pos, int oldPos, int newPos)
{
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_document->tracksCount() - track);
- if (clip) {
- m_document->renderer()->mltMoveEffect(track, pos, oldPos, newPos);
+ if (clip && !clip->effectAt(newPos - 1).isNull() && !clip->effectAt(oldPos - 1).isNull()) {
QDomElement act = clip->effectAt(newPos - 1).cloneNode().toElement();
QDomElement before = clip->effectAt(oldPos - 1).cloneNode().toElement();
clip->setEffectAt(oldPos - 1, act);
clip->setEffectAt(newPos - 1, before);
+ m_document->renderer()->mltMoveEffect(track, pos, oldPos, newPos);
emit clipItemSelected(clip, newPos - 1);
- }
- setDocumentModified();
+ setDocumentModified();
+ } else emit displayMessage(i18n("Cannot move effect"), ErrorMessage);
}
void CustomTrackView::slotChangeEffectState(ClipItem *clip, int effectPos, bool disable)
{
- QDomElement effect = clip->effectAt(effectPos);
+ QDomElement effect = clip->effectAt(effectPos).cloneNode().toElement();
QDomElement oldEffect = effect.cloneNode().toElement();
-
if (effect.attribute("id") == "speed") {
if (clip) {
ItemInfo info = clip->info();
- effect.setAttribute("disabled", disable);
+ effect.setAttribute("disabled", (int) disable);
if (disable) doChangeClipSpeed(info, 1.0, clip->speed(), 1, clip->baseClip()->getId());
else {
double speed = EffectsList::parameter(effect, "speed").toDouble() / 100.0;
return;
}
}
- effect.setAttribute("disabled", disable);
+ effect.setAttribute("disabled", (int) disable);
EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldEffect, effect, effectPos, true);
m_commandStack->push(command);
setDocumentModified();;
{
if (cut) {
// cut clip
- ClipItem *item = getClipItemAt((int) info.startPos.frames(m_document->fps()) + 1, info.track);
+ ClipItem *item = getClipItemAt((int) info.startPos.frames(m_document->fps()), info.track);
if (!item || cutTime >= item->endPos() || cutTime <= item->startPos()) {
emit displayMessage(i18n("Cannot find clip to cut"), ErrorMessage);
kDebug() << "///////// ERROR CUTTING CLIP : (" << item->startPos().frames(25) << "-" << item->endPos().frames(25) << "), INFO: (" << info.startPos.frames(25) << "-" << info.endPos.frames(25) << ")" << ", CUT: " << cutTime.frames(25);
item->baseClip()->addReference();
m_document->updateClip(item->baseClip()->getId());
setDocumentModified();
- kDebug() << "///////// CUTTING CLIP RESULT: (" << item->startPos().frames(25) << "-" << item->endPos().frames(25) << "), DUP: (" << dup->startPos().frames(25) << "-" << dup->endPos().frames(25) << ")" << ", CUT: " << cutTime.frames(25);
- kDebug() << "// CUTTING CLIP dONE";
+ //kDebug() << "///////// CUTTING CLIP RESULT: (" << item->startPos().frames(25) << "-" << item->endPos().frames(25) << "), DUP: (" << dup->startPos().frames(25) << "-" << dup->endPos().frames(25) << ")" << ", CUT: " << cutTime.frames(25);
} else {
// uncut clip
return;
}
- kDebug() << "// UNCUTTING CLIPS: ITEM 1 (" << item->startPos().frames(25) << "x" << item->endPos().frames(25) << ")";
+ /*kDebug() << "// UNCUTTING CLIPS: ITEM 1 (" << item->startPos().frames(25) << "x" << item->endPos().frames(25) << ")";
kDebug() << "// UNCUTTING CLIPS: ITEM 2 (" << dup->startPos().frames(25) << "x" << dup->endPos().frames(25) << ")";
- kDebug() << "// UNCUTTING CLIPS, INFO (" << info.startPos.frames(25) << "x" << info.endPos.frames(25) << ") , CUT: " << cutTime.frames(25);;
+ kDebug() << "// UNCUTTING CLIPS, INFO (" << info.startPos.frames(25) << "x" << info.endPos.frames(25) << ") , CUT: " << cutTime.frames(25);;*/
//deleteClip(dup->info());
void CustomTrackView::slotTransitionUpdated(Transition *tr, QDomElement old)
{
- kDebug() << "TRANS UPDATE, TRACKS: " << old.attribute("transition_btrack") << ", NEW: " << tr->toXML().attribute("transition_btrack");
+ //kDebug() << "TRANS UPDATE, TRACKS: " << old.attribute("transition_btrack") << ", NEW: " << tr->toXML().attribute("transition_btrack");
EditTransitionCommand *command = new EditTransitionCommand(this, tr->track(), tr->startPos(), old, tr->toXML(), false);
m_commandStack->push(command);
setDocumentModified();
ClipItem *transitionClip = getClipItemAt(info.startPos, info.track);
if (transitionClip && transitionClip->baseClip()) {
QString size = transitionClip->baseClip()->getProperty("frame_size");
- p.setX(size.section('x', 0, 0).toInt());
+ double factor = transitionClip->baseClip()->getProperty("aspect_ratio").toDouble();
+ p.setX((int)(size.section('x', 0, 0).toInt() * factor + 0.5));
p.setY(size.section('x', 1, 1).toInt());
}
emit transitionItemSelected(item, getPreviousVideoTrack(info.track), p, true);
int tracknumber = m_document->tracksCount() - info.track - 1;
bool isLocked = m_document->trackInfoAt(tracknumber).isLocked;
if (isLocked) item->setItemLocked(true);
+ ItemInfo clipInfo = info;
+ clipInfo.track = m_document->tracksCount() - item->track();
+ if (m_document->renderer()->mltInsertClip(clipInfo, item->xml(), item->baseClip()->producer(item->track())) == -1) {
+ emit displayMessage(i18n("Cannot insert clip in timeline"), ErrorMessage);
+ }
if (item->baseClip()->isTransparent() && getTransitionItemAtStart(info.startPos, info.track) == NULL) {
// add transparency transition
- QDomElement trans = MainWindow::transitions.getEffectByTag("composite", "composite").cloneNode().toElement();
+ QDomElement trans = MainWindow::transitions.getEffectByTag("composite", "composite").cloneNode().toElement();
new AddTransitionCommand(this, info, getPreviousVideoTrack(info.track), trans, false, true, addCommand);
}
- info.track = m_document->tracksCount() - item->track();
- m_document->renderer()->mltInsertClip(info, item->xml(), item->baseClip()->producer(item->track()));
item->setSelected(true);
}
m_commandStack->push(addCommand);
else if (clip->isVideoOnly()) prod = clip->baseClip()->videoProducer();
else prod = clip->baseClip()->producer(clipinfo.track);
m_document->renderer()->mltUpdateClipProducer((int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod);
- kDebug() << "// UPDATING CLIP TO TRACK PROD: " << clipinfo.track;
}
} else if (item->type() == TRANSITIONWIDGET) {
Transition *tr = static_cast <Transition *>(item);
EditGuideCommand *command = new EditGuideCommand(this, m_dragGuide->position(), m_dragGuide->label(), newPos, m_dragGuide->label(), false);
m_commandStack->push(command);
m_dragGuide->updateGuide(GenTime(m_dragGuide->pos().x(), m_document->fps()));
+ qSort(m_guides.begin(), m_guides.end(), sortGuidesList);
m_document->syncGuides(m_guides);
}
m_dragGuide = NULL;
bool success = m_document->renderer()->mltMoveClip((int)(m_document->tracksCount() - m_dragItemInfo.track), (int)(m_document->tracksCount() - m_dragItem->track()), (int) m_dragItemInfo.startPos.frames(m_document->fps()), (int)(m_dragItem->startPos().frames(m_document->fps())), prod);
if (success) {
- kDebug() << "// get trans info";
int tracknumber = m_document->tracksCount() - item->track() - 1;
bool isLocked = m_document->trackInfoAt(tracknumber).isLocked;
if (isLocked) item->setItemLocked(true);
new MoveClipCommand(this, m_dragItemInfo, info, false, moveCommand);
// Also move automatic transitions (on lower track)
Transition *tr = getTransitionItemAtStart(m_dragItemInfo.startPos, m_dragItemInfo.track);
- kDebug() << "// get trans info2";
if (tr && tr->isAutomatic()) {
ItemInfo trInfo = tr->info();
ItemInfo newTrInfo = trInfo;
//m_document->renderer()->doRefresh();
} else if (m_operationMode == FADEIN) {
// resize fade in effect
- ClipItem * item = (ClipItem *) m_dragItem;
+ ClipItem * item = static_cast <ClipItem *>(m_dragItem);
int ix = item->hasEffect("volume", "fadein");
if (ix != -1) {
- QDomElement oldeffect = item->effectAt(ix);
+ QDomElement oldeffect = item->effectAt(ix).cloneNode().toElement();
int start = item->cropStart().frames(m_document->fps());
int end = item->fadeIn();
if (end == 0) {
}
ix = item->hasEffect("volume", "fade_from_black");
if (ix != -1) {
- QDomElement oldeffect = item->effectAt(ix);
+ QDomElement oldeffect = item->effectAt(ix).cloneNode().toElement();
int start = item->cropStart().frames(m_document->fps());
int end = item->fadeIn();
if (end == 0) {
}
} else if (m_operationMode == FADEOUT) {
// resize fade in effect
- ClipItem * item = (ClipItem *) m_dragItem;
+ ClipItem * item = static_cast <ClipItem *>(m_dragItem);
int ix = item->hasEffect("volume", "fadeout");
if (ix != -1) {
- QDomElement oldeffect = item->effectAt(ix);
+ QDomElement oldeffect = item->effectAt(ix).cloneNode().toElement();
int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
int start = item->fadeOut();
if (start == 0) {
}
ix = item->hasEffect("brightness", "fade_to_black");
if (ix != -1) {
- QDomElement oldeffect = item->effectAt(ix);
+ QDomElement oldeffect = item->effectAt(ix).cloneNode().toElement();
int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
int start = item->fadeOut();
if (start == 0) {
}
} else if (m_operationMode == KEYFRAME) {
// update the MLT effect
- ClipItem * item = (ClipItem *) m_dragItem;
+ ClipItem * item = static_cast <ClipItem *>(m_dragItem);
QString previous = item->keyframes(item->selectedEffectIndex());
item->updateKeyframeEffect();
QString next = item->keyframes(item->selectedEffectIndex());
ClipItem *transitionClip = getClipItemAt(m_dragItemInfo.startPos, m_dragItemInfo.track);
if (transitionClip && transitionClip->baseClip()) {
QString size = transitionClip->baseClip()->getProperty("frame_size");
- p.setX(size.section('x', 0, 0).toInt());
+ double factor = transitionClip->baseClip()->getProperty("aspect_ratio").toDouble();
+ p.setX((int)(size.section('x', 0, 0).toInt() * factor + 0.5));
p.setY(size.section('x', 1, 1).toInt());
}
emit transitionItemSelected(static_cast <Transition *>(m_dragItem), getPreviousVideoTrack(m_dragItem->track()), p);
ClipItem *CustomTrackView::getClipItemAt(GenTime pos, int track)
{
- int framepos = (int)(pos.frames(m_document->fps()));
- return getClipItemAt(framepos, track);
+ return getClipItemAt((int) pos.frames(m_document->fps()), track);
}
Transition *CustomTrackView::getTransitionItemAt(int pos, int track)
void CustomTrackView::moveClip(const ItemInfo start, const ItemInfo end)
{
if (m_selectionGroup) resetSelectionGroup(false);
- ClipItem *item = getClipItemAt((int) start.startPos.frames(m_document->fps()) + 1, start.track);
+ ClipItem *item = getClipItemAt((int) start.startPos.frames(m_document->fps()), start.track);
if (!item) {
emit displayMessage(i18n("Cannot move clip at time: %1 on track %2", m_document->timecode().getTimecodeFromFrames(start.startPos.frames(m_document->fps())), start.track), ErrorMessage);
kDebug() << "---------------- ERROR, CANNOT find clip to move at.. ";
m_selectionGroup->moveBy(offset.frames(m_document->fps()), trackOffset *(qreal) m_tracksHeight);
- kDebug() << "%% GRP NEW POS: " << m_selectionGroup->scenePos().x();
-
QList<QGraphicsItem *> children = m_selectionGroup->childItems();
// Expand groups
int max = children.count();
children += children.at(i)->childItems();
}
}
- kDebug() << "// GRP MOVE; FOUND CHILDREN:" << children.count();
for (int i = 0; i < children.count(); i++) {
// re-add items in correct place
ClipItem *transitionClip = getClipItemAt(item->startPos(), item->track());
if (transitionClip && transitionClip->baseClip()) {
QString size = transitionClip->baseClip()->getProperty("frame_size");
- p.setX(size.section('x', 0, 0).toInt());
+ double factor = transitionClip->baseClip()->getProperty("aspect_ratio").toDouble();
+ p.setX((int)(size.section('x', 0, 0).toInt() * factor + 0.5));
p.setY(size.section('x', 1, 1).toInt());
}
emit transitionItemSelected(item, getPreviousVideoTrack(item->track()), p);
viewport()->update();
}
-bool sortGuidesList(const Guide *g1 , const Guide *g2)
-{
- return (*g1).position() < (*g2).position();
-}
-
int CustomTrackView::hasGuide(int pos, int offset)
{
for (int i = 0; i < m_guides.count(); i++) {
void CustomTrackView::slotRefreshGuides()
{
if (KdenliveSettings::showmarkers()) {
- kDebug() << "// refresh GUIDES";
for (int i = 0; i < m_guides.count(); i++) {
m_guides.at(i)->update();
}
}
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
- ClipItem *dup = static_cast <ClipItem *>(itemList.at(i));
- m_copiedItems.append(dup->clone(dup->info()));
+ ClipItem *clip = static_cast <ClipItem *>(itemList.at(i));
+ ClipItem *clone = clip->clone(clip->info());
+ m_copiedItems.append(clone);
} else if (itemList.at(i)->type() == TRANSITIONWIDGET) {
Transition *dup = static_cast <Transition *>(itemList.at(i));
m_copiedItems.append(dup->clone());
return;
}
ClipItem *clip = static_cast < ClipItem *>(m_copiedItems.at(0));
- EffectsList effects = clip->effectList();
QUndoCommand *paste = new QUndoCommand();
paste->setText("Paste effects");
for (int i = 0; i < clips.count(); ++i) {
if (clips.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast < ClipItem *>(clips.at(i));
- for (int i = 0; i < clip->effectsCount(); i++) {
- new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), clip->effectAt(i), true, paste);
+ for (int j = 0; j < clip->effectsCount(); j++) {
+ new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), clip->effectAt(j), true, paste);
}
}
}