summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-01-21 16:10:39 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2013-01-21 16:10:39 +0000
commit3b171074172b627dea03dbdb81dc4544f509770b (patch)
tree70e058ee220138a9cad872b6c29ea44e6dec6b86 /libs
parentc939a6624933c5bc7c920c296ad67c9a7dbfd1e9 (diff)
pixfaders should invalidate their patterns and layout on style change, helps fix #5275
git-svn-id: svn://localhost/ardour2/branches/3.0@13949 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/pixfader.h1
-rw-r--r--libs/gtkmm2ext/pixfader.cc27
2 files changed, 22 insertions, 6 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/pixfader.h b/libs/gtkmm2ext/gtkmm2ext/pixfader.h
index 1e1a76d744..c43daa7d50 100644
--- a/libs/gtkmm2ext/gtkmm2ext/pixfader.h
+++ b/libs/gtkmm2ext/gtkmm2ext/pixfader.h
@@ -61,6 +61,7 @@ class PixFader : public Gtk::DrawingArea
bool on_enter_notify_event (GdkEventCrossing* ev);
bool on_leave_notify_event (GdkEventCrossing* ev);
void on_state_changed (Gtk::StateType);
+ void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
enum Orientation {
VERT,
diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc
index 1f963fbdda..e3a6036bcb 100644
--- a/libs/gtkmm2ext/pixfader.cc
+++ b/libs/gtkmm2ext/pixfader.cc
@@ -106,6 +106,10 @@ PixFader::create_patterns ()
float radius = CORNER_RADIUS;
double w = get_width();
+
+ if (w <= 1 || get_height() <= 1) {
+ return;
+ }
if ((pattern = find_pattern (fr, fg, fb, br, bg, bb, get_width(), get_height())) != 0) {
/* found it - use it */
@@ -190,7 +194,7 @@ PixFader::on_expose_event (GdkEventExpose* ev)
if (!pattern) {
create_patterns();
}
-
+
int ds = display_span ();
float w = get_width();
float h = get_height();
@@ -304,11 +308,6 @@ PixFader::on_size_allocate (Gtk::Allocation& alloc)
}
update_unity_position ();
-
- if (is_realized()) {
- create_patterns();
- queue_draw ();
- }
}
bool
@@ -594,3 +593,19 @@ PixFader::on_state_changed (Gtk::StateType old_state)
Widget::on_state_changed (old_state);
create_patterns ();
}
+
+void
+PixFader::on_style_changed (const Glib::RefPtr<Gtk::Style>&)
+{
+ if (_layout) {
+ std::string txt = _layout->get_text();
+ _layout.clear (); // drop reference to existing layout
+ set_text (txt);
+ }
+
+ /* remember that all patterns are cached and not owned by an individual
+ pixfader. we will lazily create a new pattern when needed.
+ */
+
+ pattern = 0;
+}