Add editor actions to set tempo and meter

This commit is contained in:
Robin Gareus 2016-12-10 16:01:20 +01:00
parent 1468e270de
commit 914224f808
3 changed files with 22 additions and 1 deletions

View File

@ -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 ();

View File

@ -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)
{

View File

@ -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);