mirror of https://github.com/GNOME/gimp.git
fixed a sensitive setting bug I introduced with the last change.
1999-04-18 Michael Natterer <mitschel@cs.tu-berlin.de> * app/paintbrush.c: fixed a sensitive setting bug I introduced with the last change. * app/text_tool.c: added a toggle button which enables calling gDynText. * app/tool_options.c: the toggle callback does some more sensitive settings.
This commit is contained in:
parent
e875b11fb1
commit
9e1879d964
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
1999-04-18 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
* app/paintbrush.c: fixed a sensitive setting bug I introduced
|
||||
with the last change.
|
||||
|
||||
* app/text_tool.c: added a toggle button which enables calling
|
||||
gDynText.
|
||||
|
||||
* app/tool_options.c: the toggle callback does some more sensitive
|
||||
settings.
|
||||
|
||||
1999-04-18 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
* app/bucket_fill.c
|
||||
|
|
|
@ -37,6 +37,7 @@ tool_options_toggle_update (GtkWidget *widget,
|
|||
/* a tool options toggle button can set the sensitive state of
|
||||
* an arbitrary list of widgets
|
||||
*/
|
||||
|
||||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "set_sensitive");
|
||||
while (set_sensitive)
|
||||
|
@ -45,6 +46,15 @@ tool_options_toggle_update (GtkWidget *widget,
|
|||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (set_sensitive), "set_sensitive");
|
||||
}
|
||||
|
||||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "inverse_sensitive");
|
||||
while (set_sensitive)
|
||||
{
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (set_sensitive), ! *toggle_val);
|
||||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (set_sensitive), "inverse_sensitive");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -99,13 +99,11 @@ paintbrush_gradient_toggle_callback (GtkWidget *widget,
|
|||
incremental_save = options->incremental;
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
||||
TRUE);
|
||||
gtk_widget_set_sensitive (options->incremental_w, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
||||
incremental_save);
|
||||
gtk_widget_set_sensitive (options->incremental_w, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,14 +233,6 @@ paintbrush_options_new (void)
|
|||
radio_frame = gtk_frame_new (_("Gradient Type"));
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), radio_frame, 0, 2, 3, 4);
|
||||
|
||||
/* automatically set the sensitive state of the gradient stuff */
|
||||
gtk_object_set_data (GTK_OBJECT (options->use_gradient_w), "set_sensitive",
|
||||
scale);
|
||||
gtk_object_set_data (GTK_OBJECT (scale), "set_sensitive",
|
||||
label);
|
||||
gtk_object_set_data (GTK_OBJECT (label), "set_sensitive",
|
||||
radio_frame);
|
||||
|
||||
radio_box = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
||||
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
|
||||
|
@ -273,6 +263,20 @@ paintbrush_options_new (void)
|
|||
&options->incremental);
|
||||
gtk_widget_show (options->incremental_w);
|
||||
|
||||
/* 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_widget_set_sensitive (options->incremental_w, ! 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",
|
||||
label);
|
||||
gtk_object_set_data (GTK_OBJECT (label), "set_sensitive",
|
||||
radio_frame);
|
||||
gtk_object_set_data (GTK_OBJECT (options->use_gradient_w), "inverse_sensitive",
|
||||
options->incremental_w);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,10 @@ struct _TextOptions
|
|||
int border;
|
||||
int border_d;
|
||||
GtkObject *border_w;
|
||||
|
||||
int use_dyntext;
|
||||
int use_dyntext_d;
|
||||
GtkWidget *use_dyntext_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -120,6 +124,8 @@ text_options_reset (void)
|
|||
options->antialias_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->border_w),
|
||||
options->border_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->use_dyntext_w),
|
||||
options->use_dyntext_d);
|
||||
}
|
||||
|
||||
static TextOptions *
|
||||
|
@ -131,14 +137,16 @@ text_options_new (void)
|
|||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *sep;
|
||||
|
||||
/* the new text tool options structure */
|
||||
options = (TextOptions *) g_malloc (sizeof (TextOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Text Tool Options"),
|
||||
text_options_reset);
|
||||
options->antialias = options->antialias_d = TRUE;
|
||||
options->border = options->border_d = 0;
|
||||
options->antialias = options->antialias_d = TRUE;
|
||||
options->border = options->border_d = 0;
|
||||
options->use_dyntext = options->use_dyntext_d = FALSE;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
@ -161,13 +169,13 @@ text_options_new (void)
|
|||
|
||||
label = gtk_label_new (_("Border:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show(label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->border_w =
|
||||
gtk_adjustment_new (options->border_d, 0.0, 32767.0, 1.0, 50.0, 0.0);
|
||||
gtk_signal_connect(GTK_OBJECT (options->border_w), "changed",
|
||||
(GtkSignalFunc) tool_options_int_adjustment_update,
|
||||
&options->border);
|
||||
gtk_signal_connect (GTK_OBJECT (options->border_w), "changed",
|
||||
(GtkSignalFunc) tool_options_int_adjustment_update,
|
||||
&options->border);
|
||||
spinbutton =
|
||||
gtk_spin_button_new (GTK_ADJUSTMENT (options->border_w), 1.0, 0.0);
|
||||
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
|
||||
|
@ -179,6 +187,32 @@ text_options_new (void)
|
|||
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
sep = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sep);
|
||||
|
||||
/* antialias toggle */
|
||||
options->use_dyntext_w =
|
||||
gtk_check_button_new_with_label (_("Use Dynamic Text"));
|
||||
gtk_signal_connect (GTK_OBJECT (options->use_dyntext_w), "toggled",
|
||||
(GtkSignalFunc) tool_options_toggle_update,
|
||||
&options->use_dyntext);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->use_dyntext_w),
|
||||
options->use_dyntext_d);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->use_dyntext_w,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->use_dyntext_w);
|
||||
|
||||
/* let the toggle callback set the sensitive states */
|
||||
gtk_widget_set_sensitive (options->antialias_w, ! options->use_dyntext_d);
|
||||
gtk_widget_set_sensitive (spinbutton, ! options->use_dyntext_d);
|
||||
gtk_widget_set_sensitive (label, ! options->use_dyntext_d);
|
||||
gtk_object_set_data (GTK_OBJECT (options->use_dyntext_w), "inverse_sensitive",
|
||||
options->antialias_w);
|
||||
gtk_object_set_data (GTK_OBJECT (options->antialias_w), "inverse_sensitive",
|
||||
spinbutton);
|
||||
gtk_object_set_data (GTK_OBJECT (spinbutton), "inverse_sensitive", label);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
@ -222,6 +256,34 @@ tools_free_text (Tool *tool)
|
|||
g_free (tool->private);
|
||||
}
|
||||
|
||||
static void
|
||||
text_call_gdyntext (GDisplay *gdisp,
|
||||
GimpDrawable *drawable)
|
||||
{
|
||||
ProcRecord *proc_rec;
|
||||
Argument *args;
|
||||
|
||||
/* find the gDynText PDB record */
|
||||
if ((proc_rec = procedural_db_lookup ("plug_in_dynamic_text")) == NULL)
|
||||
{
|
||||
g_message (_("text_call_gdyntext: gDynText procedure lookup failed"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* plug-in arguments as if called by <Image>/Filters/... */
|
||||
args = g_new (Argument, 3);
|
||||
args[0].arg_type = PDB_INT32;
|
||||
args[0].value.pdb_int = RUN_INTERACTIVE;
|
||||
args[1].arg_type = PDB_IMAGE;
|
||||
args[1].value.pdb_int = (gint32) pdb_image_to_id (gdisp->gimage);
|
||||
args[2].arg_type = PDB_DRAWABLE;
|
||||
args[2].value.pdb_int = (gint32) drawable->ID;
|
||||
|
||||
plug_in_run (proc_rec, args, 3, FALSE, TRUE, gdisp->ID);
|
||||
|
||||
g_free (args);
|
||||
}
|
||||
|
||||
static void
|
||||
text_button_press (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
|
@ -232,6 +294,7 @@ text_button_press (Tool *tool,
|
|||
TextTool *text_tool;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
|
||||
text_tool = tool->private;
|
||||
text_tool->gdisp_ptr = gdisp_ptr;
|
||||
|
||||
|
@ -242,7 +305,9 @@ text_button_press (Tool *tool,
|
|||
&text_tool->click_x, &text_tool->click_y,
|
||||
TRUE, 0);
|
||||
|
||||
if ((layer = gimage_pick_correlate_layer (gdisp->gimage, text_tool->click_x, text_tool->click_y)))
|
||||
if ((layer = gimage_pick_correlate_layer (gdisp->gimage,
|
||||
text_tool->click_x,
|
||||
text_tool->click_y)))
|
||||
/* If there is a floating selection, and this aint it, use the move tool */
|
||||
if (layer_is_floating_sel (layer))
|
||||
{
|
||||
|
@ -250,6 +315,12 @@ text_button_press (Tool *tool,
|
|||
return;
|
||||
}
|
||||
|
||||
if (text_options->use_dyntext)
|
||||
{
|
||||
text_call_gdyntext (gdisp, gimage_active_drawable (gdisp->gimage));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!text_tool->shell)
|
||||
text_create_dialog (text_tool);
|
||||
|
||||
|
@ -337,7 +408,7 @@ text_create_dialog (TextTool *text_tool)
|
|||
(text_tool->shell)->ok_button),
|
||||
"clicked", GTK_SIGNAL_FUNC(text_ok_callback),
|
||||
text_tool);
|
||||
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG
|
||||
(text_tool->shell)->cancel_button),
|
||||
"clicked", GTK_SIGNAL_FUNC(text_cancel_callback),
|
||||
|
|
|
@ -37,6 +37,7 @@ tool_options_toggle_update (GtkWidget *widget,
|
|||
/* a tool options toggle button can set the sensitive state of
|
||||
* an arbitrary list of widgets
|
||||
*/
|
||||
|
||||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "set_sensitive");
|
||||
while (set_sensitive)
|
||||
|
@ -45,6 +46,15 @@ tool_options_toggle_update (GtkWidget *widget,
|
|||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (set_sensitive), "set_sensitive");
|
||||
}
|
||||
|
||||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "inverse_sensitive");
|
||||
while (set_sensitive)
|
||||
{
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (set_sensitive), ! *toggle_val);
|
||||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (set_sensitive), "inverse_sensitive");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -80,6 +80,10 @@ struct _TextOptions
|
|||
int border;
|
||||
int border_d;
|
||||
GtkObject *border_w;
|
||||
|
||||
int use_dyntext;
|
||||
int use_dyntext_d;
|
||||
GtkWidget *use_dyntext_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -120,6 +124,8 @@ text_options_reset (void)
|
|||
options->antialias_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->border_w),
|
||||
options->border_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->use_dyntext_w),
|
||||
options->use_dyntext_d);
|
||||
}
|
||||
|
||||
static TextOptions *
|
||||
|
@ -131,14 +137,16 @@ text_options_new (void)
|
|||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *sep;
|
||||
|
||||
/* the new text tool options structure */
|
||||
options = (TextOptions *) g_malloc (sizeof (TextOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Text Tool Options"),
|
||||
text_options_reset);
|
||||
options->antialias = options->antialias_d = TRUE;
|
||||
options->border = options->border_d = 0;
|
||||
options->antialias = options->antialias_d = TRUE;
|
||||
options->border = options->border_d = 0;
|
||||
options->use_dyntext = options->use_dyntext_d = FALSE;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
@ -161,13 +169,13 @@ text_options_new (void)
|
|||
|
||||
label = gtk_label_new (_("Border:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show(label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->border_w =
|
||||
gtk_adjustment_new (options->border_d, 0.0, 32767.0, 1.0, 50.0, 0.0);
|
||||
gtk_signal_connect(GTK_OBJECT (options->border_w), "changed",
|
||||
(GtkSignalFunc) tool_options_int_adjustment_update,
|
||||
&options->border);
|
||||
gtk_signal_connect (GTK_OBJECT (options->border_w), "changed",
|
||||
(GtkSignalFunc) tool_options_int_adjustment_update,
|
||||
&options->border);
|
||||
spinbutton =
|
||||
gtk_spin_button_new (GTK_ADJUSTMENT (options->border_w), 1.0, 0.0);
|
||||
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
|
||||
|
@ -179,6 +187,32 @@ text_options_new (void)
|
|||
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
sep = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sep);
|
||||
|
||||
/* antialias toggle */
|
||||
options->use_dyntext_w =
|
||||
gtk_check_button_new_with_label (_("Use Dynamic Text"));
|
||||
gtk_signal_connect (GTK_OBJECT (options->use_dyntext_w), "toggled",
|
||||
(GtkSignalFunc) tool_options_toggle_update,
|
||||
&options->use_dyntext);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->use_dyntext_w),
|
||||
options->use_dyntext_d);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->use_dyntext_w,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->use_dyntext_w);
|
||||
|
||||
/* let the toggle callback set the sensitive states */
|
||||
gtk_widget_set_sensitive (options->antialias_w, ! options->use_dyntext_d);
|
||||
gtk_widget_set_sensitive (spinbutton, ! options->use_dyntext_d);
|
||||
gtk_widget_set_sensitive (label, ! options->use_dyntext_d);
|
||||
gtk_object_set_data (GTK_OBJECT (options->use_dyntext_w), "inverse_sensitive",
|
||||
options->antialias_w);
|
||||
gtk_object_set_data (GTK_OBJECT (options->antialias_w), "inverse_sensitive",
|
||||
spinbutton);
|
||||
gtk_object_set_data (GTK_OBJECT (spinbutton), "inverse_sensitive", label);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
@ -222,6 +256,34 @@ tools_free_text (Tool *tool)
|
|||
g_free (tool->private);
|
||||
}
|
||||
|
||||
static void
|
||||
text_call_gdyntext (GDisplay *gdisp,
|
||||
GimpDrawable *drawable)
|
||||
{
|
||||
ProcRecord *proc_rec;
|
||||
Argument *args;
|
||||
|
||||
/* find the gDynText PDB record */
|
||||
if ((proc_rec = procedural_db_lookup ("plug_in_dynamic_text")) == NULL)
|
||||
{
|
||||
g_message (_("text_call_gdyntext: gDynText procedure lookup failed"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* plug-in arguments as if called by <Image>/Filters/... */
|
||||
args = g_new (Argument, 3);
|
||||
args[0].arg_type = PDB_INT32;
|
||||
args[0].value.pdb_int = RUN_INTERACTIVE;
|
||||
args[1].arg_type = PDB_IMAGE;
|
||||
args[1].value.pdb_int = (gint32) pdb_image_to_id (gdisp->gimage);
|
||||
args[2].arg_type = PDB_DRAWABLE;
|
||||
args[2].value.pdb_int = (gint32) drawable->ID;
|
||||
|
||||
plug_in_run (proc_rec, args, 3, FALSE, TRUE, gdisp->ID);
|
||||
|
||||
g_free (args);
|
||||
}
|
||||
|
||||
static void
|
||||
text_button_press (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
|
@ -232,6 +294,7 @@ text_button_press (Tool *tool,
|
|||
TextTool *text_tool;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
|
||||
text_tool = tool->private;
|
||||
text_tool->gdisp_ptr = gdisp_ptr;
|
||||
|
||||
|
@ -242,7 +305,9 @@ text_button_press (Tool *tool,
|
|||
&text_tool->click_x, &text_tool->click_y,
|
||||
TRUE, 0);
|
||||
|
||||
if ((layer = gimage_pick_correlate_layer (gdisp->gimage, text_tool->click_x, text_tool->click_y)))
|
||||
if ((layer = gimage_pick_correlate_layer (gdisp->gimage,
|
||||
text_tool->click_x,
|
||||
text_tool->click_y)))
|
||||
/* If there is a floating selection, and this aint it, use the move tool */
|
||||
if (layer_is_floating_sel (layer))
|
||||
{
|
||||
|
@ -250,6 +315,12 @@ text_button_press (Tool *tool,
|
|||
return;
|
||||
}
|
||||
|
||||
if (text_options->use_dyntext)
|
||||
{
|
||||
text_call_gdyntext (gdisp, gimage_active_drawable (gdisp->gimage));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!text_tool->shell)
|
||||
text_create_dialog (text_tool);
|
||||
|
||||
|
@ -337,7 +408,7 @@ text_create_dialog (TextTool *text_tool)
|
|||
(text_tool->shell)->ok_button),
|
||||
"clicked", GTK_SIGNAL_FUNC(text_ok_callback),
|
||||
text_tool);
|
||||
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG
|
||||
(text_tool->shell)->cancel_button),
|
||||
"clicked", GTK_SIGNAL_FUNC(text_cancel_callback),
|
||||
|
|
|
@ -99,13 +99,11 @@ paintbrush_gradient_toggle_callback (GtkWidget *widget,
|
|||
incremental_save = options->incremental;
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
||||
TRUE);
|
||||
gtk_widget_set_sensitive (options->incremental_w, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
||||
incremental_save);
|
||||
gtk_widget_set_sensitive (options->incremental_w, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,14 +233,6 @@ paintbrush_options_new (void)
|
|||
radio_frame = gtk_frame_new (_("Gradient Type"));
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), radio_frame, 0, 2, 3, 4);
|
||||
|
||||
/* automatically set the sensitive state of the gradient stuff */
|
||||
gtk_object_set_data (GTK_OBJECT (options->use_gradient_w), "set_sensitive",
|
||||
scale);
|
||||
gtk_object_set_data (GTK_OBJECT (scale), "set_sensitive",
|
||||
label);
|
||||
gtk_object_set_data (GTK_OBJECT (label), "set_sensitive",
|
||||
radio_frame);
|
||||
|
||||
radio_box = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
||||
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
|
||||
|
@ -273,6 +263,20 @@ paintbrush_options_new (void)
|
|||
&options->incremental);
|
||||
gtk_widget_show (options->incremental_w);
|
||||
|
||||
/* 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_widget_set_sensitive (options->incremental_w, ! 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",
|
||||
label);
|
||||
gtk_object_set_data (GTK_OBJECT (label), "set_sensitive",
|
||||
radio_frame);
|
||||
gtk_object_set_data (GTK_OBJECT (options->use_gradient_w), "inverse_sensitive",
|
||||
options->incremental_w);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,10 @@ struct _TextOptions
|
|||
int border;
|
||||
int border_d;
|
||||
GtkObject *border_w;
|
||||
|
||||
int use_dyntext;
|
||||
int use_dyntext_d;
|
||||
GtkWidget *use_dyntext_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -120,6 +124,8 @@ text_options_reset (void)
|
|||
options->antialias_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->border_w),
|
||||
options->border_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->use_dyntext_w),
|
||||
options->use_dyntext_d);
|
||||
}
|
||||
|
||||
static TextOptions *
|
||||
|
@ -131,14 +137,16 @@ text_options_new (void)
|
|||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *sep;
|
||||
|
||||
/* the new text tool options structure */
|
||||
options = (TextOptions *) g_malloc (sizeof (TextOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Text Tool Options"),
|
||||
text_options_reset);
|
||||
options->antialias = options->antialias_d = TRUE;
|
||||
options->border = options->border_d = 0;
|
||||
options->antialias = options->antialias_d = TRUE;
|
||||
options->border = options->border_d = 0;
|
||||
options->use_dyntext = options->use_dyntext_d = FALSE;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
@ -161,13 +169,13 @@ text_options_new (void)
|
|||
|
||||
label = gtk_label_new (_("Border:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show(label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->border_w =
|
||||
gtk_adjustment_new (options->border_d, 0.0, 32767.0, 1.0, 50.0, 0.0);
|
||||
gtk_signal_connect(GTK_OBJECT (options->border_w), "changed",
|
||||
(GtkSignalFunc) tool_options_int_adjustment_update,
|
||||
&options->border);
|
||||
gtk_signal_connect (GTK_OBJECT (options->border_w), "changed",
|
||||
(GtkSignalFunc) tool_options_int_adjustment_update,
|
||||
&options->border);
|
||||
spinbutton =
|
||||
gtk_spin_button_new (GTK_ADJUSTMENT (options->border_w), 1.0, 0.0);
|
||||
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
|
||||
|
@ -179,6 +187,32 @@ text_options_new (void)
|
|||
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
sep = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sep);
|
||||
|
||||
/* antialias toggle */
|
||||
options->use_dyntext_w =
|
||||
gtk_check_button_new_with_label (_("Use Dynamic Text"));
|
||||
gtk_signal_connect (GTK_OBJECT (options->use_dyntext_w), "toggled",
|
||||
(GtkSignalFunc) tool_options_toggle_update,
|
||||
&options->use_dyntext);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->use_dyntext_w),
|
||||
options->use_dyntext_d);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->use_dyntext_w,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->use_dyntext_w);
|
||||
|
||||
/* let the toggle callback set the sensitive states */
|
||||
gtk_widget_set_sensitive (options->antialias_w, ! options->use_dyntext_d);
|
||||
gtk_widget_set_sensitive (spinbutton, ! options->use_dyntext_d);
|
||||
gtk_widget_set_sensitive (label, ! options->use_dyntext_d);
|
||||
gtk_object_set_data (GTK_OBJECT (options->use_dyntext_w), "inverse_sensitive",
|
||||
options->antialias_w);
|
||||
gtk_object_set_data (GTK_OBJECT (options->antialias_w), "inverse_sensitive",
|
||||
spinbutton);
|
||||
gtk_object_set_data (GTK_OBJECT (spinbutton), "inverse_sensitive", label);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
@ -222,6 +256,34 @@ tools_free_text (Tool *tool)
|
|||
g_free (tool->private);
|
||||
}
|
||||
|
||||
static void
|
||||
text_call_gdyntext (GDisplay *gdisp,
|
||||
GimpDrawable *drawable)
|
||||
{
|
||||
ProcRecord *proc_rec;
|
||||
Argument *args;
|
||||
|
||||
/* find the gDynText PDB record */
|
||||
if ((proc_rec = procedural_db_lookup ("plug_in_dynamic_text")) == NULL)
|
||||
{
|
||||
g_message (_("text_call_gdyntext: gDynText procedure lookup failed"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* plug-in arguments as if called by <Image>/Filters/... */
|
||||
args = g_new (Argument, 3);
|
||||
args[0].arg_type = PDB_INT32;
|
||||
args[0].value.pdb_int = RUN_INTERACTIVE;
|
||||
args[1].arg_type = PDB_IMAGE;
|
||||
args[1].value.pdb_int = (gint32) pdb_image_to_id (gdisp->gimage);
|
||||
args[2].arg_type = PDB_DRAWABLE;
|
||||
args[2].value.pdb_int = (gint32) drawable->ID;
|
||||
|
||||
plug_in_run (proc_rec, args, 3, FALSE, TRUE, gdisp->ID);
|
||||
|
||||
g_free (args);
|
||||
}
|
||||
|
||||
static void
|
||||
text_button_press (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
|
@ -232,6 +294,7 @@ text_button_press (Tool *tool,
|
|||
TextTool *text_tool;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
|
||||
text_tool = tool->private;
|
||||
text_tool->gdisp_ptr = gdisp_ptr;
|
||||
|
||||
|
@ -242,7 +305,9 @@ text_button_press (Tool *tool,
|
|||
&text_tool->click_x, &text_tool->click_y,
|
||||
TRUE, 0);
|
||||
|
||||
if ((layer = gimage_pick_correlate_layer (gdisp->gimage, text_tool->click_x, text_tool->click_y)))
|
||||
if ((layer = gimage_pick_correlate_layer (gdisp->gimage,
|
||||
text_tool->click_x,
|
||||
text_tool->click_y)))
|
||||
/* If there is a floating selection, and this aint it, use the move tool */
|
||||
if (layer_is_floating_sel (layer))
|
||||
{
|
||||
|
@ -250,6 +315,12 @@ text_button_press (Tool *tool,
|
|||
return;
|
||||
}
|
||||
|
||||
if (text_options->use_dyntext)
|
||||
{
|
||||
text_call_gdyntext (gdisp, gimage_active_drawable (gdisp->gimage));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!text_tool->shell)
|
||||
text_create_dialog (text_tool);
|
||||
|
||||
|
@ -337,7 +408,7 @@ text_create_dialog (TextTool *text_tool)
|
|||
(text_tool->shell)->ok_button),
|
||||
"clicked", GTK_SIGNAL_FUNC(text_ok_callback),
|
||||
text_tool);
|
||||
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG
|
||||
(text_tool->shell)->cancel_button),
|
||||
"clicked", GTK_SIGNAL_FUNC(text_cancel_callback),
|
||||
|
|
|
@ -37,6 +37,7 @@ tool_options_toggle_update (GtkWidget *widget,
|
|||
/* a tool options toggle button can set the sensitive state of
|
||||
* an arbitrary list of widgets
|
||||
*/
|
||||
|
||||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "set_sensitive");
|
||||
while (set_sensitive)
|
||||
|
@ -45,6 +46,15 @@ tool_options_toggle_update (GtkWidget *widget,
|
|||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (set_sensitive), "set_sensitive");
|
||||
}
|
||||
|
||||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (widget), "inverse_sensitive");
|
||||
while (set_sensitive)
|
||||
{
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (set_sensitive), ! *toggle_val);
|
||||
set_sensitive =
|
||||
gtk_object_get_data (GTK_OBJECT (set_sensitive), "inverse_sensitive");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue