[vlmc-devel] Timeline: Implement basic linked clips resizing

Hugo Beauzée-Luyssen git at videolan.org
Sun Oct 30 02:02:09 CEST 2016


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sun Oct 30 00:18:01 2016 +0200| [805479f066ec4bfcf32a1a07b1c3f94d78691f77] | committer: Hugo Beauzée-Luyssen

Timeline: Implement basic linked clips resizing

> https://code.videolan.org/videolan/vlmc/commit/805479f066ec4bfcf32a1a07b1c3f94d78691f77
---

 src/Gui/timeline/Clip.qml | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/Gui/timeline/Clip.qml b/src/Gui/timeline/Clip.qml
index a1297ee..3a87b6a 100644
--- a/src/Gui/timeline/Clip.qml
+++ b/src/Gui/timeline/Clip.qml
@@ -57,7 +57,12 @@ Rectangle {
 
     function resize() {
         // This function updates Backend
-        workflow.resizeClip( uuid, begin, end, position )
+        var _length = selectedClips.length;
+        for ( var i = _length - 1; i >= 0; --i ) {
+            if ( selectedClips[i] ) {
+                workflow.resizeClip( selectedClips[i].uuid, begin, end, position );
+            }
+        }
     }
 
     function selectLinkedClip() {
@@ -82,6 +87,21 @@ Rectangle {
         thumbnailSource = "image://thumbnail/" + libraryUuid + "/" + pos;
     }
 
+    function resizeLinkedClips( oldPos, oldBegin, oldEnd ) {
+        if ( !linkedClip )
+            return;
+        var lc = findClipItem( linkedClip );
+        if ( lc === null )
+            return;
+        // Don't resize from the begining if the clips didn't shared the same begin position
+        if ( lc.position === oldPos ) {
+            lc.position = position;
+            lc.begin = begin;
+        }
+        if ( lc.end === oldEnd )
+            lc.end = end;
+    }
+
     onXChanged: {
         if ( sView.width - initPosOfCursor < width )
             return;
@@ -268,6 +288,9 @@ Rectangle {
             if ( dragArea.pressed === true ) {
                 // Handle resizing
                 if ( resizing === true ) {
+                    var oldPos = position;
+                    var oldBegin = begin;
+                    var oldEnd = end;
                     if ( mouseX < width / 2 ) {
                         var newPos = position + ptof( mouseX );
                         var newBegin = begin + ptof( mouseX );
@@ -282,6 +305,7 @@ Rectangle {
                             return;
                         end = newEnd;
                     }
+                    resizeLinkedClips(oldPos, oldBegin, oldEnd);
                 }
             }
             else {



More information about the Vlmc-devel mailing list