Remove internal edit mode and add "content" tool.
[ardour.git] / gtk2_ardour / editor_actions.cc
index d977d27b860079dedc20e5d359b5da13ff239bc1..7c3365f91be0c8c213650591af2fb83cf11af2b1 100644 (file)
@@ -263,6 +263,8 @@ Editor::register_actions ()
        reg_sens (editor_actions, "zoom-to-session", _("Zoom to Session"), sigc::mem_fun(*this, &Editor::temporal_zoom_session));
        reg_sens (editor_actions, "zoom-to-region", _("Zoom to Region"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_to_region), false));
        reg_sens (editor_actions, "zoom-to-region-both-axes", _("Zoom to Region (Width and Height)"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_to_region), true));
+       reg_sens (editor_actions, "zoom-to-range", _("Zoom to Range"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), false));
+       reg_sens (editor_actions, "zoom-to-range-both-axes", _("Zoom to Range (Width and Height)"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), true));
        reg_sens (editor_actions, "toggle-zoom", _("Toggle Zoom State"), sigc::mem_fun(*this, &Editor::swap_visual_state));
 
        reg_sens (editor_actions, "expand-tracks", _("Expand Track Height"), sigc::bind (sigc::mem_fun (*this, &Editor::tav_zoom_step), false));
@@ -293,8 +295,11 @@ Editor::register_actions ()
        reg_sens (editor_actions, "playhead-to-edit", _("Playhead to Active Mark"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_align), true));
        reg_sens (editor_actions, "edit-to-playhead", _("Active Mark to Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_align), false));
 
+       toggle_reg_sens (editor_actions, "toggle-skip-playback", _("Use Skip Ranges"), sigc::mem_fun(*this, &Editor::toggle_skip_playback));
+
        reg_sens (editor_actions, "set-loop-from-edit-range", _("Set Loop from Edit Range"), sigc::bind (sigc::mem_fun(*this, &Editor::set_loop_from_edit_range), false));
        reg_sens (editor_actions, "set-punch-from-edit-range", _("Set Punch from Edit Range"), sigc::mem_fun(*this, &Editor::set_punch_from_edit_range));
+       reg_sens (editor_actions, "set-session-from-edit-range", _("Set Session Start/End from Edit Range"), sigc::mem_fun(*this, &Editor::set_session_extents_from_selection));
 
        /* this is a duplicated action so that the main menu can use a different label */
        reg_sens (editor_actions, "main-menu-play-selected-regions", _("Play Selected Regions"), sigc::mem_fun (*this, &Editor::play_selected_region));
@@ -343,10 +348,10 @@ Editor::register_actions ()
        toggle_reg_sens (editor_actions, "toggle-log-window", _("Log"),
                        sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::toggle_errors));
 
-       reg_sens (editor_actions, "tab-to-transient-forwards", _("Move Later to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true));
-       reg_sens (editor_actions, "alternate-tab-to-transient-forwards", _("Move Later to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true));
-       reg_sens (editor_actions, "tab-to-transient-backwards", _("Move Earlier to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false));
-       reg_sens (editor_actions, "alternate-tab-to-transient-backwards", _("Move Earlier to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false));
+       reg_sens (editor_actions, "alternate-tab-to-transient-forwards", _("Move to Next Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true));
+       reg_sens (editor_actions, "alternate-tab-to-transient-backwards", _("Move to Previous Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false));
+       reg_sens (editor_actions, "tab-to-transient-forwards", _("Move to Next Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true));
+       reg_sens (editor_actions, "tab-to-transient-backwards", _("Move to Previous Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false));
 
        reg_sens (editor_actions, "crop", _("Crop"), sigc::mem_fun(*this, &Editor::crop_region_to_selection));
 
@@ -403,7 +408,8 @@ Editor::register_actions ()
        }
        ActionManager::track_selection_sensitive_actions.push_back (act);
 
-       reg_sens (editor_actions, "fit-tracks", _("Fit Selected Tracks"), sigc::mem_fun(*this, &Editor::fit_selected_tracks));
+       act = reg_sens (editor_actions, "fit-tracks", _("Fit Selected Tracks"), sigc::mem_fun(*this, &Editor::fit_selected_tracks));
+       ActionManager::track_selection_sensitive_actions.push_back (act);
 
        act = reg_sens (editor_actions, "track-height-largest", _("Largest"), sigc::bind (
                                sigc::mem_fun(*this, &Editor::set_track_height), HeightLargest));
@@ -443,69 +449,47 @@ Editor::register_actions ()
        smart_mode_action = Glib::RefPtr<ToggleAction>::cast_static (act);
        smart_mode_button.set_related_action (smart_mode_action);
        smart_mode_button.set_text (_("Smart"));
-       smart_mode_button.add_elements ( ArdourButton::Inset );
        smart_mode_button.set_name ("mouse mode button");
 
        act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("Object Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseObject));
        mouse_move_button.set_related_action (act);
        mouse_move_button.set_image (::get_icon("tool_object"));
-       mouse_move_button.add_elements ( ArdourButton::Inset );
        mouse_move_button.set_name ("mouse mode button");
 
        act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("Range Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseRange));        
        mouse_select_button.set_related_action (act);
        mouse_select_button.set_image (::get_icon("tool_range"));
-       mouse_select_button.add_elements (ArdourButton::Inset );
        mouse_select_button.set_name ("mouse mode button");
 
        act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-draw", _("Note Drawing Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseDraw));   
        mouse_draw_button.set_related_action (act);
        mouse_draw_button.set_image (::get_icon("midi_tool_pencil"));
-       mouse_draw_button.add_elements (ArdourButton::Inset );
        mouse_draw_button.set_name ("mouse mode button");
 
-       act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-gain", _("Gain Tool"), sigc::bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseGain)); 
-       mouse_gain_button.set_related_action (act);
-       mouse_gain_button.set_image (::get_icon("tool_gain"));
-       mouse_gain_button.add_elements (ArdourButton::Inset );
-       mouse_gain_button.set_name ("mouse mode button");
-
-       if(!Profile->get_mixbus()) {
-               act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-zoom", _("Zoom Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseZoom));   
-               mouse_zoom_button.set_related_action (act);
-               mouse_zoom_button.set_image (::get_icon("tool_zoom"));
-               mouse_zoom_button.add_elements (ArdourButton::Inset );
-               mouse_zoom_button.set_name ("mouse mode button");
-       }
-       
        act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-audition", _("Audition Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseAudition));       
        mouse_audition_button.set_related_action (act);
        mouse_audition_button.set_image (::get_icon("tool_audition"));
-       mouse_audition_button.add_elements (ArdourButton::Inset );
        mouse_audition_button.set_name ("mouse mode button");
 
        act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("Time FX Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseTimeFX));    
        mouse_timefx_button.set_related_action (act);
        mouse_timefx_button.set_image (::get_icon("tool_stretch"));
-       mouse_timefx_button.add_elements (ArdourButton::Inset );
        mouse_timefx_button.set_name ("mouse mode button");
 
+       act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-content", _("Content Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseContent));  
+       mouse_content_button.set_related_action (act);
+       mouse_content_button.set_image (::get_icon("tool_content"));
+       mouse_content_button.set_name ("mouse mode button");
+
        if(!Profile->get_mixbus()) {
                act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-cut", _("Cut Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseCut));
                mouse_cut_button.set_related_action (act);
                mouse_cut_button.set_image (::get_icon("tool_cut"));
-               mouse_cut_button.add_elements (ArdourButton::Inset );
                mouse_cut_button.set_name ("mouse mode button");
        }
        
        ActionManager::register_action (editor_actions, "step-mouse-mode", _("Step Mouse Mode"), sigc::bind (sigc::mem_fun(*this, &Editor::step_mouse_mode), true));
 
-       act = ActionManager::register_toggle_action (mouse_mode_actions, "toggle-internal-edit", _("Edit MIDI"), sigc::mem_fun(*this, &Editor::toggle_internal_editing));
-       internal_edit_button.set_related_action (act);
-       internal_edit_button.set_image (::get_icon("tool_note"));
-       internal_edit_button.add_elements ( ArdourButton::Inset );
-       internal_edit_button.set_name ("mouse mode button");
-
        RadioAction::Group edit_point_group;
        ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-playhead"), _("Playhead"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
        ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-mouse"), _("Mouse"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtMouse)));
@@ -752,6 +736,20 @@ Editor::load_bindings ()
        }
 }
 
+void
+Editor::toggle_skip_playback ()
+{
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), "toggle-skip-playback");
+
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               bool s = Config->get_skip_playback ();
+               if (tact->get_active() != s) {
+                       Config->set_skip_playback (tact->get_active());
+               }
+       }
+}
+
 void
 Editor::toggle_ruler_visibility (RulerType rt)
 {
@@ -1079,7 +1077,7 @@ Editor::snap_type_action (SnapType type)
                break;
        default:
                fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible snap-to type", (int) type) << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        act = ActionManager::get_action (X_("Snap"), action);
@@ -1475,7 +1473,7 @@ Editor::snap_mode_action (SnapMode mode)
                break;
        default:
                fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible snap mode type", (int) mode) << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        act = ActionManager::get_action (X_("Editor"), action);
@@ -1539,7 +1537,7 @@ Editor::edit_point_action (EditPoint ep)
                break;
        default:
                fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible edit point type", (int) ep) << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        act = ActionManager::get_action (X_("Editor"), action);
@@ -1597,7 +1595,7 @@ Editor::zoom_focus_action (ZoomFocus focus)
                break;
        default:
                fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible focus type", (int) focus) << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        act = ActionManager::get_action (X_("Zoom"), action);
@@ -1728,6 +1726,16 @@ Editor::parameter_changed (std::string p)
                } else {
                        Gtkmm2ext::disable_tooltips ();
                }
+       } else if (p == "skip-playback") {
+               Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-skip-playback"));
+
+               if (act) {
+                       bool s = Config->get_skip_playback ();
+                       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+                       if (tact->get_active () != s) {
+                               tact->set_active (s);
+                       }
+               }
        }
 }
 
@@ -1750,16 +1758,6 @@ Editor::reset_canvas_action_sensitivity (bool onoff)
        }
 }
 
-void
-Editor::toggle_internal_editing ()
-{
-       Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("MouseMode"), X_("toggle-internal-edit"));
-       if (act) {
-               Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act);
-               set_internal_edit (tact->get_active());
-       }
-}
-
 void
 Editor::register_region_actions ()
 {
@@ -1941,6 +1939,8 @@ Editor::register_region_actions ()
                );
 
        reg_sens (_region_actions, "quantize-region", _("Quantize..."), sigc::mem_fun (*this, &Editor::quantize_region));
+       reg_sens (_region_actions, "legatize-region", _("Legatize"), sigc::bind(sigc::mem_fun (*this, &Editor::legatize_region), false));
+       reg_sens (_region_actions, "remove-overlap", _("Remove Overlap"), sigc::bind(sigc::mem_fun (*this, &Editor::legatize_region), true));
        reg_sens (_region_actions, "insert-patch-change", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), false));
        reg_sens (_region_actions, "insert-patch-change-context", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), true));
        reg_sens (_region_actions, "fork-region", _("Unlink from other copies"), sigc::mem_fun (*this, &Editor::fork_region));