Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
259
Issues
259
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
8f6fe0ce
Commit
8f6fe0ce
authored
Dec 22, 2020
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undo/redo on clip monitor set in/out point
parent
f265f7bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
22 deletions
+51
-22
src/monitor/monitor.cpp
src/monitor/monitor.cpp
+50
-4
src/monitor/monitorproxy.cpp
src/monitor/monitorproxy.cpp
+0
-14
src/timeline2/view/timelinecontroller.cpp
src/timeline2/view/timelinecontroller.cpp
+1
-4
No files found.
src/monitor/monitor.cpp
View file @
8f6fe0ce
...
...
@@ -774,14 +774,60 @@ void Monitor::slotLoadClipZone(const QPoint &zone)
void
Monitor
::
slotSetZoneStart
()
{
m_glMonitor
->
getControllerProxy
()
->
setZoneIn
(
m_glMonitor
->
getCurrentPos
());
checkOverlay
();
QPoint
oldZone
=
m_glMonitor
->
getControllerProxy
()
->
zone
();
int
currentIn
=
m_glMonitor
->
getCurrentPos
();
int
updatedZoneOut
=
-
1
;
if
(
currentIn
>
oldZone
.
y
())
{
updatedZoneOut
=
qMin
(
m_glMonitor
->
duration
(),
currentIn
+
(
oldZone
.
y
()
-
oldZone
.
x
()));
}
Fun
undo_zone
=
[
this
,
oldZone
,
updatedZoneOut
]()
{
m_glMonitor
->
getControllerProxy
()
->
setZoneIn
(
oldZone
.
x
());
if
(
updatedZoneOut
>
-
1
)
{
m_glMonitor
->
getControllerProxy
()
->
setZoneOut
(
oldZone
.
y
());
}
checkOverlay
();
return
true
;
};
Fun
redo_zone
=
[
this
,
currentIn
,
updatedZoneOut
]()
{
if
(
updatedZoneOut
>
-
1
)
{
m_glMonitor
->
getControllerProxy
()
->
setZoneOut
(
updatedZoneOut
);
}
m_glMonitor
->
getControllerProxy
()
->
setZoneIn
(
currentIn
);
checkOverlay
();
return
true
;
};
redo_zone
();
pCore
->
pushUndo
(
undo_zone
,
redo_zone
,
i18n
(
"Set Zone"
));
}
void
Monitor
::
slotSetZoneEnd
()
{
m_glMonitor
->
getControllerProxy
()
->
setZoneOut
(
m_glMonitor
->
getCurrentPos
()
+
1
);
checkOverlay
();
QPoint
oldZone
=
m_glMonitor
->
getControllerProxy
()
->
zone
();
int
currentOut
=
m_glMonitor
->
getCurrentPos
()
+
1
;
int
updatedZoneIn
=
-
1
;
if
(
currentOut
<
oldZone
.
x
())
{
updatedZoneIn
=
qMax
(
0
,
currentOut
-
(
oldZone
.
y
()
-
oldZone
.
x
()));
}
Fun
undo_zone
=
[
this
,
oldZone
,
updatedZoneIn
]()
{
m_glMonitor
->
getControllerProxy
()
->
setZoneOut
(
oldZone
.
y
());
if
(
updatedZoneIn
>
-
1
)
{
m_glMonitor
->
getControllerProxy
()
->
setZoneIn
(
oldZone
.
x
());
}
checkOverlay
();
return
true
;
};
Fun
redo_zone
=
[
this
,
currentOut
,
updatedZoneIn
]()
{
if
(
updatedZoneIn
>
-
1
)
{
m_glMonitor
->
getControllerProxy
()
->
setZoneIn
(
updatedZoneIn
);
}
m_glMonitor
->
getControllerProxy
()
->
setZoneOut
(
currentOut
);
checkOverlay
();
return
true
;
};
redo_zone
();
pCore
->
pushUndo
(
undo_zone
,
redo_zone
,
i18n
(
"Set Zone"
));
}
// virtual
...
...
src/monitor/monitorproxy.cpp
View file @
8f6fe0ce
...
...
@@ -140,13 +140,6 @@ void MonitorProxy::setZoneIn(int pos)
if
(
m_zoneIn
>
0
)
{
emit
removeSnap
(
m_zoneIn
);
}
if
(
pos
>
m_zoneOut
)
{
if
(
m_zoneOut
>
0
)
{
emit
removeSnap
(
m_zoneOut
-
1
);
}
m_zoneOut
=
qMin
(
q
->
duration
(),
pos
+
(
m_zoneOut
-
m_zoneIn
));
emit
addSnap
(
m_zoneOut
-
1
);
}
m_zoneIn
=
pos
;
if
(
pos
>
0
)
{
emit
addSnap
(
pos
);
...
...
@@ -160,13 +153,6 @@ void MonitorProxy::setZoneOut(int pos)
if
(
m_zoneOut
>
0
)
{
emit
removeSnap
(
m_zoneOut
-
1
);
}
if
(
pos
<
m_zoneIn
)
{
if
(
m_zoneIn
>
0
)
{
emit
removeSnap
(
m_zoneIn
);
}
m_zoneIn
=
qMax
(
0
,
pos
-
(
m_zoneOut
-
m_zoneIn
));
emit
addSnap
(
m_zoneIn
);
}
m_zoneOut
=
pos
;
if
(
pos
>
0
)
{
emit
addSnap
(
m_zoneOut
-
1
);
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
8f6fe0ce
...
...
@@ -1338,8 +1338,6 @@ void TimelineController::updateZone(const QPoint oldZone, const QPoint newZone,
emit
zoneMoved
(
m_zone
);
return
;
}
std
::
function
<
bool
(
void
)
>
undo
=
[]()
{
return
true
;
};
std
::
function
<
bool
(
void
)
>
redo
=
[]()
{
return
true
;
};
Fun
undo_zone
=
[
this
,
oldZone
]()
{
setZone
(
oldZone
,
false
);
return
true
;
...
...
@@ -1349,8 +1347,7 @@ void TimelineController::updateZone(const QPoint oldZone, const QPoint newZone,
return
true
;
};
redo_zone
();
UPDATE_UNDO_REDO_NOLOCK
(
redo_zone
,
undo_zone
,
undo
,
redo
);
pCore
->
pushUndo
(
undo
,
redo
,
i18n
(
"Set Zone"
));
pCore
->
pushUndo
(
undo_zone
,
redo_zone
,
i18n
(
"Set Zone"
));
}
void
TimelineController
::
setZoneIn
(
int
inPoint
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment