From: Paul Davis Date: Sat, 7 Jan 2012 17:10:18 +0000 (+0000) Subject: add an empty ProcessorEntry before the fader if there are no pre-fader processors... X-Git-Tag: 3.0-beta2~21 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=c9de3c5a16532ccc6b5e3bbd4921d0173ce58a86;p=ardour.git add an empty ProcessorEntry before the fader if there are no pre-fader processors, to strongly visually indicate that you can insert new processors there; add back a fixed, static tooltip for the processor box git-svn-id: svn://localhost/ardour2/branches/3.0@11187 d708f5d6-7413-0410-9779-e7cbd77b26cf --- diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 3040061dc9..5aaf48a719 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -102,24 +102,31 @@ ProcessorEntry::ProcessorEntry (boost::shared_ptr p, Width w) , _width (w) , _visual_state (Gtk::STATE_NORMAL) { - _vbox.pack_start (_button, true, true); _vbox.show (); - if (_processor->active()) { - _button.set_active_state (Gtkmm2ext::Active); - } _button.set_diameter (3); _button.set_distinct_led_click (true); _button.set_led_left (true); _button.signal_led_clicked.connect (sigc::mem_fun (*this, &ProcessorEntry::led_clicked)); _button.set_text (name (_width)); - _button.show (); - _processor->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_active_changed, this), gui_context()); - _processor->PropertyChanged.connect (name_connection, invalidator (*this), ui_bind (&ProcessorEntry::processor_property_changed, this, _1), gui_context()); + if (_processor) { + _vbox.pack_start (_button, true, true); - setup_tooltip (); - setup_visuals (); + if (_processor->active()) { + _button.set_active_state (Gtkmm2ext::Active); + } + + _button.show (); + + _processor->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_active_changed, this), gui_context()); + _processor->PropertyChanged.connect (name_connection, invalidator (*this), ui_bind (&ProcessorEntry::processor_property_changed, this, _1), gui_context()); + + setup_tooltip (); + setup_visuals (); + } else { + _vbox.set_size_request (-1, _button.size_request().height); + } } EventBox& @@ -191,20 +198,24 @@ ProcessorEntry::set_enum_width (Width w) void ProcessorEntry::led_clicked() { - if (_button.active_state() == Gtkmm2ext::Active) { - _processor->deactivate (); - } else { - _processor->activate (); + if (_processor) { + if (_button.active_state() == Gtkmm2ext::Active) { + _processor->deactivate (); + } else { + _processor->activate (); + } } } void ProcessorEntry::processor_active_changed () { - if (_processor->active()) { - _button.set_active_state (Gtkmm2ext::Active); - } else { - _button.unset_active_state (); + if (_processor) { + if (_processor->active()) { + _button.set_active_state (Gtkmm2ext::Active); + } else { + _button.unset_active_state (); + } } } @@ -229,6 +240,10 @@ ProcessorEntry::name (Width w) const boost::shared_ptr send; string name_display; + if (!_processor) { + return string(); + } + if ((send = boost::dynamic_pointer_cast (_processor)) != 0 && !boost::dynamic_pointer_cast(_processor)) { @@ -265,6 +280,11 @@ ProcessorEntry::name (Width w) const return name_display; } +BlankProcessorEntry::BlankProcessorEntry (Width w) + : ProcessorEntry (boost::shared_ptr(), w) +{ +} + SendProcessorEntry::SendProcessorEntry (boost::shared_ptr s, Width w) : ProcessorEntry (s, w) , _send (s) @@ -466,6 +486,7 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::functionset_tip (processor_display, _("Right-click to add/remove/edit\nplugins,inserts,sends and more")); } ProcessorBox::~ProcessorBox () @@ -706,6 +729,12 @@ ProcessorBox::show_processor_menu (int arg) int x, y; processor_display.get_pointer (x, y); _placement = processor_display.add_placeholder (y); + + if (_visible_prefader_processors == 0) { + if (_placement == 1) { + _placement = 0; + } + } } bool @@ -735,7 +764,7 @@ ProcessorBox::processor_operation (ProcessorOperation op) pair const pointer = processor_display.get_child_at_position (y); - if (pointer.first) { + if (pointer.first && pointer.first->processor()) { targets.push_back (pointer.first->processor ()); } } @@ -1087,7 +1116,8 @@ ProcessorBox::route_processors_changed (RouteProcessorChange c) void ProcessorBox::redisplay_processors () { - ENSURE_GUI_THREAD (*this, &ProcessorBox::redisplay_processors) + ENSURE_GUI_THREAD (*this, &ProcessorBox::redisplay_processors); + bool fader_seen; if (no_processor_redisplay) { return; @@ -1095,6 +1125,18 @@ ProcessorBox::redisplay_processors () processor_display.clear (); + _visible_prefader_processors = 0; + fader_seen = false; + + _route->foreach_processor (sigc::bind (sigc::mem_fun (*this, &ProcessorBox::help_count_visible_prefader_processors), + &_visible_prefader_processors, &fader_seen)); + + if (_visible_prefader_processors == 0) { // fader only + BlankProcessorEntry* bpe = new BlankProcessorEntry (_width); + bpe->set_pixel_width (get_allocation().get_width()); + processor_display.add_child (bpe); + } + _route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::add_processor_to_display)); for (list::iterator i = _processor_window_proxies.begin(); i != _processor_window_proxies.end(); ++i) { @@ -1182,6 +1224,23 @@ ProcessorBox::maybe_add_processor_to_ui_list (boost::weak_ptr w) ARDOUR_UI::instance()->add_window_proxy (wp); } +void +ProcessorBox::help_count_visible_prefader_processors (boost::weak_ptr p, uint32_t* cnt, bool* amp_seen) +{ + boost::shared_ptr processor (p.lock ()); + + if (processor && processor->display_to_user()) { + + if (boost::dynamic_pointer_cast(processor)) { + *amp_seen = true; + } else { + if (!*amp_seen) { + (*cnt)++; + } + } + } +} + void ProcessorBox::add_processor_to_display (boost::weak_ptr p) { @@ -1191,6 +1250,7 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr p) return; } + boost::shared_ptr send = boost::dynamic_pointer_cast (processor); boost::shared_ptr plugin_insert = boost::dynamic_pointer_cast (processor); ProcessorEntry* e = 0; diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index bf02caf3d7..b2fde9c668 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -144,6 +144,12 @@ private: PBD::ScopedConnection name_connection; }; +class BlankProcessorEntry : public ProcessorEntry +{ + public: + BlankProcessorEntry (Width w); +}; + class SendProcessorEntry : public ProcessorEntry { public: @@ -252,6 +258,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD * put at the end of the plugin list. */ int _placement; + uint32_t _visible_prefader_processors; RouteProcessorSelection& _rr_selection; @@ -290,6 +297,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD bool processor_button_release_event (GdkEventButton *, ProcessorEntry *); void redisplay_processors (); void add_processor_to_display (boost::weak_ptr); + void help_count_visible_prefader_processors (boost::weak_ptr, uint32_t*, bool*); void reordered (); void report_failed_reorder (); void route_processors_changed (ARDOUR::RouteProcessorChange);