diff --git a/ChangeLog b/ChangeLog index b3fad93d4d..3b32c57f6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-21 Karine Delvare + + * app/tools/gimpnewrectselecttool.c + * app/tools/gimprectangleoptions.[ch] + * app/tools/gimprectangletool.[ch]: hide properties accessors. + 2006-03-21 Karine Delvare * app/tools/gimpcropoptions.c: use GIMP_RECTANGLE_OPTIONS_PROP_LAST diff --git a/app/tools/gimpnewrectselecttool.c b/app/tools/gimpnewrectselecttool.c index 311f6197af..7f4ac67946 100644 --- a/app/tools/gimpnewrectselecttool.c +++ b/app/tools/gimpnewrectselecttool.c @@ -270,6 +270,7 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle, GimpChannel *selection_mask; gint x1, y1; gint x2, y2; + gint pressx, pressy; guchar *val_ptr; options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); @@ -317,9 +318,14 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle, return TRUE; } + g_object_get (rectangle, + "pressx", &pressx, + "pressy", &pressy, + NULL); + if ((val_ptr = gimp_pickable_get_color_at (GIMP_PICKABLE (selection_mask), - gimp_rectangle_tool_get_pressx (rectangle), - gimp_rectangle_tool_get_pressy (rectangle)))) + pressx, + pressy))) val = *val_ptr; else val = 0; @@ -360,20 +366,24 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle, } } - gimp_rectangle_tool_set_x1 (rectangle, x1); - gimp_rectangle_tool_set_y1 (rectangle, y1); - gimp_rectangle_tool_set_x2 (rectangle, x2); - gimp_rectangle_tool_set_y2 (rectangle, y2); + g_object_set (rectangle, + "x1", x1, + "y1", y1, + "x2", x2, + "y2", y2, + NULL); } else { - gimp_rectangle_tool_set_x1 (rectangle, 0); - gimp_rectangle_tool_set_y1 (rectangle, 0); - gimp_rectangle_tool_set_x2 (rectangle, gimage->width); - gimp_rectangle_tool_set_y2 (rectangle, gimage->height); + g_object_set (rectangle, + "x1", 0, + "y1", 0, + "x2", gimage->width, + "y2", gimage->height, + NULL); } - gimp_rectangle_tool_set_function (rectangle, RECT_MOVING); + g_object_set (rectangle, "function", RECT_MOVING, NULL); return FALSE; } diff --git a/app/tools/gimprectangleoptions.c b/app/tools/gimprectangleoptions.c index bfc5e5f1bf..0825541a1b 100644 --- a/app/tools/gimprectangleoptions.c +++ b/app/tools/gimprectangleoptions.c @@ -56,10 +56,49 @@ struct _GimpRectangleOptionsPrivate GimpUnit unit; }; -static void gimp_rectangle_options_iface_base_init (GimpRectangleOptionsInterface *rectangle_options_iface); +static void gimp_rectangle_options_iface_base_init (GimpRectangleOptionsInterface *rectangle_options_iface); static GimpRectangleOptionsPrivate * - gimp_rectangle_options_get_private (GimpRectangleOptions *options); + gimp_rectangle_options_get_private (GimpRectangleOptions *options); + +void gimp_rectangle_options_set_highlight (GimpRectangleOptions *options, + gboolean highlight); +gboolean gimp_rectangle_options_get_highlight (GimpRectangleOptions *options); + +void gimp_rectangle_options_set_fixed_width (GimpRectangleOptions *options, + gboolean fixed_width); +gboolean gimp_rectangle_options_get_fixed_width (GimpRectangleOptions *options); +void gimp_rectangle_options_set_width (GimpRectangleOptions *options, + gdouble width); +gdouble gimp_rectangle_options_get_width (GimpRectangleOptions *options); + +void gimp_rectangle_options_set_fixed_height (GimpRectangleOptions *options, + gboolean fixed_height); +gboolean gimp_rectangle_options_get_fixed_height (GimpRectangleOptions *options); +void gimp_rectangle_options_set_height (GimpRectangleOptions *options, + gdouble height); +gdouble gimp_rectangle_options_get_height (GimpRectangleOptions *options); + +void gimp_rectangle_options_set_fixed_aspect (GimpRectangleOptions *options, + gboolean fixed_aspect); +gboolean gimp_rectangle_options_get_fixed_aspect (GimpRectangleOptions *options); +void gimp_rectangle_options_set_aspect (GimpRectangleOptions *options, + gdouble aspect); +gdouble gimp_rectangle_options_get_aspect (GimpRectangleOptions *options); + +void gimp_rectangle_options_set_fixed_center (GimpRectangleOptions *options, + gboolean fixed_center); +gboolean gimp_rectangle_options_get_fixed_center (GimpRectangleOptions *options); +void gimp_rectangle_options_set_center_x (GimpRectangleOptions *options, + gdouble center_x); +gdouble gimp_rectangle_options_get_center_x (GimpRectangleOptions *options); +void gimp_rectangle_options_set_center_y (GimpRectangleOptions *options, + gdouble center_y); +gdouble gimp_rectangle_options_get_center_y (GimpRectangleOptions *options); + +void gimp_rectangle_options_set_unit (GimpRectangleOptions *options, + GimpUnit unit); +GimpUnit gimp_rectangle_options_get_unit (GimpRectangleOptions *options); GType diff --git a/app/tools/gimprectangleoptions.h b/app/tools/gimprectangleoptions.h index 553328185c..3cc4a25e13 100644 --- a/app/tools/gimprectangleoptions.h +++ b/app/tools/gimprectangleoptions.h @@ -55,45 +55,6 @@ struct _GimpRectangleOptionsInterface GType gimp_rectangle_options_interface_get_type (void) G_GNUC_CONST; -void gimp_rectangle_options_set_highlight (GimpRectangleOptions *options, - gboolean highlight); -gboolean gimp_rectangle_options_get_highlight (GimpRectangleOptions *options); - -void gimp_rectangle_options_set_fixed_width (GimpRectangleOptions *options, - gboolean fixed_width); -gboolean gimp_rectangle_options_get_fixed_width (GimpRectangleOptions *options); -void gimp_rectangle_options_set_width (GimpRectangleOptions *options, - gdouble width); -gdouble gimp_rectangle_options_get_width (GimpRectangleOptions *options); - -void gimp_rectangle_options_set_fixed_height (GimpRectangleOptions *options, - gboolean fixed_height); -gboolean gimp_rectangle_options_get_fixed_height (GimpRectangleOptions *options); -void gimp_rectangle_options_set_height (GimpRectangleOptions *options, - gdouble height); -gdouble gimp_rectangle_options_get_height (GimpRectangleOptions *options); - -void gimp_rectangle_options_set_fixed_aspect (GimpRectangleOptions *options, - gboolean fixed_aspect); -gboolean gimp_rectangle_options_get_fixed_aspect (GimpRectangleOptions *options); -void gimp_rectangle_options_set_aspect (GimpRectangleOptions *options, - gdouble aspect); -gdouble gimp_rectangle_options_get_aspect (GimpRectangleOptions *options); - -void gimp_rectangle_options_set_fixed_center (GimpRectangleOptions *options, - gboolean fixed_center); -gboolean gimp_rectangle_options_get_fixed_center (GimpRectangleOptions *options); -void gimp_rectangle_options_set_center_x (GimpRectangleOptions *options, - gdouble center_x); -gdouble gimp_rectangle_options_get_center_x (GimpRectangleOptions *options); -void gimp_rectangle_options_set_center_y (GimpRectangleOptions *options, - gdouble center_y); -gdouble gimp_rectangle_options_get_center_y (GimpRectangleOptions *options); - -void gimp_rectangle_options_set_unit (GimpRectangleOptions *options, - GimpUnit unit); -GimpUnit gimp_rectangle_options_get_unit (GimpRectangleOptions *options); - GtkWidget * gimp_rectangle_options_gui (GimpToolOptions *tool_options); diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c index 311f6197af..7f4ac67946 100644 --- a/app/tools/gimprectangleselecttool.c +++ b/app/tools/gimprectangleselecttool.c @@ -270,6 +270,7 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle, GimpChannel *selection_mask; gint x1, y1; gint x2, y2; + gint pressx, pressy; guchar *val_ptr; options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); @@ -317,9 +318,14 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle, return TRUE; } + g_object_get (rectangle, + "pressx", &pressx, + "pressy", &pressy, + NULL); + if ((val_ptr = gimp_pickable_get_color_at (GIMP_PICKABLE (selection_mask), - gimp_rectangle_tool_get_pressx (rectangle), - gimp_rectangle_tool_get_pressy (rectangle)))) + pressx, + pressy))) val = *val_ptr; else val = 0; @@ -360,20 +366,24 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle, } } - gimp_rectangle_tool_set_x1 (rectangle, x1); - gimp_rectangle_tool_set_y1 (rectangle, y1); - gimp_rectangle_tool_set_x2 (rectangle, x2); - gimp_rectangle_tool_set_y2 (rectangle, y2); + g_object_set (rectangle, + "x1", x1, + "y1", y1, + "x2", x2, + "y2", y2, + NULL); } else { - gimp_rectangle_tool_set_x1 (rectangle, 0); - gimp_rectangle_tool_set_y1 (rectangle, 0); - gimp_rectangle_tool_set_x2 (rectangle, gimage->width); - gimp_rectangle_tool_set_y2 (rectangle, gimage->height); + g_object_set (rectangle, + "x1", 0, + "y1", 0, + "x2", gimage->width, + "y2", gimage->height, + NULL); } - gimp_rectangle_tool_set_function (rectangle, RECT_MOVING); + g_object_set (rectangle, "function", RECT_MOVING, NULL); return FALSE; } diff --git a/app/tools/gimprectangletool.c b/app/tools/gimprectangletool.c index 1b5c3165cd..efd356fbf7 100644 --- a/app/tools/gimprectangletool.c +++ b/app/tools/gimprectangletool.c @@ -82,11 +82,89 @@ struct _GimpRectangleToolPrivate }; -static void gimp_rectangle_tool_iface_base_init (GimpRectangleToolInterface *iface); +static void gimp_rectangle_tool_iface_base_init (GimpRectangleToolInterface *iface); static GimpRectangleToolPrivate * - gimp_rectangle_tool_get_private (GimpRectangleTool *tool); + gimp_rectangle_tool_get_private (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_controls (GimpRectangleTool *tool, + GtkWidget *controls); +GtkWidget * gimp_rectangle_tool_get_controls (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_entry (GimpRectangleTool *tool, + GtkWidget *entry); +GtkWidget * gimp_rectangle_tool_get_entry (GimpRectangleTool *tool); + +void gimp_rectangle_tool_set_startx (GimpRectangleTool *tool, + gint startx); +gint gimp_rectangle_tool_get_startx (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_starty (GimpRectangleTool *tool, + gint starty); +gint gimp_rectangle_tool_get_starty (GimpRectangleTool *tool); + +void gimp_rectangle_tool_set_lastx (GimpRectangleTool *tool, + gint lastx); +gint gimp_rectangle_tool_get_lastx (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_lasty (GimpRectangleTool *tool, + gint lasty); +gint gimp_rectangle_tool_get_lasty (GimpRectangleTool *tool); + +void gimp_rectangle_tool_set_pressx (GimpRectangleTool *tool, + gint pressx); +gint gimp_rectangle_tool_get_pressx (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_pressy (GimpRectangleTool *tool, + gint pressy); +gint gimp_rectangle_tool_get_pressy (GimpRectangleTool *tool); + +void gimp_rectangle_tool_set_x1 (GimpRectangleTool *tool, + gint x1); +gint gimp_rectangle_tool_get_x1 (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_y1 (GimpRectangleTool *tool, + gint y1); +gint gimp_rectangle_tool_get_y1 (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_x2 (GimpRectangleTool *tool, + gint x2); +gint gimp_rectangle_tool_get_x2 (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_y2 (GimpRectangleTool *tool, + gint y2); +gint gimp_rectangle_tool_get_y2 (GimpRectangleTool *tool); + +void gimp_rectangle_tool_set_function (GimpRectangleTool *tool, + guint function); +guint gimp_rectangle_tool_get_function (GimpRectangleTool *tool); + +void gimp_rectangle_tool_set_dx1 (GimpRectangleTool *tool, + gint dx1); +gint gimp_rectangle_tool_get_dx1 (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_dy1 (GimpRectangleTool *tool, + gint dy1); +gint gimp_rectangle_tool_get_dy1 (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_dx2 (GimpRectangleTool *tool, + gint dx2); +gint gimp_rectangle_tool_get_dx2 (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_dy2 (GimpRectangleTool *tool, + gint dy2); +gint gimp_rectangle_tool_get_dy2 (GimpRectangleTool *tool); + +void gimp_rectangle_tool_set_dcw (GimpRectangleTool *tool, + gint dcw); +gint gimp_rectangle_tool_get_dcw (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_dch (GimpRectangleTool *tool, + gint dch); +gint gimp_rectangle_tool_get_dch (GimpRectangleTool *tool); + +void gimp_rectangle_tool_set_origx (GimpRectangleTool *tool, + gdouble origx); +gdouble gimp_rectangle_tool_get_origx (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_origy (GimpRectangleTool *tool, + gdouble origy); +gdouble gimp_rectangle_tool_get_origy (GimpRectangleTool *tool); + +void gimp_rectangle_tool_set_sizew (GimpRectangleTool *tool, + gdouble sizew); +gdouble gimp_rectangle_tool_get_sizew (GimpRectangleTool *tool); +void gimp_rectangle_tool_set_sizeh (GimpRectangleTool *tool, + gdouble sizeh); +gdouble gimp_rectangle_tool_get_sizeh (GimpRectangleTool *tool); /* Rectangle helper functions */ static void rectangle_tool_start (GimpRectangleTool *rectangle); @@ -2685,12 +2763,15 @@ gimp_rectangle_tool_notify_width (GimpRectangleOptions *options, { gint rx1, rx2, ry1, ry2; GimpCoords coords; - gdouble width = gimp_rectangle_options_get_width (options); + gdouble width; /* make sure a rectangle exists */ if (! GIMP_TOOL (rectangle)->gdisp) return; + g_object_get (options, + "width", &width, + NULL); g_object_get (rectangle, "x1", &rx1, "y1", &ry1, @@ -2721,11 +2802,14 @@ gimp_rectangle_tool_notify_height (GimpRectangleOptions *options, { gint rx1, rx2, ry1, ry2; GimpCoords coords; - gdouble height = gimp_rectangle_options_get_height (options); + gdouble height; if (! GIMP_TOOL (rectangle)->gdisp) return; + g_object_get (options, + "height", &height, + NULL); g_object_get (rectangle, "x1", &rx1, "y1", &ry1, @@ -2756,11 +2840,14 @@ gimp_rectangle_tool_notify_aspect (GimpRectangleOptions *options, { gint rx1, rx2, ry1, ry2; GimpCoords coords; - gdouble aspect = gimp_rectangle_options_get_aspect (options); + gdouble aspect; if (! GIMP_TOOL (rectangle)->gdisp) return; + g_object_get (options, + "aspect", &aspect, + NULL); g_object_get (rectangle, "x1", &rx1, "y1", &ry1, diff --git a/app/tools/gimprectangletool.h b/app/tools/gimprectangletool.h index ab40668ab6..10cd95a4c1 100644 --- a/app/tools/gimprectangletool.h +++ b/app/tools/gimprectangletool.h @@ -91,84 +91,6 @@ struct _GimpRectangleToolInterface GType gimp_rectangle_tool_interface_get_type (void) G_GNUC_CONST; -void gimp_rectangle_tool_set_controls (GimpRectangleTool *tool, - GtkWidget *controls); -GtkWidget * gimp_rectangle_tool_get_controls (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_entry (GimpRectangleTool *tool, - GtkWidget *entry); -GtkWidget * gimp_rectangle_tool_get_entry (GimpRectangleTool *tool); - -void gimp_rectangle_tool_set_startx (GimpRectangleTool *tool, - gint startx); -gint gimp_rectangle_tool_get_startx (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_starty (GimpRectangleTool *tool, - gint starty); -gint gimp_rectangle_tool_get_starty (GimpRectangleTool *tool); - -void gimp_rectangle_tool_set_lastx (GimpRectangleTool *tool, - gint lastx); -gint gimp_rectangle_tool_get_lastx (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_lasty (GimpRectangleTool *tool, - gint lasty); -gint gimp_rectangle_tool_get_lasty (GimpRectangleTool *tool); - -void gimp_rectangle_tool_set_pressx (GimpRectangleTool *tool, - gint pressx); -gint gimp_rectangle_tool_get_pressx (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_pressy (GimpRectangleTool *tool, - gint pressy); -gint gimp_rectangle_tool_get_pressy (GimpRectangleTool *tool); - -void gimp_rectangle_tool_set_x1 (GimpRectangleTool *tool, - gint x1); -gint gimp_rectangle_tool_get_x1 (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_y1 (GimpRectangleTool *tool, - gint y1); -gint gimp_rectangle_tool_get_y1 (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_x2 (GimpRectangleTool *tool, - gint x2); -gint gimp_rectangle_tool_get_x2 (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_y2 (GimpRectangleTool *tool, - gint y2); -gint gimp_rectangle_tool_get_y2 (GimpRectangleTool *tool); - -void gimp_rectangle_tool_set_function (GimpRectangleTool *tool, - guint function); -guint gimp_rectangle_tool_get_function (GimpRectangleTool *tool); - -void gimp_rectangle_tool_set_dx1 (GimpRectangleTool *tool, - gint dx1); -gint gimp_rectangle_tool_get_dx1 (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_dy1 (GimpRectangleTool *tool, - gint dy1); -gint gimp_rectangle_tool_get_dy1 (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_dx2 (GimpRectangleTool *tool, - gint dx2); -gint gimp_rectangle_tool_get_dx2 (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_dy2 (GimpRectangleTool *tool, - gint dy2); -gint gimp_rectangle_tool_get_dy2 (GimpRectangleTool *tool); - -void gimp_rectangle_tool_set_dcw (GimpRectangleTool *tool, - gint dcw); -gint gimp_rectangle_tool_get_dcw (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_dch (GimpRectangleTool *tool, - gint dch); -gint gimp_rectangle_tool_get_dch (GimpRectangleTool *tool); - -void gimp_rectangle_tool_set_origx (GimpRectangleTool *tool, - gdouble origx); -gdouble gimp_rectangle_tool_get_origx (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_origy (GimpRectangleTool *tool, - gdouble origy); -gdouble gimp_rectangle_tool_get_origy (GimpRectangleTool *tool); - -void gimp_rectangle_tool_set_sizew (GimpRectangleTool *tool, - gdouble sizew); -gdouble gimp_rectangle_tool_get_sizew (GimpRectangleTool *tool); -void gimp_rectangle_tool_set_sizeh (GimpRectangleTool *tool, - gdouble sizeh); -gdouble gimp_rectangle_tool_get_sizeh (GimpRectangleTool *tool); void gimp_rectangle_tool_constructor (GObject *object); void gimp_rectangle_tool_dispose (GObject *object);