mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 20:12:30 +00:00
app/tools/gimprectangletool.[ch] removed function from the properties.
2006-11-15 Sven Neumann <sven@gimp.org> * app/tools/gimprectangletool.[ch] * app/tools/gimprectangleselecttool.c: removed function from the properties. Added getter and setter functions instead. Redraw the tool whenever the function changes.
This commit is contained in:
parent
35f198e7b0
commit
c4b8cda67d
|
@ -1,3 +1,10 @@
|
|||
2006-11-15 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/tools/gimprectangletool.[ch]
|
||||
* app/tools/gimprectangleselecttool.c: removed function from the
|
||||
properties. Added getter and setter functions instead. Redraw the
|
||||
tool whenever the function changes.
|
||||
|
||||
2006-11-15 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpbrush.c (gimp_brush_real_scale_pixmap): use
|
||||
|
|
|
@ -287,13 +287,14 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
|
||||
guint function;
|
||||
GimpRectangleTool *rectangle = GIMP_RECTANGLE_TOOL (tool);
|
||||
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
|
||||
GimpRectangleFunction function;
|
||||
|
||||
if (tool->display && display != tool->display)
|
||||
gimp_rectangle_tool_cancel (GIMP_RECTANGLE_TOOL (tool));
|
||||
|
||||
g_object_get (tool, "function", &function, NULL);
|
||||
function = gimp_rectangle_tool_get_function (rectangle);
|
||||
|
||||
rect_select->saved_show_selection
|
||||
= gimp_display_shell_get_show_selection (GIMP_DISPLAY_SHELL (display->shell));
|
||||
|
@ -321,7 +322,7 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||
/* if the shift or ctrl keys are down, we don't want to adjust, we
|
||||
* want to create a new rectangle, regardless of pointer loc */
|
||||
if (state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
|
||||
g_object_set (tool, "function", RECT_CREATING, NULL);
|
||||
gimp_rectangle_tool_set_function (rectangle, RECT_CREATING);
|
||||
|
||||
gimp_rectangle_tool_button_press (tool, coords, time, state, display);
|
||||
|
||||
|
@ -329,7 +330,7 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||
* we have already "executed", and need to undo at this point,
|
||||
* unless the user has done something in the meantime
|
||||
*/
|
||||
g_object_get (tool, "function", &function, NULL);
|
||||
function = gimp_rectangle_tool_get_function (rectangle);
|
||||
|
||||
if (function == RECT_CREATING)
|
||||
{
|
||||
|
@ -451,11 +452,11 @@ gimp_rect_select_tool_oper_update (GimpTool *tool,
|
|||
gboolean proximity,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
guint function;
|
||||
GimpRectangleFunction function;
|
||||
|
||||
gimp_rectangle_tool_oper_update (tool, coords, state, proximity, display);
|
||||
|
||||
g_object_get (tool, "function", &function, NULL);
|
||||
function = gimp_rectangle_tool_get_function (GIMP_RECTANGLE_TOOL (tool));
|
||||
|
||||
if (function == RECT_INACTIVE)
|
||||
GIMP_SELECTION_TOOL (tool)->allow_move = TRUE;
|
||||
|
@ -653,7 +654,7 @@ gimp_rect_select_tool_execute (GimpRectangleTool *rectangle,
|
|||
NULL);
|
||||
}
|
||||
|
||||
g_object_set (rectangle, "function", RECT_MOVING, NULL);
|
||||
gimp_rectangle_tool_set_function (rectangle, RECT_MOVING);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -215,14 +215,6 @@ gimp_rectangle_tool_iface_base_init (GimpRectangleToolInterface *iface)
|
|||
0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_uint ("function",
|
||||
NULL, NULL,
|
||||
RECT_INACTIVE,
|
||||
RECT_EXECUTING,
|
||||
RECT_INACTIVE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_uint ("constraint",
|
||||
NULL, NULL,
|
||||
|
@ -295,9 +287,6 @@ gimp_rectangle_tool_install_properties (GObjectClass *klass)
|
|||
g_object_class_override_property (klass,
|
||||
GIMP_RECTANGLE_TOOL_PROP_Y2,
|
||||
"y2");
|
||||
g_object_class_override_property (klass,
|
||||
GIMP_RECTANGLE_TOOL_PROP_FUNCTION,
|
||||
"function");
|
||||
g_object_class_override_property (klass,
|
||||
GIMP_RECTANGLE_TOOL_PROP_CONSTRAINT,
|
||||
"constraint");
|
||||
|
@ -368,9 +357,6 @@ gimp_rectangle_tool_set_property (GObject *object,
|
|||
case GIMP_RECTANGLE_TOOL_PROP_Y2:
|
||||
private->y2 = g_value_get_int (value);
|
||||
break;
|
||||
case GIMP_RECTANGLE_TOOL_PROP_FUNCTION:
|
||||
private->function = g_value_get_uint (value);
|
||||
break;
|
||||
case GIMP_RECTANGLE_TOOL_PROP_CONSTRAINT:
|
||||
gimp_rectangle_tool_set_constraint (rectangle, g_value_get_uint (value));
|
||||
break;
|
||||
|
@ -405,9 +391,6 @@ gimp_rectangle_tool_get_property (GObject *object,
|
|||
case GIMP_RECTANGLE_TOOL_PROP_Y2:
|
||||
g_value_set_int (value, private->y2);
|
||||
break;
|
||||
case GIMP_RECTANGLE_TOOL_PROP_FUNCTION:
|
||||
g_value_set_uint (value, private->function);
|
||||
break;
|
||||
case GIMP_RECTANGLE_TOOL_PROP_CONSTRAINT:
|
||||
g_value_set_uint (value, gimp_rectangle_tool_get_constraint (rectangle));
|
||||
break;
|
||||
|
@ -492,12 +475,13 @@ gimp_rectangle_tool_button_press (GimpTool *tool,
|
|||
if (gimp_draw_tool_is_active (draw_tool))
|
||||
gimp_draw_tool_stop (draw_tool);
|
||||
|
||||
gimp_rectangle_tool_set_function (rectangle, RECT_CREATING);
|
||||
|
||||
g_object_set (rectangle,
|
||||
"function", RECT_CREATING,
|
||||
"x1", x,
|
||||
"y1", y,
|
||||
"x2", x,
|
||||
"y2", y,
|
||||
"x1", x,
|
||||
"y1", y,
|
||||
"x2", x,
|
||||
"y2", y,
|
||||
NULL);
|
||||
|
||||
tool->display = display;
|
||||
|
@ -1071,7 +1055,7 @@ gimp_rectangle_tool_motion (GimpTool *tool,
|
|||
|
||||
if (private->function == RECT_CREATING)
|
||||
{
|
||||
gint function = RECT_CREATING;
|
||||
GimpRectangleFunction function = RECT_CREATING;
|
||||
|
||||
if (inc_x < 0 && inc_y < 0)
|
||||
function = RECT_RESIZING_UPPER_LEFT;
|
||||
|
@ -1082,7 +1066,7 @@ gimp_rectangle_tool_motion (GimpTool *tool,
|
|||
else if (inc_x > 0 && inc_y > 0)
|
||||
function = RECT_RESIZING_LOWER_RIGHT;
|
||||
|
||||
g_object_set (rectangle, "function", function, NULL);
|
||||
gimp_rectangle_tool_set_function (rectangle, function);
|
||||
}
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
|
@ -1157,7 +1141,7 @@ gimp_rectangle_tool_check_function (GimpRectangleTool *rectangle,
|
|||
gint cury)
|
||||
{
|
||||
GimpRectangleToolPrivate *private;
|
||||
guint function;
|
||||
GimpRectangleFunction function;
|
||||
|
||||
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rectangle);
|
||||
|
||||
|
@ -1277,8 +1261,7 @@ gimp_rectangle_tool_check_function (GimpRectangleTool *rectangle,
|
|||
break;
|
||||
}
|
||||
|
||||
if (function != private->function)
|
||||
g_object_set (rectangle, "function", function, NULL);
|
||||
gimp_rectangle_tool_set_function (rectangle, function);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -1372,10 +1355,7 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
|
|||
draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
|
||||
if (tool->display != display)
|
||||
{
|
||||
g_object_set (tool, "function", RECT_CREATING, NULL);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
if (coords->x > private->x1 && coords->x < private->x2 &&
|
||||
coords->y > private->y1 && coords->y < private->y2)
|
||||
|
@ -1453,12 +1433,7 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
|
|||
function = RECT_CREATING;
|
||||
}
|
||||
|
||||
if (function != private->function)
|
||||
{
|
||||
gimp_draw_tool_pause (draw_tool);
|
||||
g_object_set (tool, "function", function, NULL);
|
||||
gimp_draw_tool_resume (draw_tool);
|
||||
}
|
||||
gimp_rectangle_tool_set_function (GIMP_RECTANGLE_TOOL (tool), function);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1744,7 +1719,7 @@ gimp_rectangle_tool_halt (GimpRectangleTool *rectangle)
|
|||
tool->display = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
g_object_set (rectangle, "function", RECT_INACTIVE, NULL);
|
||||
gimp_rectangle_tool_set_function (rectangle, RECT_INACTIVE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -1858,11 +1833,11 @@ gimp_rectangle_tool_synthesize_motion (GimpTool *tool,
|
|||
|
||||
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (tool);
|
||||
|
||||
g_object_set (tool, "function", function, NULL);
|
||||
|
||||
private->startx = startx;
|
||||
private->starty = starty;
|
||||
|
||||
gimp_rectangle_tool_set_function (GIMP_RECTANGLE_TOOL (tool), function);
|
||||
|
||||
gimp_rectangle_tool_motion (tool, coords, 0, 0, tool->display);
|
||||
|
||||
g_signal_emit_by_name (tool, "rectangle-changed", NULL);
|
||||
|
@ -2015,6 +1990,38 @@ gimp_rectangle_tool_options_notify (GimpRectangleOptions *options,
|
|||
}
|
||||
}
|
||||
|
||||
GimpRectangleFunction
|
||||
gimp_rectangle_tool_get_function (GimpRectangleTool *rectangle)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_RECTANGLE_TOOL (rectangle), RECT_INACTIVE);
|
||||
|
||||
return GIMP_RECTANGLE_TOOL_GET_PRIVATE (rectangle)->function;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_rectangle_tool_set_function (GimpRectangleTool *rectangle,
|
||||
GimpRectangleFunction function)
|
||||
{
|
||||
GimpRectangleToolPrivate *private;
|
||||
|
||||
g_return_if_fail (GIMP_IS_RECTANGLE_TOOL (rectangle));
|
||||
|
||||
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rectangle);
|
||||
|
||||
/* redraw the tool when the function changes */
|
||||
/* FIXME: should also update the cursor */
|
||||
if (private->function != function)
|
||||
{
|
||||
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (rectangle);
|
||||
|
||||
gimp_draw_tool_pause (draw_tool);
|
||||
|
||||
private->function = function;
|
||||
|
||||
gimp_draw_tool_resume (draw_tool);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_rectangle_tool_no_movement (GimpRectangleTool *rectangle)
|
||||
{
|
||||
|
|
|
@ -27,14 +27,13 @@ typedef enum
|
|||
GIMP_RECTANGLE_TOOL_PROP_Y1,
|
||||
GIMP_RECTANGLE_TOOL_PROP_X2,
|
||||
GIMP_RECTANGLE_TOOL_PROP_Y2,
|
||||
GIMP_RECTANGLE_TOOL_PROP_FUNCTION,
|
||||
GIMP_RECTANGLE_TOOL_PROP_CONSTRAINT,
|
||||
GIMP_RECTANGLE_TOOL_PROP_LAST = GIMP_RECTANGLE_TOOL_PROP_CONSTRAINT
|
||||
} GimpRectangleToolProp;
|
||||
|
||||
|
||||
/* possible functions */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
RECT_INACTIVE,
|
||||
RECT_CREATING,
|
||||
|
@ -48,7 +47,7 @@ enum
|
|||
RECT_RESIZING_TOP,
|
||||
RECT_RESIZING_BOTTOM,
|
||||
RECT_EXECUTING
|
||||
};
|
||||
} GimpRectangleFunction;
|
||||
|
||||
|
||||
#define GIMP_TYPE_RECTANGLE_TOOL (gimp_rectangle_tool_interface_get_type ())
|
||||
|
@ -124,6 +123,9 @@ void gimp_rectangle_tool_cancel (GimpRectangleTool *re
|
|||
void gimp_rectangle_tool_configure (GimpRectangleTool *rectangle);
|
||||
void gimp_rectangle_tool_set_constraint (GimpRectangleTool *rectangle,
|
||||
GimpRectangleConstraint constraint);
|
||||
GimpRectangleFunction gimp_rectangle_tool_get_function (GimpRectangleTool *rectangle);
|
||||
void gimp_rectangle_tool_set_function (GimpRectangleTool *rectangle,
|
||||
GimpRectangleFunction function);
|
||||
gboolean gimp_rectangle_tool_no_movement (GimpRectangleTool *rectangle);
|
||||
void gimp_rectangle_tool_get_press_coords (GimpRectangleTool *rectangle,
|
||||
gint *pressx_ptr,
|
||||
|
|
Loading…
Reference in a new issue