summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-12-10 16:01:20 +0100
committerRobin Gareus <robin@gareus.org>2016-12-10 21:30:30 +0100
commit914224f808a5611029434c55855448c82053d0f8 (patch)
tree14076135e03d828e96778dca0799ba2309280973
parent1468e270defc24de767e86118d0210480fad27b9 (diff)
Add editor actions to set tempo and meter
-rw-r--r--gtk2_ardour/editor.h3
-rw-r--r--gtk2_ardour/editor_actions.cc18
-rw-r--r--gtk2_ardour/main_clock.h2
3 files changed, 22 insertions, 1 deletions
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<ARDOUR::MeterSection*>(&_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<ARDOUR::TempoSection*>(&_session->tempo_map().tempo_section_at_frame (ARDOUR_UI::instance()->primary_clock->absolute_time()));
+ edit_tempo_section (ts);
+}
+
RefPtr<RadioAction>
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);