gimptexttool.c

2008-05-02  Martin Nordholts  <martinn@svn.gnome.org>

	* gimptexttool.c
	* gimptexttool.h:
	* gimprectangletool.c
	* gimprectangletool.h
	* gimprectangleselecttool.c: Renamed the "rectangle-changed"
	signal to "rectangle-change-complete" which is much better name
	since the signal is not emited when the rectangle is changed, but
	when the change is complete.

svn path=/trunk/; revision=25557
This commit is contained in:
Martin Nordholts 2008-05-02 09:05:13 +00:00 committed by Martin Nordholts
parent 971ab1401e
commit 032b3998d4
6 changed files with 61 additions and 48 deletions

View file

@ -1,3 +1,14 @@
2008-05-02 Martin Nordholts <martinn@svn.gnome.org>
* gimptexttool.c
* gimptexttool.h:
* gimprectangletool.c
* gimprectangletool.h
* gimprectangleselecttool.c: Renamed the "rectangle-changed"
signal to "rectangle-change-complete" which is much better name
since the signal is not emited when the rectangle is changed, but
when the change is complete.
2008-05-02 Martin Nordholts <martinn@svn.gnome.org>
* plug-ins/flame/libifs.c: Use g_random_int() instead of rand().

View file

@ -127,7 +127,7 @@ static gboolean gimp_rectangle_select_tool_execute (GimpRectangleTool
gint w,
gint h);
static void gimp_rectangle_select_tool_cancel (GimpRectangleTool *rect_tool);
static gboolean gimp_rectangle_select_tool_rectangle_changed
static gboolean gimp_rectangle_select_tool_rectangle_change_complete
(GimpRectangleTool *rect_tool);
static void gimp_rectangle_select_tool_real_select (GimpRectangleSelectTool *rect_sel_tool,
GimpChannelOps operation,
@ -202,9 +202,9 @@ gimp_rectangle_select_tool_class_init (GimpRectangleSelectToolClass *klass)
static void
gimp_rectangle_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface)
{
iface->execute = gimp_rectangle_select_tool_execute;
iface->cancel = gimp_rectangle_select_tool_cancel;
iface->rectangle_changed = gimp_rectangle_select_tool_rectangle_changed;
iface->execute = gimp_rectangle_select_tool_execute;
iface->cancel = gimp_rectangle_select_tool_cancel;
iface->rectangle_change_complete = gimp_rectangle_select_tool_rectangle_change_complete;
}
static void
@ -826,7 +826,7 @@ gimp_rectangle_select_tool_cancel (GimpRectangleTool *rectangle)
}
static gboolean
gimp_rectangle_select_tool_rectangle_changed (GimpRectangleTool *rectangle)
gimp_rectangle_select_tool_rectangle_change_complete (GimpRectangleTool *rectangle)
{
GimpTool *tool;
GimpRectangleSelectTool *rect_sel_tool;
@ -908,7 +908,7 @@ gimp_rectangle_select_tool_round_corners_notify (GimpRectangleSelectOptions *opt
priv->round_corners = options->round_corners;
priv->corner_radius = options->corner_radius;
gimp_rectangle_select_tool_rectangle_changed (rect_tool);
gimp_rectangle_select_tool_rectangle_change_complete (rect_tool);
gimp_draw_tool_resume (draw_tool);
}

View file

@ -53,7 +53,7 @@
enum
{
RECTANGLE_CHANGED,
RECTANGLE_CHANGE_COMPLETE,
LAST_SIGNAL
};
@ -224,7 +224,8 @@ static void gimp_rectangle_tool_shell_scrolled (GimpDisplayShell
static void gimp_rectangle_tool_check_function (GimpRectangleTool *rect_tool);
static void gimp_rectangle_tool_rectangle_changed (GimpRectangleTool *rect_tool);
static void gimp_rectangle_tool_rectangle_change_complete
(GimpRectangleTool *rect_tool);
static void gimp_rectangle_tool_auto_shrink (GimpRectangleTool *rect_tool);
@ -357,12 +358,12 @@ gimp_rectangle_tool_iface_base_init (GimpRectangleToolInterface *iface)
if (! initialized)
{
gimp_rectangle_tool_signals[RECTANGLE_CHANGED] =
g_signal_new ("rectangle-changed",
gimp_rectangle_tool_signals[RECTANGLE_CHANGE_COMPLETE] =
g_signal_new ("rectangle-change-complete",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpRectangleToolInterface,
rectangle_changed),
rectangle_change_complete),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@ -413,9 +414,9 @@ gimp_rectangle_tool_iface_base_init (GimpRectangleToolInterface *iface)
GIMP_RECTANGLE_PRECISION_INT,
GIMP_PARAM_READWRITE));
iface->execute = NULL;
iface->cancel = NULL;
iface->rectangle_changed = NULL;
iface->execute = NULL;
iface->cancel = NULL;
iface->rectangle_change_complete = NULL;
initialized = TRUE;
}
@ -519,7 +520,7 @@ gimp_rectangle_tool_set_constraint (GimpRectangleTool *tool,
gimp_rectangle_tool_update_highlight (tool);
gimp_rectangle_tool_update_handle_sizes (tool);
gimp_rectangle_tool_rectangle_changed (tool);
gimp_rectangle_tool_rectangle_change_complete (tool);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
@ -961,7 +962,7 @@ gimp_rectangle_tool_button_release (GimpTool *tool,
switch (release_type)
{
case GIMP_BUTTON_RELEASE_NORMAL:
gimp_rectangle_tool_rectangle_changed (rect_tool);
gimp_rectangle_tool_rectangle_change_complete (rect_tool);
break;
case GIMP_BUTTON_RELEASE_CANCEL:
@ -1205,7 +1206,7 @@ gimp_rectangle_tool_active_modifier_key (GimpTool *tool,
gimp_rectangle_tool_update_highlight (rect_tool);
gimp_rectangle_tool_rectangle_changed (rect_tool);
gimp_rectangle_tool_rectangle_change_complete (rect_tool);
}
}
@ -1224,7 +1225,7 @@ gimp_rectangle_tool_active_modifier_key (GimpTool *tool,
gimp_rectangle_tool_update_highlight (rect_tool);
gimp_rectangle_tool_rectangle_changed (rect_tool);
gimp_rectangle_tool_rectangle_change_complete (rect_tool);
}
else if (button1_down)
{
@ -1240,7 +1241,7 @@ gimp_rectangle_tool_active_modifier_key (GimpTool *tool,
gimp_rectangle_tool_update_highlight (rect_tool);
gimp_rectangle_tool_rectangle_changed (rect_tool);
gimp_rectangle_tool_rectangle_change_complete (rect_tool);
}
}
@ -1461,7 +1462,7 @@ gimp_rectangle_tool_key_press (GimpTool *tool,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
gimp_rectangle_tool_rectangle_changed (rect_tool);
gimp_rectangle_tool_rectangle_change_complete (rect_tool);
/* Evil hack to suppress oper updates. We do this because we don't
* want the rectangle tool to change function while the rectangle
@ -2182,7 +2183,7 @@ gimp_rectangle_tool_synthesize_motion (GimpRectangleTool *rect_tool,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (rect_tool));
gimp_rectangle_tool_rectangle_changed (rect_tool);
gimp_rectangle_tool_rectangle_change_complete (rect_tool);
}
static void
@ -2408,10 +2409,10 @@ gimp_rectangle_tool_set_function (GimpRectangleTool *rect_tool,
}
static void
gimp_rectangle_tool_rectangle_changed (GimpRectangleTool *rect_tool)
gimp_rectangle_tool_rectangle_change_complete (GimpRectangleTool *rect_tool)
{
g_signal_emit (rect_tool,
gimp_rectangle_tool_signals[RECTANGLE_CHANGED], 0);
gimp_rectangle_tool_signals[RECTANGLE_CHANGE_COMPLETE], 0);
}
static void
@ -2464,7 +2465,7 @@ gimp_rectangle_tool_auto_shrink (GimpRectangleTool *rect_tool)
gimp_rectangle_tool_update_int_rect (rect_tool);
gimp_rectangle_tool_rectangle_changed (rect_tool);
gimp_rectangle_tool_rectangle_change_complete (rect_tool);
gimp_rectangle_tool_update_handle_sizes (rect_tool);
gimp_rectangle_tool_update_highlight (rect_tool);

View file

@ -75,7 +75,7 @@ struct _GimpRectangleToolInterface
void (* cancel) (GimpRectangleTool *rect_tool);
/* signals */
gboolean (* rectangle_changed) (GimpRectangleTool *rect_tool);
gboolean (* rectangle_change_complete) (GimpRectangleTool *rect_tool);
};

View file

@ -133,9 +133,10 @@ static gboolean gimp_text_tool_set_drawable (GimpTextTool *text_tool,
GimpDrawable *drawable,
gboolean confirm);
static gboolean gimp_text_tool_rectangle_changed (GimpRectangleTool *rect_tool);
void gimp_rectangle_tool_frame_item (GimpRectangleTool *rect_tool,
GimpItem *item);
static gboolean gimp_text_tool_rectangle_change_complete
(GimpRectangleTool *rect_tool);
void gimp_rectangle_tool_frame_item(GimpRectangleTool *rect_tool,
GimpItem *item);
G_DEFINE_TYPE_WITH_CODE (GimpTextTool, gimp_text_tool,
GIMP_TYPE_DRAW_TOOL,
@ -193,7 +194,7 @@ gimp_text_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface)
{
iface->execute = NULL;
iface->cancel = NULL;
iface->rectangle_changed = gimp_text_tool_rectangle_changed;
iface->rectangle_change_complete = gimp_text_tool_rectangle_change_complete;
}
static void
@ -215,7 +216,7 @@ gimp_text_tool_init (GimpTextTool *text_tool)
gimp_tool_control_set_action_object_1 (tool->control,
"context/context-font-select-set");
text_tool->handle_rectangle_changed = TRUE;
text_tool->handle_rectangle_change_complete = TRUE;
}
static GObject *
@ -375,13 +376,13 @@ gimp_text_tool_button_press (GimpTool *tool,
* yet exists there, we want to create one with the right shape.
* 2) If the user has modified the rectangle for an existing text layer,
* we want to change its shape accordingly. We do this by falling
* through to code that causes the "rectangle-changed" signal to
* be emitted.
* through to code that causes the "rectangle-change-complete" signal
* to be emitted.
* 3) If the rectangle that has been swept out is too small, we want to
* use dynamic text.
* 4) Otherwise, we want to use the new rectangle that the user has
* created as our text box. This again is done by causing
* "rectangle-changed" to be emitted.
* "rectangle-change-complete" to be emitted.
*/
static void
gimp_text_tool_button_release (GimpTool *tool,
@ -410,10 +411,10 @@ gimp_text_tool_button_release (GimpTool *tool,
/* user has clicked on an existing text layer */
gimp_tool_control_halt (tool->control);
text_tool->handle_rectangle_changed = FALSE;
text_tool->handle_rectangle_change_complete = FALSE;
gimp_rectangle_tool_frame_item (rect_tool,
GIMP_ITEM (text_tool->layer));
text_tool->handle_rectangle_changed = TRUE;
text_tool->handle_rectangle_change_complete = TRUE;
return;
}
else
@ -429,7 +430,7 @@ gimp_text_tool_button_release (GimpTool *tool,
g_object_set (text_tool->proxy,
"box-mode", GIMP_TEXT_BOX_DYNAMIC,
NULL);
text_tool->handle_rectangle_changed = FALSE;
text_tool->handle_rectangle_change_complete = FALSE;
}
else
{
@ -438,7 +439,7 @@ gimp_text_tool_button_release (GimpTool *tool,
gimp_rectangle_tool_button_release (tool, coords, time, state,
release_type, display);
text_tool->handle_rectangle_changed = TRUE;
text_tool->handle_rectangle_change_complete = TRUE;
}
static void
@ -626,10 +627,10 @@ gimp_text_tool_text_notify (GimpText *text,
{
GimpRectangleTool *rect_tool = GIMP_RECTANGLE_TOOL (text_tool);
text_tool->handle_rectangle_changed = FALSE;
text_tool->handle_rectangle_change_complete = FALSE;
gimp_rectangle_tool_frame_item (rect_tool,
GIMP_ITEM (text_tool->layer));
text_tool->handle_rectangle_changed = TRUE;
text_tool->handle_rectangle_change_complete = TRUE;
}
}
@ -772,10 +773,10 @@ gimp_text_tool_apply (GimpTextTool *text_tool)
* shape of the rectangle */
if (layer->text->box_mode == GIMP_TEXT_BOX_DYNAMIC)
{
text_tool->handle_rectangle_changed = FALSE;
text_tool->handle_rectangle_change_complete = FALSE;
gimp_rectangle_tool_frame_item (GIMP_RECTANGLE_TOOL (text_tool),
GIMP_ITEM (layer));
text_tool->handle_rectangle_changed = TRUE;
text_tool->handle_rectangle_change_complete = TRUE;
}
gimp_image_flush (image);
@ -914,10 +915,10 @@ gimp_text_tool_create_layer (GimpTextTool *text_tool,
}
else
{
text_tool->handle_rectangle_changed = FALSE;
text_tool->handle_rectangle_change_complete = FALSE;
gimp_rectangle_tool_frame_item (GIMP_RECTANGLE_TOOL (text_tool),
GIMP_ITEM (layer));
text_tool->handle_rectangle_changed = TRUE;
text_tool->handle_rectangle_change_complete = TRUE;
}
gimp_image_undo_group_end (image);
@ -1123,10 +1124,10 @@ gimp_text_tool_layer_changed (GimpImage *image,
{
if (! gimp_rectangle_tool_rectangle_is_new (rect_tool))
{
text_tool->handle_rectangle_changed = FALSE;
text_tool->handle_rectangle_change_complete = FALSE;
gimp_rectangle_tool_frame_item (rect_tool,
GIMP_ITEM (text_tool->layer));
text_tool->handle_rectangle_changed = TRUE;
text_tool->handle_rectangle_change_complete = TRUE;
}
}
}
@ -1265,7 +1266,7 @@ gimp_text_tool_set_layer (GimpTextTool *text_tool,
}
static gboolean
gimp_text_tool_rectangle_changed (GimpRectangleTool *rect_tool)
gimp_text_tool_rectangle_change_complete (GimpRectangleTool *rect_tool)
{
GimpTextTool *text_tool = GIMP_TEXT_TOOL (rect_tool);
GimpText *text = text_tool->text;
@ -1273,7 +1274,7 @@ gimp_text_tool_rectangle_changed (GimpRectangleTool *rect_tool)
GimpItem *item ;
gint x1, y1, x2, y2;
if (text_tool->handle_rectangle_changed)
if (text_tool->handle_rectangle_change_complete)
{
g_object_get (rect_tool,
"x1", &x1,

View file

@ -53,7 +53,7 @@ struct _GimpTextTool
GtkWidget *editor;
GtkWidget *confirm_dialog;
gboolean handle_rectangle_changed;
gboolean handle_rectangle_change_complete;
gboolean text_box_fixed;
};