From 914224f808a5611029434c55855448c82053d0f8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 10 Dec 2016 16:01:20 +0100 Subject: [PATCH] Add editor actions to set tempo and meter --- gtk2_ardour/editor.h | 3 +++ gtk2_ardour/editor_actions.cc | 18 ++++++++++++++++++ gtk2_ardour/main_clock.h | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 57e72393fa..4b2fc8222d 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1657,6 +1657,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void edit_control_point (ArdourCanvas::Item*); void edit_notes (MidiRegionView*); + void edit_current_meter (); + void edit_current_tempo (); + void marker_menu_edit (); void marker_menu_remove (); void marker_menu_rename (); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index c9f63c02ba..44d8063af8 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -38,6 +38,7 @@ #include "editing.h" #include "editor.h" #include "gui_thread.h" +#include "main_clock.h" #include "time_axis_view.h" #include "ui_config.h" #include "utils.h" @@ -202,6 +203,9 @@ Editor::register_actions () reg_sens (editor_actions, "select-punch-range", _("Set Range to Punch Range"), sigc::mem_fun(*this, &Editor::set_selection_from_punch)); reg_sens (editor_actions, "select-from-regions", _("Set Range to Selected Regions"), sigc::mem_fun(*this, &Editor::set_selection_from_region)); + reg_sens (editor_actions, "edit-current-tempo", _("Edit Current Tempo"), sigc::mem_fun(*this, &Editor::edit_current_meter)); + reg_sens (editor_actions, "edit-current-meter", _("Edit Current Meter"), sigc::mem_fun(*this, &Editor::edit_current_tempo)); + reg_sens (editor_actions, "select-all-after-edit-cursor", _("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true, false)); reg_sens (editor_actions, "alternate-select-all-after-edit-cursor", _("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true, false)); reg_sens (editor_actions, "select-all-before-edit-cursor", _("Select All Before Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false, false)); @@ -991,6 +995,20 @@ Editor::toggle_measure_visibility () } } +void +Editor::edit_current_meter () +{ + ARDOUR::MeterSection* ms = const_cast(&_session->tempo_map().meter_section_at_frame (ARDOUR_UI::instance()->primary_clock->absolute_time())); + edit_meter_section (ms); +} + +void +Editor::edit_current_tempo () +{ + ARDOUR::TempoSection* ts = const_cast(&_session->tempo_map().tempo_section_at_frame (ARDOUR_UI::instance()->primary_clock->absolute_time())); + edit_tempo_section (ts); +} + RefPtr Editor::snap_type_action (SnapType type) { diff --git a/gtk2_ardour/main_clock.h b/gtk2_ardour/main_clock.h index 25ddff45a9..1e4cd9506c 100644 --- a/gtk2_ardour/main_clock.h +++ b/gtk2_ardour/main_clock.h @@ -29,6 +29,7 @@ class MainClock : public AudioClock { public: MainClock (const std::string& clock_name, const std::string& widget_name, bool primary); + framepos_t absolute_time () const; private: @@ -40,7 +41,6 @@ private: void edit_current_meter (); void insert_new_tempo (); void insert_new_meter (); - framepos_t absolute_time () const; bool _primary; bool on_button_press_event (GdkEventButton *ev); -- 2.30.2