13
0

some structure/code for managing menu sensitivity now that VCAs are selectable

This commit is contained in:
Paul Davis 2017-08-07 11:34:03 -04:00
parent 4f2dc77f6f
commit cbe342c357
6 changed files with 54 additions and 17 deletions

View File

@ -52,6 +52,10 @@ RelatedActions ActionManager::write_sensitive_actions;
RelatedActions ActionManager::region_list_selection_sensitive_actions;
RelatedActions ActionManager::plugin_selection_sensitive_actions;
RelatedActions ActionManager::track_selection_sensitive_actions;
RelatedActions ActionManager::stripable_selection_sensitive_actions;
RelatedActions ActionManager::route_selection_sensitive_actions;
RelatedActions ActionManager::bus_selection_sensitive_actions;
RelatedActions ActionManager::vca_selection_sensitive_actions;
RelatedActions ActionManager::point_selection_sensitive_actions;
RelatedActions ActionManager::time_selection_sensitive_actions;
RelatedActions ActionManager::line_selection_sensitive_actions;

View File

@ -40,6 +40,10 @@ namespace ActionManager {
extern std::vector<Glib::RefPtr<Gtk::Action> > plugin_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > track_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > stripable_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > bus_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > route_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > vca_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > point_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > time_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > line_selection_sensitive_actions;

View File

@ -150,6 +150,10 @@ ARDOUR_UI::set_session (Session *s)
ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::route_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::bus_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::vca_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::stripable_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::line_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::point_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::playlist_selection_sensitive_actions, false);

View File

@ -178,7 +178,7 @@ ARDOUR_UI::install_actions ()
sigc::mem_fun(*this, &ARDOUR_UI::start_duplicate_routes));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::write_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::route_selection_sensitive_actions.push_back (act);
act = global_actions.register_action (main_actions, X_("cancel-solo"), _("Cancel Solo"), sigc::mem_fun(*this, &ARDOUR_UI::cancel_solo));
ActionManager::session_sensitive_actions.push_back (act);

View File

