mirror of https://github.com/GNOME/gimp.git
draw the guide all across the canvas, not limiting it to the image.
2008-08-05 Sven Neumann <sven@gimp.org> * app/display/gimpdisplayshell-draw.c (gimp_display_shell_draw_guide): draw the guide all across the canvas, not limiting it to the image. * app/tools/gimpdrawtool.[ch]: added new function gimp_draw_tool_draw_guide_line(). * app/tools/gimpmovetool.c (gimp_move_tool_draw): use it. svn path=/trunk/; revision=26375
This commit is contained in:
parent
350190c683
commit
b8ce815e54
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2008-08-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell-draw.c (gimp_display_shell_draw_guide):
|
||||
draw the guide all across the canvas, not limiting it to the image.
|
||||
|
||||
* app/tools/gimpdrawtool.[ch]: added new function
|
||||
gimp_draw_tool_draw_guide_line().
|
||||
|
||||
* app/tools/gimpmovetool.c (gimp_move_tool_draw): use it.
|
||||
|
||||
2008-08-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* menus/image-menu.xml.in: moved the Windows menu next to the Help
|
||||
|
|
|
@ -69,8 +69,8 @@ gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
|||
gboolean active)
|
||||
{
|
||||
gint position;
|
||||
gint x1, x2, y1, y2;
|
||||
gint x, y, w, h;
|
||||
gint x1, y1, x2, y2;
|
||||
gint x, y;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (GIMP_IS_GUIDE (guide));
|
||||
|
@ -80,18 +80,10 @@ gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
|||
if (position < 0)
|
||||
return;
|
||||
|
||||
gimp_display_shell_transform_xy (shell, 0, 0, &x1, &y1, FALSE);
|
||||
gimp_display_shell_transform_xy (shell,
|
||||
gimp_image_get_width (shell->display->image),
|
||||
gimp_image_get_height (shell->display->image),
|
||||
&x2, &y2, FALSE);
|
||||
x1 = 0;
|
||||
y1 = 0;
|
||||
|
||||
gdk_drawable_get_size (shell->canvas->window, &w, &h);
|
||||
|
||||
x1 = MAX (x1, 0);
|
||||
y1 = MAX (y1, 0);
|
||||
x2 = MIN (x2, w);
|
||||
y2 = MIN (y2, h);
|
||||
gdk_drawable_get_size (shell->canvas->window, &x2, &y2);
|
||||
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
|
@ -129,9 +121,7 @@ gimp_display_shell_draw_guides (GimpDisplayShell *shell)
|
|||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
gimp_display_shell_draw_guide (shell,
|
||||
(GimpGuide *) list->data,
|
||||
FALSE);
|
||||
gimp_display_shell_draw_guide (shell, list->data, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "base/boundary.h"
|
||||
|
||||
#include "core/gimpguide.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplist.h"
|
||||
|
||||
|
@ -538,6 +539,52 @@ gimp_draw_tool_draw_dashed_line (GimpDrawTool *draw_tool,
|
|||
PROJ_ROUND (tx2), PROJ_ROUND (ty2));
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_draw_tool_draw_guide:
|
||||
* @draw_tool: the #GimpDrawTool
|
||||
* @orientation: the orientation of the guide line
|
||||
* @position: the position of the guide line in image coordinates
|
||||
*
|
||||
* This function draws a guide line across the canvas.
|
||||
**/
|
||||
void
|
||||
gimp_draw_tool_draw_guide_line (GimpDrawTool *draw_tool,
|
||||
GimpOrientationType orientation,
|
||||
gint position)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
gint x1, y1, x2, y2;
|
||||
gint x, y;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (draw_tool->display->shell);
|
||||
|
||||
x1 = 0;
|
||||
y1 = 0;
|
||||
|
||||
gdk_drawable_get_size (shell->canvas->window, &x2, &y2);
|
||||
|
||||
switch (orientation)
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_display_shell_transform_xy (shell, 0, position, &x, &y, FALSE);
|
||||
y1 = y2 = y;
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
gimp_display_shell_transform_xy (shell, position, 0, &x, &y, FALSE);
|
||||
x1 = x2 = x;
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_UNKNOWN:
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR,
|
||||
x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_draw_tool_draw_rectangle:
|
||||
* @draw_tool: the #GimpDrawTool
|
||||
|
|
|
@ -118,6 +118,9 @@ void gimp_draw_tool_draw_dashed_line (GimpDrawTool *draw_tool,
|
|||
gdouble x2,
|
||||
gdouble y2,
|
||||
gboolean use_offsets);
|
||||
void gimp_draw_tool_draw_guide_line (GimpDrawTool *draw_tool,
|
||||
GimpOrientationType orientation,
|
||||
gint position);
|
||||
void gimp_draw_tool_draw_rectangle (GimpDrawTool *draw_tool,
|
||||
gboolean filled,
|
||||
gdouble x,
|
||||
|
|
|
@ -764,29 +764,9 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool)
|
|||
|
||||
if (move->moving_guide && move->guide_position != -1)
|
||||
{
|
||||
GimpImage *image = draw_tool->display->image;
|
||||
|
||||
switch (move->guide_orientation)
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_draw_tool_draw_line (draw_tool,
|
||||
0, move->guide_position,
|
||||
gimp_image_get_width (image),
|
||||
move->guide_position,
|
||||
FALSE);
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
gimp_draw_tool_draw_line (draw_tool,
|
||||
move->guide_position, 0,
|
||||
move->guide_position,
|
||||
gimp_image_get_height (image),
|
||||
FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
gimp_draw_tool_draw_guide_line (draw_tool,
|
||||
move->guide_orientation,
|
||||
move->guide_position);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue