removed non-functional colormap-cycling and simplified the selection code.

2003-11-11  Sven Neumann  <sven@gimp.org>

	* app/display/gimpdisplayshell-selection.[ch]: removed
	non-functional colormap-cycling and simplified the selection code.

	* app/config/gimpdisplayconfig.[ch]
	* app/config/gimprc-blurbs.h
	* app/gui/preferences-dialog.c: removed "colormap-cycling" from
	the preferences.
This commit is contained in:
Sven Neumann 2003-11-11 12:43:52 +00:00 committed by Sven Neumann
parent 7110a5bd4c
commit 5728a40c69
8 changed files with 60 additions and 195 deletions

View File

@ -1,8 +1,18 @@
2003-11-11 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-selection.[ch]: removed
non-functional colormap-cycling and simplified the selection code.
* app/config/gimpdisplayconfig.[ch]
* app/config/gimprc-blurbs.h
* app/gui/preferences-dialog.c: removed "colormap-cycling" from
the preferences.
2003-11-11 Michael Natterer <mitch@gimp.org>
* plug-ins/common/dicom.c: removed doubly pasted code. Changed
error/progress messages to use the "standard" string many plug-ins
use. Added error message if opening for wriring fails. Minor
error/progress messages to use the "standard" strings many plug-ins
use. Added error message if opening for writing fails. Minor
cleanups.
2003-11-11 Sven Neumann <sven@gimp.org>

View File

@ -70,7 +70,6 @@ enum
{
PROP_0,
PROP_MARCHING_ANTS_SPEED,
PROP_COLORMAP_CYCLING,
PROP_RESIZE_WINDOWS_ON_ZOOM,
PROP_RESIZE_WINDOWS_ON_RESIZE,
PROP_DEFAULT_DOT_FOR_DOT,
@ -144,10 +143,6 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
MARCHING_ANTS_SPEED_BLURB,
50, G_MAXINT, 300,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_COLORMAP_CYCLING,
"colormap-cycling", COLORMAP_CYCLING_BLURB,
FALSE,
GIMP_PARAM_RESTART);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RESIZE_WINDOWS_ON_ZOOM,
"resize-windows-on-zoom",
RESIZE_WINDOWS_ON_ZOOM_BLURB,
@ -282,9 +277,6 @@ gimp_display_config_set_property (GObject *object,
case PROP_MARCHING_ANTS_SPEED:
display_config->marching_ants_speed = g_value_get_int (value);
break;
case PROP_COLORMAP_CYCLING:
display_config->colormap_cycling = g_value_get_boolean (value);
break;
case PROP_RESIZE_WINDOWS_ON_ZOOM:
display_config->resize_windows_on_zoom = g_value_get_boolean (value);
break;
@ -362,9 +354,6 @@ gimp_display_config_get_property (GObject *object,
case PROP_MARCHING_ANTS_SPEED:
g_value_set_int (value, display_config->marching_ants_speed);
break;
case PROP_COLORMAP_CYCLING:
g_value_set_boolean (value, display_config->colormap_cycling);
break;
case PROP_RESIZE_WINDOWS_ON_ZOOM:
g_value_set_boolean (value, display_config->resize_windows_on_zoom);
break;

View File

@ -41,7 +41,6 @@ struct _GimpDisplayConfig
GimpCoreConfig parent_instance;
gint marching_ants_speed;
gboolean colormap_cycling;
gboolean resize_windows_on_zoom;
gboolean resize_windows_on_resize;
gboolean default_dot_for_dot;

View File

@ -19,11 +19,6 @@ N_("Specifies how the area around the image should be drawn.")
N_("Sets the canvas padding color used if the padding mode is set to " \
"custom color.")
#define COLORMAP_CYCLING_BLURB \
N_("Specify that marching ants for selected regions will be drawn with " \
"colormap cycling as opposed to be drawn as animated lines. This color " \
"cycling option works only with 8-bit displays.")
#define CONFIRM_ON_CLOSE_BLURB \
N_("Ask for confirmation before closing an image without saving.")

View File

@ -1552,9 +1552,6 @@ prefs_dialog_new (Gimp *gimp,
prefs_check_button_add (object, "install-colormap",
_("Install Colormap"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "colormap-cycling",
_("Colormap Cycling"),
GTK_BOX (vbox2));
/*************************/

View File

@ -50,30 +50,23 @@
/* local function prototypes */
static GdkPixmap * create_cycled_ants_pixmap (GdkWindow *window,
gint depth);
static void cycle_ant_colors (Selection *select);
static void selection_add_point (GdkPoint *points[8],
gint max_npoints[8],
gint npoints[8],
gint x,
gint y);
static void selection_render_points (Selection *select);
static void selection_draw (Selection *select);
static void selection_transform_segs (Selection *select,
const BoundSeg *src_segs,
GdkSegment *dest_segs,
gint num_segs);
static void selection_generate_segs (Selection *select);
static void selection_free_segs (Selection *select);
static gboolean selection_start_marching (gpointer data);
static gboolean selection_march_ants (gpointer data);
static void selection_add_point (GdkPoint *points[8],
gint max_npoints[8],
gint npoints[8],
gint x,
gint y);
static void selection_render_points (Selection *select);
static void selection_draw (Selection *select);
static void selection_transform_segs (Selection *select,
const BoundSeg *src_segs,
GdkSegment *dest_segs,
gint num_segs);
static void selection_generate_segs (Selection *select);
static void selection_free_segs (Selection *select);
static gboolean selection_start_marching (gpointer data);
static gboolean selection_march_ants (gpointer data);
static GdkColor marching_ants_colors[8];
static GdkPixmap *marching_ants[9] = { NULL };
static GdkPixmap *cycled_ants_pixmap = NULL;
static GdkPixmap *marching_ants[9] = { NULL };
/* public functions */
@ -97,31 +90,11 @@ gimp_display_shell_selection_create (GdkWindow *win,
gimage = shell->gdisp->gimage;
base_type = gimp_image_base_type (gimage);
if (GIMP_DISPLAY_CONFIG (gimage->gimp->config)->colormap_cycling)
{
new->cycle = TRUE;
if (! cycled_ants_pixmap)
{
GdkVisual *visual;
visual = gdk_screen_get_rgb_visual (gdk_drawable_get_screen (win));
cycled_ants_pixmap = create_cycled_ants_pixmap (win, visual->depth);
}
new->cycle_pix = cycled_ants_pixmap;
}
else
{
new->cycle = FALSE;
if (! marching_ants[0])
for (i = 0; i < 8; i++)
marching_ants[i] = gdk_bitmap_create_from_data (win,
(gchar *) ant_data[i],
8, 8);
}
if (! marching_ants[0])
for (i = 0; i < 8; i++)
marching_ants[i] = gdk_bitmap_create_from_data (win,
(gchar *) ant_data[i],
8, 8);
new->win = win;
new->shell = shell;
@ -132,8 +105,6 @@ gimp_display_shell_selection_create (GdkWindow *win,
new->num_segs_out = 0;
new->num_segs_layer = 0;
new->index_in = 0;
new->index_out = 0;
new->index_layer = 0;
new->state = INVISIBLE;
new->paused = 0;
new->recalc = TRUE;
@ -146,30 +117,20 @@ gimp_display_shell_selection_create (GdkWindow *win,
/* create a new graphics context */
new->gc_in = gdk_gc_new (new->win);
if (new->cycle)
{
gdk_gc_set_fill (new->gc_in, GDK_TILED);
gdk_gc_set_tile (new->gc_in, new->cycle_pix);
gdk_gc_set_line_attributes (new->gc_in, 1,
GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
}
else
{
/* get black and white pixels for this gdisplay */
fg.red = 0x0;
fg.green = 0x0;
fg.blue = 0x0;
/* get black and white pixels for this gdisplay */
fg.red = 0x0;
fg.green = 0x0;
fg.blue = 0x0;
bg.red = 0xffff;
bg.green = 0xffff;
bg.blue = 0xffff;
bg.red = 0xffff;
bg.green = 0xffff;
bg.blue = 0xffff;
gdk_gc_set_rgb_fg_color (new->gc_in, &fg);
gdk_gc_set_rgb_bg_color (new->gc_in, &bg);
gdk_gc_set_fill (new->gc_in, GDK_OPAQUE_STIPPLED);
gdk_gc_set_line_attributes (new->gc_in, 1,
GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
}
gdk_gc_set_rgb_fg_color (new->gc_in, &fg);
gdk_gc_set_rgb_bg_color (new->gc_in, &bg);
gdk_gc_set_fill (new->gc_in, GDK_OPAQUE_STIPPLED);
gdk_gc_set_line_attributes (new->gc_in,
1, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
new->gc_white = gdk_gc_new (new->win);
gdk_gc_set_rgb_fg_color (new->gc_white, &bg);
@ -191,6 +152,7 @@ gimp_display_shell_selection_create (GdkWindow *win,
gdk_gc_set_rgb_fg_color (new->gc_out, &fg);
gdk_gc_set_rgb_bg_color (new->gc_out, &bg);
gdk_gc_set_fill (new->gc_out, GDK_OPAQUE_STIPPLED);
gdk_gc_set_stipple (new->gc_out, marching_ants[0]);
gdk_gc_set_line_attributes (new->gc_out, 1,
GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
@ -208,6 +170,7 @@ gimp_display_shell_selection_create (GdkWindow *win,
gdk_gc_set_rgb_fg_color (new->gc_layer, &fg);
gdk_gc_set_rgb_bg_color (new->gc_layer, &bg);
gdk_gc_set_fill (new->gc_layer, GDK_OPAQUE_STIPPLED);
gdk_gc_set_stipple (new->gc_layer, marching_ants[0]);
gdk_gc_set_line_attributes (new->gc_layer, 1,
GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
@ -401,57 +364,6 @@ gimp_display_shell_selection_layer_set_hidden (Selection *select,
/* private functions */
static GdkPixmap *
create_cycled_ants_pixmap (GdkWindow *window,
gint depth)
{
GdkPixmap *pixmap;
GdkGC *gc;
gint i, j;
pixmap = gdk_pixmap_new (window, 8, 8, depth);
gc = gdk_gc_new (window);
for (i = 0; i < 8; i++)
for (j = 0; j < 8; j++)
{
gdk_gc_set_rgb_fg_color (gc, &marching_ants_colors[((i + j) % 8)]);
gdk_draw_line (pixmap, gc, i, j, i, j);
}
g_object_unref (gc);
return pixmap;
}
static void
cycle_ant_colors (Selection *select)
{
gint i;
gint index;
for (i = 0; i < 8; i++)
{
index = (i + (8 - select->index_in)) % 8;
if (index < 4)
{
marching_ants_colors[i].red = 0x0;
marching_ants_colors[i].green = 0x0;
marching_ants_colors[i].blue = 0x0;
}
else
{
marching_ants_colors[i].red = 0xffff;
marching_ants_colors[i].green = 0xffff;
marching_ants_colors[i].blue = 0xffff;
}
}
}
#define MAX_POINTS_INC 2048
static void
@ -572,13 +484,6 @@ selection_render_points (Selection *select)
static void
selection_draw (Selection *select)
{
if (! select->layer_hidden)
{
if (select->segs_layer && select->index_layer == 0)
gdk_draw_segments (select->win, select->gc_layer,
select->segs_layer, select->num_segs_layer);
}
if (select->hidden)
return;
@ -619,12 +524,6 @@ selection_draw (Selection *select)
select->points_in[i], select->num_points_in[i]);
}
}
if (select->segs_out && select->index_out == 0)
{
gdk_draw_segments (select->win, select->gc_out,
select->segs_out, select->num_segs_out);
}
}
@ -792,27 +691,24 @@ selection_start_marching (gpointer data)
select->recalc = FALSE;
}
select->index_in = 0;
select->index_out = 0;
select->index_layer = 0;
select->index_in = 0;
/* Make sure the state is set to marching */
select->state = MARCHING;
/* Draw the ants */
if (select->cycle)
{
cycle_ant_colors (select);
}
else
{
gdk_gc_set_stipple (select->gc_in, marching_ants[select->index_in]);
gdk_gc_set_stipple (select->gc_out, marching_ants[select->index_out]);
gdk_gc_set_stipple (select->gc_layer, marching_ants[select->index_layer]);
}
gdk_gc_set_stipple (select->gc_in, marching_ants[0]);
if (! select->layer_hidden && select->segs_layer)
gdk_draw_segments (select->win, select->gc_layer,
select->segs_layer, select->num_segs_layer);
selection_draw (select);
if (select->segs_out)
gdk_draw_segments (select->win, select->gc_out,
select->segs_out, select->num_segs_out);
/* Reset the timer */
select->timeout_id = g_timeout_add (config->marching_ants_speed,
selection_march_ants,
@ -825,9 +721,7 @@ selection_start_marching (gpointer data)
static gboolean
selection_march_ants (gpointer data)
{
Selection *select;
select = (Selection *) data;
Selection *select = (Selection *) data;
/* increment stipple index */
select->index_in++;
@ -835,23 +729,10 @@ selection_march_ants (gpointer data)
if (select->index_in > 7)
select->index_in = 0;
/* outside segments do not march, so index does not cycle */
select->index_out++;
/* layer doesn't march */
select->index_layer++;
/* Draw the ants */
if (select->cycle)
{
cycle_ant_colors (select);
}
else
{
gdk_gc_set_stipple (select->gc_in, marching_ants[select->index_in]);
gdk_gc_set_stipple (select->gc_in, marching_ants[select->index_in]);
selection_draw (select);
}
selection_draw (select);
return TRUE;
}

View File

@ -38,15 +38,12 @@ struct _Selection
gint num_segs_out; /* number of segments in segs2 */
gint num_segs_layer; /* number of segments in segs3 */
gint index_in; /* index of current stipple pattern */
gint index_out; /* index of current stipple pattern */
gint index_layer; /* index of current stipple pattern */
gint state; /* internal drawing state */
gint paused; /* count of pause requests */
gboolean recalc; /* flag to recalculate the selection */
gboolean hidden; /* is the selection hidden? */
gboolean layer_hidden; /* is the layer boundary hidden? */
guint timeout_id; /* timer for successive draws */
gint cycle; /* color cycling turned on */
GdkPixmap *cycle_pix; /* cycling pixmap */
/* These are used only if USE_XDRAWPOINTS is defined. */

View File

@ -1552,9 +1552,6 @@ prefs_dialog_new (Gimp *gimp,
prefs_check_button_add (object, "install-colormap",
_("Install Colormap"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "colormap-cycling",
_("Colormap Cycling"),
GTK_BOX (vbox2));
/*************************/