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
9d7abcda
Commit
9d7abcda
authored
Jun 06, 2019
by
Jean-Baptiste Mardelle
Browse files
Allow resizing item start/end on clip in current track if no item is selected
Fixes #232
parent
3282e56a
Pipeline
#4088
passed with stage
in 28 minutes and 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/mainwindow.cpp
View file @
9d7abcda
...
...
@@ -1303,13 +1303,11 @@ void MainWindow::setupActions()
QIcon
::
fromTheme
(
QStringLiteral
(
"edit-delete"
)),
Qt
::
Key_Delete
);
QAction
*
resizeStart
=
new
QAction
(
QIcon
(),
i18n
(
"Resize Item Start"
),
this
);
addAction
(
QStringLiteral
(
"resize_timeline_clip_start"
),
resizeStart
,
Qt
::
Key_1
,
clipActionCategory
);
resizeStart
->
setEnabled
(
false
);
addAction
(
QStringLiteral
(
"resize_timeline_clip_start"
),
resizeStart
,
Qt
::
Key_1
);
connect
(
resizeStart
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
slotResizeItemStart
);
QAction
*
resizeEnd
=
new
QAction
(
QIcon
(),
i18n
(
"Resize Item End"
),
this
);
addAction
(
QStringLiteral
(
"resize_timeline_clip_end"
),
resizeEnd
,
Qt
::
Key_2
,
clipActionCategory
);
resizeEnd
->
setEnabled
(
false
);
addAction
(
QStringLiteral
(
"resize_timeline_clip_end"
),
resizeEnd
,
Qt
::
Key_2
);
connect
(
resizeEnd
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
slotResizeItemEnd
);
QAction
*
pasteEffects
=
addAction
(
QStringLiteral
(
"paste_effects"
),
i18n
(
"Paste Effects"
),
this
,
SLOT
(
slotPasteEffects
()),
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
9d7abcda
...
...
@@ -626,6 +626,7 @@ void TimelineController::setInPoint()
int
cursorPos
=
timelinePosition
();
const
auto
selection
=
m_model
->
getCurrentSelection
();
bool
selectionFound
=
false
;
if
(
!
selection
.
empty
())
{
for
(
int
id
:
selection
)
{
int
start
=
m_model
->
getItemPosition
(
id
);
...
...
@@ -634,6 +635,26 @@ void TimelineController::setInPoint()
}
int
size
=
start
+
m_model
->
getItemPlaytime
(
id
)
-
cursorPos
;
m_model
->
requestItemResize
(
id
,
size
,
false
,
true
,
0
,
false
);
selectionFound
=
true
;
}
}
if
(
!
selectionFound
)
{
if
(
m_activeTrack
>=
0
)
{
int
cid
=
m_model
->
getClipByPosition
(
m_activeTrack
,
cursorPos
);
if
(
cid
<
0
)
{
// Check first item after timeline position
int
maximumSpace
=
m_model
->
getTrackById_const
(
m_activeTrack
)
->
getBlankEnd
(
cursorPos
);
if
(
maximumSpace
<
INT_MAX
)
{
cid
=
m_model
->
getClipByPosition
(
m_activeTrack
,
maximumSpace
+
1
);
}
}
if
(
cid
>=
0
)
{
int
start
=
m_model
->
getItemPosition
(
cid
);
if
(
start
!=
cursorPos
)
{
int
size
=
start
+
m_model
->
getItemPlaytime
(
cid
)
-
cursorPos
;
m_model
->
requestItemResize
(
cid
,
size
,
false
,
true
,
0
,
false
);
}
}
}
}
}
...
...
@@ -652,6 +673,7 @@ void TimelineController::setOutPoint()
}
int
cursorPos
=
timelinePosition
();
const
auto
selection
=
m_model
->
getCurrentSelection
();
bool
selectionFound
=
false
;
if
(
!
selection
.
empty
())
{
for
(
int
id
:
selection
)
{
int
start
=
m_model
->
getItemPosition
(
id
);
...
...
@@ -660,6 +682,24 @@ void TimelineController::setOutPoint()
}
int
size
=
cursorPos
-
start
;
m_model
->
requestItemResize
(
id
,
size
,
true
,
true
,
0
,
false
);
selectionFound
=
true
;
}
}
if
(
!
selectionFound
)
{
if
(
m_activeTrack
>=
0
)
{
int
cid
=
m_model
->
getClipByPosition
(
m_activeTrack
,
cursorPos
);
if
(
cid
<
0
)
{
// Check first item after timeline position
int
minimumSpace
=
m_model
->
getTrackById_const
(
m_activeTrack
)
->
getBlankStart
(
cursorPos
);
cid
=
m_model
->
getClipByPosition
(
m_activeTrack
,
qMax
(
0
,
minimumSpace
-
1
));
}
if
(
cid
>=
0
)
{
int
start
=
m_model
->
getItemPosition
(
cid
);
if
(
start
+
m_model
->
getItemPlaytime
(
cid
)
!=
cursorPos
)
{
int
size
=
cursorPos
-
start
;
m_model
->
requestItemResize
(
cid
,
size
,
true
,
true
,
0
,
false
);
}
}
}
}
}
...
...
Write
Preview
Supports
Markdown
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