gimp r26681 - in trunk: . app/display app/tools
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26681 - in trunk: . app/display app/tools
- Date: Wed, 20 Aug 2008 16:22:09 +0000 (UTC)
Author: mitch
Date: Wed Aug 20 16:22:09 2008
New Revision: 26681
URL: http://svn.gnome.org/viewvc/gimp?rev=26681&view=rev
Log:
2008-08-20 Michael Natterer <mitch gimp org>
Bug 496772 â Position shown in the statusbar needs more
precision (for some tools)
* app/display/display-enums.[ch]: add enum GimpCursorPrecision
which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }.
* app/display/gimpdisplayshell-cursor.[ch]: add "precision"
parameter to gimp_display_shell_update_cursor() and pass it
on to the statusbar.
* app/display/gimpstatusbar.[ch]: add "precision" parameters to
the cursor coordinates APIs, offset the passed coords accordingly
and display them with one decimal point if SUBPIXEL is requested
and the display's unit is PIXEL. Keep a second floating-point
format string around at any time.
* app/tools/gimptoolcontrol.[ch]: add a "precision" member and API
so tools can configure the precision they need. Defalt to
PIXEL_CENTER since that's right for almost all tools.
* app/display/gimpdisplayshell-callbacks.c: pass the tool's
precision to gimp_display_shell_update_cursor().
* app/tools/gimptool.[ch]: add "precision" parameter to
gimp_tool_push_status_coords() and pass it on to the statusbar.
* app/tools/gimpaligntool.c
* app/tools/gimpblendtool.c
* app/tools/gimpcolortool.c
* app/tools/gimpcroptool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpfliptool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpmovetool.c
* app/tools/gimppainttool.c
* app/tools/gimpperspectiveclonetool.c
* app/tools/gimprectangleselecttool.c
* app/tools/gimprectangletool.c
* app/tools/gimptransformtool.c
* app/tools/gimpvectortool.c: set precision in init() where
needed. Adjust the precision in the fly when needed, e.g. while
moving guides or when toggling hard-edge on paint tools. Also pass
an appropriate precision to gimp_tool_push_status_coords(), which
is not always the tool's precision as used for cursor display.
Modified:
trunk/ChangeLog
trunk/app/display/display-enums.c
trunk/app/display/display-enums.h
trunk/app/display/gimpdisplayshell-callbacks.c
trunk/app/display/gimpdisplayshell-cursor.c
trunk/app/display/gimpdisplayshell-cursor.h
trunk/app/display/gimpstatusbar.c
trunk/app/display/gimpstatusbar.h
trunk/app/tools/gimpaligntool.c
trunk/app/tools/gimpblendtool.c
trunk/app/tools/gimpcolortool.c
trunk/app/tools/gimpcroptool.c
trunk/app/tools/gimpeditselectiontool.c
trunk/app/tools/gimpfliptool.c
trunk/app/tools/gimpfreeselecttool.c
trunk/app/tools/gimpmovetool.c
trunk/app/tools/gimppainttool.c
trunk/app/tools/gimpperspectiveclonetool.c
trunk/app/tools/gimprectangleselecttool.c
trunk/app/tools/gimprectangletool.c
trunk/app/tools/gimptool.c
trunk/app/tools/gimptool.h
trunk/app/tools/gimptoolcontrol.c
trunk/app/tools/gimptoolcontrol.h
trunk/app/tools/gimptransformtool.c
trunk/app/tools/gimpvectortool.c
Modified: trunk/app/display/display-enums.c
==============================================================================
--- trunk/app/display/display-enums.c (original)
+++ trunk/app/display/display-enums.c Wed Aug 20 16:22:09 2008
@@ -39,6 +39,36 @@
}
GType
+gimp_cursor_precision_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_CURSOR_PRECISION_PIXEL_CENTER, "GIMP_CURSOR_PRECISION_PIXEL_CENTER", "pixel-center" },
+ { GIMP_CURSOR_PRECISION_PIXEL_BORDER, "GIMP_CURSOR_PRECISION_PIXEL_BORDER", "pixel-border" },
+ { GIMP_CURSOR_PRECISION_SUBPIXEL, "GIMP_CURSOR_PRECISION_SUBPIXEL", "subpixel" },
+ { 0, NULL, NULL }
+ };
+
+ static const GimpEnumDesc descs[] =
+ {
+ { GIMP_CURSOR_PRECISION_PIXEL_CENTER, "GIMP_CURSOR_PRECISION_PIXEL_CENTER", NULL },
+ { GIMP_CURSOR_PRECISION_PIXEL_BORDER, "GIMP_CURSOR_PRECISION_PIXEL_BORDER", NULL },
+ { GIMP_CURSOR_PRECISION_SUBPIXEL, "GIMP_CURSOR_PRECISION_SUBPIXEL", NULL },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (! type)
+ {
+ type = g_enum_register_static ("GimpCursorPrecision", values);
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+GType
gimp_canvas_padding_mode_get_type (void)
{
static const GEnumValue values[] =
Modified: trunk/app/display/display-enums.h
==============================================================================
--- trunk/app/display/display-enums.h (original)
+++ trunk/app/display/display-enums.h Wed Aug 20 16:22:09 2008
@@ -32,6 +32,18 @@
} GimpCursorMode;
+#define GIMP_TYPE_CURSOR_PRECISION (gimp_cursor_precision_get_type ())
+
+GType gimp_cursor_precision_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_CURSOR_PRECISION_PIXEL_CENTER,
+ GIMP_CURSOR_PRECISION_PIXEL_BORDER,
+ GIMP_CURSOR_PRECISION_SUBPIXEL
+} GimpCursorPrecision;
+
+
#define GIMP_TYPE_CANVAS_PADDING_MODE (gimp_canvas_padding_mode_get_type ())
GType gimp_canvas_padding_mode_get_type (void) G_GNUC_CONST;
Modified: trunk/app/display/gimpdisplayshell-callbacks.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-callbacks.c (original)
+++ trunk/app/display/gimpdisplayshell-callbacks.c Wed Aug 20 16:22:09 2008
@@ -1529,11 +1529,21 @@
}
if (update_sw_cursor)
- gimp_display_shell_update_cursor (shell,
- (gint) display_coords.x,
- (gint) display_coords.y,
- (gint) image_coords.x,
- (gint) image_coords.y);
+ {
+ GimpCursorPrecision precision = GIMP_CURSOR_PRECISION_PIXEL_CENTER;
+
+ active_tool = tool_manager_get_active (gimp);
+
+ if (active_tool)
+ precision = gimp_tool_control_get_precision (active_tool->control);
+
+ gimp_display_shell_update_cursor (shell,
+ precision,
+ (gint) display_coords.x,
+ (gint) display_coords.y,
+ image_coords.x,
+ image_coords.y);
+ }
return return_val;
}
Modified: trunk/app/display/gimpdisplayshell-cursor.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-cursor.c (original)
+++ trunk/app/display/gimpdisplayshell-cursor.c Wed Aug 20 16:22:09 2008
@@ -117,11 +117,12 @@
}
void
-gimp_display_shell_update_cursor (GimpDisplayShell *shell,
- gint display_x,
- gint display_y,
- gint image_x,
- gint image_y)
+gimp_display_shell_update_cursor (GimpDisplayShell *shell,
+ GimpCursorPrecision precision,
+ gint display_x,
+ gint display_y,
+ gdouble image_x,
+ gdouble image_y)
{
GimpDialogFactory *factory;
GimpSessionInfo *session_info;
@@ -159,7 +160,7 @@
* possibly snapped...
*/
gimp_statusbar_update_cursor (GIMP_STATUSBAR (shell->statusbar),
- image_x, image_y);
+ precision, image_x, image_y);
factory = gimp_dialog_factory_from_name ("dock");
session_info = gimp_dialog_factory_find_session_info (factory,
Modified: trunk/app/display/gimpdisplayshell-cursor.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-cursor.h (original)
+++ trunk/app/display/gimpdisplayshell-cursor.h Wed Aug 20 16:22:09 2008
@@ -20,21 +20,22 @@
#define __GIMP_DISPLAY_SHELL_CURSOR_H__
-void gimp_display_shell_set_cursor (GimpDisplayShell *shell,
- GimpCursorType cursor_type,
- GimpToolCursorType tool_cursor,
- GimpCursorModifier modifier);
-void gimp_display_shell_unset_cursor (GimpDisplayShell *shell);
-void gimp_display_shell_set_override_cursor (GimpDisplayShell *shell,
- GimpCursorType cursor_type);
-void gimp_display_shell_unset_override_cursor (GimpDisplayShell *shell);
+void gimp_display_shell_set_cursor (GimpDisplayShell *shell,
+ GimpCursorType cursor_type,
+ GimpToolCursorType tool_cursor,
+ GimpCursorModifier modifier);
+void gimp_display_shell_unset_cursor (GimpDisplayShell *shell);
+void gimp_display_shell_set_override_cursor (GimpDisplayShell *shell,
+ GimpCursorType cursor_type);
+void gimp_display_shell_unset_override_cursor (GimpDisplayShell *shell);
-void gimp_display_shell_update_cursor (GimpDisplayShell *shell,
- gint display_x,
- gint display_y,
- gint image_x,
- gint image_y);
-void gimp_display_shell_clear_cursor (GimpDisplayShell *shell);
+void gimp_display_shell_update_cursor (GimpDisplayShell *shell,
+ GimpCursorPrecision precision,
+ gint display_x,
+ gint display_y,
+ gdouble image_x,
+ gdouble image_y);
+void gimp_display_shell_clear_cursor (GimpDisplayShell *shell);
#endif /* __GIMP_DISPLAY_SHELL_CURSOR_H__ */
Modified: trunk/app/display/gimpstatusbar.c
==============================================================================
--- trunk/app/display/gimpstatusbar.c (original)
+++ trunk/app/display/gimpstatusbar.c Wed Aug 20 16:22:09 2008
@@ -164,8 +164,9 @@
statusbar->temp_context_id =
gimp_statusbar_get_context_id (statusbar, "gimp-statusbar-temp");
- statusbar->cursor_format_str[0] = '\0';
- statusbar->length_format_str[0] = '\0';
+ statusbar->cursor_format_str[0] = '\0';
+ statusbar->cursor_format_str_f[0] = '\0';
+ statusbar->length_format_str[0] = '\0';
statusbar->progress_active = FALSE;
statusbar->progress_shown = FALSE;
@@ -792,14 +793,15 @@
}
void
-gimp_statusbar_push_coords (GimpStatusbar *statusbar,
- const gchar *context,
- const gchar *stock_id,
- const gchar *title,
- gdouble x,
- const gchar *separator,
- gdouble y,
- const gchar *help)
+gimp_statusbar_push_coords (GimpStatusbar *statusbar,
+ const gchar *context,
+ const gchar *stock_id,
+ GimpCursorPrecision precision,
+ const gchar *title,
+ gdouble x,
+ const gchar *separator,
+ gdouble y,
+ const gchar *help)
{
GimpDisplayShell *shell;
@@ -812,16 +814,46 @@
shell = statusbar->shell;
+ switch (precision)
+ {
+ case GIMP_CURSOR_PRECISION_PIXEL_CENTER:
+ x = RINT (x + 0.5);
+ y = RINT (y + 0.5);
+ break;
+
+ case GIMP_CURSOR_PRECISION_PIXEL_BORDER:
+ x = RINT (x);
+ y = RINT (y);
+ break;
+
+ case GIMP_CURSOR_PRECISION_SUBPIXEL:
+ break;
+ }
+
if (shell->unit == GIMP_UNIT_PIXEL)
{
- gimp_statusbar_push (statusbar, context,
- stock_id,
- statusbar->cursor_format_str,
- title,
- (gint) RINT (x),
- separator,
- (gint) RINT (y),
- help);
+ if (precision == GIMP_CURSOR_PRECISION_SUBPIXEL)
+ {
+ gimp_statusbar_push (statusbar, context,
+ stock_id,
+ statusbar->cursor_format_str_f,
+ title,
+ x,
+ separator,
+ y,
+ help);
+ }
+ else
+ {
+ gimp_statusbar_push (statusbar, context,
+ stock_id,
+ statusbar->cursor_format_str,
+ title,
+ (gint) RINT (x),
+ separator,
+ (gint) RINT (y),
+ help);
+ }
}
else /* show real world units */
{
@@ -1132,13 +1164,12 @@
}
void
-gimp_statusbar_update_cursor (GimpStatusbar *statusbar,
- gdouble x,
- gdouble y)
+gimp_statusbar_update_cursor (GimpStatusbar *statusbar,
+ GimpCursorPrecision precision,
+ gdouble x,
+ gdouble y)
{
GimpDisplayShell *shell;
- GtkTreeModel *model;
- GimpUnitStore *store;
gchar buffer[CURSOR_LEN];
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
@@ -1158,19 +1189,46 @@
gtk_widget_set_sensitive (statusbar->cursor_label, TRUE);
}
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (statusbar->unit_combo));
- store = GIMP_UNIT_STORE (model);
+ switch (precision)
+ {
+ case GIMP_CURSOR_PRECISION_PIXEL_CENTER:
+ x = RINT (x + 0.5);
+ y = RINT (y + 0.5);
+ break;
+
+ case GIMP_CURSOR_PRECISION_PIXEL_BORDER:
+ x = RINT (x);
+ y = RINT (y);
+ break;
- gimp_unit_store_set_pixel_values (store, x, y);
+ case GIMP_CURSOR_PRECISION_SUBPIXEL:
+ break;
+ }
if (shell->unit == GIMP_UNIT_PIXEL)
{
- g_snprintf (buffer, sizeof (buffer),
- statusbar->cursor_format_str,
- "", (gint) RINT (x), ", ", (gint) RINT (y), "");
+ if (precision == GIMP_CURSOR_PRECISION_SUBPIXEL)
+ {
+ g_snprintf (buffer, sizeof (buffer),
+ statusbar->cursor_format_str_f,
+ "", x, ", ", y, "");
+ }
+ else
+ {
+ g_snprintf (buffer, sizeof (buffer),
+ statusbar->cursor_format_str,
+ "", (gint) RINT (x), ", ", (gint) RINT (y), "");
+ }
}
else /* show real world units */
{
+ GtkTreeModel *model;
+ GimpUnitStore *store;
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (statusbar->unit_combo));
+ store = GIMP_UNIT_STORE (model);
+
+ gimp_unit_store_set_pixel_values (store, x, y);
gimp_unit_store_get_values (store, shell->unit, &x, &y);
g_snprintf (buffer, sizeof (buffer),
@@ -1275,6 +1333,9 @@
g_snprintf (statusbar->cursor_format_str,
sizeof (statusbar->cursor_format_str),
"%%s%%d%%s%%d%%s");
+ g_snprintf (statusbar->cursor_format_str_f,
+ sizeof (statusbar->cursor_format_str_f),
+ "%%s%%.1f%%s%%.1f%%s");
g_snprintf (statusbar->length_format_str,
sizeof (statusbar->length_format_str),
"%%s%%d%%s");
@@ -1286,13 +1347,15 @@
"%%s%%.%df%%s%%.%df%%s",
_gimp_unit_get_digits (shell->display->gimp, shell->unit),
_gimp_unit_get_digits (shell->display->gimp, shell->unit));
+ strcpy (statusbar->cursor_format_str_f, statusbar->cursor_format_str);
g_snprintf (statusbar->length_format_str,
sizeof (statusbar->length_format_str),
"%%s%%.%df%%s",
_gimp_unit_get_digits (shell->display->gimp, shell->unit));
}
- gimp_statusbar_update_cursor (statusbar, image_width, image_height);
+ gimp_statusbar_update_cursor (statusbar, GIMP_CURSOR_PRECISION_SUBPIXEL,
+ image_width, image_height);
text = gtk_label_get_text (GTK_LABEL (statusbar->cursor_label));
Modified: trunk/app/display/gimpstatusbar.h
==============================================================================
--- trunk/app/display/gimpstatusbar.h (original)
+++ trunk/app/display/gimpstatusbar.h Wed Aug 20 16:22:09 2008
@@ -52,6 +52,7 @@
GimpMessageSeverity temp_severity;
gchar cursor_format_str[CURSOR_FORMAT_LENGTH];
+ gchar cursor_format_str_f[CURSOR_FORMAT_LENGTH];
gchar length_format_str[CURSOR_FORMAT_LENGTH];
GtkWidget *cursor_label;
@@ -93,6 +94,7 @@
void gimp_statusbar_push_coords (GimpStatusbar *statusbar,
const gchar *context,
const gchar *stock_id,
+ GimpCursorPrecision precision,
const gchar *title,
gdouble x,
const gchar *separator,
@@ -133,6 +135,7 @@
void gimp_statusbar_pop_temp (GimpStatusbar *statusbar);
void gimp_statusbar_update_cursor (GimpStatusbar *statusbar,
+ GimpCursorPrecision precision,
gdouble x,
gdouble y);
void gimp_statusbar_clear_cursor (GimpStatusbar *statusbar);
Modified: trunk/app/tools/gimpaligntool.c
==============================================================================
--- trunk/app/tools/gimpaligntool.c (original)
+++ trunk/app/tools/gimpaligntool.c Wed Aug 20 16:22:09 2008
@@ -176,6 +176,8 @@
align_tool->vert_offset = 0;
gimp_tool_control_set_snap_to (tool->control, FALSE);
+ gimp_tool_control_set_precision (tool->control,
+ GIMP_CURSOR_PRECISION_PIXEL_BORDER);
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_MOVE);
}
Modified: trunk/app/tools/gimpblendtool.c
==============================================================================
--- trunk/app/tools/gimpblendtool.c (original)
+++ trunk/app/tools/gimpblendtool.c Wed Aug 20 16:22:09 2008
@@ -390,7 +390,8 @@
GdkModifierType state,
GimpDisplay *display)
{
- gchar *status_help;
+ GimpTool *tool = GIMP_TOOL (blend_tool);
+ gchar *status_help;
status_help = gimp_suggest_modifiers ("",
((GDK_CONTROL_MASK | GDK_MOD1_MASK)
@@ -398,11 +399,14 @@
NULL,
_("%s for constrained angles"),
_("%s to move the whole line"));
- gimp_tool_push_status_coords (GIMP_TOOL (blend_tool), display,
+
+ gimp_tool_push_status_coords (tool, display,
+ gimp_tool_control_get_precision (tool->control),
_("Blend: "),
blend_tool->end_x - blend_tool->start_x,
", ",
blend_tool->end_y - blend_tool->start_y,
status_help);
+
g_free (status_help);
}
Modified: trunk/app/tools/gimpcolortool.c
==============================================================================
--- trunk/app/tools/gimpcolortool.c (original)
+++ trunk/app/tools/gimpcolortool.c Wed Aug 20 16:22:09 2008
@@ -254,6 +254,7 @@
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
gimp_tool_push_status_coords (tool, display,
+ gimp_tool_control_get_precision (tool->control),
_("Move Sample Point: "),
color_tool->sample_point_x,
", ",
@@ -431,6 +432,7 @@
else
{
gimp_tool_push_status_coords (tool, display,
+ gimp_tool_control_get_precision (tool->control),
color_tool->sample_point ?
_("Move Sample Point: ") :
_("Add Sample Point: "),
Modified: trunk/app/tools/gimpcroptool.c
==============================================================================
--- trunk/app/tools/gimpcroptool.c (original)
+++ trunk/app/tools/gimpcroptool.c Wed Aug 20 16:22:09 2008
@@ -172,6 +172,8 @@
gimp_rectangle_tool_init (GIMP_RECTANGLE_TOOL (crop_tool));
gimp_tool_control_set_wants_click (tool->control, TRUE);
+ gimp_tool_control_set_precision (tool->control,
+ GIMP_CURSOR_PRECISION_PIXEL_BORDER);
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_CROP);
crop_tool->current_image = NULL;
Modified: trunk/app/tools/gimpeditselectiontool.c
==============================================================================
--- trunk/app/tools/gimpeditselectiontool.c (original)
+++ trunk/app/tools/gimpeditselectiontool.c Wed Aug 20 16:22:09 2008
@@ -186,6 +186,7 @@
gboolean propagate_release)
{
GimpEditSelectionTool *edit_select;
+ GimpTool *tool;
GimpDisplayShell *shell;
GimpItem *active_item;
GimpChannel *channel;
@@ -201,6 +202,8 @@
edit_select->propagate_release = propagate_release;
+ tool = GIMP_TOOL (edit_select);
+
shell = GIMP_DISPLAY_SHELL (display->shell);
/* Make a check to see if it should be a floating selection translation */
@@ -429,7 +432,7 @@
break;
}
- gimp_tool_control_set_snap_offsets (GIMP_TOOL (edit_select)->control,
+ gimp_tool_control_set_snap_offsets (tool->control,
x1 - coords->x,
y1 - coords->y,
x2 - x1,
@@ -440,16 +443,17 @@
edit_select->center_y = (y1 + y2) / 2.0;
}
- gimp_tool_control_activate (GIMP_TOOL (edit_select)->control);
- GIMP_TOOL (edit_select)->display = display;
+ gimp_tool_control_activate (tool->control);
+ tool->display = display;
- tool_manager_push_tool (display->image->gimp, GIMP_TOOL (edit_select));
+ tool_manager_push_tool (display->image->gimp, tool);
/* pause the current selection */
gimp_display_shell_selection_control (shell, GIMP_SELECTION_PAUSE);
/* initialize the statusbar display */
- gimp_tool_push_status_coords (GIMP_TOOL (edit_select), display,
+ gimp_tool_push_status_coords (tool, display,
+ gimp_tool_control_get_precision (tool->control),
_("Move: "), 0, ", ", 0, NULL);
gimp_draw_tool_start (GIMP_DRAW_TOOL (edit_select), display);
@@ -579,8 +583,8 @@
gdouble new_y,
GimpDisplay *display)
{
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (edit_select);
- GimpTool *tool = GIMP_TOOL (edit_select);
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (edit_select);
+ GimpTool *tool = GIMP_TOOL (edit_select);
GimpItem *active_item;
gint off_x, off_y;
gdouble motion_x, motion_y;
@@ -718,6 +722,7 @@
gimp_tool_pop_status (tool, display);
gimp_tool_push_status_coords (tool, display,
+ gimp_tool_control_get_precision (tool->control),
_("Move: "),
edit_select->cumlx,
", ",
@@ -772,7 +777,7 @@
gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
{
GimpEditSelectionTool *edit_select = GIMP_EDIT_SELECTION_TOOL (draw_tool);
- GimpDisplay *display = GIMP_TOOL (draw_tool)->display;
+ GimpDisplay *display = GIMP_TOOL (draw_tool)->display;
GimpItem *active_item;
active_item = gimp_edit_selection_tool_get_active_item (edit_select,
Modified: trunk/app/tools/gimpfliptool.c
==============================================================================
--- trunk/app/tools/gimpfliptool.c (original)
+++ trunk/app/tools/gimpfliptool.c Wed Aug 20 16:22:09 2008
@@ -104,6 +104,8 @@
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (flip_tool);
gimp_tool_control_set_snap_to (tool->control, FALSE);
+ gimp_tool_control_set_precision (tool->control,
+ GIMP_CURSOR_PRECISION_PIXEL_CENTER);
gimp_tool_control_set_cursor (tool->control, GIMP_CURSOR_MOUSE);
gimp_tool_control_set_toggle_cursor (tool->control, GIMP_CURSOR_MOUSE);
gimp_tool_control_set_tool_cursor (tool->control,
Modified: trunk/app/tools/gimpfreeselecttool.c
==============================================================================
--- trunk/app/tools/gimpfreeselecttool.c (original)
+++ trunk/app/tools/gimpfreeselecttool.c Wed Aug 20 16:22:09 2008
@@ -236,6 +236,8 @@
gimp_tool_control_set_scroll_lock (tool->control, FALSE);
gimp_tool_control_set_wants_click (tool->control, TRUE);
+ gimp_tool_control_set_precision (tool->control,
+ GIMP_CURSOR_PRECISION_SUBPIXEL);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_FREE_SELECT);
Modified: trunk/app/tools/gimpmovetool.c
==============================================================================
--- trunk/app/tools/gimpmovetool.c (original)
+++ trunk/app/tools/gimpmovetool.c Wed Aug 20 16:22:09 2008
@@ -262,6 +262,9 @@
move->guide_orientation = gimp_guide_get_orientation (guide);
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
+ gimp_tool_control_set_precision (tool->control,
+ GIMP_CURSOR_PRECISION_PIXEL_BORDER);
+
gimp_tool_control_activate (tool->control);
gimp_display_shell_selection_control (shell,
@@ -366,6 +369,9 @@
gimp_tool_pop_status (tool, display);
gimp_tool_control_set_scroll_lock (tool->control, FALSE);
+ gimp_tool_control_set_precision (tool->control,
+ GIMP_CURSOR_PRECISION_PIXEL_CENTER);
+
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
if (release_type == GIMP_BUTTON_RELEASE_CANCEL)
Modified: trunk/app/tools/gimppainttool.c
==============================================================================
--- trunk/app/tools/gimppainttool.c (original)
+++ trunk/app/tools/gimppainttool.c Wed Aug 20 16:22:09 2008
@@ -90,6 +90,10 @@
static void gimp_paint_tool_draw (GimpDrawTool *draw_tool);
+static void gimp_paint_tool_hard_notify (GimpPaintOptions *options,
+ const GParamSpec *pspec,
+ GimpTool *tool);
+
G_DEFINE_TYPE (GimpPaintTool, gimp_paint_tool, GIMP_TYPE_COLOR_TOOL)
@@ -121,8 +125,8 @@
{
GimpTool *tool = GIMP_TOOL (paint_tool);
- gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_EXACT);
- gimp_tool_control_set_scroll_lock (tool->control, TRUE);
+ gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_EXACT);
+ gimp_tool_control_set_scroll_lock (tool->control, TRUE);
gimp_tool_control_set_action_value_1 (tool->control,
"context/context-opacity-set");
@@ -144,15 +148,17 @@
guint n_params,
GObjectConstructParam *params)
{
- GObject *object;
- GimpTool *tool;
- GimpPaintInfo *paint_info;
- GimpPaintTool *paint_tool;
+ GObject *object;
+ GimpTool *tool;
+ GimpPaintInfo *paint_info;
+ GimpPaintTool *paint_tool;
+ GimpPaintOptions *options;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
tool = GIMP_TOOL (object);
paint_tool = GIMP_PAINT_TOOL (object);
+ options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
g_assert (GIMP_IS_TOOL_INFO (tool->tool_info));
g_assert (GIMP_IS_PAINT_INFO (tool->tool_info->paint_info));
@@ -165,6 +171,12 @@
"undo-desc", paint_info->blurb,
NULL);
+ g_signal_connect_object (options, "notify::hard",
+ G_CALLBACK (gimp_paint_tool_hard_notify),
+ tool, 0);
+
+ gimp_paint_tool_hard_notify (options, NULL, tool);
+
return object;
}
@@ -706,3 +718,14 @@
GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
}
+
+static void
+gimp_paint_tool_hard_notify (GimpPaintOptions *options,
+ const GParamSpec *pspec,
+ GimpTool *tool)
+{
+ gimp_tool_control_set_precision (tool->control,
+ options->hard ?
+ GIMP_CURSOR_PRECISION_PIXEL_CENTER :
+ GIMP_CURSOR_PRECISION_SUBPIXEL);
+}
Modified: trunk/app/tools/gimpperspectiveclonetool.c
==============================================================================
--- trunk/app/tools/gimpperspectiveclonetool.c (original)
+++ trunk/app/tools/gimpperspectiveclonetool.c Wed Aug 20 16:22:09 2008
@@ -876,20 +876,25 @@
GParamSpec *pspec,
GimpPerspectiveCloneTool *clone_tool)
{
+ GimpTool *tool = GIMP_TOOL (clone_tool);
GimpPerspectiveClone *clone;
clone = GIMP_PERSPECTIVE_CLONE (GIMP_PAINT_TOOL (clone_tool)->core);
if (options->clone_mode == GIMP_PERSPECTIVE_CLONE_MODE_PAINT)
{
- gimp_tool_control_set_tool_cursor (GIMP_TOOL (clone_tool)->control,
+ /* GimpPaintTool's notify callback will set the right precision */
+ g_object_notify (G_OBJECT (options), "hard");
+
+ gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_CLONE);
gimp_perspective_clone_set_transform (clone, &clone_tool->transform);
}
else
{
- GimpTool *tool = GIMP_TOOL (clone_tool);
+ gimp_tool_control_set_precision (tool->control,
+ GIMP_CURSOR_PRECISION_SUBPIXEL);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_PERSPECTIVE);
Modified: trunk/app/tools/gimprectangleselecttool.c
==============================================================================
--- trunk/app/tools/gimprectangleselecttool.c (original)
+++ trunk/app/tools/gimprectangleselecttool.c Wed Aug 20 16:22:09 2008
@@ -222,6 +222,8 @@
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
gimp_tool_control_set_wants_click (tool->control, TRUE);
+ gimp_tool_control_set_precision (tool->control,
+ GIMP_CURSOR_PRECISION_PIXEL_BORDER);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_RECT_SELECT);
gimp_tool_control_set_dirty_mask (tool->control,
Modified: trunk/app/tools/gimprectangletool.c
==============================================================================
--- trunk/app/tools/gimprectangletool.c (original)
+++ trunk/app/tools/gimprectangletool.c Wed Aug 20 16:22:09 2008
@@ -1080,6 +1080,7 @@
aspect_text = g_strdup_printf (" (%.2f:1)", w / (gdouble) h);
gimp_tool_push_status_coords (tool, display,
+ GIMP_CURSOR_PRECISION_PIXEL_CENTER,
_("Rectangle: "),
w, " Ã ", h, aspect_text);
g_free (aspect_text);
@@ -1976,6 +1977,7 @@
/* initialize the statusbar display */
gimp_tool_push_status_coords (tool, tool->display,
+ GIMP_CURSOR_PRECISION_PIXEL_CENTER,
_("Rectangle: "), 0, " Ã ", 0, NULL);
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), tool->display);
Modified: trunk/app/tools/gimptool.c
==============================================================================
--- trunk/app/tools/gimptool.c (original)
+++ trunk/app/tools/gimptool.c Wed Aug 20 16:22:09 2008
@@ -864,13 +864,14 @@
}
void
-gimp_tool_push_status_coords (GimpTool *tool,
- GimpDisplay *display,
- const gchar *title,
- gdouble x,
- const gchar *separator,
- gdouble y,
- const gchar *help)
+gimp_tool_push_status_coords (GimpTool *tool,
+ GimpDisplay *display,
+ GimpCursorPrecision precision,
+ const gchar *title,
+ gdouble x,
+ const gchar *separator,
+ gdouble y,
+ const gchar *help)
{
GimpDisplayShell *shell;
const gchar *stock_id;
@@ -884,7 +885,8 @@
gimp_statusbar_push_coords (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool), stock_id,
- title, x, separator, y, help);
+ precision, title, x, separator, y,
+ help);
tool->status_displays = g_list_remove (tool->status_displays, display);
tool->status_displays = g_list_prepend (tool->status_displays, display);
Modified: trunk/app/tools/gimptool.h
==============================================================================
--- trunk/app/tools/gimptool.h (original)
+++ trunk/app/tools/gimptool.h Wed Aug 20 16:22:09 2008
@@ -191,6 +191,7 @@
...) G_GNUC_PRINTF(3,4);
void gimp_tool_push_status_coords (GimpTool *tool,
GimpDisplay *display,
+ GimpCursorPrecision precision,
const gchar *title,
gdouble x,
const gchar *separator,
Modified: trunk/app/tools/gimptoolcontrol.c
==============================================================================
--- trunk/app/tools/gimptoolcontrol.c (original)
+++ trunk/app/tools/gimptoolcontrol.c Wed Aug 20 16:22:09 2008
@@ -60,6 +60,8 @@
control->snap_width = 0;
control->snap_height = 0;
+ control->precision = GIMP_CURSOR_PRECISION_PIXEL_CENTER;
+
control->toggled = FALSE;
control->cursor = GIMP_CURSOR_MOUSE;
@@ -301,6 +303,24 @@
}
void
+gimp_tool_control_set_precision (GimpToolControl *control,
+ GimpCursorPrecision precision)
+{
+ g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
+
+ control->precision = precision;
+}
+
+GimpCursorPrecision
+gimp_tool_control_get_precision (GimpToolControl *control)
+{
+ g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control),
+ GIMP_CURSOR_PRECISION_PIXEL_CENTER);
+
+ return control->precision;
+}
+
+void
gimp_tool_control_set_toggled (GimpToolControl *control,
gboolean toggled)
{
Modified: trunk/app/tools/gimptoolcontrol.h
==============================================================================
--- trunk/app/tools/gimptoolcontrol.h (original)
+++ trunk/app/tools/gimptoolcontrol.h Wed Aug 20 16:22:09 2008
@@ -36,43 +36,45 @@
struct _GimpToolControl
{
- GimpObject parent_instance;
+ GimpObject parent_instance;
- gboolean active; /* state of tool activity */
- gint paused_count; /* paused control count */
+ gboolean active; /* state of tool activity */
+ gint paused_count; /* paused control count */
- gboolean preserve; /* Preserve this tool across *
- * drawable changes */
- gboolean scroll_lock; /* allow scrolling or not */
- gboolean handle_empty_image; /* invoke the tool on images *
- * without active drawable */
- gboolean wants_click; /* wants click detection */
- GimpDirtyMask dirty_mask; /* if preserve is FALSE, cancel *
- * the tool on these events */
- GimpMotionMode motion_mode; /* how to process motion events *
- * before they go to the tool */
- gboolean auto_snap_to; /* snap to guides automatically */
- gint snap_offset_x;
- gint snap_offset_y;
- gint snap_width;
- gint snap_height;
-
- gboolean toggled;
-
- GimpCursorType cursor;
- GimpToolCursorType tool_cursor;
- GimpCursorModifier cursor_modifier;
-
- GimpCursorType toggle_cursor;
- GimpToolCursorType toggle_tool_cursor;
- GimpCursorModifier toggle_cursor_modifier;
-
- gchar *action_value_1;
- gchar *action_value_2;
- gchar *action_value_3;
- gchar *action_value_4;
- gchar *action_object_1;
- gchar *action_object_2;
+ gboolean preserve; /* Preserve this tool across *
+ * drawable changes */
+ gboolean scroll_lock; /* allow scrolling or not */
+ gboolean handle_empty_image; /* invoke the tool on images *
+ * without active drawable */
+ gboolean wants_click; /* wants click detection */
+ GimpDirtyMask dirty_mask; /* if preserve is FALSE, cancel *
+ * the tool on these events */
+ GimpMotionMode motion_mode; /* how to process motion events *
+ * before they go to the tool */
+ gboolean auto_snap_to; /* snap to guides automatically */
+ gint snap_offset_x;
+ gint snap_offset_y;
+ gint snap_width;
+ gint snap_height;
+
+ GimpCursorPrecision precision;
+
+ gboolean toggled;
+
+ GimpCursorType cursor;
+ GimpToolCursorType tool_cursor;
+ GimpCursorModifier cursor_modifier;
+
+ GimpCursorType toggle_cursor;
+ GimpToolCursorType toggle_tool_cursor;
+ GimpCursorModifier toggle_cursor_modifier;
+
+ gchar *action_value_1;
+ gchar *action_value_2;
+ gchar *action_value_3;
+ gchar *action_value_4;
+ gchar *action_object_1;
+ gchar *action_object_2;
};
struct _GimpToolControlClass
@@ -130,6 +132,11 @@
gint *width,
gint *height);
+void gimp_tool_control_set_precision (GimpToolControl *control,
+ GimpCursorPrecision precision);
+GimpCursorPrecision
+ gimp_tool_control_get_precision (GimpToolControl *control);
+
void gimp_tool_control_set_toggled (GimpToolControl *control,
gboolean toggled);
gboolean gimp_tool_control_get_toggled (GimpToolControl *control);
Modified: trunk/app/tools/gimptransformtool.c
==============================================================================
--- trunk/app/tools/gimptransformtool.c (original)
+++ trunk/app/tools/gimptransformtool.c Wed Aug 20 16:22:09 2008
@@ -203,6 +203,8 @@
GIMP_DIRTY_IMAGE_SIZE |
GIMP_DIRTY_DRAWABLE |
GIMP_DIRTY_SELECTION);
+ gimp_tool_control_set_precision (tool->control,
+ GIMP_CURSOR_PRECISION_SUBPIXEL);
tr_tool->function = TRANSFORM_CREATING;
tr_tool->original = NULL;
Modified: trunk/app/tools/gimpvectortool.c
==============================================================================
--- trunk/app/tools/gimpvectortool.c (original)
+++ trunk/app/tools/gimpvectortool.c Wed Aug 20 16:22:09 2008
@@ -192,6 +192,8 @@
gimp_tool_control_set_handle_empty_image (tool->control, TRUE);
gimp_tool_control_set_motion_mode (tool->control,
GIMP_MOTION_MODE_COMPRESS);
+ gimp_tool_control_set_precision (tool->control,
+ GIMP_CURSOR_PRECISION_SUBPIXEL);
gimp_tool_control_set_cursor (tool->control, GIMP_CURSOR_MOUSE);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_PATHS);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]