Commit 7358758f authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

minor cleanup.

2005-05-22  Sven Neumann  <sven@gimp.org>

	* app/core/gimpdashpattern.c: minor cleanup.

	* app/widgets/gimpcellrendererdashes.c: don't draw a background,
	draw the dash pattern twice, use the correct widget state.
parent 22475618
2005-05-22 Sven Neumann <sven@gimp.org>
* app/core/gimpdashpattern.c: minor cleanup.
* app/widgets/gimpcellrendererdashes.c: don't draw a background,
draw the dash pattern twice, use the correct widget state.
2005-05-21 Manish Singh <yosh@gimp.org>
* plug-ins/metadata/metadata.c (run): don't do pointer arithmetic
......
......@@ -130,7 +130,7 @@ gimp_dash_pattern_from_segments (const gboolean *segments,
{
gdouble l = (dash_length * count) / n_segments;
pattern = g_array_append_val (pattern, l);
g_array_append_val (pattern, l);
count = 1;
state = ! state;
......@@ -220,7 +220,7 @@ gimp_dash_pattern_from_value (const GValue *value)
val = g_value_get_double (item);
pattern = g_array_append_val (pattern, val);
g_array_append_val (pattern, val);
}
return pattern;
......@@ -266,7 +266,7 @@ gimp_dash_pattern_copy (GArray *pattern)
copy = g_array_sized_new (FALSE, FALSE, sizeof (gdouble), pattern->len);
for (i = 0; i < pattern->len; i++)
copy = g_array_append_val (copy, g_array_index (pattern, gdouble, i));
g_array_append_val (copy, g_array_index (pattern, gdouble, i));
return copy;
}
......
......@@ -30,11 +30,11 @@
#include "gimpcellrendererdashes.h"
#define DASHES_WIDTH 72
#define DASHES_HEIGHT 6
#define DASHES_WIDTH 96
#define DASHES_HEIGHT 4
#define N_SEGMENTS 24
#define BLOCK_WIDTH (DASHES_WIDTH / N_SEGMENTS)
#define BLOCK_WIDTH (DASHES_WIDTH / (2 * N_SEGMENTS))
enum
......@@ -231,17 +231,37 @@ gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
GtkCellRendererState flags)
{
GimpCellRendererDashes *dashes = GIMP_CELL_RENDERER_DASHES (cell);
GtkStateType state;
GdkRectangle rect;
gint x, y;
if (!cell->sensitive)
{
state = GTK_STATE_INSENSITIVE;
}
else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
{
if (GTK_WIDGET_HAS_FOCUS (widget))
state = GTK_STATE_SELECTED;
else
state = GTK_STATE_ACTIVE;
}
else if ((flags & GTK_CELL_RENDERER_PRELIT) == GTK_CELL_RENDERER_PRELIT &&
GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT)
{
state = GTK_STATE_PRELIGHT;
}
else
{
if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
state = GTK_STATE_INSENSITIVE;
else
state = GTK_STATE_NORMAL;
}
gimp_dash_pattern_segments_set (dashes->pattern,
dashes->segments, N_SEGMENTS);
gdk_rectangle_intersect (cell_area, expose_area, &rect);
gdk_draw_rectangle (window,
widget->style->base_gc[GTK_STATE_NORMAL], TRUE,
rect.x, rect.y, rect.width, rect.height);
y = cell_area->y + (cell_area->height - DASHES_HEIGHT) / 2;
for (x = 0; x < cell_area->width + BLOCK_WIDTH; x += BLOCK_WIDTH)
......@@ -257,7 +277,7 @@ gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
gdk_rectangle_intersect (&rect, expose_area, &rect);
gdk_draw_rectangle (widget->window,
widget->style->text_gc[GTK_STATE_NORMAL], TRUE,
widget->style->text_gc[state], TRUE,
rect.x, rect.y, rect.width, rect.height);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment