fix up rather odd sizing model for ProcessorBox that affected Pixfaders used as controls
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 24 Jan 2013 21:58:07 +0000 (21:58 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 24 Jan 2013 21:58:07 +0000 (21:58 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@13994 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h
libs/gtkmm2ext/gtkmm2ext/pixfader.h
libs/gtkmm2ext/pixfader.cc

index 7bdaa8b3cbaeb537087a91551ca723fead1d23a6..91551e19bb49b6077952736bd03c9013d1712e0a 100644 (file)
@@ -296,14 +296,6 @@ ProcessorEntry::name (Width w) const
        return name_display;
 }
 
-void
-ProcessorEntry::set_pixel_width (int p)
-{
-       for (list<Control*>::iterator i = _controls.begin(); i != _controls.end(); ++i) {
-               (*i)->set_pixel_width (p);
-       }
-}
-
 void
 ProcessorEntry::show_all_controls ()
 {
@@ -469,12 +461,6 @@ ProcessorEntry::Control::set_tooltip ()
        ARDOUR_UI::instance()->set_tip (_button, sm);
 }
 
-void
-ProcessorEntry::Control::set_pixel_width (int p)
-{
-       _slider.set_fader_length (p);
-}
-
 void
 ProcessorEntry::Control::slider_adjusted ()
 {
@@ -705,7 +691,6 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelecto
 
        processor_display.set_flags (CAN_FOCUS);
        processor_display.set_name ("ProcessorList");
-       processor_display.set_size_request (48, -1);
        processor_display.set_data ("processorbox", this);
        processor_display.set_spacing (2);
 
@@ -844,8 +829,7 @@ ProcessorBox::set_width (Width w)
                (*i)->set_enum_width (w);
        }
 
-       _redisplay_pending = true;
-       
+       queue_resize ();
 }
 
 Gtk::Menu*
@@ -1356,7 +1340,6 @@ ProcessorBox::redisplay_processors ()
 
        if (_visible_prefader_processors == 0) { // fader only
                BlankProcessorEntry* bpe = new BlankProcessorEntry (this, _width);
-               bpe->set_pixel_width (get_allocation().get_width());
                processor_display.add_child (bpe);
        }
 
@@ -1481,8 +1464,6 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
                e = new ProcessorEntry (this, processor, _width);
        }
 
-       e->set_pixel_width (get_allocation().get_width());
-
        /* Set up this entry's state from the GUIObjectState */
        XMLNode* proc = entry_gui_object_state (e);
        if (proc) {
@@ -2499,22 +2480,6 @@ 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);
-
-       if (_redisplay_pending) {
-               _redisplay_pending = false;
-               redisplay_processors ();
-       } else {
-               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 ());
-               }
-       }
-}
-
 /** @param p Processor.
  *  @return the UI window for \a p.
  */
index f500a0683843b4e2f15d5b12c68974d4687cd1ef..157cdbf27e30207a31b10fb9769c547b6422c031 100644 (file)
@@ -119,7 +119,6 @@ public:
        void set_position (Position);
        boost::shared_ptr<ARDOUR::Processor> processor () const;
        void set_enum_width (Width);
-       virtual void set_pixel_width (int);
 
        /** Hide any widgets that should be hidden */
        virtual void hide_things ();
@@ -156,7 +155,6 @@ private:
        public:
                Control (boost::shared_ptr<ARDOUR::AutomationControl>, std::string const &);
 
-               void set_pixel_width (int);
                void set_visible (bool);
                void add_state (XMLNode *) const;
                void set_state (XMLNode const *);
@@ -367,7 +365,6 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
        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 &);
 
        void setup_entry_positions ();
 
index c43daa7d507badc233eda2b16d02a107fe178f68..2953cc633340bfc065f0bc687008e61cf4764f54 100644 (file)
@@ -35,7 +35,6 @@ class PixFader : public Gtk::DrawingArea
         PixFader (Gtk::Adjustment& adjustment, int orientation, int span, int girth);
        virtual ~PixFader ();
 
-       void set_fader_length (int);
        void set_default_value (float);
        void set_text (const std::string&);
 
index 005e9dcefdc47c3e0532ed9352ede68e2900a02b..f4e362bca1b6ec0b3670d3a110354c8fa9cd2bad 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <iostream>
 
+#include "pbd/stacktrace.h"
+
 #include "gtkmm2ext/pixfader.h"
 #include "gtkmm2ext/keyboard.h"
 #include "gtkmm2ext/rgb_macros.h"
@@ -280,12 +282,11 @@ PixFader::on_expose_event (GdkEventExpose* ev)
                        }
                }
        }
-       
-       if ( !_text.empty() ) {
 
-               cairo_new_path (cr);    
+       if ( !_text.empty() ) {
 
                /* center text */
+               cairo_new_path (cr);
                cairo_move_to (cr, (get_width() - _text_width)/2.0, get_height()/2.0 - _text_height/2.0);
                cairo_set_source_rgba (cr, text_r, text_g, text_b, 0.9);
                pango_cairo_show_layout (cr, _layout->gobj());
@@ -308,11 +309,11 @@ void
 PixFader::on_size_request (GtkRequisition* req)
 {
        if (_orien == VERT) {
-               req->width = girth;
-               req->height = span;
+               req->width = (girth ? girth : -1);
+               req->height = (span ? span : -1);
        } else {
-               req->height = girth;
-               req->width = span;
+               req->height = (girth ? girth : -1);
+               req->width = (span ? span : -1);
        }
 }
 
@@ -329,6 +330,11 @@ PixFader::on_size_allocate (Gtk::Allocation& alloc)
                span = alloc.get_width ();
        }
 
+       if (is_realized()) {
+               /* recreate patterns in case we've changed size */
+               create_patterns ();
+       }
+
        update_unity_position ();
 }
 
@@ -534,14 +540,6 @@ PixFader::display_span ()
        return ds;
 }
 
-void
-PixFader::set_fader_length (int l)
-{
-       span = l;
-       update_unity_position ();
-       queue_resize ();
-}
-
 void
 PixFader::update_unity_position ()
 {