Commit b39f8fb8 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

expects the tool identifier as a GQuark now.

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

	* app/gui/tools-commands.c (tools_select_cmd_callback): expects
	the tool identifier as a GQuark now.

	* app/gui/image-menu.c: changed accordingly. Removed code that
	used to move the menu entries for the color correction tools to
	the Layers menu. Added the respective menu entries by hand. Added
	a menu entry for arbitrary rotations and one for Select by Color.

	* app/tools/gimpbrightnesscontrasttool.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimpcolorizetool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimphistogramtool.c
	* app/tools/gimphuesaturationtool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimpposterizetool.c
	* app/tools/gimpthresholdtool.c: register the color correction
	tools in the Tools menu.

	* app/tools/gimptransformtool.c: added an initialize method and
	moved most initalization code from button_press to this place.
parent cee14a8d
2003-06-10 Sven Neumann <sven@gimp.org>
* app/gui/tools-commands.c (tools_select_cmd_callback): expects
the tool identifier as a GQuark now.
* app/gui/image-menu.c: changed accordingly. Removed code that
used to move the menu entries for the color correction tools to
the Layers menu. Added the respective menu entries by hand. Added
a menu entry for arbitrary rotations and one for Select by Color.
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcolorizetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphistogramtool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpposterizetool.c
* app/tools/gimpthresholdtool.c: register the color correction
tools in the Tools menu.
* app/tools/gimptransformtool.c: added an initialize method and
moved most initalization code from button_press to this place.
2003-06-10 Michael Natterer <mitch@gimp.org>
* plug-ins/common/film.c: treeviewized and undeprecated. Enabled
......@@ -23,6 +23,7 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimptoolinfo.h"
......@@ -71,13 +72,18 @@ tools_select_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
Gimp *gimp;
GimpToolInfo *tool_info;
GimpContext *context;
GimpDisplay *gdisp;
const gchar *identifier;
return_if_no_gimp (gimp, data);
identifier = g_quark_to_string ((GQuark) action);
tool_info = GIMP_TOOL_INFO (data);
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (gimp->tool_info_list, identifier);
context = gimp_get_user_context (tool_info->gimp);
context = gimp_get_user_context (gimp);
/* always allocate a new tool when selected from the image menu
*/
......@@ -90,7 +96,5 @@ tools_select_cmd_callback (GtkWidget *widget,
gimp_context_tool_changed (context);
}
gdisp = gimp_context_get_display (context);
tool_manager_initialize_active (tool_info->gimp, gdisp);
tool_manager_initialize_active (gimp, gimp_context_get_display (context));
}
......@@ -260,6 +260,11 @@ GimpItemFactoryEntry image_menu_entries[] =
select_float_cmd_callback, 0 },
NULL,
"select/float.html", NULL },
{ { N_("/Select/By Color"), "<shift>O",
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_BY_COLOR_SELECT },
"gimp-by-color-select-tool",
"tools/by_color_select.html", NULL },
MENU_SEPARATOR ("/Select/---"),
......@@ -620,6 +625,52 @@ GimpItemFactoryEntry image_menu_entries[] =
MENU_BRANCH (N_("/Layer/_Colors")),
{ { N_("/Layer/Colors/Color Balance..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_COLOR_BALANCE },
"gimp-color-balance-tool",
"tools/color_balance.html", NULL },
{ { N_("/Layer/Colors/Hue-Saturation..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_HUE_SATURATION },
"gimp-hue-saturation-tool",
"tools/hue_saturation.html", NULL },
{ { N_("/Layer/Colors/Colorize..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_COLORIZE },
"gimp-colorize-tool",
"tools/colorize.html", NULL },
{ { N_("/Layer/Colors/Brightness-Contrast..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_BRIGHTNESS_CONTRAST },
"gimp-brightness-contrast-tool",
"tools/brightness-contrast.html", NULL },
{ { N_("/Layer/Colors/Threshold..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_THRESHOLD },
"gimp-threshold-tool",
"tools/threshold.html", NULL },
{ { N_("/Layer/Colors/Threshold..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_THRESHOLD },
"gimp-threshold-tool",
"tools/threshold.html", NULL },
{ { N_("/Layer/Colors/Levels..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_LEVELS },
"gimp-levels-tool",
"tools/levels.html", NULL },
{ { N_("/Layer/Colors/Curves..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_CURVES },
"gimp-curves-tool",
"tools/curves.html", NULL },
{ { N_("/Layer/Colors/Posterize..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_POSTERIZE },
"gimp-posterize-tool",
"tools/posterize.html", NULL },
MENU_SEPARATOR ("/Layer/Colors/---"),
{ { N_("/Layer/Colors/Desaturate"), NULL,
......@@ -644,6 +695,12 @@ GimpItemFactoryEntry image_menu_entries[] =
MENU_SEPARATOR ("/Layer/Colors/---"),
{ { N_("/Layer/Colors/Histogram..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_HISTOGRAM },
"gimp-histogram-tool",
"tools/histogram.html", NULL },
/* <Image>/Layer/Mask */
MENU_BRANCH (N_("/Layer/_Mask")),
......@@ -714,7 +771,12 @@ GimpItemFactoryEntry image_menu_entries[] =
drawable_rotate_cmd_callback, GIMP_ROTATE_180,
"<StockItem>", GIMP_STOCK_ROTATE_180 },
NULL,
"layers/rotate_layer.html", NULL },
"layers/rotate_layer.html", NULL },
{ { N_("/Layer/Transform/Arbitrary Rotation..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_ROTATE },
"gimp-rotate-tool",
"layers/rotate_layer.html", NULL },
MENU_SEPARATOR ("/Layer/Transform/---"),
......@@ -772,6 +834,7 @@ GimpItemFactoryEntry image_menu_entries[] =
MENU_BRANCH (N_("/Tools/_Selection Tools")),
MENU_BRANCH (N_("/Tools/_Paint Tools")),
MENU_BRANCH (N_("/Tools/_Transform Tools")),
MENU_BRANCH (N_("/Tools/_Color Tools")),
/* <Image>/Dialogs */
......@@ -970,18 +1033,8 @@ image_menu_setup (GimpItemFactory *factory)
/* create tool menu items */
{
static const gchar *color_tools[] = { "gimp-color-balance-tool",
"gimp-hue-saturation-tool",
"gimp-colorize-tool",
"gimp-brightness-contrast-tool",
"gimp-threshold-tool",
"gimp-levels-tool",
"gimp-curves-tool",
"gimp-posterize-tool" };
GtkWidget *menu_item;
GimpToolInfo *tool_info;
GList *list;
gint i;
for (list = GIMP_LIST (factory->gimp->tool_info_list)->list;
list;
......@@ -993,8 +1046,10 @@ image_menu_setup (GimpItemFactory *factory)
{
GimpItemFactoryEntry entry;
const gchar *stock_id;
const gchar *identifier;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
identifier = gimp_object_get_name (GIMP_OBJECT (tool_info));
entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel;
......@@ -1002,33 +1057,17 @@ image_menu_setup (GimpItemFactory *factory)
entry.entry.callback_action = 0;
entry.entry.item_type = "<StockItem>";
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.quark_string = identifier;
entry.help_page = tool_info->help_data;
entry.description = NULL;
gimp_item_factory_create_item (factory,
&entry,
NULL,
tool_info, 2,
factory->gimp, 2,
TRUE, FALSE);
}
}
/* reorder color tools to the top of the Layers/Colors menu */
for (i = 0; i < G_N_ELEMENTS (color_tools); i++)
{
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (factory->gimp->tool_info_list,
color_tools[i]);
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
tool_info->menu_path);
if (menu_item && menu_item->parent)
{
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, i + 1);
}
}
}
{
......@@ -1330,6 +1369,7 @@ image_menu_update (GtkItemFactory *item_factory,
SET_SENSITIVE ("/Select/None", lp && sel);
SET_SENSITIVE ("/Select/Invert", lp && sel);
SET_SENSITIVE ("/Select/Float", lp && sel);
SET_SENSITIVE ("/Select/By Color", lp);
SET_SENSITIVE ("/Select/Feather...", lp && sel);
SET_SENSITIVE ("/Select/Sharpen", lp && sel);
......
......@@ -23,6 +23,7 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimptoolinfo.h"
......@@ -71,13 +72,18 @@ tools_select_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
Gimp *gimp;
GimpToolInfo *tool_info;
GimpContext *context;
GimpDisplay *gdisp;
const gchar *identifier;
return_if_no_gimp (gimp, data);
identifier = g_quark_to_string ((GQuark) action);
tool_info = GIMP_TOOL_INFO (data);
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (gimp->tool_info_list, identifier);
context = gimp_get_user_context (tool_info->gimp);
context = gimp_get_user_context (gimp);
/* always allocate a new tool when selected from the image menu
*/
......@@ -90,7 +96,5 @@ tools_select_cmd_callback (GtkWidget *widget,
gimp_context_tool_changed (context);
}
gdisp = gimp_context_get_display (context);
tool_manager_initialize_active (tool_info->gimp, gdisp);
tool_manager_initialize_active (gimp, gimp_context_get_display (context));
}
......@@ -260,6 +260,11 @@ GimpItemFactoryEntry image_menu_entries[] =
select_float_cmd_callback, 0 },
NULL,
"select/float.html", NULL },
{ { N_("/Select/By Color"), "<shift>O",
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_BY_COLOR_SELECT },
"gimp-by-color-select-tool",
"tools/by_color_select.html", NULL },
MENU_SEPARATOR ("/Select/---"),
......@@ -620,6 +625,52 @@ GimpItemFactoryEntry image_menu_entries[] =
MENU_BRANCH (N_("/Layer/_Colors")),
{ { N_("/Layer/Colors/Color Balance..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_COLOR_BALANCE },
"gimp-color-balance-tool",
"tools/color_balance.html", NULL },
{ { N_("/Layer/Colors/Hue-Saturation..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_HUE_SATURATION },
"gimp-hue-saturation-tool",
"tools/hue_saturation.html", NULL },
{ { N_("/Layer/Colors/Colorize..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_COLORIZE },
"gimp-colorize-tool",
"tools/colorize.html", NULL },
{ { N_("/Layer/Colors/Brightness-Contrast..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_BRIGHTNESS_CONTRAST },
"gimp-brightness-contrast-tool",
"tools/brightness-contrast.html", NULL },
{ { N_("/Layer/Colors/Threshold..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_THRESHOLD },
"gimp-threshold-tool",
"tools/threshold.html", NULL },
{ { N_("/Layer/Colors/Threshold..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_THRESHOLD },
"gimp-threshold-tool",
"tools/threshold.html", NULL },
{ { N_("/Layer/Colors/Levels..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_LEVELS },
"gimp-levels-tool",
"tools/levels.html", NULL },
{ { N_("/Layer/Colors/Curves..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_CURVES },
"gimp-curves-tool",
"tools/curves.html", NULL },
{ { N_("/Layer/Colors/Posterize..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_POSTERIZE },
"gimp-posterize-tool",
"tools/posterize.html", NULL },
MENU_SEPARATOR ("/Layer/Colors/---"),
{ { N_("/Layer/Colors/Desaturate"), NULL,
......@@ -644,6 +695,12 @@ GimpItemFactoryEntry image_menu_entries[] =
MENU_SEPARATOR ("/Layer/Colors/---"),
{ { N_("/Layer/Colors/Histogram..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_HISTOGRAM },
"gimp-histogram-tool",
"tools/histogram.html", NULL },
/* <Image>/Layer/Mask */
MENU_BRANCH (N_("/Layer/_Mask")),
......@@ -714,7 +771,12 @@ GimpItemFactoryEntry image_menu_entries[] =
drawable_rotate_cmd_callback, GIMP_ROTATE_180,
"<StockItem>", GIMP_STOCK_ROTATE_180 },
NULL,
"layers/rotate_layer.html", NULL },
"layers/rotate_layer.html", NULL },
{ { N_("/Layer/Transform/Arbitrary Rotation..."), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_ROTATE },
"gimp-rotate-tool",
"layers/rotate_layer.html", NULL },
MENU_SEPARATOR ("/Layer/Transform/---"),
......@@ -772,6 +834,7 @@ GimpItemFactoryEntry image_menu_entries[] =
MENU_BRANCH (N_("/Tools/_Selection Tools")),
MENU_BRANCH (N_("/Tools/_Paint Tools")),
MENU_BRANCH (N_("/Tools/_Transform Tools")),
MENU_BRANCH (N_("/Tools/_Color Tools")),
/* <Image>/Dialogs */
......@@ -970,18 +1033,8 @@ image_menu_setup (GimpItemFactory *factory)
/* create tool menu items */
{
static const gchar *color_tools[] = { "gimp-color-balance-tool",
"gimp-hue-saturation-tool",
"gimp-colorize-tool",
"gimp-brightness-contrast-tool",
"gimp-threshold-tool",
"gimp-levels-tool",
"gimp-curves-tool",
"gimp-posterize-tool" };
GtkWidget *menu_item;
GimpToolInfo *tool_info;
GList *list;
gint i;
for (list = GIMP_LIST (factory->gimp->tool_info_list)->list;
list;
......@@ -993,8 +1046,10 @@ image_menu_setup (GimpItemFactory *factory)
{
GimpItemFactoryEntry entry;
const gchar *stock_id;
const gchar *identifier;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
identifier = gimp_object_get_name (GIMP_OBJECT (tool_info));
entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel;
......@@ -1002,33 +1057,17 @@ image_menu_setup (GimpItemFactory *factory)
entry.entry.callback_action = 0;
entry.entry.item_type = "<StockItem>";
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.quark_string = identifier;
entry.help_page = tool_info->help_data;
entry.description = NULL;
gimp_item_factory_create_item (factory,
&entry,
NULL,
tool_info, 2,
factory->gimp, 2,
TRUE, FALSE);
}
}
/* reorder color tools to the top of the Layers/Colors menu */
for (i = 0; i < G_N_ELEMENTS (color_tools); i++)
{
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (factory->gimp->tool_info_list,
color_tools[i]);
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
tool_info->menu_path);
if (menu_item && menu_item->parent)
{
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, i + 1);
}
}
}
{
......@@ -1330,6 +1369,7 @@ image_menu_update (GtkItemFactory *item_factory,
SET_SENSITIVE ("/Select/None", lp && sel);
SET_SENSITIVE ("/Select/Invert", lp && sel);
SET_SENSITIVE ("/Select/Float", lp && sel);
SET_SENSITIVE ("/Select/By Color", lp);
SET_SENSITIVE ("/Select/Feather...", lp && sel);
SET_SENSITIVE ("/Select/Sharpen", lp && sel);
......
......@@ -81,7 +81,7 @@ gimp_brightness_contrast_tool_register (GimpToolRegisterCallback callback,
"gimp-brightness-contrast-tool",
_("Brightness-Contrast"),
_("Adjust brightness and contrast"),
N_("/Layer/Colors/Brightness-Contrast..."), NULL,
N_("/Tools/Color Tools/Brightness-Contrast..."), NULL,
NULL, "tools/brightness_contrast.html",
GIMP_STOCK_TOOL_BRIGHTNESS_CONTRAST,
data);
......
......@@ -79,7 +79,7 @@ gimp_by_color_select_tool_register (GimpToolRegisterCallback callback,
"gimp-by-color-select-tool",
_("Select By Color"),
_("Select regions by color"),
N_("/Tools/Selection Tools/By Color Select"), "<shift>O",
N_("/Tools/Selection Tools/By Color Select"), NULL,
NULL, "tools/by_color_select.html",
GIMP_STOCK_TOOL_BY_COLOR_SELECT,
data);
......
......@@ -93,7 +93,7 @@ gimp_color_balance_tool_register (GimpToolRegisterCallback callback,
"gimp-color-balance-tool",
_("Color Balance"),
_("Adjust color balance"),
N_("/Layer/Colors/Color Balance..."), NULL,
N_("/Tools/Color Tools/Color Balance..."), NULL,
NULL, "tools/color_balance.html",
GIMP_STOCK_TOOL_COLOR_BALANCE,
data);
......
......@@ -92,7 +92,7 @@ gimp_colorize_tool_register (GimpToolRegisterCallback callback,
"gimp-colorize-tool",
_("Colorize"),
_("Colorize the image"),
N_("/Layer/Colors/Colorize..."), NULL,
N_("/Tools/Color Tools/Colorize..."), NULL,
NULL, "tools/colorize.html",
GIMP_STOCK_TOOL_COLORIZE,
data);
......
......@@ -158,7 +158,7 @@ gimp_curves_tool_register (GimpToolRegisterCallback callback,
"gimp-curves-tool",
_("Curves"),
_("Adjust color curves"),
N_("/Layer/Colors/Curves..."), NULL,
N_("/Tools/Color Tools/Curves..."), NULL,
NULL, "tools/curves.html",
GIMP_STOCK_TOOL_CURVES,
data);
......
......@@ -120,7 +120,7 @@ gimp_histogram_tool_register (GimpToolRegisterCallback callback,
"gimp-histogram-tool",
_("Histogram"),
_("View image histogram"),
N_("/Layer/Colors/Histogram..."), NULL,
N_("/Tools/Color Tools/Histogram..."), NULL,
NULL, "tools/histogram.html",
GIMP_STOCK_TOOL_HISTOGRAM,
data);
......
......@@ -106,7 +106,7 @@ gimp_hue_saturation_tool_register (GimpToolRegisterCallback callback,
"gimp-hue-saturation-tool",
_("Hue-Saturation"),
_("Adjust hue and saturation"),
N_("/Layer/Colors/Hue-Saturation..."), NULL,
N_("/Tools/Color Tools/Hue-Saturation..."), NULL,
NULL, "tools/hue_saturation.html",
GIMP_STOCK_TOOL_HUE_SATURATION,
data);
......
......@@ -161,7 +161,7 @@ gimp_levels_tool_register (GimpToolRegisterCallback callback,
"gimp-levels-tool",
_("Levels"),
_("Adjust color levels"),
N_("/Layer/Colors/Levels..."), NULL,
N_("/Tools/Color Tools/Levels..."), NULL,
NULL, "tools/levels.html",
GIMP_STOCK_TOOL_LEVELS,
data);
......
......@@ -74,7 +74,7 @@ gimp_posterize_tool_register (GimpToolRegisterCallback callback,
"gimp-posterize-tool",
_("Posterize"),
_("Reduce image to a fixed number of colors"),
N_("/Layer/Colors/Posterize..."), NULL,
N_("/Tools/Color Tools/Posterize..."), NULL,
NULL, "tools/posterize.html",
GIMP_STOCK_TOOL_POSTERIZE,
data);
......
......@@ -87,7 +87,7 @@ gimp_threshold_tool_register (GimpToolRegisterCallback callback,
"gimp-threshold-tool",
_("Threshold"),
_("Reduce image to two colors using a threshold"),
N_("/Layer/Colors/Threshold..."), NULL,
N_("/Tools/Color Tools/Threshold..."), NULL,
NULL, "tools/threshold.html",
GIMP_STOCK_TOOL_THRESHOLD,
data);
......
......@@ -72,6 +72,8 @@ static void gimp_transform_tool_class_init (GimpTransformToolClass *tool);
static void gimp_transform_tool_finalize (GObject *object);
static void gimp_transform_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp);
static void gimp_transform_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp);
......@@ -184,6 +186,7 @@ gimp_transform_tool_class_init (GimpTransformToolClass *klass)
object_class->finalize = gimp_transform_tool_finalize;
tool_class->initialize = gimp_transform_tool_initialize;
tool_class->control = gimp_transform_tool_control;
tool_class->button_press = gimp_transform_tool_button_press;
tool_class->button_release = gimp_transform_tool_button_release;
......@@ -272,6 +275,64 @@ gimp_transform_tool_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_transform_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool);
if (gdisp != tool->gdisp)
{
GimpDrawable *drawable = gimp_image_active_drawable (gdisp->gimage);
if (GIMP_IS_LAYER (drawable) &&
gimp_layer_get_mask (GIMP_LAYER (drawable)))
{
g_message (_("Transformations do not work on\n"
"layers that contain layer masks."));
return;
}
/* Set the pointer to the active display */
tool->gdisp = gdisp;
tool->drawable = drawable;
if (! gimp_tool_control_is_active (tool->control))
gimp_tool_control_activate (tool->control);
/* Initialize the transform tool dialog */
if (! tr_tool->info_dialog)
gimp_transform_tool_dialog (tr_tool);
/* Find the transform bounds for some tools (like scale,
* perspective) that actually need the bounds for
* initializing
*/
gimp_transform_tool_bounds (tr_tool, gdisp);
gimp_transform_tool_prepare (tr_tool, gdisp);
/* Recalculate the transform tool */
gimp_transform_tool_recalc (tr_tool, gdisp);
/* start drawing the bounding box and handles... */
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), gdisp);
tr_tool->function = TRANSFORM_CREATING;
}
if (tr_tool->function == TRANSFORM_CREATING &&
gimp_tool_control_is_active (tool->control))
{
gint i;
/* Save the current transformation info */
for (i = 0; i < TRAN_INFO_SIZE; i++)
tr_tool->old_trans_info[i] = tr_tool->trans_info[i];
}
}
static void