app/bucket_fill.c app/clone.c app/convolve.c app/flip_tool.c app/ink.c

1999-04-18  Michael Natterer  <mitschel@cs.tu-berlin.de>

	* app/bucket_fill.c
	* app/clone.c
	* app/convolve.c
	* app/flip_tool.c
	* app/ink.c
	* app/paintbrush.c
	* app/transform_tool.c: remember all radio buttons in the
	ToolOptions structures. This enables arbitrary default values and
	gui feedback for the "toggle key" feature.
This commit is contained in:
Michael Natterer 1999-04-17 23:18:43 +00:00 committed by Michael Natterer
parent 283fdacbfe
commit 2d54cc6406
25 changed files with 347 additions and 249 deletions

View File

@ -1,3 +1,15 @@
1999-04-18 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/bucket_fill.c
* app/clone.c
* app/convolve.c
* app/flip_tool.c
* app/ink.c
* app/paintbrush.c
* app/transform_tool.c: remember all radio buttons in the
ToolOptions structures. This enables arbitrary default values and
gui feedback for the "toggle key" feature.
Sat Apr 17 11:15:35 PDT 1999 Manish Singh <yosh@gimp.org> Sat Apr 17 11:15:35 PDT 1999 Manish Singh <yosh@gimp.org>
* app/text_tool_cmds.c: doh, decipoints not decipixels * app/text_tool_cmds.c: doh, decipoints not decipixels

View File

@ -61,13 +61,13 @@ struct _BucketOptions
double threshold_d; double threshold_d;
GtkObject *threshold_w; GtkObject *threshold_w;
FillMode fill_mode;
FillMode fill_mode_d;
GtkWidget *fill_mode_w;
int sample_merged; int sample_merged;
int sample_merged_d; int sample_merged_d;
GtkWidget *sample_merged_w; GtkWidget *sample_merged_w;
FillMode fill_mode;
FillMode fill_mode_d;
GtkWidget *fill_mode_w[2]; /* 2 radio buttons */
}; };
@ -128,7 +128,10 @@ bucket_options_reset (void)
options->sample_merged_d); options->sample_merged_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
options->threshold_d); options->threshold_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w), TRUE); gtk_toggle_button_set_active (((options->fill_mode_d == FgColorFill) ?
GTK_TOGGLE_BUTTON (options->fill_mode_w[0]) :
GTK_TOGGLE_BUTTON (options->fill_mode_w[1])),
TRUE);
} }
static BucketOptions * static BucketOptions *
@ -247,8 +250,6 @@ bucket_options_new (void)
gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update, (GtkSignalFunc) tool_options_toggle_update,
&options->sample_merged); &options->sample_merged);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
options->sample_merged_d);
gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w, FALSE, FALSE, 0);
gtk_widget_show (options->sample_merged_w); gtk_widget_show (options->sample_merged_w);
@ -272,8 +273,7 @@ bucket_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == 0) options->fill_mode_w[i] = radio_button;
options->fill_mode_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -687,6 +687,9 @@ tools_new_bucket_fill (void)
{ {
bucket_options = bucket_options_new (); bucket_options = bucket_options_new ();
tools_register (BUCKET_FILL, (ToolOptions *) bucket_options); tools_register (BUCKET_FILL, (ToolOptions *) bucket_options);
/* press all default buttons */
bucket_options_reset ();
} }
tool = (Tool *) g_malloc (sizeof (Tool)); tool = (Tool *) g_malloc (sizeof (Tool));

View File

@ -52,11 +52,11 @@ struct _CloneOptions
CloneType type; CloneType type;
CloneType type_d; CloneType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
AlignType aligned; AlignType aligned;
AlignType aligned_d; AlignType aligned_d;
GtkWidget *aligned_w; GtkWidget *aligned_w[3]; /* 3 radio buttons */
}; };
@ -113,8 +113,8 @@ clone_options_reset (void)
{ {
CloneOptions *options = clone_options; CloneOptions *options = clone_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
} }
static CloneOptions * static CloneOptions *
@ -172,8 +172,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->type_d) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -198,8 +197,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->aligned_d) options->aligned_w[i] = radio_button;
options->aligned_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -357,6 +355,9 @@ tools_new_clone ()
{ {
clone_options = clone_options_new (); clone_options = clone_options_new ();
tools_register (CLONE, (ToolOptions *) clone_options); tools_register (CLONE, (ToolOptions *) clone_options);
/* press all default buttons */
clone_options_reset ();
} }
tool = paint_core_new (CLONE); tool = paint_core_new (CLONE);

View File

@ -47,7 +47,7 @@ struct _ConvolveOptions
ConvolveType type; ConvolveType type;
ConvolveType type_d; ConvolveType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
double pressure; double pressure;
double pressure_d; double pressure_d;
@ -117,7 +117,7 @@ convolve_options_reset (void)
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
options->pressure_d); options->pressure_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
} }
static ConvolveOptions * static ConvolveOptions *
@ -194,8 +194,7 @@ convolve_options_new (void)
(gpointer) ((long) i)); (gpointer) ((long) i));
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->type_d) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
@ -228,6 +227,9 @@ tools_new_convolve ()
{ {
convolve_options = convolve_options_new (); convolve_options = convolve_options_new ();
tools_register (CONVOLVE, (ToolOptions *) convolve_options); tools_register (CONVOLVE, (ToolOptions *) convolve_options);
/* press all default buttons */
convolve_options_reset ();
} }
tool = paint_core_new (CONVOLVE); tool = paint_core_new (CONVOLVE);

View File

@ -41,7 +41,7 @@ struct _FlipOptions
ToolType type; ToolType type;
ToolType type_d; ToolType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
}; };
@ -63,7 +63,7 @@ static Argument * flip_invoker (Argument *);
/* functions */ /* functions */
static void static void
flip_type_callback (GtkWidget *w, flip_type_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
flip_change_type ((long) client_data); flip_change_type ((long) client_data);
@ -74,7 +74,10 @@ flip_options_reset (void)
{ {
FlipOptions *options = flip_options; FlipOptions *options = flip_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (((options->type_d == FLIP_HORZ) ?
GTK_TOGGLE_BUTTON (options->type_w[0]) :
GTK_TOGGLE_BUTTON (options->type_w[1])),
TRUE);
} }
static FlipOptions * static FlipOptions *
@ -85,7 +88,6 @@ flip_options_new (void)
GtkWidget *vbox; GtkWidget *vbox;
GSList *group = NULL; GSList *group = NULL;
GtkWidget *radio_box; GtkWidget *radio_box;
GtkWidget *radio_button;
/* the new flip tool options structure */ /* the new flip tool options structure */
options = (FlipOptions *) g_malloc (sizeof (FlipOptions)); options = (FlipOptions *) g_malloc (sizeof (FlipOptions));
@ -101,22 +103,22 @@ flip_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), radio_box, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_box, FALSE, FALSE, 0);
/* the radio buttons */ /* the radio buttons */
options->type_w = options->type_w[0] =
gtk_radio_button_new_with_label (group, _("Horizontal")); gtk_radio_button_new_with_label (group, _("Horizontal"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w)); group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[0]));
gtk_box_pack_start (GTK_BOX (radio_box), options->type_w, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[0], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->type_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->type_w[0]), "toggled",
(GtkSignalFunc) flip_type_callback, (GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_HORZ))); (gpointer) ((long) (FLIP_HORZ)));
gtk_widget_show (options->type_w); gtk_widget_show (options->type_w[0]);
radio_button = gtk_radio_button_new_with_label (group, _("Vertical")); options->type_w[1] = gtk_radio_button_new_with_label (group, _("Vertical"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button)); group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[1]));
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[1], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled", gtk_signal_connect (GTK_OBJECT (options->type_w[1]), "toggled",
(GtkSignalFunc) flip_type_callback, (GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_VERT))); (gpointer) ((long) (FLIP_VERT)));
gtk_widget_show (radio_button); gtk_widget_show (options->type_w[1]);
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
@ -198,6 +200,9 @@ tools_new_flip ()
flip_options = flip_options_new (); flip_options = flip_options_new ();
tools_register (FLIP_HORZ, (ToolOptions *) flip_options); tools_register (FLIP_HORZ, (ToolOptions *) flip_options);
tools_register (FLIP_VERT, (ToolOptions *) flip_options); tools_register (FLIP_VERT, (ToolOptions *) flip_options);
/* press all default buttons */
flip_options_reset ();
} }
switch (flip_options->type) switch (flip_options->type)

View File

@ -104,7 +104,7 @@ struct _InkOptions
BlobFunc function; BlobFunc function;
BlobFunc function_d; BlobFunc function_d;
GtkWidget *function_w; GtkWidget *function_w[3]; /* 3 radio buttons */
double aspect; double aspect;
double aspect_d; double aspect_d;
@ -236,8 +236,12 @@ ink_options_reset (void)
options->vel_sensitivity_d); options->vel_sensitivity_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w),
options->tilt_angle_d); options->tilt_angle_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->function_w), TRUE); gtk_toggle_button_set_active (((options->function_d == blob_ellipse) ?
GTK_TOGGLE_BUTTON (options->function_w[0]) :
((options->function_d == blob_square) ?
GTK_TOGGLE_BUTTON (options->function_w[1]) :
GTK_TOGGLE_BUTTON (options->function_w[2]))),
TRUE);
options->aspect = options->aspect_d; options->aspect = options->aspect_d;
options->angle = options->angle_d; options->angle = options->angle_d;
gtk_widget_queue_draw (options->brush_w->widget); gtk_widget_queue_draw (options->brush_w->widget);
@ -434,7 +438,7 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w = radio_button; options->function_w[0] = radio_button;
pixmap = blob_pixmap (gtk_widget_get_colormap (vbox), pixmap = blob_pixmap (gtk_widget_get_colormap (vbox),
gtk_widget_get_visual (vbox), gtk_widget_get_visual (vbox),
@ -452,6 +456,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[1] = radio_button;
pixmap = blob_pixmap (gtk_widget_get_colormap (vbox), pixmap = blob_pixmap (gtk_widget_get_colormap (vbox),
gtk_widget_get_visual (vbox), gtk_widget_get_visual (vbox),
blob_diamond); blob_diamond);
@ -468,6 +474,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[2] = radio_button;
/* Brush shape widget */ /* Brush shape widget */
frame = gtk_frame_new (_("Shape")); frame = gtk_frame_new (_("Shape"));
gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9); gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9);
@ -480,17 +488,17 @@ ink_options_new (void)
options->brush_w = g_new (BrushWidget, 1); options->brush_w = g_new (BrushWidget, 1);
options->brush_w->state = FALSE; options->brush_w->state = FALSE;
frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, FALSE); frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, FALSE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
darea = gtk_drawing_area_new(); darea = gtk_drawing_area_new();
options->brush_w->widget = darea; options->brush_w->widget = darea;
gtk_drawing_area_size (GTK_DRAWING_AREA (darea), 60, 60); gtk_drawing_area_size (GTK_DRAWING_AREA (darea), 60, 60);
gtk_container_add (GTK_CONTAINER (frame), darea); gtk_container_add (GTK_CONTAINER (frame), darea);
gtk_widget_set_events (darea, gtk_widget_set_events (darea,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK); | GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK);
@ -1531,6 +1539,9 @@ tools_new_ink ()
{ {
ink_options = ink_options_new (); ink_options = ink_options_new ();
tools_register (INK, (ToolOptions *) ink_options); tools_register (INK, (ToolOptions *) ink_options);
/* press all default buttons */
ink_options_reset ();
} }
tool = (Tool *) g_malloc (sizeof (Tool)); tool = (Tool *) g_malloc (sizeof (Tool));
@ -1635,4 +1646,3 @@ ink_invoker (args)
/* Fix me */ /* Fix me */
return NULL; return NULL;
} }

View File

@ -52,11 +52,11 @@ struct _CloneOptions
CloneType type; CloneType type;
CloneType type_d; CloneType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
AlignType aligned; AlignType aligned;
AlignType aligned_d; AlignType aligned_d;
GtkWidget *aligned_w; GtkWidget *aligned_w[3]; /* 3 radio buttons */
}; };
@ -113,8 +113,8 @@ clone_options_reset (void)
{ {
CloneOptions *options = clone_options; CloneOptions *options = clone_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
} }
static CloneOptions * static CloneOptions *
@ -172,8 +172,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->type_d) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -198,8 +197,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->aligned_d) options->aligned_w[i] = radio_button;
options->aligned_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -357,6 +355,9 @@ tools_new_clone ()
{ {
clone_options = clone_options_new (); clone_options = clone_options_new ();
tools_register (CLONE, (ToolOptions *) clone_options); tools_register (CLONE, (ToolOptions *) clone_options);
/* press all default buttons */
clone_options_reset ();
} }
tool = paint_core_new (CLONE); tool = paint_core_new (CLONE);

View File

@ -47,7 +47,7 @@ struct _ConvolveOptions
ConvolveType type; ConvolveType type;
ConvolveType type_d; ConvolveType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
double pressure; double pressure;
double pressure_d; double pressure_d;
@ -117,7 +117,7 @@ convolve_options_reset (void)
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
options->pressure_d); options->pressure_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
} }
static ConvolveOptions * static ConvolveOptions *
@ -194,8 +194,7 @@ convolve_options_new (void)
(gpointer) ((long) i)); (gpointer) ((long) i));
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->type_d) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
@ -228,6 +227,9 @@ tools_new_convolve ()
{ {
convolve_options = convolve_options_new (); convolve_options = convolve_options_new ();
tools_register (CONVOLVE, (ToolOptions *) convolve_options); tools_register (CONVOLVE, (ToolOptions *) convolve_options);
/* press all default buttons */
convolve_options_reset ();
} }
tool = paint_core_new (CONVOLVE); tool = paint_core_new (CONVOLVE);

View File

