X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_markers.cc;h=8723aad488b7834832e032870f0be9fac015f63f;hb=c4578db595771b5db9572b23cfe3f9a7ebef66c3;hp=f885537393a859ebdaab6eae4138c95eb4dcd55f;hpb=f41748803ad8a9069b8bd6bdda5f500d2d8bd99b;p=ardour.git diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index f885537393..8723aad488 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -741,7 +741,7 @@ Editor::remove_marker (ArdourCanvas::Item& item, GdkEvent*) Location* loc = find_location_from_marker (marker, is_start); if (_session && loc) { - Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::really_remove_marker), loc)); + Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::really_remove_marker), loc)); } } @@ -991,14 +991,28 @@ Editor::build_tempo_marker_menu (TempoMarker* loc, bool can_remove) MenuList& items = tempo_marker_menu->items(); tempo_marker_menu->set_name ("ArdourContextMenu"); - if (loc->tempo().type() == TempoSection::Ramp) { - items.push_back (MenuElem (_("Set Constant"), sigc::mem_fun(*this, &Editor::toggle_tempo_type))); + if (!loc->tempo().initial()) { + if (loc->tempo().clamped()) { + items.push_back (MenuElem (_("Unlock Continue"), sigc::mem_fun(*this, &Editor::toggle_tempo_clamped))); + } else { + items.push_back (MenuElem (_("Lock Continue"), sigc::mem_fun(*this, &Editor::toggle_tempo_clamped))); + } + + TempoSection* prev_ts = _session->tempo_map().previous_tempo_section (&loc->tempo()); + if (prev_ts && prev_ts->end_note_types_per_minute() != loc->tempo().note_types_per_minute()) { + items.push_back (MenuElem (_("Continue"), sigc::mem_fun(*this, &Editor::continue_previous_tempo))); + } } - if (_session->tempo_map().next_tempo_section (&loc->tempo())) { + TempoSection* next_ts = _session->tempo_map().next_tempo_section (&loc->tempo()); + if (next_ts && next_ts->note_types_per_minute() != loc->tempo().end_note_types_per_minute()) { items.push_back (MenuElem (_("Ramp to Next"), sigc::mem_fun(*this, &Editor::ramp_to_next_tempo))); } + if (loc->tempo().type() == TempoSection::Ramp) { + items.push_back (MenuElem (_("Set Constant"), sigc::mem_fun(*this, &Editor::toggle_tempo_type))); + } + if (loc->tempo().position_lock_style() == AudioTime && can_remove) { items.push_back (MenuElem (_("Lock to Music"), sigc::mem_fun(*this, &Editor::toggle_marker_lock_style))); } else if (can_remove) { @@ -1080,7 +1094,7 @@ Editor::marker_menu_select_using_range () bool is_start; if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) { - set_selection_from_range (*l); + set_selection_from_range (*l); } } @@ -1098,7 +1112,7 @@ Editor::marker_menu_select_all_selectables_using_range () bool is_start; if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) { - select_all_within (l->start(), l->end() - 1, 0, DBL_MAX, track_views, Selection::Set, false); + select_all_within (l->start(), l->end() - 1, 0, DBL_MAX, track_views, Selection::Set, false); } } @@ -1117,7 +1131,7 @@ Editor::marker_menu_separate_regions_using_location () bool is_start; if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) { - separate_regions_using_location (*l); + separate_regions_using_location (*l); } } @@ -1312,14 +1326,11 @@ Editor::marker_menu_loop_range () bool is_start; if ((l = find_location_from_marker (marker, is_start)) != 0) { - Location* l2; - if ((l2 = transport_loop_location()) != 0) { - l2->set (l->start(), l->end()); - - // enable looping, reposition and start rolling - _session->request_locate (l2->start(), true); - _session->request_play_loop(true); + if (l != transport_loop_location()) { + set_loop_range (l->start(), l->end(), _("loop range from marker")); } + _session->request_locate (l->start(), true); + _session->request_play_loop (true); } } @@ -1458,6 +1469,63 @@ Editor::toggle_tempo_type () commit_reversible_command (); } } +/* clamped locks the previous section end tempo to the start tempo */ +void +Editor::toggle_tempo_clamped () +{ + TempoMarker* tm; + MeterMarker* mm; + dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm); + + if (tm) { + begin_reversible_command (_("Clamp Tempo")); + XMLNode &before = _session->tempo_map().get_state(); + + TempoSection* tsp = &tm->tempo(); + TempoSection* prev = _session->tempo_map().previous_tempo_section (tsp); + + if (prev) { + /* set to the end tempo of the previous section */ + Tempo new_tempo (prev->end_note_types_per_minute(), prev->note_type(), tsp->end_note_types_per_minute()); + _session->tempo_map().gui_change_tempo (tsp, new_tempo); + } + + tsp->set_clamped (!tsp->clamped()); + + XMLNode &after = _session->tempo_map().get_state(); + _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + commit_reversible_command (); + } +} + +void +Editor::continue_previous_tempo () +{ + TempoMarker* tm; + MeterMarker* mm; + dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm); + + if (tm) { + TempoMap& tmap (_session->tempo_map()); + TempoSection* tsp = &tm->tempo(); + TempoSection* prev_ts = tmap.previous_tempo_section (&tm->tempo()); + if (prev_ts) { + const Tempo tempo (prev_ts->end_note_types_per_minute(), tsp->note_type(), tsp->end_note_types_per_minute()); + const double pulse = tsp->pulse(); + const framepos_t frame = tsp->frame(); + const PositionLockStyle pls = tsp->position_lock_style(); + + begin_reversible_command (_("continue previous tempo")); + XMLNode &before = _session->tempo_map().get_state(); + + tmap.replace_tempo (*tsp, tempo, pulse, frame, pls); + + XMLNode &after = _session->tempo_map().get_state(); + _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + commit_reversible_command (); + } + } +} void Editor::ramp_to_next_tempo () @@ -1536,11 +1604,13 @@ Editor::rename_marker(ArdourMarker *marker) loc = find_location_from_marker (marker, is_start); - if (!loc) - return; + if (!loc) { + return; + } - if (loc == transport_loop_location() || loc == transport_punch_location() || loc->is_session_range()) + if (loc == transport_loop_location() || loc == transport_punch_location() || loc->is_session_range()) { return; + } ArdourPrompter dialog (true); string txt; @@ -1658,7 +1728,7 @@ Editor::update_punch_range_view () } else { - transport_punch_range_rect->hide(); + transport_punch_range_rect->hide(); } } @@ -1679,9 +1749,9 @@ Editor::marker_selection_changed () } struct SortLocationsByPosition { - bool operator() (Location* a, Location* b) { - return a->start() < b->start(); - } + bool operator() (Location* a, Location* b) { + return a->start() < b->start(); + } }; void