Move monitor funcs (mute,dim,mono) to globally-accessible actions.

This commit is contained in:
Ben Loftis 2018-12-05 11:25:56 -06:00
parent 85ce44724a
commit 1478d73586
9 changed files with 144 additions and 35 deletions

View file

@ -57,6 +57,8 @@ just align the first region and moves other selected regions to maintain relativ
%gmode Global Global Transport Modes
%gmon Global Global Monitor Operations
%movp Global Global Playhead Operations
A left click in the rulers positions the playhead unless Ardour is recording. You can use {\tt KP$\_$n} to move the
playhead to the n-th marker.
@ -150,6 +152,7 @@ This mode provides many different operations on both regions and control points,
@gmark|Common/jump-backward-to-mark|q|to previous mark
@sess|Common/Quit|<@PRIMARY@>q|quit
@gmark|Common/jump-forward-to-mark|w|to next mark
@mmode|MouseMode/set-mouse-mode-content|e|content mode
@select|Editor/select-all-before-edit-cursor|<@PRIMARY@>e|select all before EP
@rop|Region/export-region|<@PRIMARY@><@SECONDARY@>e|export selected region(s)
@sess|Main/ExportAudio|<@SECONDARY@>e|export session
@ -167,8 +170,6 @@ This mode provides many different operations on both regions and control points,
@sess|Common/addExistingAudioFiles|<@PRIMARY@>i|import audio files
@gselect|Common/invert-selection|<@TERTIARY@>i|invert selection
@edtrk|Editor/toggle-midi-input-active|<@SECONDARY@>i|toggle sel. track MIDI input
@mmode|MouseMode/set-mouse-mode-object|g|object mode
@mmode|MouseMode/set-mouse-mode-content|e|content mode
@sess|Main/Open|<@PRIMARY@>o|open an existing session
@sess|Main/Recent|<@PRIMARY@><@TERTIARY@>o|open a recent session
@wvis|Window/toggle-session-options-editor|<@SECONDARY@>o|toggle preferences dialog
@ -198,6 +199,7 @@ This mode provides many different operations on both regions and control points,
@rop|Region/show-rhythm-ferret|<@SECONDARY@>f|show rhythm ferret window
@wvis|Common/ToggleMaximalEditor|<@PRIMARY@><@SECONDARY@>f|maximise editor space
@wvis|Common/ToggleMaximalMixer|<@PRIMARY@><@TERTIARY@>f|maximise mixer space
@mmode|MouseMode/set-mouse-mode-object|g|object mode
@edit|Region/play-selected-regions|h|play selected region(s)
@eep|Region/trim-front|j|trim front
@eep|Region/trim-back|k|trim back
@ -229,6 +231,10 @@ This mode provides many different operations on both regions and control points,
@wvis|Window/toggle-midi-connection-manager|<@SECONDARY@><@TERTIARY@>m|toggle global midi patchbay
@wvis|Window/show-mixer|<@SECONDARY@>m|show mixer window
@gmon|Transport/monitor-cut-all|<@PRIMARY@>m|monitor cut all
@gmon|Transport/monitor-mono|<@PRIMARY@><@SECONDARY@>m|monitor mono
@gmon|Transport/monitor-dim-all|<@PRIMARY@><@TERTIARY@>m|monitor dim
;; arrow keys, navigation etc.
@vis|Editor/step-tracks-up|Up|scroll up (step)

View file

@ -34,6 +34,14 @@
</menu>
<separator/>
<menuitem action='toggle-session-options-editor'/>
<menu name='MonitorMenu' action='MonitorMenu'>
<menuitem action='UseMonitorSection'/>
<menuitem action='monitor-cut-all'/>
<menuitem action='monitor-dim-all'/>
<menuitem action='monitor-mono'/>
</menu>
<menu name='Metadata' action='Metadata'>
<menuitem action='EditMetadata'/>
<menuitem action='ImportMetadata'/>
@ -76,11 +84,6 @@
<menuitem action='toggle-skip-playback'/>
#endif
<separator/>
<menuitem action='set-loop-from-edit-range'/>
<menuitem action='set-punch-from-edit-range'/>
<menuitem action='set-session-from-edit-range'/>
<separator/>
<menuitem action='Forward'/>
<menuitem action='Rewind'/>
@ -88,6 +91,10 @@
<menuitem action='TransitionToReverse'/>
<separator/>
<separator/>
<menuitem action='set-loop-from-edit-range'/>
<menuitem action='set-punch-from-edit-range'/>
<menuitem action='set-session-from-edit-range'/>
<menu action="MovePlayHeadMenu">
<menuitem action='set-playhead'/>

