diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-01-24 21:58:07 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-01-24 21:58:07 +0000 |
commit | a97376dd808f72e0bc0c1a0f40c1a6244f0b0c3c (patch) | |
tree | 46e018003851cbeb57ad7623b28f301ef2aa0745 /libs/gtkmm2ext | |
parent | 627a99034a1a90dd1111c9d32a280490ad9f7e6f (diff) |
fix up rather odd sizing model for ProcessorBox that affected Pixfaders used as controls
git-svn-id: svn://localhost/ardour2/branches/3.0@13994 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/pixfader.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/pixfader.cc | 28 |
2 files changed, 13 insertions, 16 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/pixfader.h b/libs/gtkmm2ext/gtkmm2ext/pixfader.h index c43daa7d50..2953cc6333 100644 --- a/libs/gtkmm2ext/gtkmm2ext/pixfader.h +++ b/libs/gtkmm2ext/gtkmm2ext/pixfader.h @@ -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&); diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc index 005e9dcefd..f4e362bca1 100644 --- a/libs/gtkmm2ext/pixfader.cc +++ b/libs/gtkmm2ext/pixfader.cc @@ -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 (); } @@ -535,14 +541,6 @@ PixFader::display_span () } void -PixFader::set_fader_length (int l) -{ - span = l; - update_unity_position (); - queue_resize (); -} - -void PixFader::update_unity_position () { if (_orien == VERT) { |