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>
* app/text_tool_cmds.c: doh, decipoints not decipixels

View File

@ -61,13 +61,13 @@ struct _BucketOptions
double threshold_d;
GtkObject *threshold_w;
FillMode fill_mode;
FillMode fill_mode_d;
GtkWidget *fill_mode_w;
int sample_merged;
int sample_merged_d;
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);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
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 *
@ -247,8 +250,6 @@ bucket_options_new (void)
gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&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_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_widget_show (radio_button);
if (i == 0)
options->fill_mode_w = radio_button;
options->fill_mode_w[i] = radio_button;
}
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
@ -687,6 +687,9 @@ tools_new_bucket_fill (void)
{
bucket_options = bucket_options_new ();
tools_register (BUCKET_FILL, (ToolOptions *) bucket_options);
/* press all default buttons */
bucket_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));

View File

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

View File

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

View File

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

View File

@ -104,7 +104,7 @@ struct _InkOptions
BlobFunc function;
BlobFunc function_d;
GtkWidget *function_w;
GtkWidget *function_w[3]; /* 3 radio buttons */
double aspect;
double aspect_d;
@ -236,8 +236,12 @@ ink_options_reset (void)
options->vel_sensitivity_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w),
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->angle = options->angle_d;
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_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),
gtk_widget_get_visual (vbox),
@ -452,6 +456,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
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),
gtk_widget_get_visual (vbox),
blob_diamond);
@ -468,6 +474,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[2] = radio_button;
/* Brush shape widget */
frame = gtk_frame_new (_("Shape"));
gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9);
@ -1531,6 +1539,9 @@ tools_new_ink ()
{
ink_options = ink_options_new ();
tools_register (INK, (ToolOptions *) ink_options);
/* press all default buttons */
ink_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
@ -1635,4 +1646,3 @@ ink_invoker (args)
/* Fix me */
return NULL;
}

View File

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

View File

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

View File

@ -104,7 +104,7 @@ struct _InkOptions
BlobFunc function;
BlobFunc function_d;
GtkWidget *function_w;
GtkWidget *function_w[3]; /* 3 radio buttons */
double aspect;
double aspect_d;
@ -236,8 +236,12 @@ ink_options_reset (void)
options->vel_sensitivity_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w),
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->angle = options->angle_d;
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_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),
gtk_widget_get_visual (vbox),
@ -452,6 +456,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
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),
gtk_widget_get_visual (vbox),
blob_diamond);
@ -468,6 +474,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[2] = radio_button;
/* Brush shape widget */
frame = gtk_frame_new (_("Shape"));
gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9);
@ -1531,6 +1539,9 @@ tools_new_ink ()
{
ink_options = ink_options_new ();
tools_register (INK, (ToolOptions *) ink_options);
/* press all default buttons */
ink_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
@ -1635,4 +1646,3 @@ ink_invoker (args)
/* Fix me */
return NULL;
}

View File

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

View File

@ -58,7 +58,7 @@ struct _PaintOptions
int gradient_type;
int gradient_type_d;
GtkWidget *gradient_type_w;
GtkWidget *gradient_type_w[4]; /* 4 radio buttons */
gboolean incremental;
gboolean incremental_d;
@ -129,7 +129,7 @@ paintbrush_options_reset (void)
options->use_gradient_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->gradient_length_w),
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);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
@ -202,8 +202,6 @@ paintbrush_options_new (void)
gtk_check_button_new_with_label (_("Gradient"));
gtk_table_attach (GTK_TABLE (table), options->use_gradient_w, 0, 1, 1, 2,
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",
(GtkSignalFunc) paintbrush_gradient_toggle_callback,
&options->use_gradient);
@ -238,9 +236,6 @@ paintbrush_options_new (void)
gtk_table_attach_defaults (GTK_TABLE (table), radio_frame, 0, 2, 3, 4);
/* 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",
scale);
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_widget_show (radio_button);
if (i == options->gradient_type_d)
options->gradient_type_w = radio_button;
options->gradient_type_w[i] = radio_button;
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->gradient_type_w),
TRUE);
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
@ -278,8 +271,6 @@ paintbrush_options_new (void)
gtk_signal_connect (GTK_OBJECT (options->incremental_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&options->incremental);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
gtk_widget_show (options->incremental_w);
return options;
@ -352,6 +343,9 @@ tools_new_paintbrush ()
{
paintbrush_options = paintbrush_options_new ();
tools_register (PAINTBRUSH, (ToolOptions *) paintbrush_options);
/* press all default buttons */
paintbrush_options_reset ();
}
tool = paint_core_new (PAINTBRUSH);

View File

@ -61,13 +61,13 @@ struct _BucketOptions
double threshold_d;
GtkObject *threshold_w;
FillMode fill_mode;
FillMode fill_mode_d;
GtkWidget *fill_mode_w;
int sample_merged;
int sample_merged_d;
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);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
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 *
@ -247,8 +250,6 @@ bucket_options_new (void)
gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&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_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_widget_show (radio_button);
if (i == 0)
options->fill_mode_w = radio_button;
options->fill_mode_w[i] = radio_button;
}
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
@ -687,6 +687,9 @@ tools_new_bucket_fill (void)
{
bucket_options = bucket_options_new ();
tools_register (BUCKET_FILL, (ToolOptions *) bucket_options);
/* press all default buttons */
bucket_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));

