Commit 9c85236d authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

we need to override GimpDrawTool's "draw" method to actually see

2001-03-01  Michael Natterer  <mitch@gimp.org>

	* app/tools/crop.[ch]: we need to override GimpDrawTool's "draw"
	method to actually see something.

	* app/channels_dialog.c
	* app/layers_dialog.c: fixed the crash introduced by the migration
	of gimage->layers and gimage->channels to GimpContainer.
parent a7ae94d7
2001-03-01 Michael Natterer <mitch@gimp.org>
* app/tools/crop.[ch]: we need to override GimpDrawTool's "draw"
method to actually see something.
* app/channels_dialog.c
* app/layers_dialog.c: fixed the crash introduced by the migration
of gimage->layers and gimage->channels to GimpContainer.
2001-02-20 Nathan Summers <rock@gimp.org>
* app/tools/gimptransformtool.c
......
......@@ -411,7 +411,6 @@ void
channels_dialog_free (void)
{
ChannelWidget *cw;
GSList *list;
if (!channelsD)
return;
......@@ -421,11 +420,10 @@ channels_dialog_free (void)
gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1);
suspend_gimage_notify--;
list = channelsD->channel_widgets;
while (list)
while (channelsD->channel_widgets)
{
cw = (ChannelWidget *) list->data;
list = g_slist_next (list);
cw = (ChannelWidget *) channelsD->channel_widgets->data;
channel_widget_delete (cw);
}
channelsD->channel_widgets = NULL;
......@@ -444,7 +442,6 @@ channels_dialog_update (GimpImage* gimage)
{
GimpChannel *channel;
ChannelWidget *cw;
GSList *slist;
GList *list;
GList *item_list;
......@@ -458,10 +455,9 @@ channels_dialog_update (GimpImage* gimage)
gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1);
suspend_gimage_notify--;
for (slist = channelsD->channel_widgets; slist;)
while (channelsD->channel_widgets)
{
cw = (ChannelWidget *) slist->data;
slist = g_slist_next (slist);
cw = (ChannelWidget *) channelsD->channel_widgets->data;
channel_widget_delete (cw);
}
......
......@@ -411,7 +411,6 @@ void
channels_dialog_free (void)
{
ChannelWidget *cw;
GSList *list;
if (!channelsD)
return;
......@@ -421,11 +420,10 @@ channels_dialog_free (void)
gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1);
suspend_gimage_notify--;
list = channelsD->channel_widgets;
while (list)
while (channelsD->channel_widgets)
{
cw = (ChannelWidget *) list->data;
list = g_slist_next (list);
cw = (ChannelWidget *) channelsD->channel_widgets->data;
channel_widget_delete (cw);
}
channelsD->channel_widgets = NULL;
......@@ -444,7 +442,6 @@ channels_dialog_update (GimpImage* gimage)
{
GimpChannel *channel;
ChannelWidget *cw;
GSList *slist;
GList *list;
GList *item_list;
......@@ -458,10 +455,9 @@ channels_dialog_update (GimpImage* gimage)
gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1);
suspend_gimage_notify--;
for (slist = channelsD->channel_widgets; slist;)
while (channelsD->channel_widgets)
{
cw = (ChannelWidget *) slist->data;
slist = g_slist_next (slist);
cw = (ChannelWidget *) channelsD->channel_widgets->data;
channel_widget_delete (cw);
}
......
......@@ -518,7 +518,6 @@ void
layers_dialog_free (void)
{
LayerWidget *lw;
GSList *list;
if (!layersD)
return;
......@@ -528,13 +527,13 @@ layers_dialog_free (void)
gtk_list_clear_items (GTK_LIST (layersD->layer_list), 0, -1);
suspend_gimage_notify--;
list = layersD->layer_widgets;
while (list)
while (layersD->layer_widgets)
{
lw = (LayerWidget *) list->data;
list = g_slist_next (list);
lw = (LayerWidget *) layersD->layer_widgets->data;
layer_widget_delete (lw);
}
layersD->layer_widgets = NULL;
layersD->active_layer = NULL;
layersD->active_channel = NULL;
......@@ -567,7 +566,6 @@ layers_dialog_update (GimpImage* gimage)
{
GimpLayer *layer;
LayerWidget *lw;
GSList *slist;
GList *list;
GList *item_list;
......@@ -581,12 +579,10 @@ layers_dialog_update (GimpImage* gimage)
/* Free all elements in the layers listbox */
gtk_list_clear_items (GTK_LIST (layersD->layer_list), 0, -1);
for (slist = layersD->layer_widgets;
slist;
slist = g_slist_next (slist))
while (layersD->layer_widgets)
{
lw = (LayerWidget *) slist->data;
lw = (LayerWidget *) layersD->layer_widgets->data;
layer_widget_delete (lw);
}
......
......@@ -518,7 +518,6 @@ void
layers_dialog_free (void)
{
LayerWidget *lw;
GSList *list;
if (!layersD)
return;
......@@ -528,13 +527,13 @@ layers_dialog_free (void)
gtk_list_clear_items (GTK_LIST (layersD->layer_list), 0, -1);
suspend_gimage_notify--;
list = layersD->layer_widgets;
while (list)
while (layersD->layer_widgets)
{
lw = (LayerWidget *) list->data;
list = g_slist_next (list);
lw = (LayerWidget *) layersD->layer_widgets->data;
layer_widget_delete (lw);
}
layersD->layer_widgets = NULL;
layersD->active_layer = NULL;
layersD->active_channel = NULL;
......@@ -567,7 +566,6 @@ layers_dialog_update (GimpImage* gimage)
{
GimpLayer *layer;
LayerWidget *lw;
GSList *slist;
GList *list;
GList *item_list;
......@@ -581,12 +579,10 @@ layers_dialog_update (GimpImage* gimage)
/* Free all elements in the layers listbox */
gtk_list_clear_items (GTK_LIST (layersD->layer_list), 0, -1);
for (slist = layersD->layer_widgets;
slist;
slist = g_slist_next (slist))
while (layersD->layer_widgets)
{
lw = (LayerWidget *) slist->data;
lw = (LayerWidget *) layersD->layer_widgets->data;
layer_widget_delete (lw);
}
......
......@@ -114,10 +114,10 @@ static void crop_tool_cursor_update (GimpTool *tool,
static void crop_tool_control (GimpTool *tool,
ToolAction action,
GDisplay *gdisp);
static void crop_arrow_keys_func (GimpTool *tool,
static void crop_tool_arrow_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
static void crop_modifier_key_func (GimpTool *tool,
static void crop_tool_modifier_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
......@@ -148,7 +148,8 @@ static void gimp_crop_tool_class_init (GimpCropToolClass *klass);
static void gimp_crop_tool_init (GimpCropTool *crop_tool);
static void gimp_crop_tool_destroy (GtkObject *object);
static GimpToolClass *parent_class = NULL;
static GimpDrawToolClass *parent_class = NULL;
/* Crop area-select functions */
......@@ -634,9 +635,9 @@ crop_tool_cursor_update (GimpTool *tool,
}
static void
crop_arrow_keys_func (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp)
crop_tool_arrow_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp)
{
GimpLayer *layer;
GimpDrawTool *draw;
......@@ -646,10 +647,11 @@ crop_arrow_keys_func (GimpTool *tool,
gint min_x, min_y;
gint max_x, max_y;
crop = GIMP_CROP_TOOL (tool);
draw = GIMP_DRAW_TOOL (tool);
if (tool->state == ACTIVE)
{
crop = GIMP_CROP_TOOL(tool);
draw = GIMP_DRAW_TOOL(tool);
inc_x = inc_y = 0;
switch (kevent->keyval)
......@@ -667,7 +669,7 @@ crop_arrow_keys_func (GimpTool *tool,
inc_x *= ARROW_VELOCITY;
}
gimp_draw_tool_pause(draw);
gimp_draw_tool_pause (draw);
if (crop_options->layer_only)
{
......@@ -711,12 +713,13 @@ crop_arrow_keys_func (GimpTool *tool,
}
crop_recalc (tool, crop);
gimp_draw_tool_resume(draw);
gimp_draw_tool_resume (draw);
}
}
static void
crop_modifier_key_func (GimpTool *tool,
crop_tool_modifier_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp)
{
......@@ -741,25 +744,23 @@ crop_modifier_key_func (GimpTool *tool,
}
static void
crop_tool_control (GimpTool *tool,
ToolAction action,
GDisplay *gdisp)
crop_tool_control (GimpTool *tool,
ToolAction action,
GDisplay *gdisp)
{
GimpCropTool *crop;
GimpDrawTool *draw;
crop = GIMP_CROP_TOOL(tool);
draw = GIMP_DRAW_TOOL(tool);
crop = GIMP_CROP_TOOL (tool);
draw = GIMP_DRAW_TOOL (tool);
switch (action)
{
case PAUSE:
gimp_draw_tool_pause(draw);
break;
case RESUME:
crop_recalc (tool, crop);
gimp_draw_tool_resume(draw);
break;
case HALT:
......@@ -769,16 +770,19 @@ crop_tool_control (GimpTool *tool,
default:
break;
}
if (GIMP_TOOL_CLASS (parent_class)->control)
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
}
void
crop_draw (GimpTool *tool)
crop_tool_draw (GimpDrawTool *draw)
{
GimpCropTool *crop;
GimpDrawTool *draw;
GimpTool *tool;
crop = GIMP_CROP_TOOL(tool);
draw = GIMP_DRAW_TOOL(tool);
crop = GIMP_CROP_TOOL (draw);
tool = GIMP_TOOL (draw);
#define SRW 10
#define SRH 10
......@@ -1596,21 +1600,27 @@ gimp_crop_tool_get_type (void)
static void
gimp_crop_tool_class_init (GimpCropToolClass *klass)
{
GtkObjectClass *object_class;
GimpToolClass *tool_class;
GtkObjectClass *object_class;
GimpToolClass *tool_class;
GimpDrawToolClass *draw_tool_class;
object_class = (GtkObjectClass *) klass;
tool_class = (GimpToolClass *) klass;
object_class = (GtkObjectClass *) klass;
tool_class = (GimpToolClass *) klass;
draw_tool_class = (GimpDrawToolClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_TOOL);
parent_class = gtk_type_class (GIMP_TYPE_DRAW_TOOL);
object_class->destroy = gimp_crop_tool_destroy;
object_class->destroy = gimp_crop_tool_destroy;
tool_class->control = crop_tool_control;
tool_class->button_press = crop_tool_button_press;
tool_class->button_release = crop_tool_button_release;
tool_class->motion = crop_tool_motion;
tool_class->cursor_update = crop_tool_cursor_update;
tool_class->arrow_key = crop_tool_arrow_key;
tool_class->modifier_key = crop_tool_modifier_key;
draw_tool_class->draw = crop_tool_draw;
}
static void
......
......@@ -66,7 +66,11 @@ struct _GimpCropToolClass
GimpDrawToolClass parent_class;
};
void gimp_crop_tool_register (void);
void gimp_crop_tool_register (void);
GtkType gimp_crop_tool_get_type (void);
/* Keep around for the PDB, temporarily */
void crop_image (GimpImage *gimage,
......
......@@ -114,10 +114,10 @@ static void crop_tool_cursor_update (GimpTool *tool,
static void crop_tool_control (GimpTool *tool,
ToolAction action,
GDisplay *gdisp);
static void crop_arrow_keys_func (GimpTool *tool,
static void crop_tool_arrow_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
static void crop_modifier_key_func (GimpTool *tool,
static void crop_tool_modifier_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
......@@ -148,7 +148,8 @@ static void gimp_crop_tool_class_init (GimpCropToolClass *klass);
static void gimp_crop_tool_init (GimpCropTool *crop_tool);
static void gimp_crop_tool_destroy (GtkObject *object);
static GimpToolClass *parent_class = NULL;
static GimpDrawToolClass *parent_class = NULL;
/* Crop area-select functions */
......@@ -634,9 +635,9 @@ crop_tool_cursor_update (GimpTool *tool,
}
static void
crop_arrow_keys_func (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp)
crop_tool_arrow_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp)
{
GimpLayer *layer;
GimpDrawTool *draw;
......@@ -646,10 +647,11 @@ crop_arrow_keys_func (GimpTool *tool,
gint min_x, min_y;
gint max_x, max_y;
crop = GIMP_CROP_TOOL (tool);
draw = GIMP_DRAW_TOOL (tool);
if (tool->state == ACTIVE)
{
crop = GIMP_CROP_TOOL(tool);
draw = GIMP_DRAW_TOOL(tool);
inc_x = inc_y = 0;
switch (kevent->keyval)
......@@ -667,7 +669,7 @@ crop_arrow_keys_func (GimpTool *tool,
inc_x *= ARROW_VELOCITY;
}
gimp_draw_tool_pause(draw);
gimp_draw_tool_pause (draw);
if (crop_options->layer_only)
{
......@@ -711,12 +713,13 @@ crop_arrow_keys_func (GimpTool *tool,
}
crop_recalc (tool, crop);
gimp_draw_tool_resume(draw);
gimp_draw_tool_resume (draw);
}
}
static void
crop_modifier_key_func (GimpTool *tool,
crop_tool_modifier_key (GimpTool *tool,
GdkEventKey *kevent,
GDisplay *gdisp)
{
......@@ -741,25 +744,23 @@ crop_modifier_key_func (GimpTool *tool,
}
static void
crop_tool_control (GimpTool *tool,
ToolAction action,
GDisplay *gdisp)
crop_tool_control (GimpTool *tool,
ToolAction action,
GDisplay *gdisp)
{
GimpCropTool *crop;
GimpDrawTool *draw;
crop = GIMP_CROP_TOOL(tool);
draw = GIMP_DRAW_TOOL(tool);
crop = GIMP_CROP_TOOL (tool);
draw = GIMP_DRAW_TOOL (tool);
switch (action)
{
case PAUSE:
gimp_draw_tool_pause(draw);
break;
case RESUME:
crop_recalc (tool, crop);
gimp_draw_tool_resume(draw);
break;
case HALT:
......@@ -769,16 +770,19 @@ crop_tool_control (GimpTool *tool,
default:
break;
}
if (GIMP_TOOL_CLASS (parent_class)->control)
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
}
void
crop_draw (GimpTool *tool)
crop_tool_draw (GimpDrawTool *draw)
{
GimpCropTool *crop;
GimpDrawTool *draw;
GimpTool *tool;
crop = GIMP_CROP_TOOL(tool);
draw = GIMP_DRAW_TOOL(tool);
crop = GIMP_CROP_TOOL (draw);
tool = GIMP_TOOL (draw);
#define SRW 10
#define SRH 10
......@@ -1596,21 +1600,27 @@ gimp_crop_tool_get_type (void)
static void
gimp_crop_tool_class_init (GimpCropToolClass *klass)
{
GtkObjectClass *object_class;
GimpToolClass *tool_class;
GtkObjectClass *object_class;
GimpToolClass *tool_class;
GimpDrawToolClass *draw_tool_class;
object_class = (GtkObjectClass *) klass;
tool_class = (GimpToolClass *) klass;
object_class = (GtkObjectClass *) klass;
tool_class = (GimpToolClass *) klass;
draw_tool_class = (GimpDrawToolClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_TOOL);
parent_class = gtk_type_class (GIMP_TYPE_DRAW_TOOL);
object_class->destroy = gimp_crop_tool_destroy;
object_class->destroy = gimp_crop_tool_destroy;
tool_class->control = crop_tool_control;
tool_class->button_press = crop_tool_button_press;
tool_class->button_release = crop_tool_button_release;
tool_class->motion = crop_tool_motion;
tool_class->cursor_update = crop_tool_cursor_update;
tool_class->arrow_key = crop_tool_arrow_key;
tool_class->modifier_key = crop_tool_modifier_key;
draw_tool_class->draw = crop_tool_draw;
}
static void
......
......@@ -66,7 +66,11 @@ struct _GimpCropToolClass
GimpDrawToolClass parent_class;
};
void gimp_crop_tool_register (void);
void gimp_crop_tool_register (void);
GtkType gimp_crop_tool_get_type (void);
/* Keep around for the PDB, temporarily */
void crop_image (GimpImage *gimage,
......
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