Some limited control of mixer strip component

visibility.


git-svn-id: svn://localhost/ardour2/branches/3.0@10341 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-10-29 20:08:48 +00:00
parent 4d365d08c1
commit db429c2362
7 changed files with 129 additions and 2 deletions

View file

@ -871,6 +871,7 @@ Editor::show_window ()
if (current_mixer_strip) {
current_mixer_strip->hide_things ();
current_mixer_strip->parameter_changed ("mixer-strip-visibility");
}
}

View file

@ -24,6 +24,7 @@
#include "pbd/convert.h"
#include "pbd/enumwriter.h"
#include "pbd/replace_all.h"
#include "pbd/stacktrace.h"
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/utils.h>
@ -92,6 +93,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
, bottom_button_table (1, 2)
, meter_point_label (_("pre"))
, midi_input_enable_button (0)
, _visibility (X_("mixer-strip-visibility"))
{
init ();
@ -117,6 +119,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt
, bottom_button_table (1, 2)
, meter_point_label (_("pre"))
, midi_input_enable_button (0)
, _visibility (X_("mixer-strip-visibility"))
{
init ();
set_route (rt);
@ -222,7 +225,7 @@ MixerStrip::init ()
rec_solo_table.attach (*solo_safe_led, 1, 2, 1, 2);
rec_solo_table.show ();
button_table.set_homogeneous (true);
button_table.set_homogeneous (false);
button_table.set_spacings (0);
button_table.attach (name_button, 0, 1, 0, 1);
@ -335,6 +338,18 @@ MixerStrip::init ()
AudioEngine::instance()->PortConnectedOrDisconnected.connect (
*this, invalidator (*this), boost::bind (&MixerStrip::port_connected_or_disconnected, this, _1, _3), gui_context ()
);
/* Add the widgets under visibility control to the VisibilityGroup; the names used here
must be the same as those used in RCOptionEditor so that the configuration changes
are recognised when they occur.
*/
_visibility.add (&_invert_button_box, X_("PhaseInvert"), _("Phase Invert"));
_visibility.add (solo_safe_led, X_("SoloSafe"), _("Solo Safe"));
_visibility.add (solo_isolated_led, X_("SoloIsolated"), _("Solo Isolated"));
parameter_changed (X_("mixer-strip-visibility"));
Config->ParameterChanged.connect (_config_connection, MISSING_INVALIDATOR, ui_bind (&MixerStrip::parameter_changed, this, _1), gui_context());
}
MixerStrip::~MixerStrip ()
@ -522,6 +537,8 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
group_button.show();
group_label.show();
parameter_changed ("mixer-strip-visibility");
show ();
}
@ -1354,6 +1371,7 @@ MixerStrip::build_route_ops_menu ()
items.push_back (MenuElem (_("Save As Template..."), sigc::mem_fun(*this, &RouteUI::save_as_template)));
items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteUI::route_rename)));
rename_menu_item = &items.back();
items.push_back (SeparatorElem());
items.push_back (CheckMenuElem (_("Active")));
CheckMenuItem* i = dynamic_cast<CheckMenuItem *> (&items.back());
@ -1970,3 +1988,14 @@ MixerStrip::state_id () const
{
return string_compose ("strip %1", _route->id().to_s());
}
void
MixerStrip::parameter_changed (string p)
{
if (p == _visibility.get_state_name()) {
/* The user has made changes to the mixer strip visibility, so get
our VisibilityGroup to reflect these changes in our widgets.
*/
_visibility.set_state (Config->get_mixer_strip_visibility ());
}
}

View file

@ -53,6 +53,7 @@
#include "enums.h"
#include "processor_box.h"
#include "ardour_dialog.h"
#include "visibility_group.h"
namespace ARDOUR {
class Route;
@ -120,6 +121,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
std::string state_id() const;
void parameter_changed (std::string);
protected:
friend class Mixer_UI;
void set_packed (bool yn);
@ -290,6 +293,17 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
void update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width width, bool input_button);
void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
/** A VisibilityGroup to manage the visibility of some of our controls.
* We fill it with the controls that are being managed, using the same names
* as those used with _mixer_strip_visibility in RCOptionEditor. Then
* this VisibilityGroup is configured by changes to the RC variable
* mixer-strip-visibility, which happen when the user makes changes in
* the RC option editor.
*/
VisibilityGroup _visibility;
PBD::ScopedConnection _config_connection;
static std::string meter_point_string (ARDOUR::MeterPoint);
};

View file