View File

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

View File

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

View File

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

View File

@ -61,13 +61,13 @@ struct _BucketOptions
double threshold_d;
GtkObject *threshold_w;
FillMode fill_mode;
FillMode fill_mode_d;
GtkWidget *fill_mode_w;
int sample_merged;
int sample_merged_d;
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);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
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 *
@ -247,8 +250,6 @@ bucket_options_new (void)
gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&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_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_widget_show (radio_button);
if (i == 0)
options->fill_mode_w = radio_button;
options->fill_mode_w[i] = radio_button;
}
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
@ -687,6 +687,9 @@ tools_new_bucket_fill (void)
{
bucket_options = bucket_options_new ();
tools_register (BUCKET_FILL, (ToolOptions *) bucket_options);
/* press all default buttons */
bucket_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));

View File

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

View File

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

View File

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

View File

@ -104,7 +104,7 @@ struct _InkOptions
BlobFunc function;
BlobFunc function_d;
GtkWidget *function_w;
GtkWidget *function_w[3]; /* 3 radio buttons */
double aspect;
double aspect_d;
@ -236,8 +236,12 @@ ink_options_reset (void)
options->vel_sensitivity_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w),
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->angle = options->angle_d;
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_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),
gtk_widget_get_visual (vbox),
@ -452,6 +456,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
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),
gtk_widget_get_visual (vbox),
blob_diamond);
@ -468,6 +474,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[2] = radio_button;
/* Brush shape widget */
frame = gtk_frame_new (_("Shape"));
gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9);
@ -1531,6 +1539,9 @@ tools_new_ink ()
{
ink_options = ink_options_new ();
tools_register (INK, (ToolOptions *) ink_options);
/* press all default buttons */
ink_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
@ -1635,4 +1646,3 @@ ink_invoker (args)
/* Fix me */
return NULL;
}

View File

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

View File

@ -104,7 +104,7 @@ struct _InkOptions
BlobFunc function;
BlobFunc function_d;
GtkWidget *function_w;
GtkWidget *function_w[3]; /* 3 radio buttons */
double aspect;
double aspect_d;
@ -236,8 +236,12 @@ ink_options_reset (void)
options->vel_sensitivity_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->tilt_angle_w),
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->angle = options->angle_d;
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_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),
gtk_widget_get_visual (vbox),
@ -452,6 +456,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
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),
gtk_widget_get_visual (vbox),
blob_diamond);
@ -468,6 +474,8 @@ ink_options_new (void)
gtk_container_add (GTK_CONTAINER (radio_button), pixmap_widget);
gtk_box_pack_start (GTK_BOX (vbox), radio_button, FALSE, FALSE, 0);
options->function_w[2] = radio_button;
/* Brush shape widget */
frame = gtk_frame_new (_("Shape"));
gtk_table_attach_defaults (GTK_TABLE (table), frame, 1, 2, 8, 9);
@ -1531,6 +1539,9 @@ tools_new_ink ()
{
ink_options = ink_options_new ();
tools_register (INK, (ToolOptions *) ink_options);
/* press all default buttons */
ink_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
@ -1635,4 +1646,3 @@ ink_invoker (args)
/* Fix me */
return NULL;
}

View File

@ -58,7 +58,7 @@ struct _PaintOptions
int gradient_type;
int gradient_type_d;
GtkWidget *gradient_type_w;
GtkWidget *gradient_type_w[4]; /* 4 radio buttons */
gboolean incremental;
gboolean incremental_d;
@ -129,7 +129,7 @@ paintbrush_options_reset (void)
options->use_gradient_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->gradient_length_w),
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);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
@ -202,8 +202,6 @@ paintbrush_options_new (void)
gtk_check_button_new_with_label (_("Gradient"));
gtk_table_attach (GTK_TABLE (table), options->use_gradient_w, 0, 1, 1, 2,
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",
(GtkSignalFunc) paintbrush_gradient_toggle_callback,
&options->use_gradient);
@ -238,9 +236,6 @@ paintbrush_options_new (void)
gtk_table_attach_defaults (GTK_TABLE (table), radio_frame, 0, 2, 3, 4);
/* 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",
scale);
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_widget_show (radio_button);
if (i == options->gradient_type_d)
options->gradient_type_w = radio_button;
options->gradient_type_w[i] = radio_button;
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->gradient_type_w),
TRUE);
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
@ -278,8 +271,6 @@ paintbrush_options_new (void)
gtk_signal_connect (GTK_OBJECT (options->incremental_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&options->incremental);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
gtk_widget_show (options->incremental_w);
return options;
@ -352,6 +343,9 @@ tools_new_paintbrush ()
{
paintbrush_options = paintbrush_options_new ();
tools_register (PAINTBRUSH, (ToolOptions *) paintbrush_options);
/* press all default buttons */
paintbrush_options_reset ();
}
tool = paint_core_new (PAINTBRUSH);

View File

