, clicked_control_point (0)
, button_release_can_deselect (true)
, _mouse_changed_selection (false)
- , region_edit_menu_split_item (0)
- , region_edit_menu_split_multichannel_item (0)
- , track_region_edit_playlist_menu (0)
- , track_edit_playlist_submenu (0)
- , track_selection_edit_playlist_submenu (0)
, _popup_region_menu_item (0)
, _track_canvas (0)
, _track_canvas_viewport (0)
, meter_marker_menu (0)
, marker_menu (0)
, range_marker_menu (0)
- , transport_marker_menu (0)
, new_transport_marker_menu (0)
- , cd_marker_menu (0)
, marker_menu_item (0)
, bbt_beat_subdivision (4)
, _visible_track_count (-1)
, _stepping_axis_view (0)
, quantize_dialog (0)
, _main_menu_disabler (0)
- , myactions (X_("editor"))
{
/* we are a singleton */
/* register actions now so that set_state() can find them and set toggles/checks etc */
- register_actions ();
load_bindings ();
+ register_actions ();
setup_toolbar ();
_ignore_region_action = false;
_last_region_menu_was_main = false;
- _popup_region_menu_item = 0;
_show_marker_lines = false;
setup_fade_images ();
set_grid_to (GridTypeNone);
-
- instant_save ();
}
Editor::~Editor()
{
+ delete tempo_marker_menu;
+ delete meter_marker_menu;
+ delete marker_menu;
+ delete range_marker_menu;
+ delete new_transport_marker_menu;
+ delete editor_ruler_menu;
+ delete _popup_region_menu_item;
+
delete button_bindings;
delete _routes;
delete _route_groups;
void
Editor::instant_save ()
{
- if (!constructed || !ARDOUR_UI::instance()->session_loaded || no_save_instant) {
+ if (!constructed || !_session || no_save_instant) {
return;
}
- if (_session) {
- _session->add_instant_xml(get_state());
- } else {
- Config->add_instant_xml(get_state());
- }
+ _session->add_instant_xml(get_state());
}
void
ENSURE_GUI_THREAD (*this, &Editor::access_action, action_group, action_item)
RefPtr<Action> act;
- act = ActionManager::get_action (action_group.c_str(), action_item.c_str());
-
- if (act) {
- act->activate();
+ try {
+ act = ActionManager::get_action (action_group.c_str(), action_item.c_str());
+ if (act) {
+ act->activate();
+ }
+ } catch ( ActionManager::MissingActionException const& e) {
+ cerr << "MissingActionException:" << e.what () << endl;
}
}
case RegionViewNameHighlight:
case LeftFrameHandle:
case RightFrameHandle:
- if (!with_selection) {
- if (region_edit_menu_split_item) {
- if (clicked_regionview && clicked_regionview->region()->covers (get_preferred_edit_position())) {
- ActionManager::set_sensitive (ActionManager::edit_point_in_region_sensitive_actions, true);
- } else {
- ActionManager::set_sensitive (ActionManager::edit_point_in_region_sensitive_actions, false);
- }
- }
- if (region_edit_menu_split_multichannel_item) {
- if (clicked_regionview && clicked_regionview->region()->n_channels() > 1) {
- region_edit_menu_split_multichannel_item->set_sensitive (true);
- } else {
- region_edit_menu_split_multichannel_item->set_sensitive (false);
- }
- }
- }
break;
case SelectionItem:
/* we've just cleared the track region context menu, so the menu that these
two items were on will have disappeared; stop them dangling.
*/
- region_edit_menu_split_item = 0;
- region_edit_menu_split_multichannel_item = 0;
-
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (clicked_axisview);
if (rtv) {
edit_items.push_back (MenuElem (_("Select"), *select_menu));
/* Cut-n-Paste */
-
+#if 0 // unused, why?
Menu *cutnpaste_menu = manage (new Menu);
MenuList& cutnpaste_items = cutnpaste_menu->items();
cutnpaste_menu->set_name ("ArdourContextMenu");
cutnpaste_items.push_back (MenuElem (_("Cut"), sigc::mem_fun(*this, &Editor::cut)));
cutnpaste_items.push_back (MenuElem (_("Copy"), sigc::mem_fun(*this, &Editor::copy)));
cutnpaste_items.push_back (MenuElem (_("Paste"), sigc::bind (sigc::mem_fun(*this, &Editor::paste), 1.0f, true)));
+#endif
Menu *nudge_menu = manage (new Menu());
MenuList& nudge_items = nudge_menu->items();
void
Editor::set_edit_point_preference (EditPoint ep, bool force)
{
+ if (Profile->get_mixbus()) {
+ if (ep == EditAtSelectedMarker) {
+ ep = EditAtPlayhead;
+ }
+ }
+
bool changed = (_edit_point != ep);
_edit_point = ep;
- if (Profile->get_mixbus())
- if (ep == EditAtSelectedMarker)
- ep = EditAtPlayhead;
string str = edit_point_strings[(int)ep];
if (str != edit_point_selector.get_text ()) {
action = "edit-at-playhead";
break;
case EditAtSelectedMarker:
- action = "edit-at-marker";
+ action = "edit-at-selected-marker";
break;
case EditAtMouse:
action = "edit-at-mouse";
break;
}
- Glib::RefPtr<Action> act = ActionManager::get_action ("Editor", action);
- if (act) {
- Glib::RefPtr<RadioAction>::cast_dynamic(act)->set_active (true);
- }
+ Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action ("Editor", action);
+ tact->set_active (true);
samplepos_t foo;
bool in_track_canvas;
reset_y_origin (y_origin);
}
- if (node.get_property ("join-object-range", yn)) {
- RefPtr<Action> act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-object-range"));
- if (act) {
- RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
- tact->set_active (!yn);
- tact->set_active (yn);
- }
+ yn = false;
+ node.get_property ("join-object-range", yn);
+ {
+ RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("MouseMode"), X_("set-mouse-mode-object-range"));
+ /* do it twice to force the change */
+ tact->set_active (!yn);
+ tact->set_active (yn);
set_mouse_mode(mouse_mode, true);
}
_regions->reset_sort_type (sort_type, true);
}
- if (node.get_property ("show-editor-mixer", yn)) {
-
- Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
- assert (act);
-
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-
+ yn = false;
+ node.get_property ("show-editor-mixer", yn);
+ {
+ Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-mixer"));
/* do it twice to force the change */
-
tact->set_active (!yn);
tact->set_active (yn);
}
- if (node.get_property ("show-editor-list", yn)) {
-
- Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
- assert (act);
-
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-
+ yn = false;
+ node.get_property ("show-editor-list", yn);
+ {
+ Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-list"));
/* do it twice to force the change */
-
tact->set_active (!yn);
tact->set_active (yn);
}
_the_notebook.set_current_page (el_page);
}
- if (node.get_property (X_("show-marker-lines"), yn)) {
- Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-marker-lines"));
- assert (act);
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-
+ yn = false;
+ node.get_property (X_("show-marker-lines"), yn);
+ {
+ Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-marker-lines"));
+ /* do it twice to force the change */
tact->set_active (!yn);
tact->set_active (yn);
}
}
if (node.get_property ("maximised", yn)) {
- Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleMaximalEditor"));
- assert (act);
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
- bool fs = tact && tact->get_active();
+ Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Common"), X_("ToggleMaximalEditor"));
+ bool fs = tact->get_active();
if (yn ^ fs) {
ActionManager::do_action ("Common", "ToggleMaximalEditor");
}
* Not all properties may have been in XML, but
* those that are linked to a private variable may need changing
*/
- RefPtr<Action> act;
+ RefPtr<ToggleAction> tact;
- act = ActionManager::get_action (X_("Editor"), X_("toggle-follow-playhead"));
+ tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-follow-playhead"));
yn = _follow_playhead;
- if (act) {
- RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
- if (tact->get_active() != yn) {
- tact->set_active (yn);
- }
+ if (tact->get_active() != yn) {
+ tact->set_active (yn);
}
- act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
+ tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-stationary-playhead"));
yn = _stationary_playhead;
- if (act) {
- RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
- if (tact->get_active() != yn) {
- tact->set_active (yn);
- }
+ if (tact->get_active() != yn) {
+ tact->set_active (yn);
}
}
node->set_property ("mouse-mode", mouse_mode);
node->set_property ("join-object-range", smart_mode_action->get_active ());
- Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
- if (act) {
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
- node->set_property (X_("show-editor-mixer"), tact->get_active());
- }
+ Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-mixer"));
+ node->set_property (X_("show-editor-mixer"), tact->get_active());
- act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
- if (act) {
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
- node->set_property (X_("show-editor-list"), tact->get_active());
- }
+ tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-list"));
+ node->set_property (X_("show-editor-list"), tact->get_active());
node->set_property (X_("editor-list-page"), _the_notebook.get_current_page ());
Editor::snap_to_minsec (MusicSample presnap, RoundMode direction, SnapPref gpref)
{
MusicSample ret(presnap);
-
+
const samplepos_t one_second = _session->sample_rate();
const samplepos_t one_minute = one_second * 60;
const samplepos_t one_hour = one_minute * 60;
}
} break;
}
-
+
return ret;
}
{
if ((gpref != SnapToGrid_Unscaled) && (minsec_ruler_scale != minsec_show_msecs)) {
return snap_to_minsec (presnap, direction, gpref);
- }
-
+ }
+
const samplepos_t one_second = _session->sample_rate();
MusicSample ret(presnap);
-
+
if ((direction == RoundUpMaybe || direction == RoundDownMaybe) &&
presnap.sample % (one_second/75) == 0) {
/* start is already on a whole CD sample, do nothing */
Editor::snap_to_bbt (MusicSample presnap, RoundMode direction, SnapPref gpref)
{
MusicSample ret(presnap);
-
+
if (gpref != SnapToGrid_Unscaled) { // use the visual grid lines which are limited by the zoom scale that the user selected
int divisor = 2;
} else {
ret = _session->tempo_map().round_to_quarter_note_subdivision (presnap.sample, get_grid_beat_divisions(_grid_type), direction);
}
-
+
return ret;
}
Editor::snap_to_grid (MusicSample presnap, RoundMode direction, SnapPref gpref)
{
MusicSample ret(presnap);
-
+
if (grid_musical()) {
ret = snap_to_bbt (presnap, direction, gpref);
}
-
+
switch (_grid_type) {
case GridTypeTimecode:
ret = snap_to_timecode(presnap, direction, gpref);
Glib::RefPtr<SizeGroup> mouse_mode_size_group = SizeGroup::create (SIZE_GROUP_VERTICAL);
mouse_mode_size_group->add_widget (smart_mode_button);
mouse_mode_size_group->add_widget (mouse_move_button);
- mouse_mode_size_group->add_widget (mouse_cut_button);
+ if (!Profile->get_mixbus()) {
+ mouse_mode_size_group->add_widget (mouse_cut_button);
+ }
mouse_mode_size_group->add_widget (mouse_select_button);
mouse_mode_size_group->add_widget (mouse_timefx_button);
- mouse_mode_size_group->add_widget (mouse_audition_button);
+ if (!Profile->get_mixbus()) {
+ mouse_mode_size_group->add_widget (mouse_audition_button);
+ }
mouse_mode_size_group->add_widget (mouse_draw_button);
mouse_mode_size_group->add_widget (mouse_content_button);
void
Editor::toggle_follow_playhead ()
{
- RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-follow-playhead"));
- if (act) {
- RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
- set_follow_playhead (tact->get_active());
- }
+ RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-follow-playhead"));
+ set_follow_playhead (tact->get_active());
}
/** @param yn true to follow playhead, otherwise false.
void
Editor::toggle_stationary_playhead ()
{
- RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
- if (act) {
- RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
- set_stationary_playhead (tact->get_active());
- }
+ RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("toggle-stationary-playhead"));
+ set_stationary_playhead (tact->get_active());
}
void
{
begin_reversible_command (_("new playlists"));
vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
- _session->playlists->get (playlists);
+ _session->playlists()->get (playlists);
mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_use_new_playlist), playlists), v, ARDOUR::Properties::group_select.property_id);
commit_reversible_command ();
}
{
begin_reversible_command (_("copy playlists"));
vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
- _session->playlists->get (playlists);
+ _session->playlists()->get (playlists);
mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_use_copy_playlist), playlists), v, ARDOUR::Properties::group_select.property_id);
commit_reversible_command ();
}
{
begin_reversible_command (_("clear playlists"));
vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
- _session->playlists->get (playlists);
+ _session->playlists()->get (playlists);
mapover_tracks (sigc::mem_fun (*this, &Editor::mapped_clear_playlist), v, ARDOUR::Properties::group_select.property_id);
commit_reversible_command ();
}
* button to inactive (which also unticks the menu option)
*/
- ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer");
+ ActionManager::uncheck_toggleaction ("Editor/show-editor-mixer");
}
}
}
_last_update_time = 0;
}
- if (!_session->transport_rolling ()) {
+ if (!_session->transport_rolling () || _session->is_auditioning ()) {
/* Do not interpolate the playhead position; just set it */
_last_update_time = 0;
}