gimp r26588 - in trunk: . app/tools
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26588 - in trunk: . app/tools
- Date: Sat, 16 Aug 2008 10:07:43 +0000 (UTC)
Author: neo
Date: Sat Aug 16 10:07:43 2008
New Revision: 26588
URL: http://svn.gnome.org/viewvc/gimp?rev=26588&view=rev
Log:
2008-08-16 Sven Neumann <sven gimp org>
* app/tools/gimpfreeselecttool.c
* app/tools/gimprectangletool.c: formatting.
Modified:
trunk/ChangeLog
trunk/app/tools/gimpfreeselecttool.c
trunk/app/tools/gimprectangletool.c
Modified: trunk/app/tools/gimpfreeselecttool.c
==============================================================================
--- trunk/app/tools/gimpfreeselecttool.c (original)
+++ trunk/app/tools/gimpfreeselecttool.c Sat Aug 16 10:07:43 2008
@@ -56,10 +56,11 @@
#define NO_CLICK_TIME_AVAILABLE 0
#define GET_PRIVATE(fst) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((fst), GIMP_TYPE_FREE_SELECT_TOOL, Private))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((fst), \
+ GIMP_TYPE_FREE_SELECT_TOOL, GimpFreeSelectToolPrivate))
-typedef struct _Private
+typedef struct
{
/* Index of grabbed segment index. */
gint grabbed_segment_index;
@@ -125,7 +126,7 @@
guint32 last_click_time;
GimpCoords last_click_coord;
-} Private;
+} GimpFreeSelectToolPrivate;
static void gimp_free_select_tool_finalize (GObject *object);
@@ -224,14 +225,14 @@
klass->select = gimp_free_select_tool_real_select;
- g_type_class_add_private (klass, sizeof (Private));
+ g_type_class_add_private (klass, sizeof (GimpFreeSelectToolPrivate));
}
static void
gimp_free_select_tool_init (GimpFreeSelectTool *fst)
{
- GimpTool *tool = GIMP_TOOL (fst);
- Private *priv = GET_PRIVATE (fst);
+ GimpTool *tool = GIMP_TOOL (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
gimp_tool_control_set_scroll_lock (tool->control, FALSE);
gimp_tool_control_set_wants_click (tool->control, TRUE);
@@ -268,8 +269,8 @@
static void
gimp_free_select_tool_finalize (GObject *object)
{
- GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (object);
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (object);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
g_free (priv->points);
g_free (priv->segment_indices);
@@ -286,7 +287,7 @@
gint segment_start,
gint segment_end)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
*points = &priv->points[priv->segment_indices[segment_start]];
*n_points = priv->segment_indices[segment_end] -
@@ -300,7 +301,7 @@
gdouble *start_point_y,
gint segment_index)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
*start_point_x = priv->points[priv->segment_indices[segment_index]].x;
*start_point_y = priv->points[priv->segment_indices[segment_index]].y;
@@ -311,7 +312,7 @@
gdouble *start_point_x,
gdouble *start_point_y)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
gimp_free_select_tool_get_segment_point (fst,
start_point_x,
@@ -342,9 +343,9 @@
guint32 time,
GimpCoords *coords)
{
- Private *priv = GET_PRIVATE (fst);
- gboolean double_click = FALSE;
- gdouble dist = G_MAXDOUBLE;
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
+ gboolean double_click = FALSE;
+ gdouble dist = G_MAXDOUBLE;
if (priv->polygon_modified ||
priv->n_segment_indices <= 1 ||
@@ -386,8 +387,8 @@
dist_from_last_point < double_click_distance;
}
- return (! priv->supress_handles && dist < POINT_GRAB_THRESHOLD_SQ) ||
- double_click;
+ return ((! priv->supress_handles && dist < POINT_GRAB_THRESHOLD_SQ) ||
+ double_click);
}
static void
@@ -395,11 +396,11 @@
GimpDisplay *display,
GimpCoords *coords)
{
- Private *priv = GET_PRIVATE (fst);
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
- gdouble shortest_dist = POINT_GRAB_THRESHOLD_SQ;
- gint grabbed_segment_index = INVALID_INDEX;
- gint i;
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
+ gdouble shortest_dist = POINT_GRAB_THRESHOLD_SQ;
+ gint grabbed_segment_index = INVALID_INDEX;
+ gint i;
if (GIMP_TOOL (fst)->display != NULL &&
! priv->supress_handles)
@@ -438,9 +439,9 @@
static void
gimp_free_select_tool_halt (GimpFreeSelectTool *fst)
{
- GimpTool *tool = GIMP_TOOL (fst);
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
- Private *priv = GET_PRIVATE (fst);
+ GimpTool *tool = GIMP_TOOL (fst);
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
if (gimp_draw_tool_is_active (draw_tool))
gimp_draw_tool_stop (draw_tool);
@@ -459,7 +460,7 @@
static void
gimp_free_select_tool_revert_to_last_segment (GimpFreeSelectTool *fst)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
priv->n_points = priv->segment_indices[priv->n_segment_indices - 1] + 1;
}
@@ -468,7 +469,7 @@
gimp_free_select_tool_update_button_state (GimpFreeSelectTool *fst,
GdkModifierType state)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
priv->button1_down = state & GDK_BUTTON1_MASK ? TRUE : FALSE;
}
@@ -476,8 +477,8 @@
static void
gimp_free_select_tool_remove_last_segment (GimpFreeSelectTool *fst)
{
- Private *priv = GET_PRIVATE (fst);
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
gimp_draw_tool_pause (draw_tool);
@@ -500,7 +501,7 @@
gdouble x,
gdouble y)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
if (priv->n_points >= priv->max_n_points)
{
@@ -520,14 +521,15 @@
gimp_free_select_tool_add_segment_index (GimpFreeSelectTool *fst,
gint index)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
if (priv->n_segment_indices >= priv->max_n_segment_indices)
{
priv->max_n_segment_indices += N_ITEMS_PER_ALLOC;
priv->segment_indices = g_realloc (priv->segment_indices,
- sizeof (GimpVector2) * priv->max_n_segment_indices);
+ sizeof (GimpVector2) *
+ priv->max_n_segment_indices);
}
priv->segment_indices[priv->n_segment_indices] = index;
@@ -538,7 +540,7 @@
static gboolean
gimp_free_select_tool_is_point_grabbed (GimpFreeSelectTool *fst)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
return priv->grabbed_segment_index != INVALID_INDEX;
}
@@ -548,10 +550,10 @@
GimpCoords *coords,
GimpDisplay *display)
{
- GimpTool *tool = GIMP_TOOL (fst);
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fst);
- Private *priv = GET_PRIVATE (fst);
+ GimpTool *tool = GIMP_TOOL (fst);
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
+ GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
gimp_free_select_tool_halt (fst);
@@ -686,12 +688,12 @@
gdouble new_x,
gdouble new_y)
{
- Private *priv = GET_PRIVATE (fst);
- GimpVector2 cursor_point = { new_x, new_y };
- GimpVector2 *dest;
- GimpVector2 *dest_start_target;
- GimpVector2 *dest_end_target;
- gint n_points;
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
+ GimpVector2 cursor_point = { new_x, new_y };
+ GimpVector2 *dest;
+ GimpVector2 *dest_start_target;
+ GimpVector2 *dest_end_target;
+ gint n_points;
/* Handle the segment before the grabbed point */
if (segment_index > 0)
@@ -766,7 +768,7 @@
static void
gimp_free_select_tool_finish_free_segment (GimpFreeSelectTool *fst)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
/* The points are all setup, just make a segment */
gimp_free_select_tool_add_segment_index (fst,
@@ -777,7 +779,7 @@
gimp_free_select_tool_commit (GimpFreeSelectTool *fst,
GimpDisplay *display)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
if (priv->n_points >= 3)
{
@@ -790,9 +792,9 @@
static void
gimp_free_select_tool_revert_to_saved_state (GimpFreeSelectTool *fst)
{
- Private *priv = GET_PRIVATE (fst);
- GimpVector2 *dest;
- gint n_points;
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
+ GimpVector2 *dest;
+ gint n_points;
/* Without a point grab we have no sensible information to fall back
* on, bail out
@@ -841,7 +843,7 @@
guint32 time,
GimpDisplay *display)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
/* If there is a floating selection, anchor it */
if (gimp_image_floating_sel (display->image))
@@ -870,7 +872,7 @@
* free selection, revert it before doing the commit.
*/
gimp_free_select_tool_revert_to_saved_state (fst);
-
+
gimp_free_select_tool_commit (fst, display);
}
@@ -927,9 +929,9 @@
static void
gimp_free_select_tool_prepare_for_move (GimpFreeSelectTool *fst)
{
- Private *priv = GET_PRIVATE (fst);
- GimpVector2 *source;
- gint n_points;
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
+ GimpVector2 *source;
+ gint n_points;
if (priv->grabbed_segment_index > 0)
{
@@ -944,7 +946,8 @@
priv->max_n_saved_points_lower_segment = n_points;
priv->saved_points_lower_segment = g_realloc (priv->saved_points_lower_segment,
- sizeof (GimpVector2) * n_points);
+ sizeof (GimpVector2) *
+ n_points);
}
memcpy (priv->saved_points_lower_segment,
@@ -980,7 +983,7 @@
if (priv->max_n_saved_points_lower_segment == 0)
{
priv->max_n_saved_points_lower_segment = 1;
-
+
priv->saved_points_lower_segment = g_new0 (GimpVector2, 1);
}
@@ -1023,7 +1026,7 @@
gdouble new_x,
gdouble new_y)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
if (gimp_free_select_tool_is_point_grabbed (fst))
{
@@ -1053,7 +1056,7 @@
&start_point_x,
&start_point_y,
segment_index);
-
+
gimp_tool_motion_constrain (start_point_x,
start_point_y,
&new_x,
@@ -1092,8 +1095,8 @@
GimpCoords *coords,
gboolean proximity)
{
- GimpTool *tool = GIMP_TOOL (fst);
- Private *priv = GET_PRIVATE (fst);
+ GimpTool *tool = GIMP_TOOL (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
gimp_tool_pop_status (tool, display);
@@ -1157,9 +1160,9 @@
gboolean proximity,
GimpDisplay *display)
{
- GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
- Private *priv = GET_PRIVATE (fst);
- gboolean hovering_first_point;
+ GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
+ gboolean hovering_first_point;
gimp_free_select_tool_handle_segment_selection (fst,
display,
@@ -1202,9 +1205,10 @@
gimp_free_select_tool_get_last_point (fst,
&start_point_x,
&start_point_y);
-
+
gimp_tool_motion_constrain (start_point_x, start_point_y,
- &priv->pending_point.x, &priv->pending_point.y,
+ &priv->pending_point.x,
+ &priv->pending_point.y,
GIMP_TOOL_CONSTRAIN_15_DEGREES);
}
}
@@ -1272,9 +1276,9 @@
GdkModifierType state,
GimpDisplay *display)
{
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
- GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
- Private *priv = GET_PRIVATE (fst);
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
+ GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
/* First of all handle delegation to the selection mask edit logic
* if appropriate
@@ -1342,8 +1346,8 @@
GimpButtonReleaseType release_type,
GimpDisplay *display)
{
- GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
if (tool->display != display)
return;
@@ -1392,9 +1396,9 @@
GdkModifierType state,
GimpDisplay *display)
{
- GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
- Private *priv = GET_PRIVATE (fst);
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
+ GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
if (tool->display != display)
return;
@@ -1448,8 +1452,8 @@
GdkModifierType state,
GimpDisplay *display)
{
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
- Private *priv = GET_PRIVATE (tool);
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (tool);
if (tool->display == display)
{
@@ -1476,8 +1480,8 @@
GdkModifierType state,
GimpDisplay *display)
{
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
- Private *priv = GET_PRIVATE (tool);
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (tool);
if (tool->display != display)
return;
@@ -1508,9 +1512,9 @@
static void
gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
{
- GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (draw_tool);
- Private *priv = GET_PRIVATE (fst);
- GimpTool *tool = GIMP_TOOL (draw_tool);
+ GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (draw_tool);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
+ GimpTool *tool = GIMP_TOOL (draw_tool);
if (! tool->display)
return;
@@ -1527,8 +1531,8 @@
for (i = 0; i < priv->n_segment_indices; i++)
{
- gdouble dist;
GimpVector2 *point;
+ gdouble dist;
point = &priv->points[priv->segment_indices[i]];
@@ -1568,8 +1572,8 @@
gimp_free_select_tool_real_select (GimpFreeSelectTool *fst,
GimpDisplay *display)
{
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fst);
- Private *priv = GET_PRIVATE (fst);
+ GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
gimp_channel_select_polygon (gimp_image_get_mask (display->image),
C_("command", "Free Select"),
@@ -1590,7 +1594,7 @@
const GimpVector2 **points,
gint *n_points)
{
- Private *priv = GET_PRIVATE (fst);
+ GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
g_return_if_fail (points != NULL && n_points != NULL);
Modified: trunk/app/tools/gimprectangletool.c
==============================================================================
--- trunk/app/tools/gimprectangletool.c (original)
+++ trunk/app/tools/gimprectangletool.c Sat Aug 16 10:07:43 2008
@@ -97,9 +97,7 @@
(gimp_rectangle_tool_get_private (GIMP_RECTANGLE_TOOL (obj)))
-typedef struct _GimpRectangleToolPrivate GimpRectangleToolPrivate;
-
-struct _GimpRectangleToolPrivate
+typedef struct
{
/* The following members are "constants", that is, variables that are setup
* during gimp_rectangle_tool_button_press and then only read.
@@ -202,7 +200,7 @@
/* Synced with options->guide, only exists for drawing. */
GimpRectangleGuide guide;
-};
+} GimpRectangleToolPrivate;
static void gimp_rectangle_tool_iface_base_init (GimpRectangleToolInterface *iface);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]