@ -104,7 +104,7 @@ struct _InkOptions
BlobFunc function; BlobFunc function;
BlobFunc function_d; BlobFunc function_d;
GtkWidget *function_w; GtkWidget *function_w[3]; /* 3 radio buttons */
double aspect; double aspect;
double aspect_d; double aspect_d;
@ -236,8 +236,12 @@ ink_options_reset (void)
options->vel_sensitivity_d); options->vel_sensitivity_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w),
options->tilt_angle_d); options->tilt_angle_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->function_w), TRUE); gtk_toggle_button_set_active (((options->function_d == blob_ellipse) ?
GTK_TOGGLE_BUTTON (options->function_w[0]) :
((options->function_d == blob_square) ?
GTK_TOGGLE_BUTTON (options->function_w[1]) :
GTK_TOGGLE_BUTTON (options->function_w[2]))),
TRUE);
options->aspect = options->aspect_d; options->aspect = options->aspect_d;
options->angle = options->angle_d; options->angle = options->angle_d;
gtk_widget_queue_draw (options->brush_w->widget); gtk_widget_queue_draw (options->brush_w->widget);
@ -434,7 +438,7 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w = radio_button; options->function_w[0] = radio_button;
pixmap = blob_pixmap (gtk_widget_get_colormap (vbox), pixmap = blob_pixmap (gtk_widget_get_colormap (vbox),
gtk_widget_get_visual (vbox), gtk_widget_get_visual (vbox),
@ -452,6 +456,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[1] = radio_button;
pixmap = blob_pixmap (gtk_widget_get_colormap (vbox), pixmap = blob_pixmap (gtk_widget_get_colormap (vbox),
gtk_widget_get_visual (vbox), gtk_widget_get_visual (vbox),
blob_diamond); blob_diamond);
@ -468,6 +474,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[2] = radio_button;
/* Brush shape widget */ /* Brush shape widget */
frame = gtk_frame_new (_("Shape")); frame = gtk_frame_new (_("Shape"));
gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9); gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9);
@ -480,17 +488,17 @@ ink_options_new (void)
options->brush_w = g_new (BrushWidget, 1); options->brush_w = g_new (BrushWidget, 1);
options->brush_w->state = FALSE; options->brush_w->state = FALSE;
frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, FALSE); frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, FALSE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
darea = gtk_drawing_area_new(); darea = gtk_drawing_area_new();
options->brush_w->widget = darea; options->brush_w->widget = darea;
gtk_drawing_area_size (GTK_DRAWING_AREA (darea), 60, 60); gtk_drawing_area_size (GTK_DRAWING_AREA (darea), 60, 60);
gtk_container_add (GTK_CONTAINER (frame), darea); gtk_container_add (GTK_CONTAINER (frame), darea);
gtk_widget_set_events (darea, gtk_widget_set_events (darea,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK); | GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK);
@ -1531,6 +1539,9 @@ tools_new_ink ()
{ {
ink_options = ink_options_new (); ink_options = ink_options_new ();
tools_register (INK, (ToolOptions *) ink_options); tools_register (INK, (ToolOptions *) ink_options);
/* press all default buttons */
ink_options_reset ();
} }
tool = (Tool *) g_malloc (sizeof (Tool)); tool = (Tool *) g_malloc (sizeof (Tool));
@ -1635,4 +1646,3 @@ ink_invoker (args)
/* Fix me */ /* Fix me */
return NULL; return NULL;
} }

View File

@ -52,11 +52,11 @@ struct _CloneOptions
CloneType type; CloneType type;
CloneType type_d; CloneType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
AlignType aligned; AlignType aligned;
AlignType aligned_d; AlignType aligned_d;
GtkWidget *aligned_w; GtkWidget *aligned_w[3]; /* 3 radio buttons */
}; };
@ -113,8 +113,8 @@ clone_options_reset (void)
{ {
CloneOptions *options = clone_options; CloneOptions *options = clone_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
} }
static CloneOptions * static CloneOptions *
@ -172,8 +172,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->type_d) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -198,8 +197,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->aligned_d) options->aligned_w[i] = radio_button;
options->aligned_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -357,6 +355,9 @@ tools_new_clone ()
{ {
clone_options = clone_options_new (); clone_options = clone_options_new ();
tools_register (CLONE, (ToolOptions *) clone_options); tools_register (CLONE, (ToolOptions *) clone_options);
/* press all default buttons */
clone_options_reset ();
} }
tool = paint_core_new (CLONE); tool = paint_core_new (CLONE);

View File

@ -58,7 +58,7 @@ struct _PaintOptions
int gradient_type; int gradient_type;
int gradient_type_d; int gradient_type_d;
GtkWidget *gradient_type_w; GtkWidget *gradient_type_w[4]; /* 4 radio buttons */
gboolean incremental; gboolean incremental;
gboolean incremental_d; gboolean incremental_d;
@ -129,7 +129,7 @@ paintbrush_options_reset (void)
options->use_gradient_d); options->use_gradient_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->gradient_length_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->gradient_length_w),
options->gradient_length_d); options->gradient_length_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->gradient_type_w), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->gradient_type_w[options->gradient_type_d]),
TRUE); TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d); options->incremental_d);
@ -202,8 +202,6 @@ paintbrush_options_new (void)
gtk_check_button_new_with_label (_("Gradient")); gtk_check_button_new_with_label (_("Gradient"));
gtk_table_attach (GTK_TABLE (table), options->use_gradient_w, 0, 1, 1, 2, gtk_table_attach (GTK_TABLE (table), options->use_gradient_w, 0, 1, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0); GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->use_gradient_w),
options->use_gradient_d);
gtk_signal_connect (GTK_OBJECT (options->use_gradient_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->use_gradient_w), "toggled",
(GtkSignalFunc) paintbrush_gradient_toggle_callback, (GtkSignalFunc) paintbrush_gradient_toggle_callback,
&options->use_gradient); &options->use_gradient);
@ -238,9 +236,6 @@ paintbrush_options_new (void)
gtk_table_attach_defaults (GTK_TABLE (table), radio_frame, 0, 2, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), radio_frame, 0, 2, 3, 4);
/* automatically set the sensitive state of the gradient stuff */ /* automatically set the sensitive state of the gradient stuff */
gtk_widget_set_sensitive (scale, options->use_gradient_d);
gtk_widget_set_sensitive (label, options->use_gradient_d);
gtk_widget_set_sensitive (radio_frame, options->use_gradient_d);
gtk_object_set_data (GTK_OBJECT (options->use_gradient_w), "set_sensitive", gtk_object_set_data (GTK_OBJECT (options->use_gradient_w), "set_sensitive",
scale); scale);
gtk_object_set_data (GTK_OBJECT (scale), "set_sensitive", gtk_object_set_data (GTK_OBJECT (scale), "set_sensitive",
@ -264,11 +259,9 @@ paintbrush_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->gradient_type_d) options->gradient_type_w[i] = radio_button;
options->gradient_type_w = radio_button;
} }
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->gradient_type_w),
TRUE);
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -278,8 +271,6 @@ paintbrush_options_new (void)
gtk_signal_connect (GTK_OBJECT (options->incremental_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->incremental_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update, (GtkSignalFunc) tool_options_toggle_update,
&options->incremental); &options->incremental);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
gtk_widget_show (options->incremental_w); gtk_widget_show (options->incremental_w);
return options; return options;
@ -352,6 +343,9 @@ tools_new_paintbrush ()
{ {
paintbrush_options = paintbrush_options_new (); paintbrush_options = paintbrush_options_new ();
tools_register (PAINTBRUSH, (ToolOptions *) paintbrush_options); tools_register (PAINTBRUSH, (ToolOptions *) paintbrush_options);
/* press all default buttons */
paintbrush_options_reset ();
} }
tool = paint_core_new (PAINTBRUSH); tool = paint_core_new (PAINTBRUSH);

View File

@ -61,13 +61,13 @@ struct _BucketOptions
double threshold_d; double threshold_d;
GtkObject *threshold_w; GtkObject *threshold_w;
FillMode fill_mode;
FillMode fill_mode_d;
GtkWidget *fill_mode_w;
int sample_merged; int sample_merged;
int sample_merged_d; int sample_merged_d;
GtkWidget *sample_merged_w; GtkWidget *sample_merged_w;
FillMode fill_mode;
FillMode fill_mode_d;
GtkWidget *fill_mode_w[2]; /* 2 radio buttons */
}; };
@ -128,7 +128,10 @@ bucket_options_reset (void)
options->sample_merged_d); options->sample_merged_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
options->threshold_d); options->threshold_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w), TRUE); gtk_toggle_button_set_active (((options->fill_mode_d == FgColorFill) ?
GTK_TOGGLE_BUTTON (options->fill_mode_w[0]) :
GTK_TOGGLE_BUTTON (options->fill_mode_w[1])),
TRUE);
} }
static BucketOptions * static BucketOptions *
@ -247,8 +250,6 @@ bucket_options_new (void)
gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update, (GtkSignalFunc) tool_options_toggle_update,
&options->sample_merged); &options->sample_merged);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
options->sample_merged_d);
gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w, FALSE, FALSE, 0);
gtk_widget_show (options->sample_merged_w); gtk_widget_show (options->sample_merged_w);
@ -272,8 +273,7 @@ bucket_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == 0) options->fill_mode_w[i] = radio_button;
options->fill_mode_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -687,6 +687,9 @@ tools_new_bucket_fill (void)
{ {
bucket_options = bucket_options_new (); bucket_options = bucket_options_new ();
tools_register (BUCKET_FILL, (ToolOptions *) bucket_options); tools_register (BUCKET_FILL, (ToolOptions *) bucket_options);
/* press all default buttons */
bucket_options_reset ();
} }
tool = (Tool *) g_malloc (sizeof (Tool)); tool = (Tool *) g_malloc (sizeof (Tool));

View File

@ -52,11 +52,11 @@ struct _CloneOptions
CloneType type; CloneType type;
CloneType type_d; CloneType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
AlignType aligned; AlignType aligned;
AlignType aligned_d; AlignType aligned_d;
GtkWidget *aligned_w; GtkWidget *aligned_w[3]; /* 3 radio buttons */
}; };
@ -113,8 +113,8 @@ clone_options_reset (void)
{ {
CloneOptions *options = clone_options; CloneOptions *options = clone_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
} }
static CloneOptions * static CloneOptions *
@ -172,8 +172,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->type_d) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -198,8 +197,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->aligned_d) options->aligned_w[i] = radio_button;
options->aligned_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -357,6 +355,9 @@ tools_new_clone ()
{ {
clone_options = clone_options_new (); clone_options = clone_options_new ();
tools_register (CLONE, (ToolOptions *) clone_options); tools_register (CLONE, (ToolOptions *) clone_options);
/* press all default buttons */
clone_options_reset ();
} }
tool = paint_core_new (CLONE); tool = paint_core_new (CLONE);

View File

@ -47,7 +47,7 @@ struct _ConvolveOptions
ConvolveType type; ConvolveType type;
ConvolveType type_d; ConvolveType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
double pressure; double pressure;
double pressure_d; double pressure_d;
@ -117,7 +117,7 @@ convolve_options_reset (void)
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
options->pressure_d); options->pressure_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
} }
static ConvolveOptions * static ConvolveOptions *
@ -194,8 +194,7 @@ convolve_options_new (void)
(gpointer) ((long) i)); (gpointer) ((long) i));
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->type_d) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
@ -228,6 +227,9 @@ tools_new_convolve ()
{ {
convolve_options = convolve_options_new (); convolve_options = convolve_options_new ();
tools_register (CONVOLVE, (ToolOptions *) convolve_options); tools_register (CONVOLVE, (ToolOptions *) convolve_options);
/* press all default buttons */
convolve_options_reset ();
} }
tool = paint_core_new (CONVOLVE); tool = paint_core_new (CONVOLVE);

View File

@ -41,7 +41,7 @@ struct _FlipOptions
ToolType type; ToolType type;
ToolType type_d; ToolType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
}; };
@ -63,7 +63,7 @@ static Argument * flip_invoker (Argument *);
/* functions */ /* functions */
static void static void
flip_type_callback (GtkWidget *w, flip_type_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
flip_change_type ((long) client_data); flip_change_type ((long) client_data);
@ -74,7 +74,10 @@ flip_options_reset (void)
{ {
FlipOptions *options = flip_options; FlipOptions *options = flip_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (((options->type_d == FLIP_HORZ) ?
GTK_TOGGLE_BUTTON (options->type_w[0]) :
GTK_TOGGLE_BUTTON (options->type_w[1])),
TRUE);
} }
static FlipOptions * static FlipOptions *
@ -85,7 +88,6 @@ flip_options_new (void)
GtkWidget *vbox; GtkWidget *vbox;
GSList *group = NULL; GSList *group = NULL;
GtkWidget *radio_box; GtkWidget *radio_box;
GtkWidget *radio_button;
/* the new flip tool options structure */ /* the new flip tool options structure */
options = (FlipOptions *) g_malloc (sizeof (FlipOptions)); options = (FlipOptions *) g_malloc (sizeof (FlipOptions));
@ -101,22 +103,22 @@ flip_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), radio_box, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_box, FALSE, FALSE, 0);
/* the radio buttons */ /* the radio buttons */
options->type_w = options->type_w[0] =
gtk_radio_button_new_with_label (group, _("Horizontal")); gtk_radio_button_new_with_label (group, _("Horizontal"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w)); group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[0]));
gtk_box_pack_start (GTK_BOX (radio_box), options->type_w, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[0], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->type_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->type_w[0]), "toggled",
(GtkSignalFunc) flip_type_callback, (GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_HORZ))); (gpointer) ((long) (FLIP_HORZ)));
gtk_widget_show (options->type_w); gtk_widget_show (options->type_w[0]);
radio_button = gtk_radio_button_new_with_label (group, _("Vertical")); options->type_w[1] = gtk_radio_button_new_with_label (group, _("Vertical"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button)); group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[1]));
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[1], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled", gtk_signal_connect (GTK_OBJECT (options->type_w[1]), "toggled",
(GtkSignalFunc) flip_type_callback, (GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_VERT))); (gpointer) ((long) (FLIP_VERT)));
gtk_widget_show (radio_button); gtk_widget_show (options->type_w[1]);
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
@ -198,6 +200,9 @@ tools_new_flip ()
flip_options = flip_options_new (); flip_options = flip_options_new ();
tools_register (FLIP_HORZ, (ToolOptions *) flip_options); tools_register (FLIP_HORZ, (ToolOptions *) flip_options);
tools_register (FLIP_VERT, (ToolOptions *) flip_options); tools_register (FLIP_VERT, (ToolOptions *) flip_options);
/* press all default buttons */
flip_options_reset ();
} }
switch (flip_options->type) switch (flip_options->type)

View File

