http://www.kdenlive.org:80/mantis/view.php?id=501
svn path=/branches/KDE4/; revision=2815
emit displayMessage(i18n("You must be in an empty space to remove space (time=%1, track:%2)", m_document->timecode().getTimecodeFromFrames(mapToScene(m_menuPosition).x()), track), ErrorMessage);
return;
}
emit displayMessage(i18n("You must be in an empty space to remove space (time=%1, track:%2)", m_document->timecode().getTimecodeFromFrames(mapToScene(m_menuPosition).x()), track), ErrorMessage);
return;
}
- int length = m_document->renderer()->mltGetSpaceLength(pos, m_document->tracksCount() - track);
+ int length = m_document->renderer()->mltGetSpaceLength(pos, m_document->tracksCount() - track, true);
//kDebug() << "// GOT LENGT; " << length;
if (length <= 0) {
emit displayMessage(i18n("You must be in an empty space to remove space (time=%1, track:%2)", m_document->timecode().getTimecodeFromFrames(mapToScene(m_menuPosition).x()), track), ErrorMessage);
//kDebug() << "// GOT LENGT; " << length;
if (length <= 0) {
emit displayMessage(i18n("You must be in an empty space to remove space (time=%1, track:%2)", m_document->timecode().getTimecodeFromFrames(mapToScene(m_menuPosition).x()), track), ErrorMessage);
kDebug() << "---------------- ERROR, CANNOT find clip to resize at... "; // << startPos;
return;
}
kDebug() << "---------------- ERROR, CANNOT find clip to resize at... "; // << startPos;
return;
}
+ bool snap = KdenliveSettings::snaptopoints();
+ KdenliveSettings::setSnaptopoints(false);
if (resizeClipStart) {
ItemInfo clipinfo = item->info();
clipinfo.track = m_document->tracksCount() - clipinfo.track;
if (resizeClipStart) {
ItemInfo clipinfo = item->info();
clipinfo.track = m_document->tracksCount() - clipinfo.track;
} else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
}
m_document->renderer()->doRefresh();
} else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
}
m_document->renderer()->doRefresh();
+ KdenliveSettings::setSnaptopoints(snap);
}
void CustomTrackView::updateClipFade(ClipItem * item, bool updateFadeOut) {
}
void CustomTrackView::updateClipFade(ClipItem * item, bool updateFadeOut) {
ItemInfo endInfo = clip->info();
endInfo.startPos = GenTime(m_cursorPos, m_document->fps());
if (endInfo.startPos >= startInfo.endPos) {
ItemInfo endInfo = clip->info();
endInfo.startPos = GenTime(m_cursorPos, m_document->fps());
if (endInfo.startPos >= startInfo.endPos) {
- // Check for invalid resize
+ // Check for invalid resize
emit displayMessage(i18n("Invalid action"), ErrorMessage);
return;
} else if (endInfo.startPos < startInfo.startPos) {
emit displayMessage(i18n("Invalid action"), ErrorMessage);
return;
} else if (endInfo.startPos < startInfo.startPos) {
- int length = m_document->renderer()->mltGetSpaceLength(endInfo.startPos, m_document->tracksCount() - startInfo.track);
- if (length < (startInfo.startPos - endInfo.startPos).frames(m_document->fps())) {
- emit displayMessage(i18n("Invalid action"), ErrorMessage);
- return;
- }
+ int length = m_document->renderer()->mltGetSpaceLength(endInfo.startPos, m_document->tracksCount() - startInfo.track, false);
+ if (length < (startInfo.startPos - endInfo.startPos).frames(m_document->fps())) {
+ emit displayMessage(i18n("Invalid action"), ErrorMessage);
+ return;
+ }
}
ResizeClipCommand *command = new ResizeClipCommand(this, startInfo, endInfo, true);
m_commandStack->push(command);
}
ResizeClipCommand *command = new ResizeClipCommand(this, startInfo, endInfo, true);
m_commandStack->push(command);
ItemInfo endInfo = clip->info();
endInfo.endPos = GenTime(m_cursorPos, m_document->fps());
if (endInfo.endPos <= startInfo.startPos) {
ItemInfo endInfo = clip->info();
endInfo.endPos = GenTime(m_cursorPos, m_document->fps());
if (endInfo.endPos <= startInfo.startPos) {
- // Check for invalid resize
+ // Check for invalid resize
emit displayMessage(i18n("Invalid action"), ErrorMessage);
return;
} else if (endInfo.endPos > startInfo.endPos) {
emit displayMessage(i18n("Invalid action"), ErrorMessage);
return;
} else if (endInfo.endPos > startInfo.endPos) {
- int length = m_document->renderer()->mltGetSpaceLength(endInfo.endPos, m_document->tracksCount() - startInfo.track);
- if (length < (endInfo.endPos - startInfo.endPos).frames(m_document->fps())) {
- emit displayMessage(i18n("Invalid action"), ErrorMessage);
- return;
- }
+ int length = m_document->renderer()->mltGetSpaceLength(endInfo.endPos, m_document->tracksCount() - startInfo.track, false);
+ if (length < (endInfo.endPos - startInfo.endPos).frames(m_document->fps())) {
+ emit displayMessage(i18n("Invalid action"), ErrorMessage);
+ return;
+ }
// Retrieve audio / video codec name
// Retrieve audio / video codec name
char property[200];
if (producer->get_int("video_index") > -1) {
/*if (context->duration == AV_NOPTS_VALUE) {
char property[200];
if (producer->get_int("video_index") > -1) {
/*if (context->duration == AV_NOPTS_VALUE) {
-int Render::mltGetSpaceLength(const GenTime pos, int track) {
+int Render::mltGetSpaceLength(const GenTime pos, int track, bool fromBlankStart) {
if (!m_mltProducer) {
kDebug() << "PLAYLIST NOT INITIALISED //////";
return -1;
if (!m_mltProducer) {
kDebug() << "PLAYLIST NOT INITIALISED //////";
return -1;
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
int clipIndex = trackPlaylist.get_clip_index_at(insertPos);
if (!trackPlaylist.is_blank(clipIndex)) return -1;
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
int clipIndex = trackPlaylist.get_clip_index_at(insertPos);
if (!trackPlaylist.is_blank(clipIndex)) return -1;
- return trackPlaylist.clip_length(clipIndex);
+ if (fromBlankStart) return trackPlaylist.clip_length(clipIndex);
+ return trackPlaylist.clip_length(clipIndex) + trackPlaylist.clip_start(clipIndex) - insertPos;
void mltUpdateClip(ItemInfo info, QDomElement element, Mlt::Producer *prod);
void mltCutClip(int track, GenTime position);
void mltInsertSpace(const GenTime pos, int track, const GenTime duration);
void mltUpdateClip(ItemInfo info, QDomElement element, Mlt::Producer *prod);
void mltCutClip(int track, GenTime position);
void mltInsertSpace(const GenTime pos, int track, const GenTime duration);
- int mltGetSpaceLength(const GenTime pos, int track);
+ int mltGetSpaceLength(const GenTime pos, int track, bool fromBlankStart);
bool mltResizeClipEnd(ItemInfo info, GenTime clipDuration);
bool mltResizeClipStart(ItemInfo info, GenTime diff);
bool mltMoveClip(int startTrack, int endTrack, GenTime pos, GenTime moveStart, Mlt::Producer *prod);
bool mltResizeClipEnd(ItemInfo info, GenTime clipDuration);
bool mltResizeClipStart(ItemInfo info, GenTime diff);
bool mltMoveClip(int startTrack, int endTrack, GenTime pos, GenTime moveStart, Mlt::Producer *prod);