View file

@ -92,6 +92,7 @@
#include "ardour/filename_extensions.h"
#include "ardour/filesystem_paths.h"
#include "ardour/ltc_file_reader.h"
#include "ardour/monitor_control.h"
#include "ardour/midi_track.h"
#include "ardour/port.h"
#include "ardour/plugin_manager.h"
@ -5985,3 +5986,45 @@ ARDOUR_UI::reset_focus (Gtk::Widget* w)
gtk_window_set_focus (GTK_WINDOW(top->gobj()), 0);
}
void
ARDOUR_UI::monitor_dim_all ()
{
boost::shared_ptr<Route> mon = _session->monitor_out ();
if (!mon) {
return;
}
boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor = mon->monitor_control ();
Glib::RefPtr<Action> act = global_actions.find_action (X_("Transport"), "monitor-dim-all");
assert (act); Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
assert (tact); _monitor->set_dim_all (tact->get_active());
}
void
ARDOUR_UI::monitor_cut_all ()
{
boost::shared_ptr<Route> mon = _session->monitor_out ();
if (!mon) {
return;
}
boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor = mon->monitor_control ();
Glib::RefPtr<Action> act = global_actions.find_action (X_("Transport"), "monitor-cut-all");
assert (act); Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
assert (tact); _monitor->set_cut_all (tact->get_active());
}
void
ARDOUR_UI::monitor_mono ()
{
boost::shared_ptr<Route> mon = _session->monitor_out ();
if (!mon) {
return;
}
boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor = mon->monitor_control ();
Glib::RefPtr<Action> act = global_actions.find_action (X_("Transport"), "monitor-mono");
assert (act); Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
assert (tact);_monitor->set_mono (tact->get_active());
}

View file

@ -365,6 +365,11 @@ public:
protected:
friend class PublicEditor;
void toggle_use_monitor_section ();
void monitor_dim_all ();
void monitor_cut_all ();
void monitor_mono ();
void toggle_auto_play ();
void toggle_auto_input ();
void toggle_punch ();

View file

@ -817,3 +817,17 @@ ARDOUR_UI::update_title ()
}
}
void
ARDOUR_UI::toggle_use_monitor_section ()
{
bool yn = !(_session->monitor_out() != 0);
if (yn) {
_session->add_monitor_section ();
} else {
_session->remove_monitor_section ();
}
Config->set_use_monitor_bus (yn);
}

View file

@ -624,6 +624,20 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
/* Monitor actions (accessible globally) */
/* ...will get sensitized if a mon-section is added */
act = global_actions.register_action (main_actions, X_("MonitorMenu"), _("Monitor Section"));
ActionManager::session_sensitive_actions.push_back (act);
act = global_actions.register_toggle_action (transport_actions, X_("UseMonitorSection"), _("Use Monitor Section"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_use_monitor_section));
ActionManager::session_sensitive_actions.push_back (act);
act = global_actions.register_toggle_action (transport_actions, "monitor-mono", _("Monitor Section: Mono"), sigc::mem_fun (*this, &ARDOUR_UI::monitor_mono));
act->set_sensitive(false);
act = global_actions.register_toggle_action (transport_actions, "monitor-cut-all", _("Monitor Section: Mute"), sigc::mem_fun (*this, &ARDOUR_UI::monitor_cut_all));
act->set_sensitive(false);
act = global_actions.register_toggle_action (transport_actions, "monitor-dim-all", _("Monitor Section: Dim"), sigc::mem_fun (*this, &ARDOUR_UI::monitor_dim_all));
act->set_sensitive(false);
act = global_actions.register_toggle_action (transport_actions, X_("ToggleVideoSync"), _("Sync Startup to Video"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_video_sync));
ActionManager::session_sensitive_actions.push_back (act);

View file

