Do not do shell darkening while GimpRectangleTool rectangles are being

2007-11-04  Martin Nordholts  <martinn@svn.gnome.org>

	Do not do shell darkening while GimpRectangleTool rectangles are
	being rubber-banded.

	* app/tools/gimprectangletool.c
	(gimp_rectangle_tool_button_press)
	(gimp_rectangle_tool_button_release): Maintain a variable keeping
	track of if the rectangle is being rubber banded or not.
	(gimp_rectangle_tool_update_highlight): Do not set a shell
	highligt if the rectangle is being rubber-banded.
	(gimp_rectangle_tool_rubber_banding_func): New helper function.

svn path=/trunk/; revision=24059
This commit is contained in:
Martin Nordholts 2007-11-04 21:26:01 +00:00 committed by Martin Nordholts
parent f6994c34f5
commit a07756d894
2 changed files with 83 additions and 9 deletions

View File

@ -1,3 +1,16 @@
2007-11-04 Martin Nordholts <martinn@svn.gnome.org>
Do not do shell darkening while GimpRectangleTool rectangles are
being rubber-banded.
* app/tools/gimprectangletool.c
(gimp_rectangle_tool_button_press)
(gimp_rectangle_tool_button_release): Maintain a variable keeping
track of if the rectangle is being rubber banded or not.
(gimp_rectangle_tool_update_highlight): Do not set a shell
highligt if the rectangle is being rubber-banded.
(gimp_rectangle_tool_rubber_banding_func): New helper function.
2007-11-04 Sven Neumann <sven@gimp.org>
* app/widgets/gimpviewrendererbrush.c: implement

View File

@ -156,6 +156,9 @@ struct _GimpRectangleToolPrivate
*/
gboolean narrow_mode;
/* True when the rectangle is being rubber banded. */
gboolean rubber_banding;
/* For what scale the handle sizes is calculated. We must cache this so that
* we can differentiate between when the tool is resumed because of zoom level
* just has changed or because the highlight has just been updated.
@ -214,6 +217,8 @@ static GtkAnchorType gimp_rectangle_tool_get_anchor (GimpRectangleTool
static void gimp_rectangle_tool_update_highlight (GimpRectangleTool *rect_tool);
static gboolean gimp_rectangle_tool_rubber_banding_func (GimpRectangleTool *rect_tool);
static void gimp_rectangle_tool_update_handle_sizes (GimpRectangleTool *rect_tool);
static gboolean gimp_rectangle_tool_scale_has_changed (GimpRectangleTool *rect_tool);
@ -902,6 +907,11 @@ gimp_rectangle_tool_button_press (GimpTool *tool,
private->other_side_y = other_side_y;
}
/* Is the rectangle being rubber-banded? */
private->rubber_banding = gimp_rectangle_tool_rubber_banding_func (rect_tool);
gimp_rectangle_tool_update_highlight (rect_tool);
gimp_tool_control_activate (tool->control);
gimp_draw_tool_resume (draw_tool);
@ -978,6 +988,9 @@ gimp_rectangle_tool_button_release (GimpTool *tool,
gimp_tool_control_set_snap_offsets (tool->control, 0, 0, 0, 0);
/* On button release, we are not rubber-banding the rectangle any longer. */
private->rubber_banding = FALSE;
gimp_rectangle_tool_update_highlight (rect_tool);
gimp_rectangle_tool_update_handle_sizes (rect_tool);
@ -1033,8 +1046,12 @@ gimp_rectangle_tool_motion (GimpTool *tool,
current_x,
current_y);
/* Update the highlight. */
gimp_rectangle_tool_update_highlight (rect_tool);
/* Update the highlight, but only if it is not being
* rubber-banded. If it is being rubber-banded, the highlight is not
* shown anyway.
*/
if (! gimp_rectangle_tool_rubber_banding_func (rect_tool))
gimp_rectangle_tool_update_highlight (rect_tool);
if (private->function != RECT_MOVING &&
private->function != RECT_EXECUTING)
@ -2672,10 +2689,16 @@ gimp_rectangle_tool_get_anchor (GimpRectangleToolPrivate *private)
static void
gimp_rectangle_tool_update_highlight (GimpRectangleTool *rect_tool)
{
GimpTool *tool = GIMP_TOOL (rect_tool);
GimpRectangleOptions *options = GIMP_RECTANGLE_TOOL_GET_OPTIONS (tool);
GimpDisplayShell *shell;
gboolean highlight = FALSE;
GimpRectangleToolPrivate *private;
GimpTool *tool;
GimpRectangleOptions *options;
GimpDisplayShell *shell;
gboolean highlight;
tool = GIMP_TOOL (rect_tool);
options = GIMP_RECTANGLE_TOOL_GET_OPTIONS (tool);
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
highlight = FALSE;
if (! tool->display)
return;
@ -2684,7 +2707,12 @@ gimp_rectangle_tool_update_highlight (GimpRectangleTool *rect_tool)
g_object_get (options, "highlight", &highlight, NULL);
if (highlight)
/* Don't show the highlight when the mouse is down. */
if (! highlight || private->rubber_banding)
{
gimp_display_shell_set_highlight (shell, NULL);
}
else
{
GimpRectangleToolPrivate *private;
GdkRectangle rect;
@ -2698,10 +2726,43 @@ gimp_rectangle_tool_update_highlight (GimpRectangleTool *rect_tool)
gimp_display_shell_set_highlight (shell, &rect);
}
else
}
/**
* gimp_rectangle_tool_rubber_banding_func:
*
* Returns: %TRUE if the current function is a rubber-banding
* function.
*/
static gboolean
gimp_rectangle_tool_rubber_banding_func (GimpRectangleTool *rect_tool)
{
GimpRectangleToolPrivate *private;
gboolean rubber_banding_func;
rubber_banding_func = FALSE;
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
switch (private->function)
{
gimp_display_shell_set_highlight (shell, NULL);
case RECT_CREATING:
case RECT_RESIZING_LEFT:
case RECT_RESIZING_RIGHT:
case RECT_RESIZING_TOP:
case RECT_RESIZING_BOTTOM:
case RECT_RESIZING_UPPER_LEFT:
case RECT_RESIZING_UPPER_RIGHT:
case RECT_RESIZING_LOWER_LEFT:
case RECT_RESIZING_LOWER_RIGHT:
rubber_banding_func = TRUE;
break;
default:
rubber_banding_func = FALSE;
break;
}
return rubber_banding_func;
}
/**