From ef5fd145f7273029020ece2131533dfe841edbb8 Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Sat, 14 Sep 2019 10:19:01 -0700 Subject: [PATCH] Set Foldback strip width and ellipsize to work --- gtk2_ardour/foldback_strip.cc | 34 +++++++++++++++------------------- gtk2_ardour/foldback_strip.h | 8 +++----- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/gtk2_ardour/foldback_strip.cc b/gtk2_ardour/foldback_strip.cc index 6cd31b555a..9ba5aaa19f 100644 --- a/gtk2_ardour/foldback_strip.cc +++ b/gtk2_ardour/foldback_strip.cc @@ -59,13 +59,14 @@ using namespace std; #define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale())) FoldbackSend::FoldbackSend (boost::shared_ptr snd, \ - boost::shared_ptr sr, boost::shared_ptr fr) + boost::shared_ptr sr, boost::shared_ptr fr, uint32_t wd) : _button (ArdourButton::led_default_elements) , _send (snd) , _send_route (sr) , _foldback_route (fr) , _send_proc (snd) , _send_del (snd) + , _width (wd) , pan_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero)) , _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1) , _slider (&_adjustment, boost::shared_ptr(), 0, max(13.f, rintf(13.f * UIConfiguration::instance().get_ui_scale()))) @@ -81,14 +82,15 @@ FoldbackSend::FoldbackSend (boost::shared_ptr snd, \ _button.set_led_left (true); _button.signal_led_clicked.connect (sigc::mem_fun (*this, &FoldbackSend::led_clicked)); _button.set_name ("processor prefader"); - _button.set_layout_ellipsize_width (Wide * PANGO_SCALE); - name_changed (); + _button.set_layout_ellipsize_width (PX_SCALE(_width) * PANGO_SCALE); _button.set_text_ellipsize (Pango::ELLIPSIZE_END); + name_changed (); snd_but_pan->pack_start (_button, true, true); _button.set_active (_send_proc->enabled ()); _button.show (); if (_foldback_route->input()->n_ports().n_audio() == 2) { + _button.set_layout_ellipsize_width (PX_SCALE(_width - 19) * PANGO_SCALE); boost::shared_ptr pannable = _send_del->panner()->pannable(); boost::shared_ptr ac; ac = pannable->pan_azimuth_control; @@ -147,8 +149,7 @@ FoldbackSend::route_property_changed (const PropertyChange& what_changed) void FoldbackSend::name_changed () { - string s_name = PBD::short_version (_send_route->name (), 8); - _button.set_text (s_name); + _button.set_text (_send_route->name ()); ArdourWidgets::set_tooltip (_button, Gtkmm2ext::markup_escape_text(_send_route->name())); } @@ -295,6 +296,7 @@ FoldbackStrip::FoldbackStrip (Mixer_UI& mx, Session* sess, boost::shared_ptrset_name ("FoldbackBusStripBase"); // panners from route_ui - panners.set_width (Narrow); + panners.set_width (Wide); insert_box = new ProcessorBox (0, boost::bind (&FoldbackStrip::plugin_selector, this), _pr_selection, 0); insert_box->set_no_show_all (); @@ -376,15 +376,18 @@ FoldbackStrip::init () VBox* level_box = manage (new VBox); level_box->pack_start (*fb_level_control, true, false); master_box.pack_start (*level_box, true, false); - master_box.set_size_request (PX_SCALE(120), PX_SCALE(100)); + master_box.set_size_request (PX_SCALE(_width + 34), PX_SCALE(80)); master_box.set_name ("FoldbackBusStripBase"); level_box->show (); output_button.set_text (_("Output")); output_button.set_name ("mixer strip button"); + output_button.set_text_ellipsize (Pango::ELLIPSIZE_MIDDLE); + output_button.set_layout_ellipsize_width (PX_SCALE(_width) * PANGO_SCALE); _comment_button.set_name (X_("mixer strip button")); _comment_button.set_text_ellipsize (Pango::ELLIPSIZE_END); + _comment_button.set_layout_ellipsize_width (PX_SCALE(_width) * PANGO_SCALE); global_vpacker.set_border_width (1); global_vpacker.set_spacing (2); @@ -440,7 +443,6 @@ FoldbackStrip::init () _session->engine().Stopped.connect (*this, invalidator (*this), boost::bind (&FoldbackStrip::engine_stopped, this), gui_context()); _session->engine().Running.connect (*this, invalidator (*this), boost::bind (&FoldbackStrip::engine_running, this), gui_context()); - output_button.set_text_ellipsize (Pango::ELLIPSIZE_MIDDLE); output_button.signal_button_press_event().connect (sigc::mem_fun(*this, &FoldbackStrip::output_press), false); output_button.signal_button_release_event().connect (sigc::mem_fun(*this, &FoldbackStrip::output_release), false); @@ -452,8 +454,6 @@ FoldbackStrip::init () send_scroller.signal_button_press_event().connect (sigc::mem_fun (*this, &FoldbackStrip::send_button_press_event)); _comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor)); - _width = Wide; - add_events (Gdk::BUTTON_RELEASE_MASK| Gdk::ENTER_NOTIFY_MASK| Gdk::LEAVE_NOTIFY_MASK| @@ -640,7 +640,7 @@ FoldbackStrip::update_send_box () boost::shared_ptr s_rt = boost::dynamic_pointer_cast (s_sp); boost::shared_ptr snd = s_rt->internal_send_for (_route); if (snd) { - FoldbackSend * fb_s = new FoldbackSend (snd, s_rt, _route); + FoldbackSend * fb_s = new FoldbackSend (snd, s_rt, _route, _width); send_display.pack_start (*fb_s, Gtk::PACK_SHRINK); fb_s->show (); s_rt->processors_changed.connect (_connections, invalidator (*this), boost::bind (&FoldbackStrip::processors_changed, this, _1), gui_context ()); @@ -1345,13 +1345,9 @@ FoldbackStrip::route_property_changed (const PropertyChange& what_changed) void FoldbackStrip::name_changed () { - - name_button.set_text_ellipsize (Pango::ELLIPSIZE_END); - string r_name = PBD::short_version (_route->name (), 16); - name_button.set_text (r_name); + name_button.set_text (_route->name()); set_tooltip (name_button, Gtkmm2ext::markup_escape_text(_route->name())); - } void diff --git a/gtk2_ardour/foldback_strip.h b/gtk2_ardour/foldback_strip.h index 755ba1655a..b8bc3faa4f 100644 --- a/gtk2_ardour/foldback_strip.h +++ b/gtk2_ardour/foldback_strip.h @@ -75,7 +75,7 @@ class FoldbackSend : public Gtk::VBox { public: FoldbackSend (boost::shared_ptr, \ - boost::shared_ptr sr, boost::shared_ptr fr); + boost::shared_ptr sr, boost::shared_ptr fr, uint32_t wd); ~FoldbackSend (); private: @@ -85,6 +85,7 @@ private: boost::shared_ptr _foldback_route; boost::shared_ptr _send_proc; boost::shared_ptr _send_del; + uint32_t _width; void led_clicked(GdkEventButton *); gboolean button_press (GdkEventButton*); @@ -121,8 +122,6 @@ public: boost::shared_ptr stripable() const { return RouteUI::stripable(); } - void* width_owner () const { return _width_owner; } - PannerUI& panner_ui() { return panners; } PluginSelector* plugin_selector(); @@ -178,10 +177,9 @@ private: bool _embedded; bool _packed; bool _mixer_owned; - Width _width; - void* _width_owner; ARDOUR::Session* _session; bool _showing_sends; + uint32_t _width; Gtk::EventBox spacer; Gtk::VBox send_display;