@ -160,7 +160,10 @@ Editor::register_actions ()
myactions.register_action (editor_menu_actions, X_("SyncMenu"), _("Sync"));
myactions.register_action (editor_menu_actions, X_("TempoMenu"), _("Tempo"));
myactions.register_action (editor_menu_actions, X_("Timecode"), _("Timecode fps"));
myactions.register_action (editor_menu_actions, X_("TrackHeightMenu"), _("Height"));
act = myactions.register_action (editor_menu_actions, X_("TrackHeightMenu"), _("Height"));
ActionManager::stripable_selection_sensitive_actions.push_back (act);
myactions.register_action (editor_menu_actions, X_("TrackMenu"), _("Track"));
myactions.register_action (editor_menu_actions, X_("Tools"), _("Tools"));
myactions.register_action (editor_menu_actions, X_("View"), _("View"));
@ -246,11 +249,11 @@ Editor::register_actions ()
act = reg_sens (editor_actions, "track-record-enable-toggle", _("Toggle Record Enable"), sigc::mem_fun(*this, &Editor::toggle_record_enable));
ActionManager::track_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "track-solo-toggle", _("Toggle Solo"), sigc::mem_fun(*this, &Editor::toggle_solo));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "track-mute-toggle", _("Toggle Mute"), sigc::mem_fun(*this, &Editor::toggle_mute));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "track-solo-isolate-toggle", _("Toggle Solo Isolate"), sigc::mem_fun(*this, &Editor::toggle_solo_isolate));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
for (int i = 1; i <= 12; ++i) {
string const a = string_compose (X_("save-visual-state-%1"), i);
@ -297,9 +300,9 @@ Editor::register_actions ()
reg_sens (editor_actions, "zoom_10_min", _("Zoom to 10 min"), sigc::bind (sigc::mem_fun(*this, &Editor::set_zoom_preset), 10 * 60 * 1000));
act = reg_sens (editor_actions, "move-selected-tracks-up", _("Move Selected Tracks Up"), sigc::bind (sigc::mem_fun(*_routes, &EditorRoutes::move_selected_tracks), true));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "move-selected-tracks-down", _("Move Selected Tracks Down"), sigc::bind (sigc::mem_fun(*_routes, &EditorRoutes::move_selected_tracks), false));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "scroll-tracks-up", _("Scroll Tracks Up"), sigc::mem_fun(*this, &Editor::scroll_tracks_up));
act = reg_sens (editor_actions, "scroll-tracks-down", _("Scroll Tracks Down"), sigc::mem_fun(*this, &Editor::scroll_tracks_down));
@ -429,29 +432,28 @@ Editor::register_actions ()
act = reg_sens (editor_actions, "toggle-track-active", _("Toggle Active"), (sigc::mem_fun(*this, &Editor::toggle_tracks_active)));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::route_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "remove-track", _("Remove"), (sigc::mem_fun(*this, &Editor::remove_tracks)));
/* not selection sensitive? */
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "fit-selection", _("Fit Selection (Vertical)"), sigc::mem_fun(*this, &Editor::fit_selection));
ActionManager::stripable_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));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "track-height-larger", _("Larger"), sigc::bind (
sigc::mem_fun(*this, &Editor::set_track_height), HeightLarger));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "track-height-large", _("Large"), sigc::bind (
sigc::mem_fun(*this, &Editor::set_track_height), HeightLarge));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "track-height-normal", _("Normal"), sigc::bind (
sigc::mem_fun(*this, &Editor::set_track_height), HeightNormal));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "track-height-small", _("Small"), sigc::bind (
sigc::mem_fun(*this, &Editor::set_track_height), HeightSmall));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::stripable_selection_sensitive_actions.push_back (act);
toggle_reg_sens (editor_actions, "sound-midi-notes", _("Sound Selected MIDI Notes"), sigc::mem_fun (*this, &Editor::toggle_sound_midi_notes));

View File

@ -30,6 +30,7 @@
#include "ardour/route_group.h"
#include "ardour/selection.h"
#include "ardour/session.h"
#include "ardour/vca.h"
#include "editor.h"
#include "editor_drag.h"
@ -1000,6 +1001,12 @@ struct SelectionOrderSorter {
void
Editor::presentation_info_changed (PropertyChange const & what_changed)
{
uint32_t n_tracks = 0;
uint32_t n_busses = 0;
uint32_t n_vcas = 0;
uint32_t n_routes = 0;
uint32_t n_stripables = 0;
/* We cannot ensure ordering of the handlers for
* PresentationInfo::Changed, so we have to do everything in order
* here, as a single handler.
@ -1047,6 +1054,18 @@ Editor::presentation_info_changed (PropertyChange const & what_changed)
continue;
}
n_stripables++;
if (boost::dynamic_pointer_cast<Track> ((*i).stripable)) {
n_tracks++;
n_routes++;
} else if (boost::dynamic_pointer_cast<Route> ((*i).stripable)) {
n_busses++;
n_routes++;
} else if (boost::dynamic_pointer_cast<VCA> ((*i).stripable)) {
n_vcas++;
}
TimeAxisView* tav = dynamic_cast<TimeAxisView*> (av);
if (!tav) {
@ -1082,7 +1101,11 @@ Editor::presentation_info_changed (PropertyChange const & what_changed)
stripables->push_back ((*i).stripable);
}
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, !selection->tracks.empty());
ActionManager::set_sensitive (ActionManager::stripable_selection_sensitive_actions, (n_stripables > 0));
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, (n_tracks > 0));
ActionManager::set_sensitive (ActionManager::bus_selection_sensitive_actions, (n_busses > 0));
ActionManager::set_sensitive (ActionManager::route_selection_sensitive_actions, (n_routes > 0));
ActionManager::set_sensitive (ActionManager::vca_selection_sensitive_actions, (n_vcas > 0));
sensitize_the_right_region_actions (false);