Fix --template commandline option
[ardour.git] / gtk2_ardour / editor.cc
index 174dd80817814ed616bfdf9fa4149da44220824e..ff587b2fc14683886a363d346e6e0ffeaa3fe3a0 100644 (file)
@@ -262,11 +262,6 @@ Editor::Editor ()
        , 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)
@@ -375,9 +370,7 @@ Editor::Editor ()
        , 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)
@@ -448,7 +441,6 @@ Editor::Editor ()
        , _stepping_axis_view (0)
        , quantize_dialog (0)
        , _main_menu_disabler (0)
-       , myactions (X_("editor"))
 {
        /* we are a singleton */
 
@@ -775,8 +767,8 @@ Editor::Editor ()
 
        /* register actions now so that set_state() can find them and set toggles/checks etc */
 
-       register_actions ();
        load_bindings ();
+       register_actions ();
 
        setup_toolbar ();
 
@@ -837,7 +829,6 @@ Editor::Editor ()
 
        _ignore_region_action = false;
        _last_region_menu_was_main = false;
-       _popup_region_menu_item = 0;
 
        _show_marker_lines = false;
 
@@ -861,12 +852,18 @@ Editor::Editor ()
        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;
@@ -984,15 +981,11 @@ Editor::set_entered_track (TimeAxisView* tav)
 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
@@ -1149,10 +1142,13 @@ Editor::access_action (const std::string& action_group, const std::string& actio
        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;
        }
 }
 
@@ -1612,22 +1608,6 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type,
        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:
@@ -1714,9 +1694,6 @@ Editor::build_track_region_context_menu ()
        /* 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) {
@@ -2112,7 +2089,7 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
        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");
@@ -2120,6 +2097,7 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
        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();
@@ -2208,41 +2186,15 @@ Editor::snap_mode() const
 }
 
 void
-Editor::set_grid_to (GridType gt)
+Editor::show_rulers_for_grid ()
 {
-       if (_grid_type == gt) { // already set
-               return;
-       }
-
-       unsigned int grid_ind = (unsigned int)gt;
-
-       if (internal_editing() && UIConfiguration::instance().get_grid_follows_internal()) {
-               internal_grid_type = gt;
-       } else {
-               pre_internal_grid_type = gt;
-       }
-
-       _grid_type = gt;
-
-       if (grid_ind > grid_type_strings.size() - 1) {
-               grid_ind = 0;
-               _grid_type = (GridType)grid_ind;
-       }
-
-       string str = grid_type_strings[grid_ind];
-
-       if (str != grid_type_selector.get_text()) {
-               grid_type_selector.set_text (str);
-       }
-
-       /* show appropriate rulers for this grid setting.
-        */
+       /* show appropriate rulers for this grid setting. */
        if (grid_musical()) {
                ruler_tempo_action->set_active(true);
                ruler_meter_action->set_active(true);
                ruler_bbt_action->set_active(true);
 
-               if ( UIConfiguration::instance().get_rulers_follow_grid() ) {
+               if (UIConfiguration::instance().get_rulers_follow_grid()) {
                        ruler_timecode_action->set_active(false);
                        ruler_minsec_action->set_active(false);
                        ruler_samples_action->set_active(false);
@@ -2250,7 +2202,7 @@ Editor::set_grid_to (GridType gt)
        } else if (_grid_type == GridTypeTimecode) {
                ruler_timecode_action->set_active(true);
 
-               if ( UIConfiguration::instance().get_rulers_follow_grid() ) {
+               if (UIConfiguration::instance().get_rulers_follow_grid()) {
                        ruler_tempo_action->set_active(false);
                        ruler_meter_action->set_active(false);
                        ruler_bbt_action->set_active(false);
@@ -2260,7 +2212,7 @@ Editor::set_grid_to (GridType gt)
        } else if (_grid_type == GridTypeMinSec) {
                ruler_minsec_action->set_active(true);
 
-               if ( UIConfiguration::instance().get_rulers_follow_grid() ) {
+               if (UIConfiguration::instance().get_rulers_follow_grid()) {
                        ruler_tempo_action->set_active(false);
                        ruler_meter_action->set_active(false);
                        ruler_bbt_action->set_active(false);
@@ -2271,7 +2223,7 @@ Editor::set_grid_to (GridType gt)
                ruler_cd_marker_action->set_active(true);
                ruler_minsec_action->set_active(true);
 
-               if ( UIConfiguration::instance().get_rulers_follow_grid() ) {
+               if (UIConfiguration::instance().get_rulers_follow_grid()) {
                        ruler_tempo_action->set_active(false);
                        ruler_meter_action->set_active(false);
                        ruler_bbt_action->set_active(false);
@@ -2279,6 +2231,39 @@ Editor::set_grid_to (GridType gt)
                        ruler_samples_action->set_active(false);
                }
        }
+}
+
+void
+Editor::set_grid_to (GridType gt)
+{
+       if (_grid_type == gt) { // already set
+               return;
+       }
+
+       unsigned int grid_ind = (unsigned int)gt;
+
+       if (internal_editing() && UIConfiguration::instance().get_grid_follows_internal()) {
+               internal_grid_type = gt;
+       } else {
+               pre_internal_grid_type = gt;
+       }
+
+       _grid_type = gt;
+
+       if (grid_ind > grid_type_strings.size() - 1) {
+               grid_ind = 0;
+               _grid_type = (GridType)grid_ind;
+       }
+
+       string str = grid_type_strings[grid_ind];
+
+       if (str != grid_type_selector.get_text()) {
+               grid_type_selector.set_text (str);
+       }
+
+       if (UIConfiguration::instance().get_show_grids_ruler()) {
+               show_rulers_for_grid ();
+       }
 
        instant_save ();
 
@@ -2317,12 +2302,15 @@ Editor::set_snap_mode (SnapMode mode)
 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 ()) {
@@ -2342,17 +2330,15 @@ Editor::set_edit_point_preference (EditPoint ep, bool force)
                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;
@@ -2450,13 +2436,13 @@ Editor::set_state (const XMLNode& node, int version)
                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);
        }
 
@@ -2480,28 +2466,20 @@ Editor::set_state (const XMLNode& node, int version)
                _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);
        }
@@ -2511,11 +2489,11 @@ Editor::set_state (const XMLNode& node, int version)
                _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);
        }
@@ -2528,10 +2506,8 @@ Editor::set_state (const XMLNode& node, int version)
        }
 
        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");
                }