@ -2634,7 +2634,25 @@ Mixer_UI::set_axis_targets_for_operation ()
void
Mixer_UI::monitor_section_going_away ()
{
/* Set sensitivity based on existence of the monitor bus */
Glib::RefPtr<Action> act;
Glib::RefPtr<ToggleAction> tact;
act = ActionManager::get_action (X_("Transport"), "monitor-cut-all");
assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
assert (tact); tact->set_sensitive ( false );
act = ActionManager::get_action (X_("Transport"), "monitor-dim-all");
assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
assert (tact); tact->set_sensitive ( false );
act = ActionManager::get_action (X_("Transport"), "monitor-mono");
assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
assert (tact); tact->set_sensitive ( false );
if (_monitor_section) {
XMLNode* ui_node = Config->extra_xml(X_("UI"));
/* immediate state save.
*
@ -2712,8 +2730,21 @@ Mixer_UI::restore_mixer_space ()
void
Mixer_UI::monitor_section_attached ()
{
Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleMonitorSection");
act->set_sensitive (true);
/* Set sensitivity based on existence of the monitor bus */
Glib::RefPtr<Action> act;
act = ActionManager::get_action (X_("Transport"), "monitor-cut-all");
assert (act); act->set_sensitive ( true );
act = ActionManager::get_action (X_("Transport"), "monitor-dim-all");
assert (act); act->set_sensitive ( true );
act = ActionManager::get_action (X_("Transport"), "monitor-mono");
assert (act); act->set_sensitive ( true );
act = myactions.find_action ("Mixer", "ToggleMonitorSection");
assert (act); act->set_sensitive (true);
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
assert (tact);

View file

@ -1,8 +1,5 @@
<Bindings name="Monitor Section">
<Press>
<Binding key="m" action="Monitor/monitor-mono"/>
<Binding key="c" action="Monitor/monitor-cut-all"/>
<Binding key="d" action="Monitor/monitor-dim-all"/>
<Binding key="e" action="Monitor/toggle-exclusive-solo"/>
<Binding key="Shift-o" action="Monitor/toggle-mute-overrides-solo"/>
<Binding key="b" action="Monitor/toggle-monitor-processor-box"/>

View file

@ -260,7 +260,7 @@ MonitorSection::MonitorSection (Session* s)
cut_all_button.set_size_request (-1, PX_SCALE(30));
cut_all_button.show ();
act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
act = ActionManager::get_action (X_("Transport"), X_("monitor-cut-all"));
if (act) {
cut_all_button.set_related_action (act);
}
@ -269,7 +269,7 @@ MonitorSection::MonitorSection (Session* s)
dim_all_button.set_text (_("Dim"));
dim_all_button.set_name ("monitor section dim");
dim_all_button.set_size_request (-1, PX_SCALE(25));
act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
act = ActionManager::get_action (X_("Transport"), X_("monitor-dim-all"));
if (act) {
dim_all_button.set_related_action (act);
}
@ -278,7 +278,7 @@ MonitorSection::MonitorSection (Session* s)
mono_button.set_text (_("Mono"));
mono_button.set_name ("monitor section mono");
mono_button.set_size_request (-1, PX_SCALE(25));
act = ActionManager::get_action (X_("Monitor"), X_("monitor-mono"));
act = ActionManager::get_action (X_("Transport"), X_("monitor-mono"));
if (act) {
mono_button.set_related_action (act);
}
@ -812,7 +812,7 @@ MonitorSection::dim_all ()
return;
}
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Transport"), "monitor-dim-all");
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
_monitor->set_dim_all (tact->get_active());
@ -827,7 +827,7 @@ MonitorSection::cut_all ()
return;
}
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Transport"), "monitor-cut-all");
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
_monitor->set_cut_all (tact->get_active());
@ -841,7 +841,7 @@ MonitorSection::mono ()
return;
}
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Transport"), "monitor-mono");
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
_monitor->set_mono (tact->get_active());
@ -927,15 +927,6 @@ MonitorSection::register_actions ()
monitor_actions = myactions.create_action_group (X_("Monitor"));
myactions.register_toggle_action (monitor_actions, "monitor-mono", _("Switch monitor to mono"),
sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), MonitorMono));
myactions.register_toggle_action (monitor_actions, "monitor-cut-all", _("Cut monitor"),
sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), MonitorCutAll));
myactions.register_toggle_action (monitor_actions, "monitor-dim-all", _("Dim monitor"),
sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), MonitorDimAll));
act = myactions.register_toggle_action (monitor_actions, "toggle-exclusive-solo", _("Toggle exclusive solo mode"),
sigc::bind (sigc::ptr_fun (MonitorSection::action_proxy0), ToggleExclusiveSolo));
@ -1103,29 +1094,30 @@ MonitorSection::map_state ()
return;
}
Glib::RefPtr<Action> act;
update_solo_model ();
act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
Glib::RefPtr<Action> act;
Glib::RefPtr<ToggleAction> tact;
act = ActionManager::get_action (X_("Transport"), "monitor-cut-all");
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
if (tact) {
tact->set_active (_monitor->cut_all());
}
}
act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
act = ActionManager::get_action (X_("Transport"), "monitor-dim-all");
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
if (tact) {
tact->set_active (_monitor->dim_all());
}
}
act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
act = ActionManager::get_action (X_("Transport"), "monitor-mono");
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
if (tact) {
tact->set_active (_monitor->mono());
}