/*** Olive - Non-Linear Video Editor Copyright (C) 2019 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ***/ #include "widget/timelineview/timelineview.h" TimelineView::RippleTool::RippleTool(TimelineView* parent) : PointerTool(parent) { SetMovementAllowed(false); } void TimelineView::RippleTool::MouseReleaseInternal(QMouseEvent *event) { Q_UNUSED(event) if (parent()->ghost_items_.isEmpty()) { return; } // Retrieve cursor position difference QPointF scene_pos = GetScenePos(event->pos()); QPointF movement = scene_pos - drag_start_; // For ripple operations, all ghosts will be moving the same way olive::timeline::MovementMode movement_mode = parent()->ghost_items_.first()->mode(); // The amount to ripple by rational ripple_length = parent()->SceneToTime(movement.x()); QList blocks_to_ripple; // Find earliest point to ripple around foreach (TimelineViewGhostItem* ghost, parent()->ghost_items_) { Block* b = Node::ValueToPtr(ghost->data(0)); blocks_to_ripple.append(b); } parent()->timeline_node_->RippleBlocks(blocks_to_ripple, ripple_length, movement_mode); } rational TimelineView::RippleTool::FrameValidateInternal(rational time_movement, QVector ghosts) { // FIXME: Validate rippling return PointerTool::FrameValidateInternal(time_movement, ghosts); }