@@ -2550,28 +2526,22 @@ Editor::set_state (const XMLNode& node, int version)
                 * 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);
                }
        }
 
-       return LuaInstance::instance()->set_state(node);
+       return 0;
 }
 
 XMLNode&
@@ -2612,17 +2582,11 @@ Editor::get_state ()
        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 ());
 
@@ -2639,8 +2603,6 @@ Editor::get_state ()
 
        node->set_property ("nudge-clock-value", nudge_clock->current_duration());
 
-       node->add_child_nocopy (LuaInstance::instance()->get_action_state());
-       node->add_child_nocopy (LuaInstance::instance()->get_hook_state());
        node->add_child_nocopy (_locations->get_state ());
 
        return *node;
@@ -2740,13 +2702,13 @@ check_best_snap (samplepos_t presnap, samplepos_t &test, samplepos_t &dist, samp
 }
 
 MusicSample
-Editor::snap_to_timecode ( MusicSample presnap, RoundMode direction, SnapPref gpref )
+Editor::snap_to_timecode (MusicSample presnap, RoundMode direction, SnapPref gpref)
 {
        samplepos_t start = presnap.sample;
        const samplepos_t one_timecode_second = (samplepos_t)(rint(_session->timecode_frames_per_second()) * _session->samples_per_timecode_frame());
        samplepos_t one_timecode_minute = (samplepos_t)(rint(_session->timecode_frames_per_second()) * _session->samples_per_timecode_frame() * 60);
 
-       TimecodeRulerScale scale = ( gpref != SnapToGrid_Unscaled ) ? timecode_ruler_scale : timecode_show_samples;
+       TimecodeRulerScale scale = (gpref != SnapToGrid_Unscaled) ? timecode_ruler_scale : timecode_show_samples;
 
        switch (scale) {
        case timecode_show_bits:
@@ -2814,15 +2776,15 @@ Editor::snap_to_timecode ( MusicSample presnap, RoundMode direction, SnapPref gp
 }
 
 MusicSample
-Editor::snap_to_minsec ( MusicSample presnap, RoundMode direction, SnapPref gpref )
+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;
 
-       MinsecRulerScale scale = ( gpref != SnapToGrid_Unscaled ) ? minsec_ruler_scale : minsec_show_seconds;
+       MinsecRulerScale scale = (gpref != SnapToGrid_Unscaled) ? minsec_ruler_scale : minsec_show_seconds;
 
        switch (scale) {
                case minsec_show_msecs:
@@ -2859,21 +2821,21 @@ Editor::snap_to_minsec ( MusicSample presnap, RoundMode direction, SnapPref gpre
                        }
                } break;
        }
-       
+
        return ret;
 }
 
 MusicSample
