app/tools/gimprectangleselecttool.c formatting.
2007-07-31 Sven Neumann <sven@gimp.org> * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c: formatting. svn path=/trunk/; revision=23083
This commit is contained in:

committed by
Sven Neumann

parent
faed28c054
commit
e419ea20c9
@ -1,3 +1,8 @@
|
|||||||
|
2007-07-31 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/tools/gimprectangleselecttool.c
|
||||||
|
* app/tools/gimprectangletool.c: formatting.
|
||||||
|
|
||||||
2007-07-31 Sven Neumann <sven@gimp.org>
|
2007-07-31 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimptoolview.c (gimp_tool_view_eye_clicked): don't
|
* app/widgets/gimptoolview.c (gimp_tool_view_eye_clicked): don't
|
||||||
|
@ -293,6 +293,7 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||||||
{
|
{
|
||||||
GimpRectangleTool *rectangle = GIMP_RECTANGLE_TOOL (tool);
|
GimpRectangleTool *rectangle = GIMP_RECTANGLE_TOOL (tool);
|
||||||
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
|
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
|
||||||
|
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
|
||||||
GimpRectangleFunction function;
|
GimpRectangleFunction function;
|
||||||
|
|
||||||
if (tool->display && display != tool->display)
|
if (tool->display && display != tool->display)
|
||||||
@ -300,15 +301,14 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||||||
|
|
||||||
function = gimp_rectangle_tool_get_function (rectangle);
|
function = gimp_rectangle_tool_get_function (rectangle);
|
||||||
|
|
||||||
rect_select->saved_show_selection
|
rect_select->saved_show_selection =
|
||||||
= gimp_display_shell_get_show_selection (GIMP_DISPLAY_SHELL (display->shell));
|
gimp_display_shell_get_show_selection (shell);
|
||||||
|
|
||||||
if (function == RECT_INACTIVE)
|
if (function == RECT_INACTIVE)
|
||||||
{
|
{
|
||||||
GimpDisplay *old_display;
|
GimpDisplay *old_display = tool->display;
|
||||||
gboolean edit_started;
|
gboolean edit_started;
|
||||||
|
|
||||||
old_display = tool->display;
|
|
||||||
tool->display = display;
|
tool->display = display;
|
||||||
gimp_tool_control_activate (tool->control);
|
gimp_tool_control_activate (tool->control);
|
||||||
|
|
||||||
@ -317,6 +317,7 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||||||
|
|
||||||
if (gimp_tool_control_is_active (tool->control))
|
if (gimp_tool_control_is_active (tool->control))
|
||||||
gimp_tool_control_halt (tool->control);
|
gimp_tool_control_halt (tool->control);
|
||||||
|
|
||||||
tool->display = old_display;
|
tool->display = old_display;
|
||||||
|
|
||||||
if (edit_started)
|
if (edit_started)
|
||||||
@ -370,8 +371,7 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||||||
/* if the operation is "Replace", turn off the marching ants,
|
/* if the operation is "Replace", turn off the marching ants,
|
||||||
because they are confusing */
|
because they are confusing */
|
||||||
if (operation == GIMP_CHANNEL_OP_REPLACE)
|
if (operation == GIMP_CHANNEL_OP_REPLACE)
|
||||||
gimp_display_shell_set_show_selection (GIMP_DISPLAY_SHELL (display->shell),
|
gimp_display_shell_set_show_selection (shell, FALSE);
|
||||||
FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rect_select->undo = NULL;
|
rect_select->undo = NULL;
|
||||||
@ -398,9 +398,7 @@ gimp_rect_select_tool_button_release (GimpTool *tool,
|
|||||||
if (release_type == GIMP_BUTTON_RELEASE_CLICK)
|
if (release_type == GIMP_BUTTON_RELEASE_CLICK)
|
||||||
{
|
{
|
||||||
GimpImage *image = tool->display->image;
|
GimpImage *image = tool->display->image;
|
||||||
GimpUndo *redo;
|
GimpUndo *redo = gimp_undo_stack_peek (image->redo_stack);
|
||||||
|
|
||||||
redo = gimp_undo_stack_peek (image->redo_stack);
|
|
||||||
|
|
||||||
if (redo && rect_select->redo == redo)
|
if (redo && rect_select->redo == redo)
|
||||||
{
|
{
|
||||||
@ -505,14 +503,12 @@ gimp_rect_select_tool_select (GimpRectangleTool *rectangle,
|
|||||||
GimpTool *tool = GIMP_TOOL (rectangle);
|
GimpTool *tool = GIMP_TOOL (rectangle);
|
||||||
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (rectangle);
|
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (rectangle);
|
||||||
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
|
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
|
||||||
GimpImage *image;
|
GimpImage *image = tool->display->image;
|
||||||
gboolean rectangle_exists;
|
gboolean rectangle_exists;
|
||||||
GimpChannelOps operation;
|
GimpChannelOps operation;
|
||||||
|
|
||||||
gimp_tool_pop_status (tool, tool->display);
|
gimp_tool_pop_status (tool, tool->display);
|
||||||
|
|
||||||
image = tool->display->image;
|
|
||||||
|
|
||||||
rectangle_exists = (x <= image->width && y <= image->height &&
|
rectangle_exists = (x <= image->width && y <= image->height &&
|
||||||
x + w >= 0 && y + h >= 0 &&
|
x + w >= 0 && y + h >= 0 &&
|
||||||
w > 0 && h > 0);
|
w > 0 && h > 0);
|
||||||
@ -539,20 +535,24 @@ gimp_rect_select_tool_real_select (GimpRectSelectTool *rect_select,
|
|||||||
gint w,
|
gint w,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
GimpTool *tool = GIMP_TOOL (rect_select);
|
GimpTool *tool = GIMP_TOOL (rect_select);
|
||||||
GimpSelectionOptions *options;
|
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
|
||||||
GimpRectSelectOptions *rect_select_options;
|
GimpRectSelectOptions *rect_select_options;
|
||||||
|
GimpChannel *channel;
|
||||||
|
|
||||||
options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
|
|
||||||
rect_select_options = GIMP_RECT_SELECT_TOOL_GET_OPTIONS (tool);
|
rect_select_options = GIMP_RECT_SELECT_TOOL_GET_OPTIONS (tool);
|
||||||
|
|
||||||
|
channel = gimp_image_get_mask (tool->display->image);
|
||||||
|
|
||||||
if (rect_select_options->round_corners)
|
if (rect_select_options->round_corners)
|
||||||
{
|
{
|
||||||
/* To prevent elliptification of the rect, we must cap the corner radius */
|
/* To prevent elliptification of the rectangle,
|
||||||
gdouble radius = MIN (rect_select_options->corner_radius,
|
* we must cap the corner radius.
|
||||||
MIN (w / 2.0, h / 2.0));
|
*/
|
||||||
|
gdouble max = MIN (w / 2.0, h / 2.0);
|
||||||
|
gdouble radius = MIN (rect_select_options->corner_radius, max);
|
||||||
|
|
||||||
gimp_channel_select_round_rect (gimp_image_get_mask (tool->display->image),
|
gimp_channel_select_round_rect (channel,
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
radius, radius,
|
radius, radius,
|
||||||
operation,
|
operation,
|
||||||
@ -564,7 +564,7 @@ gimp_rect_select_tool_real_select (GimpRectSelectTool *rect_select,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gimp_channel_select_rectangle (gimp_image_get_mask (tool->display->image),
|
gimp_channel_select_rectangle (channel,
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
operation,
|
operation,
|
||||||
options->feather,
|
options->feather,
|
||||||
@ -665,7 +665,7 @@ gimp_rect_select_tool_cancel (GimpRectangleTool *rectangle)
|
|||||||
* we have already "executed", and need to undo at this point,
|
* we have already "executed", and need to undo at this point,
|
||||||
* unless the user has done something in the meantime
|
* unless the user has done something in the meantime
|
||||||
*/
|
*/
|
||||||
undo = gimp_undo_stack_peek (image->undo_stack);
|
undo = gimp_undo_stack_peek (image->undo_stack);
|
||||||
|
|
||||||
if (undo && rect_select->undo == undo)
|
if (undo && rect_select->undo == undo)
|
||||||
{
|
{
|
||||||
@ -728,7 +728,9 @@ gimp_rect_select_tool_rectangle_changed (GimpRectangleTool *rectangle)
|
|||||||
|
|
||||||
if (! rect_select->use_saved_op)
|
if (! rect_select->use_saved_op)
|
||||||
{
|
{
|
||||||
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
|
GimpSelectionOptions *options;
|
||||||
|
|
||||||
|
options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
|
||||||
|
|
||||||
/* remember the operation now in case we modify the rectangle */
|
/* remember the operation now in case we modify the rectangle */
|
||||||
rect_select->operation = options->operation;
|
rect_select->operation = options->operation;
|
||||||
|
@ -910,9 +910,9 @@ gimp_rectangle_tool_motion (GimpTool *tool,
|
|||||||
gint dx = current_x - private->lastx;
|
gint dx = current_x - private->lastx;
|
||||||
gint dy = current_y - private->lasty;
|
gint dy = current_y - private->lasty;
|
||||||
|
|
||||||
/* When the user starts to move the cursor, set the current function to
|
/* When the user starts to move the cursor, set the current
|
||||||
* one of the corner-grabbed functions, depending on in what direction
|
* function to one of the corner-grabbed functions, depending on
|
||||||
* the user starts dragging the rectangle.
|
* in what direction the user starts dragging the rectangle.
|
||||||
*/
|
*/
|
||||||
if (dx < 0)
|
if (dx < 0)
|
||||||
{
|
{
|
||||||
@ -1399,9 +1399,9 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* FIXME: This is currently the only measure done to make this area
|
/* FIXME: This is currently the only measure done to make
|
||||||
* dead. In the final code the concrete rectangle tools will have to
|
* this area dead. In the final code the concrete rectangle
|
||||||
* be written to handle this state.
|
* tools will have to be written to handle this state.
|
||||||
*/
|
*/
|
||||||
function = RECT_DEAD;
|
function = RECT_DEAD;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user