void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
RegionSelection get_regions_from_selection_and_mouse (framepos_t);
+ void mouse_add_new_tempo_event (framepos_t where);
+ void mouse_add_new_meter_event (framepos_t where);
+ void edit_tempo_section (ARDOUR::TempoSection*);
+ void edit_meter_section (ARDOUR::MeterSection*);
+
protected:
void map_transport_state ();
void map_position_change (framepos_t);
#include "ardour_ui.h"
#include "main_clock.h"
+#include "public_editor.h"
#include "i18n.h"
+#include "ardour/tempo.h"
+
using namespace Gtk;
MainClock::MainClock (
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
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 ());
+}
+
#include "audio_clock.h"
-/** A simple subclass of AudioClock that adds the `display delta to edit cursor' option to its context menu */
+/** A simple subclass of AudioClock that adds a few things to its context menu:
+ * `display delta to edit cursor' and edit/change tempo/meter
+ */
class MainClock : public AudioClock
{
public:
- MainClock (const std::string &, bool, const std::string &, bool, bool, bool primary, bool duration = false, bool with_info = false);
+ MainClock (const std::string& clock_name, bool is_transient, const std::string& widget_name,
+ bool editable, bool follows_playhead, bool primary, bool duration = false, bool with_info = false);
private:
+ // Editor *_editor;
+
void build_ops_menu ();
void display_delta_to_edit_cursor ();
+ void edit_current_tempo ();
+ void edit_current_meter ();
+ void insert_new_tempo ();
+ void insert_new_meter ();
bool _primary;
};
virtual void get_regionviews_by_id (PBD::ID const id, RegionSelection & regions) const = 0;
virtual void get_per_region_note_selection (std::list<std::pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > > >&) const = 0;
+ virtual void mouse_add_new_tempo_event (framepos_t where) = 0;
+ virtual void mouse_add_new_meter_event (framepos_t where) = 0;
+ virtual void edit_tempo_section (ARDOUR::TempoSection*) = 0;
+ virtual void edit_meter_section (ARDOUR::MeterSection*) = 0;
+
/// Singleton instance, set up by Editor::Editor()
static PublicEditor* _instance;