Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
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
Show 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)
...
@@ -774,14 +774,60 @@ void Monitor::slotLoadClipZone(const QPoint &zone)
void
Monitor
::
slotSetZoneStart
()
void
Monitor
::
slotSetZoneStart
()
{
{
m_glMonitor
->
getControllerProxy
()
->
setZoneIn
(
m_glMonitor
->
getCurrentPos
());
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
();
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
()
void
Monitor
::
slotSetZoneEnd
()
{
{
m_glMonitor
->
getControllerProxy
()
->
setZoneOut
(
m_glMonitor
->
getCurrentPos
()
+
1
);
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
();
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
// virtual
...
...
src/monitor/monitorproxy.cpp
View file @
8f6fe0ce
...
@@ -140,13 +140,6 @@ void MonitorProxy::setZoneIn(int pos)
...
@@ -140,13 +140,6 @@ void MonitorProxy::setZoneIn(int pos)
if
(
m_zoneIn
>
0
)
{
if
(
m_zoneIn
>
0
)
{
emit
removeSnap
(
m_zoneIn
);
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
;
m_zoneIn
=
pos
;
if
(
pos
>
0
)
{
if
(
pos
>
0
)
{
emit
addSnap
(
pos
);
emit
addSnap
(
pos
);
...
@@ -160,13 +153,6 @@ void MonitorProxy::setZoneOut(int pos)
...
@@ -160,13 +153,6 @@ void MonitorProxy::setZoneOut(int pos)
if
(
m_zoneOut
>
0
)
{
if
(
m_zoneOut
>
0
)
{
emit
removeSnap
(
m_zoneOut
-
1
);
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
;
m_zoneOut
=
pos
;
if
(
pos
>
0
)
{
if
(
pos
>
0
)
{
emit
addSnap
(
m_zoneOut
-
1
);
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,
...
@@ -1338,8 +1338,6 @@ void TimelineController::updateZone(const QPoint oldZone, const QPoint newZone,
emit
zoneMoved
(
m_zone
);
emit
zoneMoved
(
m_zone
);
return
;
return
;
}
}
std
::
function
<
bool
(
void
)
>
undo
=
[]()
{
return
true
;
};
std
::
function
<
bool
(
void
)
>
redo
=
[]()
{
return
true
;
};
Fun
undo_zone
=
[
this
,
oldZone
]()
{
Fun
undo_zone
=
[
this
,
oldZone
]()
{
setZone
(
oldZone
,
false
);
setZone
(
oldZone
,
false
);
return
true
;
return
true
;
...
@@ -1349,8 +1347,7 @@ void TimelineController::updateZone(const QPoint oldZone, const QPoint newZone,
...
@@ -1349,8 +1347,7 @@ void TimelineController::updateZone(const QPoint oldZone, const QPoint newZone,
return
true
;
return
true
;
};
};
redo_zone
();
redo_zone
();
UPDATE_UNDO_REDO_NOLOCK
(
redo_zone
,
undo_zone
,
undo
,
redo
);
pCore
->
pushUndo
(
undo_zone
,
redo_zone
,
i18n
(
"Set Zone"
));
pCore
->
pushUndo
(
undo
,
redo
,
i18n
(
"Set Zone"
));
}
}
void
TimelineController
::
setZoneIn
(
int
inPoint
)
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