X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_actions.cc;h=dea84f478933c406652ddbcff06793db20362c4b;hb=bb9cc45cd22af67ac275a5e73accbe14fee664d8;hp=6b98446fdebdb9a663be1270c8eb7e4c97921e5a;hpb=b233455b3fd00789e4f8a951f9fe205de92f94e2;p=ardour.git diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 6b98446fde..dea84f4789 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,9 @@ */ +#include +#include + #include "ardour/ardour.h" #include "ardour/profile.h" @@ -31,6 +34,7 @@ #include "audio_time_axis.h" #include "editor_group_tabs.h" #include "editor_routes.h" +#include "editor_regions.h" using namespace Gtk; using namespace Glib; @@ -46,7 +50,7 @@ Editor::register_actions () RefPtr act; editor_actions = ActionGroup::create (X_("Editor")); - + /* non-operative menu items for menu bar */ ActionManager::register_action (editor_actions, X_("AlignMenu"), _("Align")); @@ -195,12 +199,12 @@ Editor::register_actions () ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "select-all-in-loop-range", _("Select All in Loop Range"), mem_fun(*this, &Editor::select_all_selectables_using_loop)); ActionManager::session_sensitive_actions.push_back (act); - + act = ActionManager::register_action (editor_actions, "select-next-route", _("Select Next Track/Bus"), mem_fun(*this, &Editor::select_next_route)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "select-prev-route", _("Select Previous Track/Bus"), mem_fun(*this, &Editor::select_prev_route)); ActionManager::session_sensitive_actions.push_back (act); - + act = ActionManager::register_action (editor_actions, "track-record-enable-toggle", _("Toggle Record Enable"), mem_fun(*this, &Editor::toggle_record_enable)); ActionManager::session_sensitive_actions.push_back (act); @@ -400,7 +404,7 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "add-range-markers-from-region", _("Add Range Marker(s)"), mem_fun(*this, &Editor::add_locations_from_audio_region)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::region_selection_sensitive_actions.push_back (act); - + act = ActionManager::register_action (editor_actions, "set-fade-in-length", _("Set Fade In Length"), bind (mem_fun(*this, &Editor::set_fade_length), true)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "toggle-fade-in-active", _("Toggle Fade In Active"), bind (mem_fun(*this, &Editor::toggle_fade_active), true)); @@ -549,7 +553,7 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "quantize-region", _("Quantize Region"), mem_fun(*this, &Editor::quantize_region)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::region_selection_sensitive_actions.push_back (act); - + act = ActionManager::register_action (editor_actions, "set-tempo-from-region", _("Set Tempo from Region=Bar"), mem_fun(*this, &Editor::use_region_as_bar)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::region_selection_sensitive_actions.push_back (act); @@ -578,9 +582,6 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "insert-chunk", _("Insert Chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "split-at-edit-cursor", _("Split At Edit Point"), mem_fun(*this, &Editor::split_region)); - ActionManager::edit_point_in_region_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "start-range", _("Start Range"), mem_fun(*this, &Editor::keyboard_selection_begin)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "finish-range", _("Finish Range"), bind (mem_fun(*this, &Editor::keyboard_selection_finish), false)); @@ -660,22 +661,66 @@ Editor::register_actions () Glib::RefPtr mouse_mode_actions = ActionGroup::create (X_("MouseMode")); RadioAction::Group mouse_mode_group; - ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("Object Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseObject, false)); - ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("Range Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseRange, false)); - ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-gain", _("Gain Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseGain, false)); - ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-zoom", _("Zoom Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseZoom, false)); - ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("Timefx Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseTimeFX, false)); - ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-note", _("Note Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseNote, false)); + ARDOUR_UI::instance()->tooltips().set_tip (mouse_move_button, _("Select/Move Objects")); + ARDOUR_UI::instance()->tooltips().set_tip (mouse_select_button, _("Select/Move Ranges")); + ARDOUR_UI::instance()->tooltips().set_tip (mouse_gain_button, _("Draw Gain Automation")); + ARDOUR_UI::instance()->tooltips().set_tip (mouse_zoom_button, _("Select Zoom Range")); + ARDOUR_UI::instance()->tooltips().set_tip (mouse_timefx_button, _("Stretch/Shrink Regions")); + ARDOUR_UI::instance()->tooltips().set_tip (mouse_audition_button, _("Listen to Specific Regions")); + /* in the future, this may allow other kinds of "intra-region" editing, but for now its just MIDI */ + ARDOUR_UI::instance()->tooltips().set_tip (internal_edit_button, _("Edit MIDI Notes")); + + act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("Object Tool"), bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseObject)); + act->connect_proxy (mouse_move_button); + mouse_move_button.set_image (*(manage (new Image (::get_icon("tool_object"))))); + mouse_move_button.set_label (""); + mouse_move_button.set_name ("MouseModeButton"); + + act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("Range Tool"), bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseRange)); + act->connect_proxy (mouse_select_button); + mouse_select_button.set_image (*(manage (new Image (::get_xpm("tool_range.xpm"))))); + mouse_select_button.set_label (""); + mouse_select_button.set_name ("MouseModeButton"); + + act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-gain", _("Gain Tool"), bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseGain)); + act->connect_proxy (mouse_gain_button); + mouse_gain_button.set_image (*(manage (new Image (::get_icon("tool_gain"))))); + mouse_gain_button.set_label (""); + mouse_gain_button.set_name ("MouseModeButton"); + + act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-zoom", _("Zoom Tool"), bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseZoom)); + act->connect_proxy (mouse_zoom_button); + mouse_zoom_button.set_image (*(manage (new Image (::get_icon("tool_zoom"))))); + mouse_zoom_button.set_label (""); + mouse_zoom_button.set_name ("MouseModeButton"); + + act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-audition", _("Audition Tool"), bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseAudition)); + act->connect_proxy (mouse_audition_button); + mouse_audition_button.set_image (*(manage (new Image (::get_icon("tool_audition"))))); + mouse_audition_button.set_label (""); + mouse_audition_button.set_name ("MouseModeButton"); + + act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("Timefx Tool"), bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseTimeFX)); + act->connect_proxy (mouse_timefx_button); + mouse_timefx_button.set_image (*(manage (new Image (::get_icon("tool_stretch"))))); + mouse_timefx_button.set_label (""); + mouse_timefx_button.set_name ("MouseModeButton"); ActionManager::register_action (editor_actions, "step-mouse-mode", _("Step Mouse Mode"), bind (mem_fun(*this, &Editor::step_mouse_mode), true)); - + + act = ActionManager::register_toggle_action (mouse_mode_actions, "toggle-internal-edit", _("Edit MIDI"), mem_fun(*this, &Editor::toggle_internal_editing)); + act->connect_proxy (internal_edit_button); + internal_edit_button.set_image (*(manage (new Image (::get_icon("tool_note"))))); + internal_edit_button.set_label (""); + internal_edit_button.set_name ("MouseModeButton"); + RadioAction::Group edit_point_group; ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-playhead"), _("Playhead"), (bind (mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead))); ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-mouse"), _("Mouse"), (bind (mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead))); ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-selected-marker"), _("Marker"), (bind (mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead))); - ActionManager::register_action (editor_actions, "cycle-edit-point", _("Change edit point"), bind (mem_fun (*this, &Editor::cycle_edit_point), false)); - ActionManager::register_action (editor_actions, "cycle-edit-point-with-marker", _("Change edit point (w/Marker)"), bind (mem_fun (*this, &Editor::cycle_edit_point), true)); + ActionManager::register_action (editor_actions, "cycle-edit-point", _("Change Edit Point"), bind (mem_fun (*this, &Editor::cycle_edit_point), false)); + ActionManager::register_action (editor_actions, "cycle-edit-point-with-marker", _("Change Edit Point Including Marker"), bind (mem_fun (*this, &Editor::cycle_edit_point), true)); if (!Profile->get_sae()) { ActionManager::register_action (editor_actions, "set-edit-splice", _("Splice"), bind (mem_fun (*this, &Editor::set_edit_mode), Splice)); } @@ -717,7 +762,7 @@ Editor::register_actions () ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-boundary"), _("Snap to Region Boundary"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionBoundary))); /* RULERS */ - + Glib::RefPtr ruler_actions = ActionGroup::create (X_("Rulers")); ruler_tempo_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-tempo-ruler"), _("Tempo"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_tempo))); ruler_meter_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-meter-ruler"), _("Meter"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_meter))); @@ -752,7 +797,7 @@ Editor::register_actions () } ruler_samples_action->set_active (false); no_ruler_shown_update = false; - + /* REGION LIST */ Glib::RefPtr rl_actions = ActionGroup::create (X_("RegionList")); @@ -766,67 +811,77 @@ Editor::register_actions () ActionManager::region_list_selection_sensitive_actions.push_back (act); act = ActionManager::register_action (rl_actions, X_("rlHide"), _("Hide"), mem_fun(*this, &Editor::hide_region_from_region_list)); ActionManager::region_list_selection_sensitive_actions.push_back (act); - act = ActionManager::register_action (rl_actions, X_("rlRemove"), _("Remove"), mem_fun (*this, &Editor::remove_region_from_region_list)); + act = ActionManager::register_action (rl_actions, X_("rlRemove"), _("Remove"), mem_fun (*_regions, &EditorRegions::remove_region)); ActionManager::region_list_selection_sensitive_actions.push_back (act); - ActionManager::register_toggle_action (rl_actions, X_("rlShowAll"), _("Show All"), mem_fun(*this, &Editor::toggle_full_region_list)); - ActionManager::register_toggle_action (rl_actions, X_("rlShowAuto"), _("Show Automatic Regions"), mem_fun(*this, &Editor::toggle_show_auto_regions)); + ActionManager::register_toggle_action (rl_actions, X_("rlShowAll"), _("Show All"), mem_fun(*_regions, &EditorRegions::toggle_full)); + ActionManager::register_toggle_action (rl_actions, X_("rlShowAuto"), _("Show Automatic Regions"), mem_fun (*_regions, &EditorRegions::toggle_show_auto_regions)); ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortAscending"), _("Ascending"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_direction), true)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_direction), true)); ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortDescending"), _("Descending"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_direction), false)); - + bind (mem_fun (*_regions, &EditorRegions::reset_sort_direction), false)); + ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionName"), _("By Region Name"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByName)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), ByName, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionLength"), _("By Region Length"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByLength)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), ByLength, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionPosition"), _("By Region Position"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByPosition)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), ByPosition, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionTimestamp"), _("By Region Timestamp"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByTimestamp)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), ByTimestamp, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionStartinFile"), _("By Region Start in File"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByStartInFile)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), ByStartInFile, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionEndinFile"), _("By Region End in File"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByEndInFile)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), ByEndInFile, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileName"), _("By Source File Name"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileName)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileName, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileLength"), _("By Source File Length"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileLength)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileLength, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileCreationDate"), _("By Source File Creation Date"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileCreationDate)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileCreationDate, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFilesystem"), _("By Source Filesystem"), - bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileFS)); + bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileFS, false)); /* the next two are duplicate items with different names for use in two different contexts */ act = ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Import"), mem_fun (*this, &Editor::external_audio_dialog)); ActionManager::session_sensitive_actions.push_back (act); + ActionManager::write_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, X_("addExternalAudioToRegionList"), _("Import to Region List"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion)); ActionManager::session_sensitive_actions.push_back (act); - - ActionManager::register_action (editor_actions, X_("importFromSession"), _("Import From Session"), mem_fun(*this, &Editor::session_import_dialog)); + ActionManager::write_sensitive_actions.push_back (act); + + act = ActionManager::register_action (editor_actions, X_("importFromSession"), _("Import From Session"), mem_fun(*this, &Editor::session_import_dialog)); + ActionManager::write_sensitive_actions.push_back (act); ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformsWhileRecording"), _("Show Waveforms While Recording"), mem_fun (*this, &Editor::toggle_waveforms_while_recording)); ActionManager::register_toggle_action (editor_actions, X_("ToggleSummary"), _("Show Summary"), mem_fun (*this, &Editor::set_summary)); ActionManager::register_toggle_action (editor_actions, X_("ToggleGroupTabs"), _("Show Group Tabs"), mem_fun (*this, &Editor::set_group_tabs)); - + ActionManager::register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("Show Measures"), mem_fun (*this, &Editor::toggle_measure_visibility)); - + /* if there is a logo in the editor canvas, its always visible at startup */ act = ActionManager::register_toggle_action (editor_actions, X_("ToggleLogoVisibility"), _("Show Logo"), mem_fun (*this, &Editor::toggle_logo_visibility)); Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); tact->set_active (true); + /* MIDI */ + + Glib::RefPtr midi_actions = ActionGroup::create (X_("MIDI")); + ActionManager::register_action (midi_actions, X_("panic"), _("Panic"), mem_fun(*this, &Editor::midi_panic)); + ActionManager::add_action_group (rl_actions); ActionManager::add_action_group (ruler_actions); ActionManager::add_action_group (zoom_actions); ActionManager::add_action_group (mouse_mode_actions); ActionManager::add_action_group (snap_actions); ActionManager::add_action_group (editor_actions); + ActionManager::add_action_group (midi_actions); } void @@ -942,7 +997,7 @@ Editor::snap_type_action (SnapType type) const char* action = 0; RefPtr act; - + switch (type) { case Editing::SnapToCDFrame: action = "snap-to-cd-frame"; @@ -1096,7 +1151,7 @@ Editor::snap_mode_action (SnapMode mode) { const char* action = 0; RefPtr act; - + switch (mode) { case Editing::SnapOff: action = X_("snap-off"); @@ -1111,13 +1166,13 @@ Editor::snap_mode_action (SnapMode mode) fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible snap mode type", (int) mode) << endmsg; /*NOTREACHED*/ } - + act = ActionManager::get_action (X_("Editor"), action); - + if (act) { RefPtr ract = RefPtr::cast_dynamic(act); return ract; - + } else { error << string_compose (_("programming error: %1: %2"), "Editor::snap_mode_chosen could not find action to match mode.", action) << endmsg; return RefPtr (); @@ -1160,7 +1215,7 @@ Editor::edit_point_action (EditPoint ep) { const char* action = 0; RefPtr act; - + switch (ep) { case Editing::EditAtPlayhead: action = X_("edit-at-playhead"); @@ -1175,13 +1230,13 @@ Editor::edit_point_action (EditPoint ep) fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible edit point type", (int) ep) << endmsg; /*NOTREACHED*/ } - + act = ActionManager::get_action (X_("Editor"), action); - + if (act) { RefPtr ract = RefPtr::cast_dynamic(act); return ract; - + } else { error << string_compose (_("programming error: %1: %2"), "Editor::edit_point_action could not find action to match edit point.", action) << endmsg; return RefPtr (); @@ -1209,7 +1264,7 @@ Editor::zoom_focus_action (ZoomFocus focus) { const char* action = 0; RefPtr act; - + switch (focus) { case ZoomFocusLeft: action = X_("zoom-focus-left"); @@ -1233,9 +1288,9 @@ Editor::zoom_focus_action (ZoomFocus focus) fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible focus type", (int) focus) << endmsg; /*NOTREACHED*/ } - + act = ActionManager::get_action (X_("Zoom"), action); - + if (act) { RefPtr ract = RefPtr::cast_dynamic(act); return ract; @@ -1288,7 +1343,7 @@ Editor::parameter_changed (std::string p) } else if (p == "show-track-meters") { toggle_meter_updating(); } else if (p == "show-summary") { - + bool const s = session->config.get_show_summary (); if (s) { _summary->show (); @@ -1335,9 +1390,18 @@ Editor::reset_canvas_action_sensitivity (bool onoff) onoff = true; } - for (vector >::iterator x = ActionManager::mouse_edit_point_requires_canvas_actions.begin(); + for (vector >::iterator x = ActionManager::mouse_edit_point_requires_canvas_actions.begin(); x != ActionManager::mouse_edit_point_requires_canvas_actions.end(); ++x) { (*x)->set_sensitive (onoff); } } +void +Editor::toggle_internal_editing () +{ + Glib::RefPtr act = ActionManager::get_action (X_("MouseMode"), X_("toggle-internal-edit")); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + set_internal_edit (tact->get_active()); + } +}