mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
Monitor Section actions: Allow use-monitor-section to be controlled by both menu and session-options dialog.
This commit is contained in:
parent
cd9a2e9a73
commit
bba9ac20d9
7 changed files with 116 additions and 64 deletions
|
|
@ -821,7 +821,11 @@ ARDOUR_UI::update_title ()
|
||||||
void
|
void
|
||||||
ARDOUR_UI::toggle_use_monitor_section ()
|
ARDOUR_UI::toggle_use_monitor_section ()
|
||||||
{
|
{
|
||||||
bool yn = !(_session->monitor_out() != 0);
|
RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "UseMonitorSection");
|
||||||
|
assert (act); RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||||
|
assert (tact);
|
||||||
|
|
||||||
|
bool yn = tact->get_active ();
|
||||||
|
|
||||||
if (yn) {
|
if (yn) {
|
||||||
_session->add_monitor_section ();
|
_session->add_monitor_section ();
|
||||||
|
|
|
||||||
|
|
@ -571,6 +571,8 @@ Mixer_UI::add_stripables (StripableList& slist)
|
||||||
if (mnode) {
|
if (mnode) {
|
||||||
_monitor_section->tearoff().set_state (*mnode);
|
_monitor_section->tearoff().set_state (*mnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_monitor_action_sensitivity(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
out_packer.pack_end (_monitor_section->tearoff(), false, false);
|
out_packer.pack_end (_monitor_section->tearoff(), false, false);
|
||||||
|
|
@ -2631,25 +2633,35 @@ Mixer_UI::set_axis_targets_for_operation ()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Mixer_UI::set_monitor_action_sensitivity (bool yn)
|
||||||
|
{
|
||||||
|
Glib::RefPtr<Action> act;
|
||||||
|
Glib::RefPtr<ToggleAction> tact;
|
||||||
|
|
||||||
|
act = ActionManager::get_action (X_("Monitor"), "UseMonitorSection");
|
||||||
|
assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||||
|
assert (tact); tact->set_active ( yn );
|
||||||
|
|
||||||
|
act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
|
||||||
|
assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||||
|
assert (tact); tact->set_sensitive ( yn );
|
||||||
|
|
||||||
|
act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
|
||||||
|
assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||||
|
assert (tact); tact->set_sensitive ( yn );
|
||||||
|
|
||||||
|
act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
|
||||||
|
assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||||
|
assert (tact); tact->set_sensitive ( yn );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Mixer_UI::monitor_section_going_away ()
|
Mixer_UI::monitor_section_going_away ()
|
||||||
{
|
{
|
||||||
/* Set sensitivity based on existence of the monitor bus */
|
/* Set sensitivity based on existence of the monitor bus */
|
||||||
|
|
||||||
Glib::RefPtr<Action> act;
|
set_monitor_action_sensitivity(false);
|
||||||
Glib::RefPtr<ToggleAction> tact;
|
|
||||||
|
|
||||||
act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
|
|
||||||
assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
|
||||||
assert (tact); tact->set_sensitive ( false );
|
|
||||||
|
|
||||||
act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
|
|
||||||
assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
|
||||||
assert (tact); tact->set_sensitive ( false );
|
|
||||||
|
|
||||||
act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
|
|
||||||
assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
|
||||||
assert (tact); tact->set_sensitive ( false );
|
|
||||||
|
|
||||||
if (_monitor_section) {
|
if (_monitor_section) {
|
||||||
|
|
||||||
|
|
@ -2730,20 +2742,7 @@ Mixer_UI::restore_mixer_space ()
|
||||||
void
|
void
|
||||||
Mixer_UI::monitor_section_attached ()
|
Mixer_UI::monitor_section_attached ()
|
||||||
{
|
{
|
||||||
/* Set sensitivity based on existence of the monitor bus */
|
Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleMonitorSection");
|
||||||
|
|
||||||
Glib::RefPtr<Action> act;
|
|
||||||
|
|
||||||
act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
|
|
||||||
assert (act); act->set_sensitive ( true );
|
|
||||||
|
|
||||||
act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
|
|
||||||
assert (act); act->set_sensitive ( true );
|
|
||||||
|
|
||||||
act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
|
|
||||||
assert (act); act->set_sensitive ( true );
|
|
||||||
|
|
||||||
act = myactions.find_action ("Mixer", "ToggleMonitorSection");
|
|
||||||
assert (act); act->set_sensitive (true);
|
assert (act); act->set_sensitive (true);
|
||||||
|
|
||||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
||||||
|
|
|
||||||
|
|
@ -378,6 +378,8 @@ private:
|
||||||
|
|
||||||
friend class MixerGroupTabs;
|
friend class MixerGroupTabs;
|
||||||
|
|
||||||
|
void set_monitor_action_sensitivity (bool);
|
||||||
|
|
||||||
void monitor_section_going_away ();
|
void monitor_section_going_away ();
|
||||||
|
|
||||||
void monitor_section_attached ();
|
void monitor_section_attached ();
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,55 @@ RcActionButton::add_to_page (OptionEditorPage *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*--------------------------*/
|
||||||
|
|
||||||
|
CheckOption::CheckOption (string const & i, string const & n, Glib::RefPtr<Gtk::Action> act)
|
||||||
|
{
|
||||||
|
_button = manage (new CheckButton);
|
||||||
|
_label = manage (new Label);
|
||||||
|
_label->set_markup (n);
|
||||||
|
_button->add (*_label);
|
||||||
|
_button->signal_toggled().connect (sigc::mem_fun (*this, &CheckOption::toggled));
|
||||||
|
|
||||||
|
Gtkmm2ext::Activatable::set_related_action (act);
|
||||||
|
if (_action) {
|
||||||
|
|
||||||
|
action_sensitivity_changed ();
|
||||||
|
|
||||||
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
|
||||||
|
if (tact) {
|
||||||
|
action_toggled ();
|
||||||
|
tact->signal_toggled().connect (sigc::mem_fun (*this, &CheckOption::action_toggled));
|
||||||
|
}
|
||||||
|
|
||||||
|
_action->connect_property_changed ("sensitive", sigc::mem_fun (*this, &CheckOption::action_sensitivity_changed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CheckOption::action_toggled ()
|
||||||
|
{
|
||||||
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
|
||||||
|
if (tact) {
|
||||||
|
_button->set_active(tact->get_active());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CheckOption::add_to_page (OptionEditorPage* p)
|
||||||
|
{
|
||||||
|
add_widget_to_page (p, _button);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CheckOption::toggled ()
|
||||||
|
{
|
||||||
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
|
||||||
|
|
||||||
|
tact->set_active( _button->get_active() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------*/
|
/*--------------------------*/
|
||||||
|
|
||||||
BoolOption::BoolOption (string const & i, string const & n, sigc::slot<bool> g, sigc::slot<bool, bool> s)
|
BoolOption::BoolOption (string const & i, string const & n, sigc::slot<bool> g, sigc::slot<bool, bool> s)
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include "widgets/slider_controller.h"
|
#include "widgets/slider_controller.h"
|
||||||
|
|
||||||
|
#include "actions.h"
|
||||||
#include "ardour_window.h"
|
#include "ardour_window.h"
|
||||||
#include "audio_clock.h"
|
#include "audio_clock.h"
|
||||||
#include "ardour/types.h"
|
#include "ardour/types.h"
|
||||||
|
|
@ -187,6 +188,34 @@ protected:
|
||||||
std::string _name;
|
std::string _name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Just a Gtk Checkbutton, masquerading as an option component */
|
||||||
|
class CheckOption : public OptionEditorComponent , public Gtkmm2ext::Activatable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CheckOption (std::string const &, std::string const &, Glib::RefPtr<Gtk::Action> act );
|
||||||
|
void set_state_from_config () {}
|
||||||
|
void parameter_changed (std::string const &) {}
|
||||||
|
void add_to_page (OptionEditorPage*);
|
||||||
|
|
||||||
|
void set_sensitive (bool yn) {
|
||||||
|
_button->set_sensitive (yn);
|
||||||
|
}
|
||||||
|
|
||||||
|
Gtk::Widget& tip_widget() { return *_button; }
|
||||||
|
|
||||||
|
void action_toggled ();
|
||||||
|
void action_sensitivity_changed () {}
|
||||||
|
void action_visibility_changed () {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void toggled ();
|
||||||
|
|
||||||
|
sigc::slot<bool> _get; ///< slot to get the configuration variable's value
|
||||||
|
sigc::slot<bool, bool> _set; ///< slot to set the configuration variable's value
|
||||||
|
Gtk::CheckButton* _button; ///< UI button
|
||||||
|
Gtk::Label* _label; ///< label for button, so we can use markup
|
||||||
|
};
|
||||||
|
|
||||||
/** Component which provides the UI to handle a boolean option using a GTK CheckButton */
|
/** Component which provides the UI to handle a boolean option using a GTK CheckButton */
|
||||||
class BoolOption : public Option
|
class BoolOption : public Option
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
#include "ardour/transport_master_manager.h"
|
#include "ardour/transport_master_manager.h"
|
||||||
|
|
||||||
|
#include "actions.h"
|
||||||
#include "gui_thread.h"
|
#include "gui_thread.h"
|
||||||
#include "session_option_editor.h"
|
#include "session_option_editor.h"
|
||||||
#include "search_path_option.h"
|
#include "search_path_option.h"
|
||||||
|
|
@ -273,11 +274,10 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
|
||||||
sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_input)
|
sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_input)
|
||||||
));
|
));
|
||||||
|
|
||||||
add_option (_("Monitoring"), new BoolOption (
|
add_option (_("Monitoring"), new CheckOption (
|
||||||
"have-monitor-section",
|
"have-monitor-section",
|
||||||
_("Use monitor section in this session"),
|
_("Use monitor section in this session"),
|
||||||
sigc::mem_fun (*this, &SessionOptionEditor::get_use_monitor_section),
|
ActionManager::get_action(X_("Monitor"), "UseMonitorSection")
|
||||||
sigc::mem_fun (*this, &SessionOptionEditor::set_use_monitor_section)
|
|
||||||
));
|
));
|
||||||
|
|
||||||
add_option (_("Monitoring"), new OptionEditorBlank ());
|
add_option (_("Monitoring"), new OptionEditorBlank ());
|
||||||
|
|
@ -448,34 +448,6 @@ SessionOptionEditor::parameter_changed (std::string const & p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the presence of absence of a monitor section is not really a regular session
|
|
||||||
* property so we provide these two functions to act as setter/getter slots
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool
|
|
||||||
SessionOptionEditor::set_use_monitor_section (bool yn)
|
|
||||||
{
|
|
||||||
bool had_monitor_section = _session->monitor_out() != 0;
|
|
||||||
|
|
||||||
if (yn) {
|
|
||||||
_session->add_monitor_section ();
|
|
||||||
} else {
|
|
||||||
_session->remove_monitor_section ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* store this choice for any new sessions */
|
|
||||||
|
|
||||||
Config->set_use_monitor_bus (yn);
|
|
||||||
|
|
||||||
return had_monitor_section != (_session->monitor_out() != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
SessionOptionEditor::get_use_monitor_section ()
|
|
||||||
{
|
|
||||||
return _session->monitor_out() != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SessionOptionEditor::save_defaults ()
|
SessionOptionEditor::save_defaults ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,6 @@ private:
|
||||||
|
|
||||||
ARDOUR::SessionConfiguration* _session_config;
|
ARDOUR::SessionConfiguration* _session_config;
|
||||||
|
|
||||||
bool set_use_monitor_section (bool);
|
|
||||||
bool get_use_monitor_section ();
|
|
||||||
|
|
||||||
ComboOption<float>* _vpu;
|
ComboOption<float>* _vpu;
|
||||||
ComboOption<ARDOUR::SampleFormat>* _sf;
|
ComboOption<ARDOUR::SampleFormat>* _sf;
|
||||||
EntryOption* _take_name;
|
EntryOption* _take_name;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue