app/widgets/Makefile.am added a simple utility function

2003-10-20  Sven Neumann  <sven@gimp.org>

	* app/widgets/Makefile.am
	* app/widgets/gimptooldialog.[ch]: added a simple utility function
	gimp_tool_dialog_new() that creates a GimpVieawableDialog based on
	GimpToolInfo and registers it with the toplevel dialog factory.

	* app/tools/gimpbrightnesscontrasttool.c
	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimpcolorizetool.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimphistogramtool.c
	* app/tools/gimphuesaturationtool.c
	* app/tools/gimpimagemaptool.[ch]
	* app/tools/gimplevelstool.c
	* app/tools/gimpmeasuretool.c: use the new functionality; removed
	the shell_identifier since it can be created from the tool name.

	* app/tools/gimpperspectivetool.c
	* app/tools/gimpposterizetool.c
	* app/tools/gimprotatetool.c
	* app/tools/gimpscaletool.c
	* app/tools/gimpsheartool.c
	* app/tools/gimpthresholdtool.c
	* app/tools/gimptransformtool.[ch]: removed the shell_identifier
	here as well. Should also be ported to gimp_tool_dialog_new().

	* NEWS: removed stuff that isn't new at all.
This commit is contained in:
Sven Neumann 2003-10-20 21:27:34 +00:00 committed by Sven Neumann
parent 1d6fa98982
commit 445d6bfc9f
24 changed files with 262 additions and 212 deletions

View File

@ -1,3 +1,33 @@
2003-10-20 Sven Neumann <sven@gimp.org>
* app/widgets/Makefile.am
* app/widgets/gimptooldialog.[ch]: added a simple utility function
gimp_tool_dialog_new() that creates a GimpVieawableDialog based on
GimpToolInfo and registers it with the toplevel dialog factory.
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcolorizetool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphistogramtool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimpimagemaptool.[ch]
* app/tools/gimplevelstool.c
* app/tools/gimpmeasuretool.c: use the new functionality; removed
the shell_identifier since it can be created from the tool name.
* app/tools/gimpperspectivetool.c
* app/tools/gimpposterizetool.c
* app/tools/gimprotatetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* app/tools/gimpthresholdtool.c
* app/tools/gimptransformtool.[ch]: removed the shell_identifier
here as well. Should also be ported to gimp_tool_dialog_new().
* NEWS: removed stuff that isn't new at all.
2003-10-20 Dave Neary <bolsh@gimp.org>
* NEWS: Updated the NEWS file.

3
NEWS
View File

@ -15,10 +15,7 @@ Overview of Changes in GIMP 1.3.22
- Auto-scrolling for DND in list views [Mitch]
- Refresh rendering of paint strokes more often [Mitch]
- Refactored handling of modifier keys for tools [Mitch]
- Allow editing of image templates [Sven]
- Changed the redo shortcut to Ctrl-Y [Sven]
- Display real-world units and pixels in the measure tool info
window [Sven]
- Lots of bug fixes
Other contributors:

View File

@ -142,12 +142,9 @@ gimp_brightness_contrast_tool_class_init (GimpBrightnessContrastToolClass *klass
static void
gimp_brightness_contrast_tool_init (GimpBrightnessContrastTool *bc_tool)
{
GimpImageMapTool *image_map_tool;
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (bc_tool);
image_map_tool = GIMP_IMAGE_MAP_TOOL (bc_tool);
image_map_tool->shell_identifier = "gimp-brightness-contrast-tool-dialog";
image_map_tool->shell_desc = _("Adjust Brightness and Contrast");
image_map_tool->shell_desc = _("Adjust Brightness and Contrast");
bc_tool->brightness = 0.0;
bc_tool->contrast = 0.0;

View File

@ -121,7 +121,7 @@ gimp_color_balance_tool_get_type (void)
};
tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL,
"GimpColorBalanceTool",
"GimpColorBalanceTool",
&tool_info, 0);
}
@ -153,12 +153,9 @@ gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass)
static void
gimp_color_balance_tool_init (GimpColorBalanceTool *cb_tool)
{
GimpImageMapTool *image_map_tool;
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (cb_tool);
image_map_tool = GIMP_IMAGE_MAP_TOOL (cb_tool);
image_map_tool->shell_identifier = "gimp-color-balance-tool-dialog";
image_map_tool->shell_desc = _("Adjust Color Balance");
image_map_tool->shell_desc = _("Adjust Color Balance");
cb_tool->color_balance = g_new0 (ColorBalance, 1);
cb_tool->transfer_mode = GIMP_MIDTONES;
@ -303,21 +300,21 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
cb_tool->cyan_red_adj =
cb_tool->cyan_red_adj =
create_levels_scale (_("Cyan"), _("Red"), table, 0);
g_signal_connect (cb_tool->cyan_red_adj, "value_changed",
G_CALLBACK (color_balance_cr_adjustment_update),
cb_tool);
cb_tool->magenta_green_adj =
cb_tool->magenta_green_adj =
create_levels_scale (_("Magenta"), _("Green"), table, 1);
g_signal_connect (cb_tool->magenta_green_adj, "value_changed",
G_CALLBACK (color_balance_mg_adjustment_update),
cb_tool);
cb_tool->yellow_blue_adj =
cb_tool->yellow_blue_adj =
create_levels_scale (_("Yellow"), _("Blue"), table, 2);
g_signal_connect (cb_tool->yellow_blue_adj, "value_changed",

View File

@ -156,12 +156,9 @@ gimp_colorize_tool_class_init (GimpColorizeToolClass *klass)
static void
gimp_colorize_tool_init (GimpColorizeTool *col_tool)
{
GimpImageMapTool *image_map_tool;
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (col_tool);
image_map_tool = GIMP_IMAGE_MAP_TOOL (col_tool);
image_map_tool->shell_identifier = "gimp-colorize-tool-dialog";
image_map_tool->shell_desc = _("Colorize the Image");
image_map_tool->shell_desc = _("Colorize the Image");
col_tool->colorize = g_new0 (Colorize, 1);

View File

@ -31,9 +31,9 @@
#include "core/gimptoolinfo.h"
#include "widgets/gimpcolorframe.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimptooldialog.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
@ -307,19 +307,17 @@ gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool)
g_return_if_fail (tool->drawable != NULL);
picker_tool->dialog =
gimp_viewable_dialog_new (GIMP_VIEWABLE (tool->drawable),
_("Color Picker"), "color_picker",
GIMP_STOCK_TOOL_COLOR_PICKER,
_("Color Picker Information"),
gimp_standard_help_func,
tool->tool_info->help_id,
picker_tool->dialog = gimp_tool_dialog_new (tool->tool_info,
_("Color Picker Information"),
GTK_STOCK_CLOSE,
gimp_color_picker_tool_info_close,
tool, NULL, NULL, TRUE, TRUE,
GTK_STOCK_CLOSE,
gimp_color_picker_tool_info_close,
tool, NULL, NULL, TRUE, TRUE,
NULL);
NULL);
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (picker_tool->dialog),
GIMP_VIEWABLE (tool->drawable));
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
@ -357,10 +355,6 @@ gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool)
gtk_drag_dest_unset (picker_tool->color_area);
gtk_container_add (GTK_CONTAINER (frame), picker_tool->color_area);
gtk_widget_show (picker_tool->color_area);
gimp_dialog_factory_add_foreign (gimp_dialog_factory_from_name ("toplevel"),
"gimp-color-picker-tool-dialog",
picker_tool->dialog);
}
static void

View File

@ -226,13 +226,10 @@ gimp_curves_tool_class_init (GimpCurvesToolClass *klass)
static void
gimp_curves_tool_init (GimpCurvesTool *c_tool)
{
GimpImageMapTool *image_map_tool;
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (c_tool);
gint i;
image_map_tool = GIMP_IMAGE_MAP_TOOL (c_tool);
image_map_tool->shell_identifier = "gimp-curves-tool-dialog";
image_map_tool->shell_desc = _("Adjust Color Curves");
image_map_tool->shell_desc = _("Adjust Color Curves");
c_tool->curves = g_new0 (Curves, 1);
c_tool->lut = gimp_lut_new ();

View File

@ -36,11 +36,11 @@
#include "core/gimptoolinfo.h"
#include "widgets/gimpenummenu.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimphistogrambox.h"
#include "widgets/gimphistogramview.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimptooldialog.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
@ -323,7 +323,6 @@ histogram_tool_dialog_new (GimpToolInfo *tool_info)
GtkWidget *table;
GtkWidget *label;
GtkWidget *menu;
const gchar *stock_id;
gint i;
gint x, y;
@ -340,21 +339,14 @@ histogram_tool_dialog_new (GimpToolInfo *tool_info)
htd = g_new0 (HistogramToolDialog, 1);
htd->hist = gimp_histogram_new (GIMP_BASE_CONFIG (tool_info->gimp->config));
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
/* The shell and main vbox */
htd->shell =
gimp_viewable_dialog_new (NULL,
tool_info->blurb,
GIMP_OBJECT (tool_info)->name,
stock_id,
_("View Image Histogram"),
gimp_standard_help_func, tool_info->help_id,
htd->shell = gimp_tool_dialog_new (tool_info,
_("View Image Histogram"),
GTK_STOCK_CLOSE, histogram_tool_close_callback,
htd, NULL, NULL, TRUE, TRUE,
GTK_STOCK_CLOSE, histogram_tool_close_callback,
htd, NULL, NULL, TRUE, TRUE,
NULL);
NULL);
vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
@ -432,10 +424,6 @@ histogram_tool_dialog_new (GimpToolInfo *tool_info)
gtk_widget_show (htd->info_labels[i]);
}
gimp_dialog_factory_add_foreign (gimp_dialog_factory_from_name ("toplevel"),
"gimp-histogram-tool-dialog",
htd->shell);
return htd;
}

View File

@ -170,12 +170,9 @@ gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass)
static void
gimp_hue_saturation_tool_init (GimpHueSaturationTool *hs_tool)
{
GimpImageMapTool *image_map_tool;
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (hs_tool);
image_map_tool = GIMP_IMAGE_MAP_TOOL (hs_tool);
image_map_tool->shell_identifier = "gimp-hue-saturation-tool-dialog";
image_map_tool->shell_desc = _("Adjust Hue / Lightness / Saturation");
image_map_tool->shell_desc = _("Adjust Hue / Lightness / Saturation");
hs_tool->hue_saturation = g_new0 (HueSaturation, 1);
hs_tool->hue_partition = GIMP_ALL_HUES;

View File

@ -30,8 +30,8 @@
#include "core/gimpimagemap.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimptooldialog.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
@ -146,14 +146,13 @@ gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
gimp_tool_control_set_preserve (tool->control, FALSE);
image_map_tool->drawable = NULL;
image_map_tool->image_map = NULL;
image_map_tool->preview = TRUE;
image_map_tool->drawable = NULL;
image_map_tool->image_map = NULL;
image_map_tool->preview = TRUE;
image_map_tool->shell_identifier = NULL;
image_map_tool->shell_desc = NULL;
image_map_tool->shell = NULL;
image_map_tool->main_vbox = NULL;
image_map_tool->shell_desc = NULL;
image_map_tool->shell = NULL;
image_map_tool->main_vbox = NULL;
}
void
@ -217,27 +216,21 @@ gimp_image_map_tool_initialize (GimpTool *tool,
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
image_map_tool->shell = shell =
gimp_viewable_dialog_new (NULL,
tool_info->blurb,
GIMP_OBJECT (tool_info)->name,
stock_id,
image_map_tool->shell_desc,
gimp_standard_help_func,
tool_info->help_id,
gimp_tool_dialog_new (tool_info, image_map_tool->shell_desc,
GIMP_STOCK_RESET,
gimp_image_map_tool_reset_clicked,
image_map_tool, NULL, NULL, FALSE, FALSE,
GIMP_STOCK_RESET,
gimp_image_map_tool_reset_clicked,
image_map_tool, NULL, NULL, FALSE, FALSE,
GTK_STOCK_CANCEL,
gimp_image_map_tool_cancel_clicked,
image_map_tool, NULL, NULL, FALSE, TRUE,
GTK_STOCK_CANCEL,
gimp_image_map_tool_cancel_clicked,
image_map_tool, NULL, NULL, FALSE, TRUE,
GTK_STOCK_OK,
gimp_image_map_tool_ok_clicked,
image_map_tool, NULL, NULL, TRUE, FALSE,
GTK_STOCK_OK,
gimp_image_map_tool_ok_clicked,
image_map_tool, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
image_map_tool->main_vbox = vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
@ -259,17 +252,6 @@ gimp_image_map_tool_initialize (GimpTool *tool,
gimp_image_map_tool_dialog (image_map_tool);
gtk_widget_show (vbox);
if (image_map_tool->shell_identifier)
{
GimpDialogFactory *dialog_factory;
dialog_factory = gimp_dialog_factory_from_name ("toplevel");
gimp_dialog_factory_add_foreign (dialog_factory,
image_map_tool->shell_identifier,
image_map_tool->shell);
}
}
drawable = gimp_image_active_drawable (gdisp->gimage);

View File

@ -43,7 +43,6 @@ struct _GimpImageMapTool
gboolean preview;
/* the dialog */
const gchar *shell_identifier;
const gchar *shell_desc;
GtkWidget *shell;

View File

@ -228,12 +228,9 @@ gimp_levels_tool_class_init (GimpLevelsToolClass *klass)
static void
gimp_levels_tool_init (GimpLevelsTool *l_tool)
{
GimpImageMapTool *image_map_tool;
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (l_tool);
image_map_tool = GIMP_IMAGE_MAP_TOOL (l_tool);
image_map_tool->shell_identifier = "gimp-levels-tool-dialog";
image_map_tool->shell_desc = _("Adjust Color Levels");
image_map_tool->shell_desc = _("Adjust Color Levels");
l_tool->lut = gimp_lut_new ();
l_tool->levels = g_new0 (Levels, 1);

View File

@ -37,8 +37,8 @@
#include "core/gimpimage-unit.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimptooldialog.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
@ -111,7 +111,7 @@ gimp_measure_tool_register (GimpToolRegisterCallback callback,
0,
"gimp-measure-tool",
_("Measure"),
_("Measure angles and lengths"),
_("Measure distances and angles"),
N_("/Tools/_Measure"), NULL,
NULL, GIMP_HELP_TOOL_MEASURE,
GIMP_STOCK_TOOL_MEASURE,
@ -827,25 +827,19 @@ gimp_measure_tool_dialog_update (GimpMeasureTool *mtool,
static GtkWidget *
gimp_measure_tool_dialog_new (GimpMeasureTool *mtool)
{
GimpToolInfo *tool_info = GIMP_TOOL (mtool)->tool_info;
GtkWidget *dialog;
GtkWidget *hbox;
GtkWidget *table;
GtkWidget *label;
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
dialog = gimp_tool_dialog_new (GIMP_TOOL (mtool)->tool_info,
_("Measure Distances and Angles"),
dialog = gimp_viewable_dialog_new (NULL,
tool_info->blurb,
GIMP_OBJECT (tool_info)->name,
stock_id,
_("Measure Distances and Angles"),
gimp_standard_help_func,
tool_info->help_id,
NULL);
GTK_STOCK_CLOSE,
gtk_widget_destroy, NULL,
1, NULL, TRUE, TRUE,
gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_UTILITY);
NULL);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
@ -909,17 +903,5 @@ gimp_measure_tool_dialog_new (GimpMeasureTool *mtool)
gtk_table_attach_defaults (GTK_TABLE (table), label, 4, 5, 1, 2);
gtk_widget_show (label);
gimp_dialog_create_action_area (GIMP_DIALOG (dialog),
GTK_STOCK_CLOSE,
gtk_widget_destroy, NULL,
1, NULL, TRUE, TRUE,
NULL);
gimp_dialog_factory_add_foreign (gimp_dialog_factory_from_name ("toplevel"),
"gimp-measure-tool-dialog",
dialog);
return dialog;
}

View File

@ -134,18 +134,14 @@ gimp_perspective_tool_class_init (GimpPerspectiveToolClass *klass)
static void
gimp_perspective_tool_init (GimpPerspectiveTool *perspective_tool)
{
GimpTool *tool;
GimpTransformTool *tr_tool;
tool = GIMP_TOOL (perspective_tool);
tr_tool = GIMP_TRANSFORM_TOOL (perspective_tool);
GimpTool *tool = GIMP_TOOL (perspective_tool);
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (perspective_tool);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_PERSPECTIVE_TOOL_CURSOR);
tr_tool->shell_identifier = "gimp-perspective-tool-dialog";
tr_tool->shell_desc = _("Perspective Transform Information");
tr_tool->progress_text = _("Perspective...");
tr_tool->shell_desc = _("Perspective Transform Information");
tr_tool->progress_text = _("Perspective...");
}
static void

View File

@ -135,12 +135,9 @@ gimp_posterize_tool_class_init (GimpPosterizeToolClass *klass)
static void
gimp_posterize_tool_init (GimpPosterizeTool *posterize_tool)
{
GimpImageMapTool *image_map_tool;
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (posterize_tool);
image_map_tool = GIMP_IMAGE_MAP_TOOL (posterize_tool);
image_map_tool->shell_identifier = "gimp-posterize-tool-dialog";
image_map_tool->shell_desc = _("Posterize (Reduce Number of Colors)");
image_map_tool->shell_desc = _("Posterize (Reduce Number of Colors)");
posterize_tool->levels = POSTERIZE_DEFAULT_LEVELS;
posterize_tool->lut = gimp_lut_new ();

View File

@ -157,17 +157,13 @@ gimp_rotate_tool_class_init (GimpRotateToolClass *klass)
static void
gimp_rotate_tool_init (GimpRotateTool *rotate_tool)
{
GimpTool *tool;
GimpTransformTool *tr_tool;
tool = GIMP_TOOL (rotate_tool);
tr_tool = GIMP_TRANSFORM_TOOL (rotate_tool);
GimpTool *tool = GIMP_TOOL (rotate_tool);
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (rotate_tool);
gimp_tool_control_set_tool_cursor (tool->control, GIMP_ROTATE_TOOL_CURSOR);
tr_tool->shell_identifier = "gimp-rotate-tool-dialog";
tr_tool->shell_desc = _("Rotation Information");
tr_tool->progress_text = _("Rotating...");
tr_tool->shell_desc = _("Rotation Information");
tr_tool->progress_text = _("Rotating...");
}
static void

View File

@ -153,17 +153,13 @@ gimp_scale_tool_class_init (GimpScaleToolClass *klass)
static void
gimp_scale_tool_init (GimpScaleTool *scale_tool)
{
GimpTool *tool;
GimpTransformTool *tr_tool;
tool = GIMP_TOOL (scale_tool);
tr_tool = GIMP_TRANSFORM_TOOL (scale_tool);
GimpTool *tool = GIMP_TOOL (scale_tool);
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (scale_tool);
gimp_tool_control_set_tool_cursor (tool->control, GIMP_RESIZE_TOOL_CURSOR);
tr_tool->shell_identifier = "gimp-scale-tool-dialog";
tr_tool->shell_desc = _("Scaling Information");
tr_tool->progress_text = _("Scaling...");
tr_tool->shell_desc = _("Scaling Information");
tr_tool->progress_text = _("Scaling...");
}
static void

View File

@ -151,18 +151,14 @@ gimp_shear_tool_class_init (GimpShearToolClass *klass)
static void
gimp_shear_tool_init (GimpShearTool *shear_tool)
{
GimpTool *tool;
GimpTransformTool *tr_tool;
tool = GIMP_TOOL (shear_tool);
tr_tool = GIMP_TRANSFORM_TOOL (shear_tool);
GimpTool *tool = GIMP_TOOL (shear_tool);
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (shear_tool);
gimp_tool_control_set_tool_cursor (tool->control, GIMP_SHEAR_TOOL_CURSOR);
tr_tool->use_center = FALSE;
tr_tool->shell_identifier = "gimp-shear-tool-dialog";
tr_tool->shell_desc = _("Shearing Information");
tr_tool->progress_text = _("Shearing...");
tr_tool->use_center = FALSE;
tr_tool->shell_desc = _("Shearing Information");
tr_tool->progress_text = _("Shearing...");
}
static void

View File

@ -150,12 +150,9 @@ gimp_threshold_tool_class_init (GimpThresholdToolClass *klass)
static void
gimp_threshold_tool_init (GimpThresholdTool *t_tool)
{
GimpImageMapTool *image_map_tool;
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (t_tool);
image_map_tool = GIMP_IMAGE_MAP_TOOL (t_tool);
image_map_tool->shell_identifier = "gimp-threshold-tool-dialog";
image_map_tool->shell_desc = _("Apply Threshold");
image_map_tool->shell_desc = _("Apply Threshold");
t_tool->threshold = g_new0 (Threshold, 1);
t_tool->hist = NULL;

View File

@ -1260,52 +1260,50 @@ gimp_transform_tool_grid_recalc (GimpTransformTool *tr_tool)
static void
gimp_transform_tool_dialog (GimpTransformTool *tr_tool)
{
if (GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->dialog)
{
GimpToolInfo *tool_info;
const gchar *stock_id;
GimpToolInfo *tool_info;
const gchar *stock_id;
gchar *identifier;
tool_info = GIMP_TOOL (tr_tool)->tool_info;
if (! GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->dialog)
return;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
tool_info = GIMP_TOOL (tr_tool)->tool_info;
tr_tool->info_dialog =
info_dialog_new (NULL,
tool_info->blurb,
GIMP_OBJECT (tool_info)->name,
stock_id,
tr_tool->shell_desc,
gimp_standard_help_func, tool_info->help_id);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
gimp_dialog_create_action_area (GIMP_DIALOG (tr_tool->info_dialog->shell),
tr_tool->info_dialog = info_dialog_new (NULL,
tool_info->blurb,
GIMP_OBJECT (tool_info)->name,
stock_id,
tr_tool->shell_desc,
gimp_standard_help_func,
tool_info->help_id);
GIMP_STOCK_RESET,
transform_reset_callback,
tr_tool, NULL, NULL, FALSE, FALSE,
gimp_dialog_create_action_area (GIMP_DIALOG (tr_tool->info_dialog->shell),
GTK_STOCK_CANCEL,
transform_cancel_callback,
tr_tool, NULL, NULL, FALSE, TRUE,
GIMP_STOCK_RESET,
transform_reset_callback,
tr_tool, NULL, NULL, FALSE, FALSE,
stock_id,
transform_ok_callback,
tr_tool, NULL, NULL, TRUE, FALSE,
GTK_STOCK_CANCEL,
transform_cancel_callback,
tr_tool, NULL, NULL, FALSE, TRUE,
NULL);
stock_id,
transform_ok_callback,
tr_tool, NULL, NULL, TRUE, FALSE,
GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->dialog (tr_tool);
NULL);
if (tr_tool->shell_identifier)
{
GimpDialogFactory *dialog_factory;
GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->dialog (tr_tool);
dialog_factory = gimp_dialog_factory_from_name ("toplevel");
identifier = g_strconcat (GIMP_OBJECT (tool_info)->name, "-dialog", NULL);
gimp_dialog_factory_add_foreign (dialog_factory,
tr_tool->shell_identifier,
tr_tool->info_dialog->shell);
}
}
gimp_dialog_factory_add_foreign (gimp_dialog_factory_from_name ("toplevel"),
identifier,
tr_tool->info_dialog->shell);
g_free (identifier);
}
static void

View File

@ -93,7 +93,6 @@ struct _GimpTransformTool
GimpTransformDirection direction;
/* transform info dialog */
const gchar *shell_identifier;
const gchar *shell_desc;
const gchar *progress_text;

View File

@ -172,6 +172,8 @@ libappwidgets_a_sources = \
gimptoolbox-dnd.h \
gimptoolbox-indicator-area.c \
gimptoolbox-indicator-area.h \
gimptooldialog.c \
gimptooldialog.h \
gimptooloptionseditor.c \
gimptooloptionseditor.h \
gimpundoeditor.c \

View File

@ -0,0 +1,76 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpviewabledialog.c
* Copyright (C) 2000 Michael Natterer <mitch@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
#include "core/gimpobject.h"
#include "core/gimptoolinfo.h"
#include "gimpdialogfactory.h"
#include "gimptooldialog.h"
#include "gimpviewabledialog.h"
GtkWidget *
gimp_tool_dialog_new (GimpToolInfo *tool_info,
const gchar *desc,
...)
{
GtkWidget *dialog;
const gchar *stock_id;
gchar *identifier;
va_list args;
g_return_val_if_fail (GIMP_IS_TOOL_INFO (tool_info), NULL);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
dialog = gimp_viewable_dialog_new (NULL,
tool_info->blurb,
GIMP_OBJECT (tool_info)->name,
stock_id,
desc ? desc : tool_info->help,
gimp_standard_help_func,
tool_info->help_id,
NULL);
gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_UTILITY);
va_start (args, desc);
gimp_dialog_create_action_areav (GIMP_DIALOG (dialog), args);
va_end (args);
identifier = g_strconcat (GIMP_OBJECT (tool_info)->name, "-dialog", NULL);
gimp_dialog_factory_add_foreign (gimp_dialog_factory_from_name ("toplevel"),
identifier,
dialog);
g_free (identifier);
return dialog;
}

View File

@ -0,0 +1,43 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimptooldialog.h
* Copyright (C) 2003 Sven Neumann <sven@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_TOOL_DIALOG_H__
#define __GIMP_TOOL_DIALOG_H__
GtkWidget * gimp_tool_dialog_new (GimpToolInfo *tool_info,
const gchar *desc,
/* specify action area buttons
* as va_list:
* const gchar *label,
* GCallback callback,
* gpointer callback_data,
* GObject *slot_object,
* GtkWidget **widget_ptr,
* gboolean default_action,
* gboolean connect_delete,
*/
...);
#endif /* __GIMP_TOOL_DIALOG_H__ */