next iteration of changes to handle time domain bounces as undoable (GUI)
This commit is contained in:
parent
076cb86912
commit
7c029f5f6a
|
@ -468,6 +468,7 @@ Editor::Editor ()
|
|||
, quantize_dialog (0)
|
||||
, _main_menu_disabler (0)
|
||||
, _tempo_edit_behavior (UIConfiguration::instance().get_tempo_edit_behavior())
|
||||
, domain_bounce_info (nullptr)
|
||||
{
|
||||
/* we are a singleton */
|
||||
|
||||
|
@ -3674,6 +3675,7 @@ Editor::begin_reversible_selection_op (string name)
|
|||
void
|
||||
Editor::abort_reversible_selection_op ()
|
||||
{
|
||||
PBD::stacktrace (std::cerr, 20);
|
||||
if (!_session) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1761,7 +1761,7 @@ private:
|
|||
void mid_tempo_per_region_update (RegionView*);
|
||||
bool ignore_map_change;
|
||||
|
||||
Temporal::TempoMap::WritableSharedPtr begin_tempo_mapping (PBD::Command**);
|
||||
Temporal::TempoMap::WritableSharedPtr begin_tempo_mapping (Temporal::DomainBounceInfo&);
|
||||
void abort_tempo_mapping ();
|
||||
void commit_tempo_mapping (Temporal::TempoMap::WritableSharedPtr&);
|
||||
|
||||
|
@ -2556,6 +2556,8 @@ private:
|
|||
clear_tempo_markers_after (Temporal::timepos_t (0), false);
|
||||
}
|
||||
|
||||
Temporal::DomainBounceInfo* domain_bounce_info;
|
||||
|
||||
friend class Drag;
|
||||
friend class RegionCutDrag;
|
||||
friend class RegionDrag;
|
||||
|
|
|
@ -3545,7 +3545,6 @@ MappingEndDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
XMLNode& after = map->get_state ();
|
||||
|
||||
_editor->session ()->add_command (new Temporal::TempoCommand (_("stretch tempo"), _before_state, &after));
|
||||
_editor->commit_reversible_command ();
|
||||
|
||||
/* 2nd argument means "update tempo map display after the new map is
|
||||
* installed. We need to do this because the code above has not
|
||||
|
@ -3554,6 +3553,8 @@ MappingEndDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
*/
|
||||
|
||||
_editor->commit_tempo_mapping (map);
|
||||
|
||||
_editor->commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3656,8 +3657,8 @@ MappingTwistDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
XMLNode& after = map->get_state ();
|
||||
|
||||
_editor->session ()->add_command (new Temporal::TempoCommand (_("twist tempo"), _before_state, &after));
|
||||
_editor->commit_reversible_command ();
|
||||
_editor->commit_tempo_mapping (map);
|
||||
_editor->commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -3012,8 +3012,8 @@ Editor::choose_mapping_drag (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
return;
|
||||
}
|
||||
|
||||
PBD::Command* swap_undo_command;
|
||||
Temporal::TempoMap::WritableSharedPtr map = begin_tempo_mapping (&swap_undo_command);
|
||||
domain_bounce_info = new Temporal::DomainBounceInfo (Temporal::BeatTime, Temporal::AudioTime);
|
||||
Temporal::TempoMap::WritableSharedPtr map = begin_tempo_mapping (*domain_bounce_info);
|
||||
|
||||
/* Decide between a mid-twist, which we do if the
|
||||
* pointer is between two tempo markers, and an end-stretch,
|
||||
|
@ -3104,7 +3104,6 @@ Editor::choose_mapping_drag (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
|
||||
if (at_end) {
|
||||
begin_reversible_command (_("tempo mapping: end-stretch"));
|
||||
_session->add_command (swap_undo_command);
|
||||
std::cerr << "END STRETCH\n";
|
||||
_drags->set (new MappingEndDrag (this, item, map, tempo, *focus, *before_state), event);
|
||||
return;
|
||||
|
@ -3113,13 +3112,11 @@ Editor::choose_mapping_drag (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
if (before && focus && after) {
|
||||
std::cerr << "TWIST\n";
|
||||
begin_reversible_command (_("tempo mapping: mid-twist"));
|
||||
_session->add_command (swap_undo_command);
|
||||
_drags->set (new MappingTwistDrag (this, item, map, *before, *focus, *after, *before_state, ramped), event);
|
||||
} else if (ramped && focus && after) {
|
||||
/* special case 4: user is manipulating a beat line after the INITIAL tempo marker, so there is no prior marker*/
|
||||
std::cerr << "TWIST ON START\n";
|
||||
begin_reversible_command (_("tempo mapping: mid-twist"));
|
||||
_session->add_command (swap_undo_command);
|
||||
before = focus; /* this is unused in MappingTwistDrag, when ramped is true, but let's not pass in garbage */
|
||||
_drags->set (new MappingTwistDrag (this, item, map, *before, *focus, *after, *before_state, ramped), event);
|
||||
} else {
|
||||
|
|
|
@ -711,7 +711,7 @@ Editor::edit_tempo_section (TempoPoint& section)
|
|||
tmc.map().replace_bartime (replacement);
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!tpp) {
|
||||
/* first tempo, cannot move */
|
||||
|
@ -813,21 +813,20 @@ Editor::real_remove_meter_marker (Temporal::MeterPoint const * section)
|
|||
|
||||
|
||||
Temporal::TempoMap::WritableSharedPtr
|
||||
Editor::begin_tempo_mapping (PBD::Command** cmd)
|
||||
Editor::begin_tempo_mapping (Temporal::DomainBounceInfo& dbi)
|
||||
{
|
||||
TempoMap::WritableSharedPtr wmap = TempoMap::write_copy ();
|
||||
TempoMap::set (wmap);
|
||||
TempoMap::set (wmap);
|
||||
reassociate_metric_markers (wmap);
|
||||
(void) Temporal::DomainSwapInformation::start (Temporal::BeatTime);
|
||||
*cmd = _session->globally_change_time_domain (Temporal::BeatTime, Temporal::AudioTime);
|
||||
_session->start_domain_bounce (dbi);
|
||||
return wmap;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::abort_tempo_mapping ()
|
||||
{
|
||||
delete domain_swap; /* undo the domain swap */
|
||||
domain_swap = 0;
|
||||
delete domain_bounce_info;
|
||||
domain_bounce_info = nullptr;
|
||||
|
||||
TempoMap::abort_update ();
|
||||
TempoMap::SharedPtr tmap (TempoMap::fetch());
|
||||
|
@ -838,8 +837,14 @@ void
|
|||
Editor::commit_tempo_mapping (TempoMap::WritableSharedPtr& new_map)
|
||||
{
|
||||
TempoMap::update (new_map);
|
||||
delete domain_swap; /* undo the domain swap */
|
||||
domain_swap = 0;
|
||||
|
||||
/* revert all positions */
|
||||
|
||||
_session->finish_domain_bounce (*domain_bounce_info);
|
||||
|
||||
delete domain_bounce_info;
|
||||
domain_bounce_info = nullptr;
|
||||
|
||||
TempoMap::SharedPtr tmap (TempoMap::fetch());
|
||||
reassociate_metric_markers (tmap);
|
||||
}
|
||||
|
|
|
@ -528,7 +528,7 @@ public:
|
|||
_commit_tempo_map_edit (map, with_update);
|
||||
}
|
||||
|
||||
virtual Temporal::TempoMap::WritableSharedPtr begin_tempo_mapping (PBD::Command**) = 0;
|
||||
virtual Temporal::TempoMap::WritableSharedPtr begin_tempo_mapping (Temporal::DomainBounceInfo&) = 0;
|
||||
virtual void abort_tempo_mapping () = 0;
|
||||
virtual void commit_tempo_mapping (Temporal::TempoMap::WritableSharedPtr& map) = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user