-Editor::snap_to_cd_frames ( MusicSample presnap, RoundMode direction, SnapPref gpref )
+Editor::snap_to_cd_frames (MusicSample presnap, RoundMode direction, SnapPref gpref)
 {
-       if ( (gpref != SnapToGrid_Unscaled) && (minsec_ruler_scale != minsec_show_msecs) ) {
-               return snap_to_minsec( presnap, direction, gpref );
-       }       
-       
+       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 */
@@ -2887,11 +2849,11 @@ Editor::snap_to_cd_frames ( MusicSample presnap, RoundMode direction, SnapPref g
 }
 
 MusicSample
-Editor::snap_to_bbt ( MusicSample presnap, RoundMode direction, SnapPref gpref )
+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
+
+       if (gpref != SnapToGrid_Unscaled) { // use the visual grid lines which are limited by the zoom scale that the user selected
 
                int divisor = 2;
                switch (_grid_type) {
@@ -2940,19 +2902,19 @@ Editor::snap_to_bbt ( MusicSample presnap, RoundMode direction, SnapPref gpref )
        } else {
                ret = _session->tempo_map().round_to_quarter_note_subdivision (presnap.sample, get_grid_beat_divisions(_grid_type), direction);
        }
-       
+
        return ret;
 }
 
 ARDOUR::MusicSample
-Editor::snap_to_grid (  MusicSample presnap, RoundMode direction, SnapPref gpref  )
+Editor::snap_to_grid (MusicSample presnap, RoundMode direction, SnapPref gpref)
 {
        MusicSample ret(presnap);
-       
-       if ( grid_musical() ) {
+
+       if (grid_musical()) {
                ret = snap_to_bbt (presnap, direction, gpref);
        }
-       
+
        switch (_grid_type) {
                case GridTypeTimecode:
                        ret = snap_to_timecode(presnap, direction, gpref);
@@ -3013,7 +2975,7 @@ Editor::snap_to_internal (MusicSample& start, RoundMode direction, SnapPref pref
        samplepos_t best = max_samplepos; // this records the best snap-result we've found so far
 
        /* check snap-to-marker */
-       if ( (pref == SnapToAny_Visual) && UIConfiguration::instance().get_snap_to_marks()) {
+       if ((pref == SnapToAny_Visual) && UIConfiguration::instance().get_snap_to_marks()) {
                test = snap_to_marker (presnap, direction);
                check_best_snap(presnap, test, dist, best);
        }
@@ -3052,7 +3014,7 @@ Editor::snap_to_internal (MusicSample& start, RoundMode direction, SnapPref pref
        /* check Grid */
        if (UIConfiguration::instance().get_snap_to_grid() && (_grid_type != GridTypeNone)) {
                MusicSample pre(presnap, 0);
-               MusicSample post = snap_to_grid ( pre, direction, pref);
+               MusicSample post = snap_to_grid (pre, direction, pref);
                check_best_snap(presnap, post.sample, dist, best);
        }
 
@@ -3093,10 +3055,14 @@ Editor::setup_toolbar ()
        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);
 
@@ -4076,11 +4042,8 @@ Editor::update_grid ()
 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.
@@ -4101,11 +4064,8 @@ Editor::set_follow_playhead (bool yn, bool catch_up)
 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
@@ -4164,6 +4124,8 @@ Editor::get_grid_beat_divisions(samplepos_t position)
        case GridTypeBeatDiv4:   return 4;
        case GridTypeBeatDiv3:   return 3;
        case GridTypeBeatDiv2:   return 2;
+       case GridTypeBeat:       return 1;
+       case GridTypeBar:        return 1;
 
        case GridTypeNone:       return 0;
        case GridTypeTimecode:   return 0;
@@ -4417,7 +4379,7 @@ Editor::new_playlists (TimeAxisView* v)
 {
        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 ();
 }
@@ -4433,7 +4395,7 @@ Editor::copy_playlists (TimeAxisView* v)
 {
        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 ();
 }
@@ -4448,7 +4410,7 @@ Editor::clear_playlists (TimeAxisView* v)
 {
        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 ();
 }
@@ -5622,7 +5584,7 @@ Editor::timeaxisview_deleted (TimeAxisView *tv)
                         * button to inactive (which also unticks the menu option)
                         */
 
-                       ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer");
+                       ActionManager::uncheck_toggleaction ("Editor/show-editor-mixer");
                }
        }
 }
@@ -5933,7 +5895,7 @@ Editor::super_rapid_screen_update ()
                _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;
        }