diff options
author | Carl Hetherington <carl@carlh.net> | 2009-12-04 17:45:11 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-12-04 17:45:11 +0000 |
commit | 12c97285305fba9c0edf2297128e978b0f2ccd67 (patch) | |
tree | e37a98940371cf04f14ea3248298f73718bea537 /gtk2_ardour | |
parent | 4a836618f3f9eb28848353e072315da1f2ccfbf0 (diff) |
Make processor box send faders adjust their size correctly.
git-svn-id: svn://localhost/ardour2/branches/3.0@6280 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/gain_meter.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/gain_meter.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 20 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/processor_box.cc | 29 | ||||
-rw-r--r-- | gtk2_ardour/processor_box.h | 7 | ||||
-rw-r--r-- | gtk2_ardour/rc_option_editor.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/return_ui.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/send_ui.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/sfdb_ui.cc | 2 |
11 files changed, 60 insertions, 26 deletions
diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index d72e09be10..f77a1049e0 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -76,7 +76,8 @@ GainMeter::setup_slider_pix () GainMeterBase::GainMeterBase (Session& s, const Glib::RefPtr<Gdk::Pixbuf>& pix, - bool horizontal) + bool horizontal, + int fader_length) : _session (s) // 0.781787 is the value needed for gain to be set to 0. , gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1) @@ -95,12 +96,14 @@ GainMeterBase::GainMeterBase (Session& s, _width = Wide; if (horizontal) { - gain_slider = manage (new HSliderController (pix, + gain_slider = manage (new HSliderController (pix, &gain_adjustment, + fader_length, false)); } else { gain_slider = manage (new VSliderController (pix, &gain_adjustment, + fader_length, false)); } @@ -794,8 +797,8 @@ GainMeterBase::on_theme_changed() style_changed = true; } -GainMeter::GainMeter (Session& s) - : GainMeterBase (s, slider, false) +GainMeter::GainMeter (Session& s, int fader_length) + : GainMeterBase (s, slider, false, fader_length) { gain_display_box.set_homogeneous (true); gain_display_box.set_spacing (2); diff --git a/gtk2_ardour/gain_meter.h b/gtk2_ardour/gain_meter.h index c0c5d9faff..448e0239fe 100644 --- a/gtk2_ardour/gain_meter.h +++ b/gtk2_ardour/gain_meter.h @@ -62,7 +62,7 @@ class GainMeterBase : virtual public sigc::trackable { public: GainMeterBase (ARDOUR::Session&, const Glib::RefPtr<Gdk::Pixbuf>& pix, - bool horizontal); + bool horizontal, int); virtual ~GainMeterBase (); virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route, @@ -180,7 +180,7 @@ class GainMeterBase : virtual public sigc::trackable class GainMeter : public GainMeterBase, public Gtk::VBox { public: - GainMeter (ARDOUR::Session&); + GainMeter (ARDOUR::Session&, int); ~GainMeter () {} virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route, diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 73326c8d30..cddd5b1ae9 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -80,7 +80,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer) ,_mixer(mx) , _mixer_owned (in_mixer) , processor_box (sess, sigc::mem_fun(*this, &MixerStrip::plugin_selector), mx.selection(), this, in_mixer) - , gpm (sess) + , gpm (sess, 250) , panners (sess) , _mono_button (_("Mono")) , button_table (3, 2) @@ -106,7 +106,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt ,_mixer(mx) , _mixer_owned (in_mixer) , processor_box (sess, sigc::mem_fun(*this, &MixerStrip::plugin_selector), mx.selection(), this, in_mixer) - , gpm (sess) + , gpm (sess, 250) , panners (sess) , button_table (3, 2) , middle_button_table (1, 2) @@ -134,6 +134,9 @@ MixerStrip::init () _width_owner = 0; spacer = 0; + /* the length of this string determines the width of the mixer strip when it is set to `wide' */ + longest_label = "longest label"; + Gtk::Image* img; img = manage (new Gtk::Image (::get_icon("strip_width"))); @@ -151,14 +154,15 @@ MixerStrip::init () input_button.add (input_label); input_button.set_name ("MixerIOButton"); input_label.set_name ("MixerIOButtonLabel"); - Gtkmm2ext::set_size_request_to_display_given_text (input_button, "longest label", 4, 4); + + Gtkmm2ext::set_size_request_to_display_given_text (input_button, longest_label.c_str(), 4, 4); output_label.set_text (_("Output")); ARDOUR_UI::instance()->set_tip (&output_button, _("Button 1 to choose outputs from a port matrix, button 3 to select inputs from a menu"), ""); output_button.add (output_label); output_button.set_name ("MixerIOButton"); output_label.set_name ("MixerIOButtonLabel"); - Gtkmm2ext::set_size_request_to_display_given_text (output_button, "longest label", 4, 4); + Gtkmm2ext::set_size_request_to_display_given_text (output_button, longest_label.c_str(), 4, 4); ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), ""); meter_point_button.add (meter_point_label); @@ -197,7 +201,7 @@ MixerStrip::init () name_button.add (name_label); name_button.set_name ("MixerNameButton"); - Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2); + Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2); name_label.set_name ("MixerNameButtonLabel"); ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), ""); @@ -526,7 +530,6 @@ MixerStrip::set_width_enum (Width w, void* owner) gpm.set_width (w); panners.set_width (w); - processor_box.set_width (w); boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->alist(); @@ -597,10 +600,13 @@ MixerStrip::set_width_enum (Width w, void* owner) panners.short_astate_string(_route->panner()->automation_state())); } - Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2); + Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2); set_size_request (max (50, gpm.get_gm_width()), -1); break; } + + processor_box.set_width (w); + update_input_display (); update_output_display (); route_group_changed (0); diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 5d4792d4ab..1f31b7cae5 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -165,6 +165,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox Gtk::Button output_button; Gtk::Label output_label; + std::string longest_label; + sigc::connection newplug_connection; gint mark_update_safe (); diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 1f2fe906c9..0f4da400ca 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -136,7 +136,7 @@ ProcessorEntry::processor () const } void -ProcessorEntry::set_width (Width w) +ProcessorEntry::set_enum_width (Width w) { _width = w; } @@ -223,7 +223,7 @@ SendProcessorEntry::SendProcessorEntry (boost::shared_ptr<Send> s, Width w) : ProcessorEntry (s, w), _send (s), _adjustment (0, 0, 1, 0.01, 0.1), - _fader (_slider, &_adjustment, false), + _fader (_slider, &_adjustment, 0, false), _ignore_gain_change (false) { _fader.set_controllable (_send->amp()->gain_control ()); @@ -265,7 +265,11 @@ SendProcessorEntry::gain_adjusted () _send->amp()->set_gain (slider_position_to_gain (_adjustment.get_value()), this); } - +void +SendProcessorEntry::set_pixel_width (int p) +{ + _fader.set_fader_length (p); +} ProcessorBox::ProcessorBox (ARDOUR::Session& sess, sigc::slot<PluginSelector*> get_plugin_selector, RouteRedirectSelection& rsel, MixerStrip* parent, bool owner_is_mixer) @@ -386,7 +390,7 @@ ProcessorBox::set_width (Width w) list<ProcessorEntry*> children = processor_display.children (); for (list<ProcessorEntry*>::iterator i = children.begin(); i != children.end(); ++i) { - (*i)->set_width (w); + (*i)->set_enum_width (w); } redisplay_processors (); @@ -960,11 +964,14 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p) } boost::shared_ptr<Send> send = boost::dynamic_pointer_cast<Send> (processor); + ProcessorEntry* e = 0; if (send) { - processor_display.add_child (new SendProcessorEntry (send, _width)); + e = new SendProcessorEntry (send, _width); } else { - processor_display.add_child (new ProcessorEntry (processor, _width)); + e = new ProcessorEntry (processor, _width); } + e->set_pixel_width (get_allocation().get_width()); + processor_display.add_child (e); } @@ -1802,3 +1809,13 @@ ProcessorBox::generate_processor_title (boost::shared_ptr<PluginInsert> pi) return string_compose(_("%1: %2 (by %3)"), _route->name(), pi->name(), maker); } +void +ProcessorBox::on_size_allocate (Allocation& a) +{ + HBox::on_size_allocate (a); + + list<ProcessorEntry*> children = processor_display.children (); + for (list<ProcessorEntry*>::const_iterator i = children.begin(); i != children.end(); ++i) { + (*i)->set_pixel_width (a.get_width ()); + } +} diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index efc91c7a82..daff50dfe7 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -76,7 +76,8 @@ public: Gtk::Widget& widget (); std::string drag_text () const; boost::shared_ptr<ARDOUR::Processor> processor () const; - void set_width (Width); + void set_enum_width (Width); + virtual void set_pixel_width (int) {} protected: @@ -104,6 +105,9 @@ public: static void setup_slider_pix (); + void set_enum_width (Width, int); + void set_pixel_width (int); + private: void show_gain (); void gain_adjusted (); @@ -242,6 +246,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject gint idle_delete_processor (boost::weak_ptr<ARDOUR::Processor>); void weird_plugin_dialog (ARDOUR::Plugin& p, ARDOUR::Route::ProcessorStreams streams); + void on_size_allocate (Gtk::Allocation &); static ProcessorBox* _current_processor_box; diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index bf44b1f3ad..8773db5c48 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -697,7 +697,8 @@ public: _db_slider = manage (new HSliderController (pix, &_db_adjustment, - false)); + false, + 115)); parameter_changed ("solo-mute-gain"); diff --git a/gtk2_ardour/return_ui.cc b/gtk2_ardour/return_ui.cc index 03b6d6044d..7bd9ca9557 100644 --- a/gtk2_ardour/return_ui.cc +++ b/gtk2_ardour/return_ui.cc @@ -37,7 +37,7 @@ using namespace PBD; ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session& se) : _return (r) , _session (se) - , _gpm (se) + , _gpm (se, 250) { _gpm.set_controls (boost::shared_ptr<Route>(), r->meter(), r->amp()); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index a644ef5e9e..1315ec40a2 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -112,7 +112,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh , size_button (_("h")) , automation_button (_("a")) , visual_button (_("v")) - , gm (sess, slider, true) + , gm (sess, slider, true, 115) { set_button_names (); diff --git a/gtk2_ardour/send_ui.cc b/gtk2_ardour/send_ui.cc index 9f30616cf8..0e030db091 100644 --- a/gtk2_ardour/send_ui.cc +++ b/gtk2_ardour/send_ui.cc @@ -37,7 +37,7 @@ using namespace PBD; SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se) : _send (s) , _session (se) - , _gpm (se) + , _gpm (se, 250) , _panners (se) { _panners.set_panner (s->panner()); @@ -50,7 +50,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se) _vbox.set_border_width (5); _vbox.pack_start (_hbox, false, false, false); - _vbox.pack_start (_panners, false,false); + _vbox.pack_start (_panners, false, false); io = manage (new IOSelector (parent, se, s->output())); diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 151ac4d7d4..3328b71225 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -594,7 +594,7 @@ SoundFileBrowser::add_gain_meter () { delete gm; - gm = new GainMeter (*session); + gm = new GainMeter (*session, 250); boost::shared_ptr<Route> r = session->the_auditioner (); |