marlin r1293 - trunk/marlin
- From: iain svn gnome org
- To: svn-commits-list gnome org
- Subject: marlin r1293 - trunk/marlin
- Date: Sat, 4 Oct 2008 01:27:20 +0000 (UTC)
Author: iain
Date: Sat Oct 4 01:27:20 2008
New Revision: 1293
URL: http://svn.gnome.org/viewvc/marlin?rev=1293&view=rev
Log:
Make LevelRuler a NO-WINDOW widget
Modified:
trunk/marlin/ChangeLog
trunk/marlin/marlin-level-ruler.c
Modified: trunk/marlin/marlin-level-ruler.c
==============================================================================
--- trunk/marlin/marlin-level-ruler.c (original)
+++ trunk/marlin/marlin-level-ruler.c Sat Oct 4 01:27:20 2008
@@ -208,37 +208,6 @@
req->width = widget->style->xthickness * 2 + PANGO_PIXELS (width) + 7;
}
-static void
-realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- int attributes_mask;
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
-}
-
#define YPOS(v) chan_area.y + chan_height - ((((v) - ruler->priv->vmin) * chan_height) / (ruler->priv->vmax - ruler->priv->vmin))
static void
@@ -258,13 +227,15 @@
quart = (int) (chan_height / 4);
half = quart * 2;
- chan_area.x = 0;
- chan_area.y = (chan_height * channel_num) + channel_num;
+ chan_area.x = widget->allocation.x;
+ chan_area.y = widget->allocation.y + (chan_height * channel_num) + channel_num;
chan_area.width = widget->allocation.width;
chan_area.height = chan_height;
- gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type], &chan_area);
- gdk_gc_set_clip_rectangle (widget->style->dark_gc[state_type], &chan_area);
+ gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type],
+ &chan_area);
+ gdk_gc_set_clip_rectangle (widget->style->dark_gc[state_type],
+ &chan_area);
yv = YPOS (0.0) + priv->base_offset;
gdk_draw_line (widget->window,
@@ -288,8 +259,8 @@
yv = YPOS (0.5) + priv->base_offset;
gdk_draw_line (widget->window,
widget->style->dark_gc[state_type],
- area->x + (area->width - 5), yv,
- area->x + area->width, yv);
+ area->x + (area->width - 5), area->y + yv,
+ area->x + area->width, area->y + yv);
if (priv->level_display == MARLIN_SCALE_LINEAR) {
pango_layout_set_markup (priv->layout, "<small><small>50</small></small>", -1);
@@ -313,8 +284,8 @@
yv = YPOS (-0.5) + priv->base_offset;
gdk_draw_line (widget->window,
widget->style->dark_gc[state_type],
- area->x + (area->width - 5), yv,
- area->x + area->width, yv);
+ area->x + (area->width - 5), area->y + yv,
+ area->x + area->width, area->y + yv);
if (priv->level_display == MARLIN_SCALE_LINEAR) {
pango_layout_set_markup (priv->layout, "<small><small>-50</small></small>", -1);
@@ -351,7 +322,7 @@
gtk_paint_box (widget->style, widget->window,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
NULL, widget, "marlin-db-ruler",
- 0, 0,
+ widget->allocation.x, widget->allocation.y,
widget->allocation.width,
widget->allocation.height);
@@ -360,8 +331,8 @@
for (i = 0; i < ruler->priv->channels; i++) {
GdkRectangle chan_area, inter;
- chan_area.x = 0;
- chan_area.y = (chan_height * i) + i;
+ chan_area.x = widget->allocation.x;
+ chan_area.y = widget->allocation.y + (chan_height * i) + i;
chan_area.width = widget->allocation.width;
chan_area.height = chan_height;
@@ -373,9 +344,9 @@
gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type], area);
gdk_draw_line (widget->window,
widget->style->text_gc[state_type],
- area->x, chan_height * i,
+ area->x, area->y + chan_height * i,
area->x + widget->allocation.width,
- chan_height * i);
+ area->y + chan_height * i);
gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type], NULL);
}
}
@@ -559,7 +530,7 @@
w_class->size_allocate = size_allocate;
w_class->size_request = size_request;
- w_class->realize = realize;
+ /* w_class->realize = realize; */
w_class->expose_event = expose_event;
w_class->button_press_event = button_press_event;
w_class->button_release_event = button_release_event;
@@ -596,6 +567,8 @@
{
MarlinLevelRulerPrivate *priv;
+ GTK_WIDGET_SET_FLAGS ((GtkWidget *) ruler, GTK_NO_WINDOW);
+
priv = ruler->priv = GET_PRIVATE (ruler);
priv->channels = DEFAULT_CHANNELS;
priv->vmin = DEFAULT_VMIN;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]