@ -61,13 +61,13 @@ struct _BucketOptions
double threshold_d; double threshold_d;
GtkObject *threshold_w; GtkObject *threshold_w;
FillMode fill_mode;
FillMode fill_mode_d;
GtkWidget *fill_mode_w;
int sample_merged; int sample_merged;
int sample_merged_d; int sample_merged_d;
GtkWidget *sample_merged_w; GtkWidget *sample_merged_w;
FillMode fill_mode;
FillMode fill_mode_d;
GtkWidget *fill_mode_w[2]; /* 2 radio buttons */
}; };
@ -128,7 +128,10 @@ bucket_options_reset (void)
options->sample_merged_d); options->sample_merged_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
options->threshold_d); options->threshold_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w), TRUE); gtk_toggle_button_set_active (((options->fill_mode_d == FgColorFill) ?
GTK_TOGGLE_BUTTON (options->fill_mode_w[0]) :
GTK_TOGGLE_BUTTON (options->fill_mode_w[1])),
TRUE);
} }
static BucketOptions * static BucketOptions *
@ -247,8 +250,6 @@ bucket_options_new (void)
gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update, (GtkSignalFunc) tool_options_toggle_update,
&options->sample_merged); &options->sample_merged);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
options->sample_merged_d);
gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w, FALSE, FALSE, 0);
gtk_widget_show (options->sample_merged_w); gtk_widget_show (options->sample_merged_w);
@ -272,8 +273,7 @@ bucket_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == 0) options->fill_mode_w[i] = radio_button;
options->fill_mode_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -687,6 +687,9 @@ tools_new_bucket_fill (void)
{ {
bucket_options = bucket_options_new (); bucket_options = bucket_options_new ();
tools_register (BUCKET_FILL, (ToolOptions *) bucket_options); tools_register (BUCKET_FILL, (ToolOptions *) bucket_options);
/* press all default buttons */
bucket_options_reset ();
} }
tool = (Tool *) g_malloc (sizeof (Tool)); tool = (Tool *) g_malloc (sizeof (Tool));

View File

@ -52,11 +52,11 @@ struct _CloneOptions
CloneType type; CloneType type;
CloneType type_d; CloneType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
AlignType aligned; AlignType aligned;
AlignType aligned_d; AlignType aligned_d;
GtkWidget *aligned_w; GtkWidget *aligned_w[3]; /* 3 radio buttons */
}; };
@ -113,8 +113,8 @@ clone_options_reset (void)
{ {
CloneOptions *options = clone_options; CloneOptions *options = clone_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
} }
static CloneOptions * static CloneOptions *
@ -172,8 +172,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->type_d) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -198,8 +197,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->aligned_d) options->aligned_w[i] = radio_button;
options->aligned_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -357,6 +355,9 @@ tools_new_clone ()
{ {
clone_options = clone_options_new (); clone_options = clone_options_new ();
tools_register (CLONE, (ToolOptions *) clone_options); tools_register (CLONE, (ToolOptions *) clone_options);
/* press all default buttons */
clone_options_reset ();
} }
tool = paint_core_new (CLONE); tool = paint_core_new (CLONE);

View File

@ -47,7 +47,7 @@ struct _ConvolveOptions
ConvolveType type; ConvolveType type;
ConvolveType type_d; ConvolveType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
double pressure; double pressure;
double pressure_d; double pressure_d;
@ -117,7 +117,7 @@ convolve_options_reset (void)
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
options->pressure_d); options->pressure_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
} }
static ConvolveOptions * static ConvolveOptions *
@ -194,8 +194,7 @@ convolve_options_new (void)
(gpointer) ((long) i)); (gpointer) ((long) i));
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->type_d) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
@ -228,6 +227,9 @@ tools_new_convolve ()
{ {
convolve_options = convolve_options_new (); convolve_options = convolve_options_new ();
tools_register (CONVOLVE, (ToolOptions *) convolve_options); tools_register (CONVOLVE, (ToolOptions *) convolve_options);
/* press all default buttons */
convolve_options_reset ();
} }
tool = paint_core_new (CONVOLVE); tool = paint_core_new (CONVOLVE);

View File

@ -41,7 +41,7 @@ struct _FlipOptions
ToolType type; ToolType type;
ToolType type_d; ToolType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
}; };
@ -63,7 +63,7 @@ static Argument * flip_invoker (Argument *);
/* functions */ /* functions */
static void static void
flip_type_callback (GtkWidget *w, flip_type_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
flip_change_type ((long) client_data); flip_change_type ((long) client_data);
@ -74,7 +74,10 @@ flip_options_reset (void)
{ {
FlipOptions *options = flip_options; FlipOptions *options = flip_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (((options->type_d == FLIP_HORZ) ?
GTK_TOGGLE_BUTTON (options->type_w[0]) :
GTK_TOGGLE_BUTTON (options->type_w[1])),
TRUE);
} }
static FlipOptions * static FlipOptions *
@ -85,7 +88,6 @@ flip_options_new (void)
GtkWidget *vbox; GtkWidget *vbox;
GSList *group = NULL; GSList *group = NULL;
GtkWidget *radio_box; GtkWidget *radio_box;
GtkWidget *radio_button;
/* the new flip tool options structure */ /* the new flip tool options structure */
options = (FlipOptions *) g_malloc (sizeof (FlipOptions)); options = (FlipOptions *) g_malloc (sizeof (FlipOptions));
@ -101,22 +103,22 @@ flip_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), radio_box, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_box, FALSE, FALSE, 0);
/* the radio buttons */ /* the radio buttons */
options->type_w = options->type_w[0] =
gtk_radio_button_new_with_label (group, _("Horizontal")); gtk_radio_button_new_with_label (group, _("Horizontal"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w)); group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[0]));
gtk_box_pack_start (GTK_BOX (radio_box), options->type_w, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[0], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->type_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->type_w[0]), "toggled",
(GtkSignalFunc) flip_type_callback, (GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_HORZ))); (gpointer) ((long) (FLIP_HORZ)));
gtk_widget_show (options->type_w); gtk_widget_show (options->type_w[0]);
radio_button = gtk_radio_button_new_with_label (group, _("Vertical")); options->type_w[1] = gtk_radio_button_new_with_label (group, _("Vertical"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button)); group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[1]));
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[1], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled", gtk_signal_connect (GTK_OBJECT (options->type_w[1]), "toggled",
(GtkSignalFunc) flip_type_callback, (GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_VERT))); (gpointer) ((long) (FLIP_VERT)));
gtk_widget_show (radio_button); gtk_widget_show (options->type_w[1]);
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
@ -198,6 +200,9 @@ tools_new_flip ()
flip_options = flip_options_new (); flip_options = flip_options_new ();
tools_register (FLIP_HORZ, (ToolOptions *) flip_options); tools_register (FLIP_HORZ, (ToolOptions *) flip_options);
tools_register (FLIP_VERT, (ToolOptions *) flip_options); tools_register (FLIP_VERT, (ToolOptions *) flip_options);
/* press all default buttons */
flip_options_reset ();
} }
switch (flip_options->type) switch (flip_options->type)

View File

