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

use "gimp-item-data" instead of "user_data" as data key when attaching

2001-11-22  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpwidgets.[ch]: use "gimp-item-data" instead of
	"user_data" as data key when attaching values to radio buttons or
	menu items. (For backward compat, attach "user_data" additionally,
	but don't use it to _get_data()).
	Added gimp_radio_group_set_active() which works like
	gimp_options_menu_set_history() and sets the active item by
	attached "gimp-item-data" value.

	* app/gui/brush-select.c
	* app/gui/file-new-dialog.c
	* app/gui/info-window.c
	* app/gui/preferences-dialog.c
	* app/gui/resolution-calibrate-dialog.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpselectiontool.c
	* app/tools/paint_options.c
	* app/tools/selection_options.c
	* app/widgets/gimplayerlistview.c: removed all kinds of
	"user_data" stuff and evil hacks to find a radio button by the
	value it represents (simply call gimp_radio_group_set_active()).

	* app/tools/gimpdrawtool.c: added a g_return_if_fail().

	* app/tools/gimpfliptool.c: don't set draw_tool_class->draw to NULL,

	* app/tools/gimptransformtool.[ch]: fixed some stuff i broke when
	removing the old "interactive" boolean (there is no
	non-interactive transform tool any more).  Put the info_dialog
	pointer and the old_trans_info array into the GimpTransformTool
	instance. Added gimp_transform_tool_info_dialog_connect(). Don't
	include any subclasses any more.

	* app/tools/gimpperspectivetool.c
	* app/tools/gimprotatetool.c
	* app/tools/gimpscaletool.c
	* app/tools/gimpsheartool.c: use
	gimp_transform_tool_info_dialog_connect() to create and connect
	the info dialogs' action_area.
parent 2a33106b
2001-11-22 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpwidgets.[ch]: use "gimp-item-data" instead of
"user_data" as data key when attaching values to radio buttons or
menu items. (For backward compat, attach "user_data" additionally,
but don't use it to _get_data()).
Added gimp_radio_group_set_active() which works like
gimp_options_menu_set_history() and sets the active item by
attached "gimp-item-data" value.
* app/gui/brush-select.c
* app/gui/file-new-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/resolution-calibrate-dialog.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpselectiontool.c
* app/tools/paint_options.c
* app/tools/selection_options.c
* app/widgets/gimplayerlistview.c: removed all kinds of
"user_data" stuff and evil hacks to find a radio button by the
value it represents (simply call gimp_radio_group_set_active()).
* app/tools/gimpdrawtool.c: added a g_return_if_fail().
* app/tools/gimpfliptool.c: don't set draw_tool_class->draw to NULL,
* app/tools/gimptransformtool.[ch]: fixed some stuff i broke when
removing the old "interactive" boolean (there is no
non-interactive transform tool any more). Put the info_dialog
pointer and the old_trans_info array into the GimpTransformTool
instance. Added gimp_transform_tool_info_dialog_connect(). Don't
include any subclasses any more.
* app/tools/gimpperspectivetool.c
* app/tools/gimprotatetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c: use
gimp_transform_tool_info_dialog_connect() to create and connect
the info dialogs' action_area.
2001-11-21 Sven Neumann <sven@gimp.org>
* app/gui/splash.c: sink the GtkPreview created for the splash.
......
......@@ -371,7 +371,7 @@ file_new_dialog_create (Gimp *gimp,
button = gtk_radio_button_new_with_label (group, name_info->name);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, TRUE, 0);
g_object_set_data (G_OBJECT (button), "user_data",
g_object_set_data (G_OBJECT (button), "gimp-item-data",
(gpointer) name_info->type);
gtk_widget_show (button);
......@@ -412,7 +412,7 @@ file_new_dialog_create (Gimp *gimp,
gtk_radio_button_new_with_label (group, name_info->name);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
g_object_set_data (G_OBJECT (button), "user_data",
g_object_set_data (G_OBJECT (button), "gimp-item-data",
(gpointer) name_info->type);
gtk_widget_show (button);
......@@ -513,10 +513,12 @@ file_new_reset_callback (GtkWidget *widget,
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->size_se),
info->gimp->config->default_units);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->type_w[info->gimp->config->default_type]),
TRUE);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (info->fill_type_w[BACKGROUND_FILL]), TRUE);
gimp_radio_group_set_active
(GTK_RADIO_BUTTON (info->type_w[0]),
GINT_TO_POINTER (info->gimp->config->default_type));
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->fill_type_w[0]),
GINT_TO_POINTER (BACKGROUND_FILL));
}
static void
......
......@@ -123,7 +123,8 @@ info_window_page_switch (GtkWidget *widget,
InfoDialog *info_win;
InfoWinData *iwd;
info_win = (InfoDialog *) g_object_get_data (G_OBJECT (widget), "user_data");
info_win = (InfoDialog *) g_object_get_data (G_OBJECT (widget),
"gimp-info-window");
iwd = (InfoWinData *) info_win->user_data;
/* Only deal with the second page */
......@@ -297,7 +298,7 @@ info_window_create_extended (InfoDialog *info_win,
/* Set back to first page */
gtk_notebook_set_current_page (GTK_NOTEBOOK (info_win->info_notebook), 0);
g_object_set_data (G_OBJECT (info_win->info_notebook), "user_data",
g_object_set_data (G_OBJECT (info_win->info_notebook), "gimp-info-window",
info_win);
g_signal_connect (G_OBJECT (info_win->info_notebook), "switch_page",
......
......@@ -1036,7 +1036,7 @@ prefs_toggle_callback (GtkWidget *widget,
data == &gimprc.cursor_mode)
{
*val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
"user_data"));
"gimp-item-data"));
}
/* values which need some magic */
......@@ -1044,7 +1044,7 @@ prefs_toggle_callback (GtkWidget *widget,
(data == &gimprc.transparency_size))
{
*val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
"user_data"));
"gimp-item-data"));
render_setup (gimprc.transparency_type, gimprc.transparency_size);
gimp_container_foreach (gimp->images,
......@@ -1078,7 +1078,8 @@ prefs_preview_size_callback (GtkWidget *widget,
#warning FIXME: update preview size
#endif
#if 0
lc_dialog_rebuild ((long) g_object_get_data (G_OBJECT (widget), "user_data"));
lc_dialog_rebuild ((long) g_object_get_data (G_OBJECT (widget),
"gimp-item-data"));
#endif
}
......@@ -1087,7 +1088,7 @@ prefs_nav_preview_size_callback (GtkWidget *widget,
gpointer data)
{
gimprc.nav_preview_size =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "user_data"));
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "gimp-item-data"));
gdisplays_nav_preview_resized ();
}
......
......@@ -47,7 +47,7 @@ resolution_calibrate_ok (GtkWidget *button,
GtkWidget *chain_button;
gdouble x, y;
resolution_entry = g_object_get_data (G_OBJECT (data), "user_data");
resolution_entry = g_object_get_data (G_OBJECT (data), "resolution-entry");
x = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (calibrate_entry), 0);
y = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (calibrate_entry), 1);
......@@ -120,7 +120,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
g_signal_connect (G_OBJECT (dialog), "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
g_object_set_data (G_OBJECT (dialog), "user_data", resolution_entry);
g_object_set_data (G_OBJECT (dialog), "resolution-entry", resolution_entry);
g_signal_connect_object (G_OBJECT (resolution_entry), "destroy",
G_CALLBACK (gtk_widget_destroy),
G_OBJECT (dialog), G_CONNECT_SWAPPED);
......
......@@ -523,7 +523,7 @@ paint_mode_menu_callback (GtkWidget *widget,
bsp = (BrushSelect *) data;
paint_mode = (LayerModeEffects)
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "user_data"));
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "gimp-item-data"));
gimp_context_set_paint_mode (bsp->context, paint_mode);
}
......
......@@ -371,7 +371,7 @@ file_new_dialog_create (Gimp *gimp,
button = gtk_radio_button_new_with_label (group, name_info->name);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, TRUE, 0);
g_object_set_data (G_OBJECT (button), "user_data",
g_object_set_data (G_OBJECT (button), "gimp-item-data",
(gpointer) name_info->type);
gtk_widget_show (button);
......@@ -412,7 +412,7 @@ file_new_dialog_create (Gimp *gimp,
gtk_radio_button_new_with_label (group, name_info->name);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
g_object_set_data (G_OBJECT (button), "user_data",
g_object_set_data (G_OBJECT (button), "gimp-item-data",
(gpointer) name_info->type);
gtk_widget_show (button);
......@@ -513,10 +513,12 @@ file_new_reset_callback (GtkWidget *widget,
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->size_se),
info->gimp->config->default_units);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->type_w[info->gimp->config->default_type]),
TRUE);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (info->fill_type_w[BACKGROUND_FILL]), TRUE);
gimp_radio_group_set_active
(GTK_RADIO_BUTTON (info->type_w[0]),
GINT_TO_POINTER (info->gimp->config->default_type));
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->fill_type_w[0]),
GINT_TO_POINTER (BACKGROUND_FILL));
}
static void
......
......@@ -123,7 +123,8 @@ info_window_page_switch (GtkWidget *widget,
InfoDialog *info_win;
InfoWinData *iwd;
info_win = (InfoDialog *) g_object_get_data (G_OBJECT (widget), "user_data");
info_win = (InfoDialog *) g_object_get_data (G_OBJECT (widget),
"gimp-info-window");
iwd = (InfoWinData *) info_win->user_data;
/* Only deal with the second page */
......@@ -297,7 +298,7 @@ info_window_create_extended (InfoDialog *info_win,
/* Set back to first page */
gtk_notebook_set_current_page (GTK_NOTEBOOK (info_win->info_notebook), 0);
g_object_set_data (G_OBJECT (info_win->info_notebook), "user_data",
g_object_set_data (G_OBJECT (info_win->info_notebook), "gimp-info-window",
info_win);
g_signal_connect (G_OBJECT (info_win->info_notebook), "switch_page",
......
......@@ -1036,7 +1036,7 @@ prefs_toggle_callback (GtkWidget *widget,
data == &gimprc.cursor_mode)
{
*val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
"user_data"));
"gimp-item-data"));
}
/* values which need some magic */
......@@ -1044,7 +1044,7 @@ prefs_toggle_callback (GtkWidget *widget,
(data == &gimprc.transparency_size))
{
*val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
"user_data"));
"gimp-item-data"));
render_setup (gimprc.transparency_type, gimprc.transparency_size);
gimp_container_foreach (gimp->images,
......@@ -1078,7 +1078,8 @@ prefs_preview_size_callback (GtkWidget *widget,
#warning FIXME: update preview size
#endif
#if 0
lc_dialog_rebuild ((long) g_object_get_data (G_OBJECT (widget), "user_data"));
lc_dialog_rebuild ((long) g_object_get_data (G_OBJECT (widget),
"gimp-item-data"));
#endif
}
......@@ -1087,7 +1088,7 @@ prefs_nav_preview_size_callback (GtkWidget *widget,
gpointer data)
{
gimprc.nav_preview_size =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "user_data"));
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "gimp-item-data"));
gdisplays_nav_preview_resized ();
}
......
......@@ -47,7 +47,7 @@ resolution_calibrate_ok (GtkWidget *button,
GtkWidget *chain_button;
gdouble x, y;
resolution_entry = g_object_get_data (G_OBJECT (data), "user_data");
resolution_entry = g_object_get_data (G_OBJECT (data), "resolution-entry");
x = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (calibrate_entry), 0);
y = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (calibrate_entry), 1);
......@@ -120,7 +120,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
g_signal_connect (G_OBJECT (dialog), "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
g_object_set_data (G_OBJECT (dialog), "user_data", resolution_entry);
g_object_set_data (G_OBJECT (dialog), "resolution-entry", resolution_entry);
g_signal_connect_object (G_OBJECT (resolution_entry), "destroy",
G_CALLBACK (gtk_widget_destroy),
G_OBJECT (dialog), G_CONNECT_SWAPPED);
......
......@@ -284,12 +284,14 @@ gimp_bucket_fill_tool_modifier_key (GimpTool *tool,
switch (options->fill_mode)
{
case FG_BUCKET_FILL:
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (options->fill_mode_w[BG_BUCKET_FILL]), TRUE);
gimp_radio_group_set_active
(GTK_RADIO_BUTTON (options->fill_mode_w[0]),
GINT_TO_POINTER (BG_BUCKET_FILL));
break;
case BG_BUCKET_FILL:
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (options->fill_mode_w[FG_BUCKET_FILL]), TRUE);
gimp_radio_group_set_active
(GTK_RADIO_BUTTON (options->fill_mode_w[0]),
GINT_TO_POINTER (FG_BUCKET_FILL));
break;
default:
break;
......@@ -446,7 +448,10 @@ bucket_options_reset (GimpToolOptions *tool_options)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
options->sample_merged_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
gimprc.default_threshold);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->fill_mode_w[0]),
GINT_TO_POINTER (options->fill_mode_d));
}
......@@ -216,6 +216,8 @@ gimp_draw_tool_stop (GimpDrawTool *draw_tool)
void
gimp_draw_tool_pause (GimpDrawTool *draw_tool)
{
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
if (draw_tool->paused_count == 0)
{
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE;
......
......@@ -44,10 +44,6 @@
#include "libgimp/gimpintl.h"
/* FIXME: Lame - 1 hacks abound since the code assumes certain values for
* the ORIENTATION_FOO constants.
*/
typedef struct _FlipOptions FlipOptions;
struct _FlipOptions
......@@ -139,11 +135,9 @@ static void
gimp_flip_tool_class_init (GimpFlipToolClass *klass)
{
GimpToolClass *tool_class;
GimpDrawToolClass *draw_class;
GimpTransformToolClass *trans_class;
tool_class = GIMP_TOOL_CLASS (klass);
draw_class = GIMP_DRAW_TOOL_CLASS (klass);
trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
......@@ -151,8 +145,6 @@ gimp_flip_tool_class_init (GimpFlipToolClass *klass)
tool_class->modifier_key = gimp_flip_tool_modifier_key;
tool_class->cursor_update = gimp_flip_tool_cursor_update;
draw_class->draw = NULL;
trans_class->transform = gimp_flip_tool_transform;
}
......@@ -189,14 +181,12 @@ gimp_flip_tool_modifier_key (GimpTool *tool,
switch (options->type)
{
case ORIENTATION_HORIZONTAL:
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (options->type_w[ORIENTATION_VERTICAL - 1]),
TRUE);
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->type_w[0]),
GINT_TO_POINTER (ORIENTATION_VERTICAL));
break;
case ORIENTATION_VERTICAL:
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (options->type_w[ORIENTATION_HORIZONTAL - 1]),
TRUE);
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->type_w[0]),
GINT_TO_POINTER (ORIENTATION_HORIZONTAL));
break;
default:
break;
......@@ -266,7 +256,6 @@ gimp_flip_tool_transform (GimpTransformTool *trans_tool,
switch (state)
{
case TRANSFORM_INIT:
transform_info = NULL;
break;
case TRANSFORM_MOTION:
......@@ -335,6 +324,6 @@ flip_options_reset (GimpToolOptions *tool_options)
options = (FlipOptions *) tool_options;
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (options->type_w[options->type_d - 1]), TRUE);
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->type_w[0]),
GINT_TO_POINTER (options->type_d));
}
......@@ -777,7 +777,7 @@ paint_options_paint_mode_update (GtkWidget *widget,
PaintOptions *options;
paint_mode =
(LayerModeEffects) g_object_get_data (G_OBJECT (widget), "user_data");
(LayerModeEffects) g_object_get_data (G_OBJECT (widget), "gimp-item-data");
options = (PaintOptions *) data;
......
......@@ -139,29 +139,35 @@ gimp_perspective_tool_transform (GimpTransformTool *transform_tool,
switch (state)
{
case TRANSFORM_INIT:
if (! transform_info)
if (! transform_tool->info_dialog)
{
transform_info =
transform_tool->info_dialog =
info_dialog_new (_("Perspective Transform Information"),
gimp_standard_help_func,
"tools/transform_perspective.html");
info_dialog_add_label (transform_info, _("Matrix:"),
gimp_transform_tool_info_dialog_connect (transform_tool,
_("Transform"));
info_dialog_add_label (transform_tool->info_dialog, _("Matrix:"),
matrix_row_buf[0]);
info_dialog_add_label (transform_info, "", matrix_row_buf[1]);
info_dialog_add_label (transform_info, "", matrix_row_buf[2]);
info_dialog_add_label (transform_tool->info_dialog, "",
matrix_row_buf[1]);
info_dialog_add_label (transform_tool->info_dialog, "",
matrix_row_buf[2]);
}
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), TRUE);
transform_tool->trans_info [X0] = (gdouble) transform_tool->x1;
transform_tool->trans_info [Y0] = (gdouble) transform_tool->y1;
transform_tool->trans_info [X1] = (gdouble) transform_tool->x2;
transform_tool->trans_info [Y1] = (gdouble) transform_tool->y1;
transform_tool->trans_info [X2] = (gdouble) transform_tool->x1;
transform_tool->trans_info [Y2] = (gdouble) transform_tool->y2;
transform_tool->trans_info [X3] = (gdouble) transform_tool->x2;
transform_tool->trans_info [Y3] = (gdouble) transform_tool->y2;
gtk_widget_set_sensitive (GTK_WIDGET (transform_tool->info_dialog->shell),
TRUE);
transform_tool->trans_info[X0] = (gdouble) transform_tool->x1;
transform_tool->trans_info[Y0] = (gdouble) transform_tool->y1;
transform_tool->trans_info[X1] = (gdouble) transform_tool->x2;
transform_tool->trans_info[Y1] = (gdouble) transform_tool->y1;
transform_tool->trans_info[X2] = (gdouble) transform_tool->x1;
transform_tool->trans_info[Y2] = (gdouble) transform_tool->y2;
transform_tool->trans_info[X3] = (gdouble) transform_tool->x2;
transform_tool->trans_info[Y3] = (gdouble) transform_tool->y2;
break;
case TRANSFORM_MOTION:
......@@ -199,8 +205,8 @@ perspective_info_update (GimpTransformTool *transform_tool)
}
}
info_dialog_update (transform_info);
info_dialog_popup (transform_info);
info_dialog_update (transform_tool->info_dialog);
info_dialog_popup (transform_tool->info_dialog);
}
static void
......
......@@ -165,17 +165,21 @@ gimp_rotate_tool_transform (GimpTransformTool *transform_tool,
center_vals[0] = transform_tool->cx;
center_vals[1] = transform_tool->cy;
if (! transform_info)
if (! transform_tool->info_dialog)
{
GtkWidget *widget;
GtkWidget *spinbutton2;
transform_info = info_dialog_new (_("Rotation Information"),
gimp_standard_help_func,
"tools/transform_rotate.html");
transform_tool->info_dialog =
info_dialog_new (_("Rotation Information"),
gimp_standard_help_func,
"tools/transform_rotate.html");
gimp_transform_tool_info_dialog_connect (transform_tool,
_("Rotate"));
widget =
info_dialog_add_spinbutton (transform_info, _("Angle:"),
info_dialog_add_spinbutton (transform_tool->info_dialog, _("Angle:"),
&angle_val,
-180, 180, 1, 15, 1, 1, 2,
G_CALLBACK (rotate_angle_changed),
......@@ -183,17 +187,20 @@ gimp_rotate_tool_transform (GimpTransformTool *transform_tool,
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (widget), TRUE);
/* this looks strange (-180, 181), but it works */
widget = info_dialog_add_scale (transform_info, "", &angle_val,
widget = info_dialog_add_scale (transform_tool->info_dialog, "",
&angle_val,
-180, 181, 0.01, 0.1, 1, -1,
G_CALLBACK (rotate_angle_changed),
transform_tool);
gtk_widget_set_usize (widget, 180, 0);
spinbutton2 =
info_dialog_add_spinbutton (transform_info, _("Center X:"), NULL,
info_dialog_add_spinbutton (transform_tool->info_dialog,
_("Center X:"),
NULL,
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Y:"),
info_dialog_add_sizeentry (transform_tool->info_dialog, _("Y:"),
center_vals, 1,
gdisp->gimage->unit, "%a",
TRUE, TRUE, FALSE,
......@@ -204,9 +211,9 @@ gimp_rotate_tool_transform (GimpTransformTool *transform_tool,
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
GTK_SPIN_BUTTON (spinbutton2), NULL);
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
gtk_table_set_row_spacing (GTK_TABLE (transform_tool->info_dialog->info_table),
1, 6);
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
gtk_table_set_row_spacing (GTK_TABLE (transform_tool->info_dialog->info_table),
2, 0);
}
......@@ -245,7 +252,7 @@ gimp_rotate_tool_transform (GimpTransformTool *transform_tool,
rotate_center_changed,
transform_tool);
gtk_widget_set_sensitive (transform_info->shell, TRUE);
gtk_widget_set_sensitive (transform_tool->info_dialog->shell, TRUE);
transform_tool->trans_info[ANGLE] = angle_val;
transform_tool->trans_info[REAL_ANGLE] = angle_val;
......@@ -278,8 +285,8 @@ rotate_info_update (GimpTransformTool *transform_tool)
center_vals[0] = transform_tool->trans_info[CENTER_X];
center_vals[1] = transform_tool->trans_info[CENTER_Y];
info_dialog_update (transform_info);
info_dialog_popup (transform_info);
info_dialog_update (transform_tool->info_dialog);
info_dialog_popup (transform_tool->info_dialog);
}
static void
......
......@@ -163,24 +163,32 @@ gimp_scale_tool_transform (GimpTransformTool *transform_tool,
size_vals[0] = transform_tool->x2 - transform_tool->x1;
size_vals[1] = transform_tool->y2 - transform_tool->y1;
if (! transform_info)
if (! transform_tool->info_dialog)
{
GtkWidget *spinbutton;
transform_info = info_dialog_new (_("Scaling Information"),
gimp_standard_help_func,
"tools/transform_scale.html");
transform_tool->info_dialog =
info_dialog_new (_("Scaling Information"),
gimp_standard_help_func,
"tools/transform_scale.html");
info_dialog_add_label (transform_info, _("Original Width:"),
gimp_transform_tool_info_dialog_connect (transform_tool,
_("Scale"));
info_dialog_add_label (transform_tool->info_dialog,
_("Original Width:"),
orig_width_buf);
info_dialog_add_label (transform_info, _("Height:"),
info_dialog_add_label (transform_tool->info_dialog,
_("Height:"),
orig_height_buf);
spinbutton =
info_dialog_add_spinbutton (transform_info, _("Current Width:"),
info_dialog_add_spinbutton (transform_tool->info_dialog,
_("Current Width:"),
NULL, -1, 1, 1, 10, 1, 1, 2, NULL, NULL);
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Height:"),
info_dialog_add_sizeentry (transform_tool->info_dialog,
_("Height:"),
size_vals, 1,
gdisp->gimage->unit, "%a",
TRUE, TRUE, FALSE,
......@@ -194,15 +202,17 @@ gimp_scale_tool_transform (GimpTransformTool *transform_tool,
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
GTK_SPIN_BUTTON (spinbutton), NULL);
info_dialog_add_label (transform_info, _("Scale Ratio X:"),
info_dialog_add_label (transform_tool->info_dialog,
_("Scale Ratio X:"),
x_ratio_buf);
info_dialog_add_label (transform_info, _("Y:"),
info_dialog_add_label (transform_tool->info_dialog,
_("Y:"),
y_ratio_buf);
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
1, 4);
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
2, 0);
gtk_table_set_row_spacing
(GTK_TABLE (transform_tool->info_dialog->info_table), 1, 4);
gtk_table_set_row_spacing
(GTK_TABLE (transform_tool->info_dialog->info_table), 2, 0);
}
g_signal_handlers_block_by_func (G_OBJECT (sizeentry),
......@@ -246,7 +256,8 @@ gimp_scale_tool_transform (GimpTransformTool *transform_tool,