summaryrefslogtreecommitdiff
path: root/gtk2_ardour/main_clock.cc
diff options
context:
space:
mode:
authorColin Fletcher <colin.m.fletcher@googlemail.com>2015-02-03 19:25:10 +0000
committerColin Fletcher <colin.m.fletcher@googlemail.com>2015-02-12 18:06:16 +0000
commit7de6128169f5e7834c6670b2d43e944aae2dd193 (patch)
treedd0c45761bea0636bd20a9401621eca1a4c55c83 /gtk2_ardour/main_clock.cc
parentee6ecf903425f8e3821e20b43c337cb9558c74f5 (diff)
Add tempo and meter editing functions to main clock context menu
Add 'Edit Tempo/Meter' and 'Insert Tempo/Meter Change' to the main clock's context menu.
Diffstat (limited to 'gtk2_ardour/main_clock.cc')
-rw-r--r--gtk2_ardour/main_clock.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/gtk2_ardour/main_clock.cc b/gtk2_ardour/main_clock.cc
index 80dece04aa..b8bc733ea6 100644
--- a/gtk2_ardour/main_clock.cc
+++ b/gtk2_ardour/main_clock.cc
@@ -19,9 +19,12 @@
#include "ardour_ui.h"
#include "main_clock.h"
+#include "public_editor.h"
#include "i18n.h"
+#include "ardour/tempo.h"
+
using namespace Gtk;
MainClock::MainClock (
@@ -62,6 +65,12 @@ MainClock::build_ops_menu ()
c->set_active (true);
}
}
+
+ ops_items.push_back (SeparatorElem());
+ ops_items.push_back (MenuElem (_("Edit Tempo"), sigc::mem_fun(*this, &MainClock::edit_current_tempo)));
+ ops_items.push_back (MenuElem (_("Edit Meter"), sigc::mem_fun(*this, &MainClock::edit_current_meter)));
+ ops_items.push_back (MenuElem (_("Insert Tempo Change"), sigc::mem_fun(*this, &MainClock::insert_new_tempo)));
+ ops_items.push_back (MenuElem (_("Insert Meter Change"), sigc::mem_fun(*this, &MainClock::insert_new_meter)));
}
void
@@ -73,3 +82,31 @@ MainClock::display_delta_to_edit_cursor ()
ARDOUR_UI::config()->set_secondary_clock_delta_edit_cursor (!ARDOUR_UI::config()->get_secondary_clock_delta_edit_cursor ());
}
}
+
+void
+MainClock::edit_current_tempo ()
+{
+ ARDOUR::TempoSection ts = PublicEditor::instance().session()->tempo_map().tempo_section_at(current_time());
+ PublicEditor::instance().edit_tempo_section (&ts);
+}
+
+void
+MainClock::edit_current_meter ()
+{
+ ARDOUR::Meter m = PublicEditor::instance().session()->tempo_map().meter_at(current_time());
+ ARDOUR::MeterSection ms(current_time(), m.divisions_per_bar(), m.note_divisor());
+ PublicEditor::instance().edit_meter_section (&ms);
+}
+
+void
+MainClock::insert_new_tempo ()
+{
+ PublicEditor::instance().mouse_add_new_tempo_event (current_time ());
+}
+
+void
+MainClock::insert_new_meter ()
+{
+ PublicEditor::instance().mouse_add_new_meter_event (current_time ());
+}
+