gimp r26375 - in trunk: . app/display app/tools
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26375 - in trunk: . app/display app/tools
- Date: Tue, 5 Aug 2008 10:11:08 +0000 (UTC)
Author: neo
Date: Tue Aug 5 10:11:07 2008
New Revision: 26375
URL: http://svn.gnome.org/viewvc/gimp?rev=26375&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/app/display/gimpdisplayshell-draw.c
trunk/app/tools/gimpdrawtool.c
trunk/app/tools/gimpdrawtool.h
trunk/app/tools/gimpmovetool.c
Modified: trunk/app/display/gimpdisplayshell-draw.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-draw.c (original)
+++ trunk/app/display/gimpdisplayshell-draw.c Tue Aug 5 10:11:07 2008
@@ -69,8 +69,8 @@
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 @@
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 @@
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);
}
}
}
Modified: trunk/app/tools/gimpdrawtool.c
==============================================================================
--- trunk/app/tools/gimpdrawtool.c (original)
+++ trunk/app/tools/gimpdrawtool.c Tue Aug 5 10:11:07 2008
@@ -28,6 +28,7 @@
#include "base/boundary.h"
+#include "core/gimpguide.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
@@ -539,6 +540,52 @@
}
/**
+ * 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
* @filled: whether to fill the rectangle
Modified: trunk/app/tools/gimpdrawtool.h
==============================================================================
--- trunk/app/tools/gimpdrawtool.h (original)
+++ trunk/app/tools/gimpdrawtool.h Tue Aug 5 10:11:07 2008
@@ -118,6 +118,9 @@
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,
Modified: trunk/app/tools/gimpmovetool.c
==============================================================================
--- trunk/app/tools/gimpmovetool.c (original)
+++ trunk/app/tools/gimpmovetool.c Tue Aug 5 10:11:07 2008
@@ -764,29 +764,9 @@
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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]