Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
eb7c898d
Commit
eb7c898d
authored
Dec 08, 2020
by
Jean-Baptiste Mardelle
Browse files
Effectstack: select multiple keyframes by shift-click + drag (like in timeline)
parent
59cac491
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/assets/keyframes/view/keyframeview.cpp
View file @
eb7c898d
...
...
@@ -43,6 +43,8 @@ KeyframeView::KeyframeView(std::shared_ptr<KeyframeModelList> model, int duratio
,
m_zoomFactor
(
1
)
,
m_zoomStart
(
0
)
,
m_moveKeyframeMode
(
false
)
,
m_clickPoint
(
-
1
)
,
m_clickEnd
(
-
1
)
,
m_zoomHandle
(
0
,
1
)
,
m_hoverZoomIn
(
false
)
,
m_hoverZoomOut
(
false
)
...
...
@@ -237,6 +239,10 @@ void KeyframeView::mousePressEvent(QMouseEvent *event)
// mouse click in keyframes area
bool
ok
;
GenTime
position
(
pos
+
offset
,
pCore
->
getCurrentFps
());
if
(
event
->
modifiers
()
&
Qt
::
ShiftModifier
)
{
m_clickPoint
=
pos
;
return
;
}
auto
keyframe
=
m_model
->
getClosestKeyframe
(
position
,
&
ok
);
if
(
ok
&&
qAbs
(
keyframe
.
first
.
frames
(
pCore
->
getCurrentFps
())
-
pos
-
offset
)
*
m_scale
*
m_zoomFactor
<
QApplication
::
startDragDistance
())
{
m_currentKeyframeOriginal
=
keyframe
.
first
.
frames
(
pCore
->
getCurrentFps
())
-
offset
;
...
...
@@ -356,6 +362,24 @@ void KeyframeView::mouseMoveEvent(QMouseEvent *event)
}
}
}
// Rubberband selection
if
(
m_clickPoint
>=
0
)
{
m_clickEnd
=
pos
;
int
min
=
qMin
(
m_clickPoint
,
m_clickEnd
);
int
max
=
qMax
(
m_clickPoint
,
m_clickEnd
);
min
=
qMax
(
1
,
min
);
m_selectedKeyframes
.
clear
();
double
fps
=
pCore
->
getCurrentFps
();
for
(
const
auto
&
keyframe
:
*
m_model
.
get
())
{
int
pos
=
keyframe
.
first
.
frames
(
fps
)
-
offset
;
if
(
pos
>
min
&&
pos
<
max
)
{
m_selectedKeyframes
<<
pos
;
}
}
update
();
return
;
}
if
(
KdenliveSettings
::
keyframeseek
())
{
emit
seekToPos
(
pos
);
}
...
...
@@ -416,6 +440,11 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent *event)
{
Q_UNUSED
(
event
)
m_moveKeyframeMode
=
false
;
m_clickPoint
=
-
1
;
if
(
m_clickEnd
>=
0
)
{
m_clickEnd
=
-
1
;
update
();
}
if
(
m_currentKeyframe
>=
0
&&
m_currentKeyframeOriginal
!=
m_currentKeyframe
)
{
int
offset
=
pCore
->
getItemIn
(
m_model
->
getOwnerId
());
int
delta
=
m_currentKeyframe
-
m_currentKeyframeOriginal
;
...
...
@@ -639,6 +668,14 @@ void KeyframeView::paintEvent(QPaintEvent *event)
p
.
drawPolygon
(
position
);
}
}
// Rubberband
if
(
m_clickEnd
>=
0
)
{
int
min
=
(
qMin
(
m_clickPoint
,
m_clickEnd
)
*
m_scale
-
m_zoomStart
)
*
m_zoomFactor
+
m_offset
;
int
max
=
(
qMax
(
m_clickPoint
,
m_clickEnd
)
*
m_scale
-
m_zoomStart
)
*
m_zoomFactor
+
m_offset
;
p
.
setOpacity
(
0.5
);
p
.
fillRect
(
QRect
(
min
,
0
,
max
-
min
,
m_lineHeight
),
palette
().
highlight
());
p
.
setOpacity
(
1
);
}
// Zoom bar
p
.
setPen
(
Qt
::
NoPen
);
...
...
src/assets/keyframes/view/keyframeview.hpp
View file @
eb7c898d
...
...
@@ -83,6 +83,8 @@ private:
double
m_zoomFactor
;
double
m_zoomStart
;
bool
m_moveKeyframeMode
;
int
m_clickPoint
;
int
m_clickEnd
;
/** @brief The zoom factor (start, end - between 0 and 1) */
QPointF
m_zoomHandle
;
QPointF
m_lastZoomHandle
;
...
...
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