engine: timeline panel core edit commands migrate to the facade (part 1)
- new batch primitives: split_clips (link-preserving, single undo command), delete_clips (gap replace + optional ripple with explicit region support), ripple_delete_range, marker_add_ex with color - razor/split-at-playhead, clip delete, ripple-to-point, track delete, and the non-dialog marker path now issue facade commands instead of the app's own undo command classes - batch operations deliberately produce one undo command per user action (deleting twenty clips is one entry, not twenty); selection and transition removal stay UI-side as documented leftovers
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "common/current.h"
|
||||
#include "dialog/markerproperties/markerpropertiesdialog.h"
|
||||
#include "node/project/sequence/sequence.h"
|
||||
#include "oakengine/timeline.h"
|
||||
#include "timeline/timelineundoworkarea.h"
|
||||
#include "widget/timeruler/timeruler.h"
|
||||
|
||||
@@ -751,17 +752,35 @@ void TimeBasedWidget::set_marker()
|
||||
color, TimeRange(get_connected_node()->get_playhead(),
|
||||
get_connected_node()->get_playhead()));
|
||||
|
||||
bool edited_in_dialog = false;
|
||||
if (OAK_CONFIG("SetNameWithMarker").toBool()) {
|
||||
MarkerPropertiesDialog mpd({ marker }, timebase(), this);
|
||||
if (mpd.exec() != QDialog::Accepted) {
|
||||
delete marker;
|
||||
marker = nullptr;
|
||||
} else {
|
||||
edited_in_dialog = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (marker) {
|
||||
Core::instance()->undo_stack()->push(
|
||||
new MarkerAddCommand(markers, marker), tr("Added Marker"));
|
||||
if (edited_in_dialog) {
|
||||
// The dialog pushed undo commands referencing this exact
|
||||
// marker object, so it must be the one added to the list.
|
||||
Core::instance()->undo_stack()->push(
|
||||
new MarkerAddCommand(markers, marker), tr("Added Marker"));
|
||||
} else {
|
||||
// Pristine marker: add through the liboakengine C ABI
|
||||
// facade (one undoable command) and drop the temporary.
|
||||
oakengine_sequence_marker_add_ex(
|
||||
reinterpret_cast<OakEngineSequence *>(
|
||||
get_connected_node()),
|
||||
Timecode::time_to_timestamp(marker->time().in(),
|
||||
timebase(),
|
||||
Timecode::k_round),
|
||||
"", marker->color());
|
||||
delete marker;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user