summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-02-13 16:08:32 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-02-13 16:08:32 +0000
commite92c949f3ceb80b9892e70c7d30540a2b45fbf7d (patch)
tree61178e3cc975e985db6773bfcd6f671d84b9c8d0 /libs/gtkmm2ext
parente603d9583088068b25b55886b812d1ddbae9bfdb (diff)
fix style overwriting done by fastmeter, and lack of clip mask/clip origin restore in pixscroller; fixes meter redraw botch when moving fader, and the style fix corrects visual problems with Clearlooks as soon a ameter is realized
git-svn-id: svn://localhost/trunk/ardour2@323 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r--libs/gtkmm2ext/fastmeter.cc33
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/fastmeter.h1
-rw-r--r--libs/gtkmm2ext/pixscroller.cc11
3 files changed, 21 insertions, 24 deletions
diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc
index 6cefe182bd..e1b3361f57 100644
--- a/libs/gtkmm2ext/fastmeter.cc
+++ b/libs/gtkmm2ext/fastmeter.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2003 Paul Davis
+ Copyright (C) 2003-2006 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -72,20 +72,6 @@ FastMeter::~FastMeter ()
}
void
-FastMeter::on_realize ()
-{
- DrawingArea::on_realize();
-
- RefPtr<Style> style = get_style();
- Color black = style->get_black();
-
- style->set_bg (STATE_NORMAL, black);
- style->set_bg (STATE_ACTIVE, black);
- style->set_bg (STATE_SELECTED, black);
- style->set_bg (STATE_INSENSITIVE, black);
-}
-
-void
FastMeter::set_vertical_xpm (const char **xpm)
{
if (v_pixmap == 0) {
@@ -149,14 +135,27 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
{
gint top_of_meter;
GdkRectangle intersection;
+ GdkRectangle background;
top_of_meter = (gint) floor (v_pixheight * current_level);
pixrect.height = top_of_meter;
- if (gdk_rectangle_intersect (&pixrect, &ev->area, &intersection)) {
+ background.x = 0;
+ background.y = 0;
+ background.width = pixrect.width;
+ background.height = v_pixheight - top_of_meter;
+
+ if (gdk_rectangle_intersect (&background, &ev->area, &intersection)) {
+ get_window()->draw_rectangle (get_style()->get_black_gc(), true,
+ intersection.x, intersection.y,
+ intersection.width, intersection.height);
+ }
+
+ if (gdk_rectangle_intersect (&pixrect, &ev->area, &intersection)) {
+
/* draw the part of the meter image that we need. the area we draw is bounded "in reverse" (top->bottom)
*/
-
+
get_window()->draw_drawable(get_style()->get_fg_gc(get_state()), v_pixmap,
intersection.x, v_pixheight - top_of_meter,
intersection.x, v_pixheight - top_of_meter,
diff --git a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
index 3143c71b12..53d0666e1f 100644
--- a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
+++ b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
@@ -52,7 +52,6 @@ class FastMeter : public Gtk::DrawingArea {
protected:
bool on_expose_event (GdkEventExpose*);
void on_size_request (GtkRequisition*);
- void on_realize ();
private:
static Glib::RefPtr<Gdk::Pixmap> h_pixmap;
diff --git a/libs/gtkmm2ext/pixscroller.cc b/libs/gtkmm2ext/pixscroller.cc
index 8edf0723e1..9489a532ca 100644
--- a/libs/gtkmm2ext/pixscroller.cc
+++ b/libs/gtkmm2ext/pixscroller.cc
@@ -96,9 +96,9 @@ PixScroller::on_expose_event (GdkEventExpose* ev)
if (gdk_rectangle_intersect (sliderrect.gobj(), &ev->area, &intersect)) {
Glib::RefPtr<Gdk::GC> gc(get_style()->get_fg_gc(get_state()));
Glib::RefPtr<Gdk::Bitmap> mask (slider_mask);
-// Do these have a gtk2 equivalent?
-// Gdk::GCValues values;
-// gc->get_values(values);
+
+ GdkGCValues values;
+ gdk_gc_get_values(gc->gobj(), &values);
gc->set_clip_origin (sliderrect.get_x(), sliderrect.get_y());
gc->set_clip_mask (mask);
win->draw_drawable (gc, slider,
@@ -108,9 +108,8 @@ PixScroller::on_expose_event (GdkEventExpose* ev)
intersect.y,
intersect.width,
intersect.height);
-// gc->set_clip_origin(values.clip_x_origin, values.clip_y_origin);
-// Gdk::Bitmap i_hate_gdk (values.clip_mask);
-// gc->set_clip_mask (i_hate_gdk);
+ gc->set_clip_origin (values.clip_x_origin, values.clip_y_origin);
+ gdk_gc_set_clip_mask (gc->gobj(), values.clip_mask);
}