13
0

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
This commit is contained in:
Paul Davis 2013-01-21 16:10:39 +00:00
parent c939a66249
commit 3b17107417
2 changed files with 22 additions and 6 deletions

View File

@ -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,

View File

@ -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;
}