@ -104,7 +104,7 @@ struct _InkOptions
BlobFunc function; BlobFunc function;
BlobFunc function_d; BlobFunc function_d;
GtkWidget *function_w; GtkWidget *function_w[3]; /* 3 radio buttons */
double aspect; double aspect;
double aspect_d; double aspect_d;
@ -236,8 +236,12 @@ ink_options_reset (void)
options->vel_sensitivity_d); options->vel_sensitivity_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w),
options->tilt_angle_d); options->tilt_angle_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->function_w), TRUE); gtk_toggle_button_set_active (((options->function_d == blob_ellipse) ?
GTK_TOGGLE_BUTTON (options->function_w[0]) :
((options->function_d == blob_square) ?
GTK_TOGGLE_BUTTON (options->function_w[1]) :
GTK_TOGGLE_BUTTON (options->function_w[2]))),
TRUE);
options->aspect = options->aspect_d; options->aspect = options->aspect_d;
options->angle = options->angle_d; options->angle = options->angle_d;
gtk_widget_queue_draw (options->brush_w->widget); gtk_widget_queue_draw (options->brush_w->widget);
@ -434,7 +438,7 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w = radio_button; options->function_w[0] = radio_button;
pixmap = blob_pixmap (gtk_widget_get_colormap (vbox), pixmap = blob_pixmap (gtk_widget_get_colormap (vbox),
gtk_widget_get_visual (vbox), gtk_widget_get_visual (vbox),
@ -452,6 +456,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[1] = radio_button;
pixmap = blob_pixmap (gtk_widget_get_colormap (vbox), pixmap = blob_pixmap (gtk_widget_get_colormap (vbox),
gtk_widget_get_visual (vbox), gtk_widget_get_visual (vbox),
blob_diamond); blob_diamond);
@ -468,6 +474,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[2] = radio_button;
/* Brush shape widget */ /* Brush shape widget */
frame = gtk_frame_new (_("Shape")); frame = gtk_frame_new (_("Shape"));
gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9); gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9);
@ -480,17 +488,17 @@ ink_options_new (void)
options->brush_w = g_new (BrushWidget, 1); options->brush_w = g_new (BrushWidget, 1);
options->brush_w->state = FALSE; options->brush_w->state = FALSE;
frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, FALSE); frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, FALSE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
darea = gtk_drawing_area_new(); darea = gtk_drawing_area_new();
options->brush_w->widget = darea; options->brush_w->widget = darea;
gtk_drawing_area_size (GTK_DRAWING_AREA (darea), 60, 60); gtk_drawing_area_size (GTK_DRAWING_AREA (darea), 60, 60);
gtk_container_add (GTK_CONTAINER (frame), darea); gtk_container_add (GTK_CONTAINER (frame), darea);
gtk_widget_set_events (darea, gtk_widget_set_events (darea,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK); | GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK);
@ -1531,6 +1539,9 @@ tools_new_ink ()
{ {
ink_options = ink_options_new (); ink_options = ink_options_new ();
tools_register (INK, (ToolOptions *) ink_options); tools_register (INK, (ToolOptions *) ink_options);
/* press all default buttons */
ink_options_reset ();
} }
tool = (Tool *) g_malloc (sizeof (Tool)); tool = (Tool *) g_malloc (sizeof (Tool));
@ -1635,4 +1646,3 @@ ink_invoker (args)
/* Fix me */ /* Fix me */
return NULL; return NULL;
} }

View File

@ -52,11 +52,11 @@ struct _CloneOptions
CloneType type; CloneType type;
CloneType type_d; CloneType type_d;
GtkWidget *type_w; GtkWidget *type_w[2]; /* 2 radio buttons */
AlignType aligned; AlignType aligned;
AlignType aligned_d; AlignType aligned_d;
GtkWidget *aligned_w; GtkWidget *aligned_w[3]; /* 3 radio buttons */
}; };
@ -113,8 +113,8 @@ clone_options_reset (void)
{ {
CloneOptions *options = clone_options; CloneOptions *options = clone_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
} }
static CloneOptions * static CloneOptions *
@ -172,8 +172,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->type_d) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -198,8 +197,7 @@ clone_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->aligned_d) options->aligned_w[i] = radio_button;
options->aligned_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -357,6 +355,9 @@ tools_new_clone ()
{ {
clone_options = clone_options_new (); clone_options = clone_options_new ();
tools_register (CLONE, (ToolOptions *) clone_options); tools_register (CLONE, (ToolOptions *) clone_options);
/* press all default buttons */
clone_options_reset ();
} }
tool = paint_core_new (CLONE); tool = paint_core_new (CLONE);

View File

@ -104,7 +104,7 @@ struct _InkOptions
BlobFunc function; BlobFunc function;
BlobFunc function_d; BlobFunc function_d;
GtkWidget *function_w; GtkWidget *function_w[3]; /* 3 radio buttons */
double aspect; double aspect;
double aspect_d; double aspect_d;
@ -236,8 +236,12 @@ ink_options_reset (void)
options->vel_sensitivity_d); options->vel_sensitivity_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w),
options->tilt_angle_d); options->tilt_angle_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->function_w), TRUE); gtk_toggle_button_set_active (((options->function_d == blob_ellipse) ?
GTK_TOGGLE_BUTTON (options->function_w[0]) :
((options->function_d == blob_square) ?
GTK_TOGGLE_BUTTON (options->function_w[1]) :
GTK_TOGGLE_BUTTON (options->function_w[2]))),
TRUE);
options->aspect = options->aspect_d; options->aspect = options->aspect_d;
options->angle = options->angle_d; options->angle = options->angle_d;
gtk_widget_queue_draw (options->brush_w->widget); gtk_widget_queue_draw (options->brush_w->widget);
@ -434,7 +438,7 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w = radio_button; options->function_w[0] = radio_button;
pixmap = blob_pixmap (gtk_widget_get_colormap (vbox), pixmap = blob_pixmap (gtk_widget_get_colormap (vbox),
gtk_widget_get_visual (vbox), gtk_widget_get_visual (vbox),
@ -452,6 +456,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[1] = radio_button;
pixmap = blob_pixmap (gtk_widget_get_colormap (vbox), pixmap = blob_pixmap (gtk_widget_get_colormap (vbox),
gtk_widget_get_visual (vbox), gtk_widget_get_visual (vbox),
blob_diamond); blob_diamond);
@ -468,6 +474,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget); gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[2] = radio_button;
/* Brush shape widget */ /* Brush shape widget */
frame = gtk_frame_new (_("Shape")); frame = gtk_frame_new (_("Shape"));
gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9); gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9);
@ -480,17 +488,17 @@ ink_options_new (void)
options->brush_w = g_new (BrushWidget, 1); options->brush_w = g_new (BrushWidget, 1);
options->brush_w->state = FALSE; options->brush_w->state = FALSE;
frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, FALSE); frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, FALSE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
darea = gtk_drawing_area_new(); darea = gtk_drawing_area_new();
options->brush_w->widget = darea; options->brush_w->widget = darea;
gtk_drawing_area_size (GTK_DRAWING_AREA (darea), 60, 60); gtk_drawing_area_size (GTK_DRAWING_AREA (darea), 60, 60);
gtk_container_add (GTK_CONTAINER (frame), darea); gtk_container_add (GTK_CONTAINER (frame), darea);
gtk_widget_set_events (darea, gtk_widget_set_events (darea,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK); | GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK);
@ -1531,6 +1539,9 @@ tools_new_ink ()
{ {
ink_options = ink_options_new (); ink_options = ink_options_new ();
tools_register (INK, (ToolOptions *) ink_options); tools_register (INK, (ToolOptions *) ink_options);
/* press all default buttons */
ink_options_reset ();
} }
tool = (Tool *) g_malloc (sizeof (Tool)); tool = (Tool *) g_malloc (sizeof (Tool));
@ -1635,4 +1646,3 @@ ink_invoker (args)
/* Fix me */ /* Fix me */
return NULL; return NULL;
} }

View File

@ -58,7 +58,7 @@ struct _PaintOptions
int gradient_type; int gradient_type;
int gradient_type_d; int gradient_type_d;
GtkWidget *gradient_type_w; GtkWidget *gradient_type_w[4]; /* 4 radio buttons */
gboolean incremental; gboolean incremental;
gboolean incremental_d; gboolean incremental_d;
@ -129,7 +129,7 @@ paintbrush_options_reset (void)
options->use_gradient_d); options->use_gradient_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->gradient_length_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->gradient_length_w),
options->gradient_length_d); options->gradient_length_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->gradient_type_w), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->gradient_type_w[options->gradient_type_d]),
TRUE); TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d); options->incremental_d);
@ -202,8 +202,6 @@ paintbrush_options_new (void)
gtk_check_button_new_with_label (_("Gradient")); gtk_check_button_new_with_label (_("Gradient"));
gtk_table_attach (GTK_TABLE (table), options->use_gradient_w, 0, 1, 1, 2, gtk_table_attach (GTK_TABLE (table), options->use_gradient_w, 0, 1, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0); GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->use_gradient_w),
options->use_gradient_d);
gtk_signal_connect (GTK_OBJECT (options->use_gradient_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->use_gradient_w), "toggled",
(GtkSignalFunc) paintbrush_gradient_toggle_callback, (GtkSignalFunc) paintbrush_gradient_toggle_callback,
&options->use_gradient); &options->use_gradient);
@ -238,9 +236,6 @@ paintbrush_options_new (void)
gtk_table_attach_defaults (GTK_TABLE (table), radio_frame, 0, 2, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), radio_frame, 0, 2, 3, 4);
/* automatically set the sensitive state of the gradient stuff */ /* automatically set the sensitive state of the gradient stuff */
gtk_widget_set_sensitive (scale, options->use_gradient_d);
gtk_widget_set_sensitive (label, options->use_gradient_d);
gtk_widget_set_sensitive (radio_frame, options->use_gradient_d);
gtk_object_set_data (GTK_OBJECT (options->use_gradient_w), "set_sensitive", gtk_object_set_data (GTK_OBJECT (options->use_gradient_w), "set_sensitive",
scale); scale);
gtk_object_set_data (GTK_OBJECT (scale), "set_sensitive", gtk_object_set_data (GTK_OBJECT (scale), "set_sensitive",
@ -264,11 +259,9 @@ paintbrush_options_new (void)
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == options->gradient_type_d) options->gradient_type_w[i] = radio_button;
options->gradient_type_w = radio_button;
} }
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->gradient_type_w),
TRUE);
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
@ -278,8 +271,6 @@ paintbrush_options_new (void)
gtk_signal_connect (GTK_OBJECT (options->incremental_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->incremental_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update, (GtkSignalFunc) tool_options_toggle_update,
&options->incremental); &options->incremental);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
gtk_widget_show (options->incremental_w); gtk_widget_show (options->incremental_w);
return options; return options;
@ -352,6 +343,9 @@ tools_new_paintbrush ()
{ {
paintbrush_options = paintbrush_options_new (); paintbrush_options = paintbrush_options_new ();
tools_register (PAINTBRUSH, (ToolOptions *) paintbrush_options); tools_register (PAINTBRUSH, (ToolOptions *) paintbrush_options);
/* press all default buttons */
paintbrush_options_reset ();
} }
tool = paint_core_new (PAINTBRUSH); tool = paint_core_new (PAINTBRUSH);

View File

@ -38,29 +38,29 @@ struct _TransformOptions
{ {
ToolOptions tool_options; ToolOptions tool_options;
int direction; ToolType type;
int direction_d; ToolType type_d;
GtkWidget *direction_w; GtkWidget *type_w[4]; /* 4 radio buttons */
int smoothing; int smoothing;
int smoothing_d; int smoothing_d;
GtkWidget *smoothing_w; GtkWidget *smoothing_w;
int clip; int direction;
int clip_d; int direction_d;
GtkWidget *clip_w; GtkWidget *direction_w[2]; /* 2 radio buttons */
int grid_size;
int grid_size_d;
GtkObject *grid_size_w;
int show_grid; int show_grid;
int show_grid_d; int show_grid_d;
GtkWidget *show_grid_w; GtkWidget *show_grid_w;
ToolType type; int grid_size;
ToolType type_d; int grid_size_d;
GtkWidget *type_w; GtkObject *grid_size_w;
int clip;
int clip_d;
GtkWidget *clip_w;
}; };
@ -78,6 +78,14 @@ static void
transform_show_grid_update (GtkWidget *widget, transform_show_grid_update (GtkWidget *widget,
gpointer data) gpointer data)
{ {
static gboolean first_call = TRUE; /* eek, this hack avoids a segfult */
if (first_call)
{
first_call = FALSE;
return;
}
tool_options_toggle_update (widget, data); tool_options_toggle_update (widget, data);
transform_core_grid_density_changed (); transform_core_grid_density_changed ();
} }
@ -115,11 +123,20 @@ transform_options_reset (void)
{ {
TransformOptions *options = transform_options; TransformOptions *options = transform_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), gtk_toggle_button_set_active (((options->type_d == ROTATE) ?
options->type_d); GTK_TOGGLE_BUTTON (options->type_w[0]) :
((options->type_d == SCALE) ?
GTK_TOGGLE_BUTTON (options->type_w[1]) :
((options->type_d == SHEAR) ?
GTK_TOGGLE_BUTTON (options->type_w[2]) :
GTK_TOGGLE_BUTTON (options->type_w[3])))),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
options->smoothing_d); options->smoothing_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->direction_w), TRUE); gtk_toggle_button_set_active (((options->direction_d == TRANSFORM_TRADITIONAL) ?
GTK_TOGGLE_BUTTON (options->direction_w[0]) :
GTK_TOGGLE_BUTTON (options->direction_w[1])),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w),
options->show_grid_d); options->show_grid_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->grid_size_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->grid_size_w),
@ -200,16 +217,13 @@ transform_options_new (void)
(gpointer) ((long) ROTATE + i)); (gpointer) ((long) ROTATE + i));
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == 0) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
/* the smoothing toggle button */ /* the smoothing toggle button */
options->smoothing_w = gtk_check_button_new_with_label (_("Smoothing")); options->smoothing_w = gtk_check_button_new_with_label (_("Smoothing"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
options->smoothing);
gtk_signal_connect (GTK_OBJECT (options->smoothing_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->smoothing_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update, (GtkSignalFunc) tool_options_toggle_update,
&options->smoothing); &options->smoothing);
@ -244,18 +258,13 @@ transform_options_new (void)
(gpointer) ((long) i)); (gpointer) ((long) i));
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == 0) options->direction_w[i] = radio_button;
options->direction_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
/* the show grid toggle button */ /* the show grid toggle button */
options->show_grid_w = gtk_check_button_new_with_label (_("Show grid")); options->show_grid_w = gtk_check_button_new_with_label (_("Show grid"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w),
options->show_grid);
/* important: connect the signal after setting the state, because calling
transform_show_grid_update before the tool is created will fail */
gtk_signal_connect (GTK_OBJECT (options->show_grid_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->show_grid_w), "toggled",
(GtkSignalFunc) transform_show_grid_update, (GtkSignalFunc) transform_show_grid_update,
&options->show_grid); &options->show_grid);
@ -271,7 +280,7 @@ transform_options_new (void)
gtk_widget_show (label); gtk_widget_show (label);
options->grid_size_w = options->grid_size_w =
gtk_adjustment_new (7.0 - log (options->grid_size) / log (2.0), 0.0, 5.0, gtk_adjustment_new (7.0 - log (options->grid_size_d) / log (2.0), 0.0, 5.0,
1.0, 1.0, 0.0); 1.0, 1.0, 0.0);
grid_density = grid_density =
gtk_spin_button_new (GTK_ADJUSTMENT (options->grid_size_w), 0, 0); gtk_spin_button_new (GTK_ADJUSTMENT (options->grid_size_w), 0, 0);
@ -284,8 +293,6 @@ transform_options_new (void)
/* the clip resulting image toggle button */ /* the clip resulting image toggle button */
options->clip_w = gtk_check_button_new_with_label (_("Clip result")); options->clip_w = gtk_check_button_new_with_label (_("Clip result"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->clip_w),
options->clip);
gtk_signal_connect (GTK_OBJECT (options->clip_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->clip_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update, (GtkSignalFunc) tool_options_toggle_update,
&options->clip); &options->clip);
@ -309,6 +316,9 @@ tools_new_transform_tool (void)
tools_register (SCALE, (ToolOptions *) transform_options); tools_register (SCALE, (ToolOptions *) transform_options);
tools_register (SHEAR, (ToolOptions *) transform_options); tools_register (SHEAR, (ToolOptions *) transform_options);
tools_register (PERSPECTIVE, (ToolOptions *) transform_options); tools_register (PERSPECTIVE, (ToolOptions *) transform_options);
/* press all default buttons */
transform_options_reset ();
} }
switch (transform_options->type) switch (transform_options->type)

View File

@ -38,29 +38,29 @@ struct _TransformOptions
{ {
ToolOptions tool_options; ToolOptions tool_options;
int direction; ToolType type;
int direction_d; ToolType type_d;
GtkWidget *direction_w; GtkWidget *type_w[4]; /* 4 radio buttons */
int smoothing; int smoothing;
int smoothing_d; int smoothing_d;
GtkWidget *smoothing_w; GtkWidget *smoothing_w;
int clip; int direction;
int clip_d; int direction_d;
GtkWidget *clip_w; GtkWidget *direction_w[2]; /* 2 radio buttons */
int grid_size;
int grid_size_d;
GtkObject *grid_size_w;
int show_grid; int show_grid;
int show_grid_d; int show_grid_d;
GtkWidget *show_grid_w; GtkWidget *show_grid_w;
ToolType type; int grid_size;
ToolType type_d; int grid_size_d;
GtkWidget *type_w; GtkObject *grid_size_w;
int clip;
int clip_d;
GtkWidget *clip_w;
}; };
@ -78,6 +78,14 @@ static void
transform_show_grid_update (GtkWidget *widget, transform_show_grid_update (GtkWidget *widget,
gpointer data) gpointer data)
{ {
static gboolean first_call = TRUE; /* eek, this hack avoids a segfult */
if (first_call)
{
first_call = FALSE;
return;
}
tool_options_toggle_update (widget, data); tool_options_toggle_update (widget, data);
transform_core_grid_density_changed (); transform_core_grid_density_changed ();
} }
@ -115,11 +123,20 @@ transform_options_reset (void)
{ {
TransformOptions *options = transform_options; TransformOptions *options = transform_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w), gtk_toggle_button_set_active (((options->type_d == ROTATE) ?
options->type_d); GTK_TOGGLE_BUTTON (options->type_w[0]) :
((options->type_d == SCALE) ?
GTK_TOGGLE_BUTTON (options->type_w[1]) :
((options->type_d == SHEAR) ?
GTK_TOGGLE_BUTTON (options->type_w[2]) :
GTK_TOGGLE_BUTTON (options->type_w[3])))),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
options->smoothing_d); options->smoothing_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->direction_w), TRUE); gtk_toggle_button_set_active (((options->direction_d == TRANSFORM_TRADITIONAL) ?
GTK_TOGGLE_BUTTON (options->direction_w[0]) :
GTK_TOGGLE_BUTTON (options->direction_w[1])),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w),
options->show_grid_d); options->show_grid_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->grid_size_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (options->grid_size_w),
@ -200,16 +217,13 @@ transform_options_new (void)
(gpointer) ((long) ROTATE + i)); (gpointer) ((long) ROTATE + i));
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == 0) options->type_w[i] = radio_button;
options->type_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
/* the smoothing toggle button */ /* the smoothing toggle button */
options->smoothing_w = gtk_check_button_new_with_label (_("Smoothing")); options->smoothing_w = gtk_check_button_new_with_label (_("Smoothing"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
options->smoothing);
gtk_signal_connect (GTK_OBJECT (options->smoothing_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->smoothing_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update, (GtkSignalFunc) tool_options_toggle_update,
&options->smoothing); &options->smoothing);
@ -244,18 +258,13 @@ transform_options_new (void)
(gpointer) ((long) i)); (gpointer) ((long) i));
gtk_widget_show (radio_button); gtk_widget_show (radio_button);
if (i == 0) options->direction_w[i] = radio_button;
options->direction_w = radio_button;
} }
gtk_widget_show (radio_box); gtk_widget_show (radio_box);
gtk_widget_show (radio_frame); gtk_widget_show (radio_frame);
/* the show grid toggle button */ /* the show grid toggle button */
options->show_grid_w = gtk_check_button_new_with_label (_("Show grid")); options->show_grid_w = gtk_check_button_new_with_label (_("Show grid"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w),
options->show_grid);
/* important: connect the signal after setting the state, because calling
transform_show_grid_update before the tool is created will fail */
gtk_signal_connect (GTK_OBJECT (options->show_grid_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->show_grid_w), "toggled",
(GtkSignalFunc) transform_show_grid_update, (GtkSignalFunc) transform_show_grid_update,
&options->show_grid); &options->show_grid);
@ -271,7 +280,7 @@ transform_options_new (void)
gtk_widget_show (label); gtk_widget_show (label);
options->grid_size_w = options->grid_size_w =
gtk_adjustment_new (7.0 - log (options->grid_size) / log (2.0), 0.0, 5.0, gtk_adjustment_new (7.0 - log (options->grid_size_d) / log (2.0), 0.0, 5.0,
1.0, 1.0, 0.0); 1.0, 1.0, 0.0);
grid_density = grid_density =
gtk_spin_button_new (GTK_ADJUSTMENT (options->grid_size_w), 0, 0); gtk_spin_button_new (GTK_ADJUSTMENT (options->grid_size_w), 0, 0);
@ -284,8 +293,6 @@ transform_options_new (void)
/* the clip resulting image toggle button */ /* the clip resulting image toggle button */
options->clip_w = gtk_check_button_new_with_label (_("Clip result")); options->clip_w = gtk_check_button_new_with_label (_("Clip result"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->clip_w),
options->clip);
gtk_signal_connect (GTK_OBJECT (options->clip_w), "toggled", gtk_signal_connect (GTK_OBJECT (options->clip_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update, (GtkSignalFunc) tool_options_toggle_update,
&options->clip); &options->clip);
@ -309,6 +316,9 @@ tools_new_transform_tool (void)
tools_register (SCALE, (ToolOptions *) transform_options); tools_register (SCALE, (ToolOptions *) transform_options);
tools_register (SHEAR, (ToolOptions *) transform_options); tools_register (SHEAR, (ToolOptions *) transform_options);
tools_register (PERSPECTIVE, (ToolOptions *) transform_options); tools_register (PERSPECTIVE, (ToolOptions *) transform_options);
/* press all default buttons */
transform_options_reset ();
} }
switch (transform_options->type) switch (transform_options->type)