@ -263,6 +263,8 @@ Mixer_UI::show_window ()
for (ri = rows.begin(); ri != rows.end(); ++ri) {
ms = (*ri)[track_columns.strip];
ms->set_width_enum (ms->get_width_enum (), ms->width_owner());
/* Fix visibility of mixer strip stuff */
ms->parameter_changed (X_("mixer-strip-visibility"));
}
}
_visible = true;

View file

@ -790,10 +790,69 @@ private:
Gtk::Window& _parent;
};
/** A class which allows control of visibility of some editor components usign
* a VisibilityGroup. The caller should pass in a `dummy' VisibilityGroup
* which has the correct members, but with null widget pointers. This
* class allows the user to set visibility of the members, the details
* of which are stored in a configuration variable which can be watched
* by parts of the editor that actually contain the widgets whose visibility
* is being controlled.
*/
class VisibilityOption : public Option
{
public:
/** @param name User-visible name for this group.
* @param g `Dummy' VisibilityGroup (as described above).
* @param get Method to get the value of the appropriate configuration variable.
* @param set Method to set the value of the appropriate configuration variable.
*/
VisibilityOption (string name, VisibilityGroup* g, sigc::slot<string> get, sigc::slot<bool, string> set)
: Option (g->get_state_name(), name)
, _heading (name)
, _visibility_group (g)
, _get (get)
, _set (set)
{
/* Watch for changes made by the user to our members */
_visibility_group->VisibilityChanged.connect_same_thread (
_visibility_group_connection, sigc::bind (&VisibilityOption::changed, this)
);
}
void set_state_from_config ()
{
/* Set our state from the current configuration */
_visibility_group->set_state (_get ());
}
void add_to_page (OptionEditorPage* p)
{
_heading.add_to_page (p);
add_widget_to_page (p, _visibility_group->list_view ());
}
private:
void changed ()
{
/* The user has changed something, so reflect this change
in the RCConfiguration.
*/
_set (_visibility_group->get_state_value ());
}
OptionEditorHeading _heading;
VisibilityGroup* _visibility_group;
sigc::slot<std::string> _get;
sigc::slot<bool, std::string> _set;
PBD::ScopedConnection _visibility_group_connection;
};
RCOptionEditor::RCOptionEditor ()
: OptionEditor (Config, string_compose (_("%1 Preferences"), PROGRAM_NAME))
, _rc_config (Config)
, _mixer_strip_visibility ("mixer-strip-visibility")
{
/* MISC */
@ -1460,6 +1519,25 @@ RCOptionEditor::RCOptionEditor ()
/* KEYBOARD */
add_option (_("Keyboard"), new KeyboardOptions);
/* INTERFACE */
/* The names of these controls must be the same as those given in MixerStrip
for the actual widgets being controlled.
*/
_mixer_strip_visibility.add (0, X_("PhaseInvert"), _("Phase Invert"));
_mixer_strip_visibility.add (0, X_("SoloSafe"), _("Solo Safe"));
_mixer_strip_visibility.add (0, X_("SoloIsolated"), _("Solo Isolated"));
add_option (
_("Interface"),
new VisibilityOption (
_("Mixer Strip"),
&_mixer_strip_visibility,
sigc::mem_fun (*_rc_config, &RCConfiguration::get_mixer_strip_visibility),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_mixer_strip_visibility)
)
);
}
void

View file

@ -18,6 +18,7 @@
*/
#include "option_editor.h"
#include "visibility_group.h"
/** @file rc_option_editor.h
* @brief Editing of options which are obtained from and written back to one of the .rc files.
@ -39,4 +40,5 @@ private:
ARDOUR::RCConfiguration* _rc_config;
BoolOption* _solo_control_is_listen_control;
ComboOption<ARDOUR::ListenPosition>* _listen_position;
VisibilityGroup _mixer_strip_visibility;
};

View file

@ -173,6 +173,7 @@ CONFIG_VARIABLE (gain_t, max_gain, "max-gain", 2.0) /* +6.0dB */
CONFIG_VARIABLE (bool, denormal_protection, "denormal-protection", false)
CONFIG_VARIABLE (DenormalModel, denormal_model, "denormal-model", DenormalNone)
/* visibility of toolbar components */
/* visibility of various things */
CONFIG_VARIABLE (bool, show_zoom_tools, "show-zoom-tools", true)
CONFIG_VARIABLE (std::string, mixer_strip_visibility, "mixer-strip-visibility", "PhaseInvert,SoloSafe,SoloIsolated")