@ -38,29 +38,29 @@ struct _TransformOptions
{
ToolOptions tool_options;
int direction;
int direction_d;
GtkWidget *direction_w;
ToolType type;
ToolType type_d;
GtkWidget *type_w[4]; /* 4 radio buttons */
int smoothing;
int smoothing_d;
GtkWidget *smoothing_w;
int clip;
int clip_d;
GtkWidget *clip_w;
int grid_size;
int grid_size_d;
GtkObject *grid_size_w;
int direction;
int direction_d;
GtkWidget *direction_w[2]; /* 2 radio buttons */
int show_grid;
int show_grid_d;
GtkWidget *show_grid_w;
ToolType type;
ToolType type_d;
GtkWidget *type_w;
int grid_size;
int grid_size_d;
GtkObject *grid_size_w;
int clip;
int clip_d;
GtkWidget *clip_w;
};
@ -78,6 +78,14 @@ static void
transform_show_grid_update (GtkWidget *widget,
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);
transform_core_grid_density_changed ();
}
@ -115,11 +123,20 @@ transform_options_reset (void)
{
TransformOptions *options = transform_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w),
options->type_d);
gtk_toggle_button_set_active (((options->type_d == ROTATE) ?
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),
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),
options->show_grid_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->grid_size_w),
@ -200,16 +217,13 @@ transform_options_new (void)
(gpointer) ((long) ROTATE + i));
gtk_widget_show (radio_button);
if (i == 0)
options->type_w = radio_button;
options->type_w[i] = radio_button;
}
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
/* the smoothing toggle button */
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",
(GtkSignalFunc) tool_options_toggle_update,
&options->smoothing);
@ -244,18 +258,13 @@ transform_options_new (void)
(gpointer) ((long) i));
gtk_widget_show (radio_button);
if (i == 0)
options->direction_w = radio_button;
options->direction_w[i] = radio_button;
}
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
/* the show grid toggle button */
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",
(GtkSignalFunc) transform_show_grid_update,
&options->show_grid);
@ -271,7 +280,7 @@ transform_options_new (void)
gtk_widget_show (label);
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);
grid_density =
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 */
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",
(GtkSignalFunc) tool_options_toggle_update,
&options->clip);
@ -309,6 +316,9 @@ tools_new_transform_tool (void)
tools_register (SCALE, (ToolOptions *) transform_options);
tools_register (SHEAR, (ToolOptions *) transform_options);
tools_register (PERSPECTIVE, (ToolOptions *) transform_options);
/* press all default buttons */
transform_options_reset ();
}
switch (transform_options->type)

View File

@ -38,29 +38,29 @@ struct _TransformOptions
{
ToolOptions tool_options;
int direction;
int direction_d;
GtkWidget *direction_w;
ToolType type;
ToolType type_d;
GtkWidget *type_w[4]; /* 4 radio buttons */
int smoothing;
int smoothing_d;
GtkWidget *smoothing_w;
int clip;
int clip_d;
GtkWidget *clip_w;
int grid_size;
int grid_size_d;
GtkObject *grid_size_w;
int direction;
int direction_d;
GtkWidget *direction_w[2]; /* 2 radio buttons */
int show_grid;
int show_grid_d;
GtkWidget *show_grid_w;
ToolType type;
ToolType type_d;
GtkWidget *type_w;
int grid_size;
int grid_size_d;
GtkObject *grid_size_w;
int clip;
int clip_d;
GtkWidget *clip_w;
};
@ -78,6 +78,14 @@ static void
transform_show_grid_update (GtkWidget *widget,
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);
transform_core_grid_density_changed ();
}
@ -115,11 +123,20 @@ transform_options_reset (void)
{
TransformOptions *options = transform_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w),
options->type_d);
gtk_toggle_button_set_active (((options->type_d == ROTATE) ?
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),
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),
options->show_grid_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->grid_size_w),
@ -200,16 +217,13 @@ transform_options_new (void)
(gpointer) ((long) ROTATE + i));
gtk_widget_show (radio_button);
if (i == 0)
options->type_w = radio_button;
options->type_w[i] = radio_button;
}
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
/* the smoothing toggle button */
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",
(GtkSignalFunc) tool_options_toggle_update,
&options->smoothing);
@ -244,18 +258,13 @@ transform_options_new (void)
(gpointer) ((long) i));
gtk_widget_show (radio_button);
if (i == 0)
options->direction_w = radio_button;
options->direction_w[i] = radio_button;
}
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
/* the show grid toggle button */
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",
(GtkSignalFunc) transform_show_grid_update,
&options->show_grid);
@ -271,7 +280,7 @@ transform_options_new (void)
gtk_widget_show (label);
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);
grid_density =
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 */
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",
(GtkSignalFunc) tool_options_toggle_update,
&options->clip);
@ -309,6 +316,9 @@ tools_new_transform_tool (void)
tools_register (SCALE, (ToolOptions *) transform_options);
tools_register (SHEAR, (ToolOptions *) transform_options);
tools_register (PERSPECTIVE, (ToolOptions *) transform_options);
/* press all default buttons */
transform_options_reset ();
}
switch (transform_options->type)