Fix timeline menu copy/paste

parent 53ba4307
......@@ -21,7 +21,10 @@ Menu {
MenuItem {
text: i18n('Copy')
onTriggered: root.copiedClip = clipId
onTriggered: {
root.copiedClip = clipId
timeline.copyItem()
}
}
MenuItem {
visible: canBeGrouped
......
......@@ -36,7 +36,10 @@ Menu {
MenuItem {
visible: true
text: i18n('Copy')
onTriggered: root.copiedClip = clipId
onTriggered: {
root.copiedClip = clipId
timeline.copyItem()
}
}
MenuItem {
text: i18n('Remove')
......
......@@ -366,9 +366,7 @@ Rectangle {
text: i18n('Paste')
visible: copiedClip != -1
onTriggered: {
var track = Logic.getTrackIdFromPos(menu.clickedY - ruler.height + scrollView.flickableItem.contentY)
var frame = Math.floor((menu.clickedX + scrollView.flickableItem.contentX) / timeline.scaleFactor)
timeline.pasteItem(copiedClip, track, frame)
timeline.pasteItem()
}
}
OLD.MenuItem {
......
......@@ -550,19 +550,10 @@ void TimelineController::copyItem()
m_root->setProperty("copiedClip", clipId);
}
bool TimelineController::pasteItem(int clipId, int tid, int position)
bool TimelineController::pasteItem()
{
// TODO: copy multiple clips / groups
if (clipId == -1) {
clipId = m_root->property("copiedClip").toInt();
if (clipId == -1) {
return -1;
}
}
if (tid == -1 && position == -1) {
tid = getMouseTrack();
position = getMousePos();
}
int tid = getMouseTrack();
int position = getMousePos();
if (tid == -1) {
tid = m_activeTrack;
}
......@@ -658,8 +649,6 @@ bool TimelineController::pasteItem(int clipId, int tid, int position)
m_model->m_groups->fromJsonWithOffset(groupsData, tracksMap, position - offset);
pCore->pushUndo(undo, redo, i18n("Paste clips"));
return true;
//return TimelineFunctions::requestItemCopy(m_model, clipId, tid, position);
return false;
}
void TimelineController::triggerAction(const QString &name)
......
......@@ -158,7 +158,7 @@ public:
*/
Q_INVOKABLE bool ungroupClips(int clipId);
Q_INVOKABLE void copyItem();
Q_INVOKABLE bool pasteItem(int clipId = -1, int tid = -1, int position = -1);
Q_INVOKABLE bool pasteItem();
/* @brief Request inserting a new composition in timeline (dragged from compositions list)
@param tid is the destination track
@param position is the timeline position
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment