app/display/gimpstatusbar.[ch] add optional help text at the end of the

2007-01-21  Raphael Quinet  <raphael@gimp.org>

	* app/display/gimpstatusbar.[ch]
	* app/tools/gimptool.[ch]: add optional help text at the end of
	the messages generated by gimp_statusbar_push_coords() and
	gimp_statusbar_push_length().

	* app/tools/gimpcolortool.c
	* app/tools/gimpeditselectiontool.c 
	* app/tools/gimpmovetool.c
	* app/tools/gimprectangletool.c: use the updated functions.

	* app/tools/gimpblendtool.c
	* app/tools/gimpcolorpickertool.c: added status bar messages.

svn path=/trunk/; revision=21745
This commit is contained in:
Raphael Quinet 2007-01-21 01:24:51 +00:00 committed by Raphaël Quinet
parent 4292db181f
commit 65950be141
11 changed files with 161 additions and 34 deletions

View File

@ -1,3 +1,18 @@
2007-01-21 Raphaël Quinet <raphael@gimp.org>
* app/display/gimpstatusbar.[ch]
* app/tools/gimptool.[ch]: add optional help text at the end of
the messages generated by gimp_statusbar_push_coords() and
gimp_statusbar_push_length().
* app/tools/gimpcolortool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmovetool.c
* app/tools/gimprectangletool.c: use the updated functions.
* app/tools/gimpblendtool.c
* app/tools/gimpcolorpickertool.c: added status bar messages.
2007-01-20 Raphaël Quinet <raphael@gimp.org>
* app/tools/gimppainttool.c (gimp_paint_tool_control): pop the

View File

@ -541,13 +541,18 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar,
const gchar *title,
gdouble x,
const gchar *separator,
gdouble y)
gdouble y,
const gchar *help)
{
GimpDisplayShell *shell;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (title != NULL);
g_return_if_fail (separator != NULL);
if (help == NULL)
{
help = "";
}
shell = statusbar->shell;
@ -558,7 +563,8 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar,
title,
(gint) RINT (x),
separator,
(gint) RINT (y));
(gint) RINT (y),
help);
}
else /* show real world units */
{
@ -571,7 +577,8 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar,
title,
x * unit_factor / image->xresolution,
separator,
y * unit_factor / image->yresolution);
y * unit_factor / image->yresolution,
help);
}
}
@ -580,12 +587,17 @@ gimp_statusbar_push_length (GimpStatusbar *statusbar,
const gchar *context,
const gchar *title,
GimpOrientationType axis,
gdouble value)
gdouble value,
const gchar *help)
{
GimpDisplayShell *shell;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (title != NULL);
if (help == NULL)
{
help = "";
}
shell = statusbar->shell;
@ -594,7 +606,8 @@ gimp_statusbar_push_length (GimpStatusbar *statusbar,
gimp_statusbar_push (statusbar, context,
statusbar->length_format_str,
title,
(gint) RINT (value));
(gint) RINT (value),
help);
}
else /* show real world units */
{
@ -621,7 +634,8 @@ gimp_statusbar_push_length (GimpStatusbar *statusbar,
gimp_statusbar_push (statusbar, context,
statusbar->length_format_str,
title,
value * unit_factor / resolution);
value * unit_factor / resolution,
help);
}
}
@ -849,7 +863,7 @@ gimp_statusbar_set_cursor (GimpStatusbar *statusbar,
{
g_snprintf (buffer, sizeof (buffer),
statusbar->cursor_format_str,
"", (gint) RINT (x), ", ", (gint) RINT (y));
"", (gint) RINT (x), ", ", (gint) RINT (y), "");
}
else /* show real world units */
{
@ -857,7 +871,7 @@ gimp_statusbar_set_cursor (GimpStatusbar *statusbar,
g_snprintf (buffer, sizeof (buffer),
statusbar->cursor_format_str,
"", x, ", ", y);
"", x, ", ", y, "");
}
gtk_label_set_text (GTK_LABEL (statusbar->cursor_label), buffer);
@ -988,21 +1002,21 @@ gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
{
g_snprintf (statusbar->cursor_format_str,
sizeof (statusbar->cursor_format_str),
"%%s%%d%%s%%d");
"%%s%%d%%s%%d%%s");
g_snprintf (statusbar->length_format_str,
sizeof (statusbar->length_format_str),
"%%s%%d");
"%%s%%d%%s");
}
else /* show real world units */
{
g_snprintf (statusbar->cursor_format_str,
sizeof (statusbar->cursor_format_str),
"%%s%%.%df%%s%%.%df",
"%%s%%.%df%%s%%.%df%%s",
_gimp_unit_get_digits (image->gimp, shell->unit),
_gimp_unit_get_digits (image->gimp, shell->unit));
g_snprintf (statusbar->length_format_str,
sizeof (statusbar->length_format_str),
"%%s%%.%df",
"%%s%%.%df%%s",
_gimp_unit_get_digits (image->gimp, shell->unit));
}

View File

@ -85,12 +85,14 @@ void gimp_statusbar_push_coords (GimpStatusbar *statusbar,
const gchar *title,
gdouble x,
const gchar *separator,
gdouble y);
gdouble y,
const gchar *help);
void gimp_statusbar_push_length (GimpStatusbar *statusbar,
const gchar *context,
const gchar *title,
GimpOrientationType axis,
gdouble value);
gdouble value,
const gchar *help);
void gimp_statusbar_replace (GimpStatusbar *statusbar,
const gchar *context,
const gchar *format,

View File

@ -35,6 +35,7 @@
#include "core/gimpprogress.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
@ -54,6 +55,9 @@
static gboolean gimp_blend_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error);
static void gimp_blend_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display);
static void gimp_blend_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
@ -82,6 +86,7 @@ static void gimp_blend_tool_cursor_update (GimpTool *tool,
static void gimp_blend_tool_draw (GimpDrawTool *draw_tool);
static void gimp_blend_tool_push_status (GimpBlendTool *blend_tool,
GdkModifierType state,
GimpDisplay *display);
@ -117,6 +122,7 @@ gimp_blend_tool_class_init (GimpBlendToolClass *klass)
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
tool_class->control = gimp_blend_tool_control;
tool_class->initialize = gimp_blend_tool_initialize;
tool_class->button_press = gimp_blend_tool_button_press;
tool_class->button_release = gimp_blend_tool_button_release;
@ -165,6 +171,25 @@ gimp_blend_tool_initialize (GimpTool *tool,
return TRUE;
}
static void
gimp_blend_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display)
{
switch (action)
{
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
gimp_tool_pop_status (tool, display);
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
}
static void
gimp_blend_tool_button_press (GimpTool *tool,
GimpCoords *coords,
@ -190,7 +215,7 @@ gimp_blend_tool_button_press (GimpTool *tool,
gimp_tool_control_activate (tool->control);
gimp_blend_tool_push_status (blend_tool, display);
gimp_blend_tool_push_status (blend_tool, state, display);
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
}
@ -280,7 +305,7 @@ gimp_blend_tool_motion (GimpTool *tool,
}
gimp_tool_pop_status (tool, display);
gimp_blend_tool_push_status (blend_tool, display);
gimp_blend_tool_push_status (blend_tool, state, display);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
@ -308,7 +333,7 @@ gimp_blend_tool_active_modifier_key (GimpTool *tool,
}
gimp_tool_pop_status (tool, display);
gimp_blend_tool_push_status (blend_tool, display);
gimp_blend_tool_push_status (blend_tool, state, display);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
@ -371,12 +396,22 @@ gimp_blend_tool_draw (GimpDrawTool *draw_tool)
}
static void
gimp_blend_tool_push_status (GimpBlendTool *blend_tool,
GimpDisplay *display)
gimp_blend_tool_push_status (GimpBlendTool *blend_tool,
GdkModifierType state,
GimpDisplay *display)
{
gchar *status_help;
status_help = gimp_suggest_modifiers ("",
GDK_CONTROL_MASK & ~state,
NULL,
_("%s for constrained angles"),
NULL);
gimp_tool_push_status_coords (GIMP_TOOL (blend_tool), display,
_("Blend: "),
blend_tool->endx - blend_tool->startx,
", ",
blend_tool->endy - blend_tool->starty);
blend_tool->endy - blend_tool->starty,
status_help);
g_free (status_help);
}

View File

@ -34,6 +34,7 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimptooldialog.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
@ -176,6 +177,7 @@ gimp_color_picker_tool_control (GimpTool *tool,
if (picker_tool->dialog)
gimp_color_picker_tool_info_response (NULL, GTK_RESPONSE_CLOSE,
picker_tool);
gimp_tool_pop_status (tool, display);
break;
}
@ -224,10 +226,60 @@ gimp_color_picker_tool_oper_update (GimpTool *tool,
gboolean proximity,
GimpDisplay *display)
{
GimpColorPickerTool *picker_tool = GIMP_COLOR_PICKER_TOOL (tool);
GimpColorPickerOptions *options = GIMP_COLOR_PICKER_TOOL_GET_OPTIONS (tool);
GIMP_COLOR_TOOL (tool)->pick_mode = options->pick_mode;
gimp_tool_pop_status (tool, display);
if (proximity)
{
gchar *status_help = NULL;
GdkModifierType shift_mod = 0;
if (! picker_tool->dialog)
{
shift_mod = GDK_SHIFT_MASK;
}
switch (options->pick_mode)
{
case GIMP_COLOR_PICK_MODE_NONE:
status_help = gimp_suggest_modifiers (_("Click in any image to view"
" its color"),
shift_mod & ~state,
NULL, NULL, NULL);
break;
case GIMP_COLOR_PICK_MODE_FOREGROUND:
status_help = gimp_suggest_modifiers (_("Click in any image to pick"
" the foreground color"),
(shift_mod
| GDK_CONTROL_MASK) & ~state,
NULL, NULL, NULL);
break;
case GIMP_COLOR_PICK_MODE_BACKGROUND:
status_help = gimp_suggest_modifiers (_("Click in any image to pick"
" the background color"),
(shift_mod
| GDK_CONTROL_MASK) & ~state,
NULL, NULL, NULL);
break;
case GIMP_COLOR_PICK_MODE_PALETTE:
status_help = gimp_suggest_modifiers (_("Click in any image to add"
" the color to the palette"),
shift_mod & ~state,
NULL, NULL, NULL);
break;
}
if (status_help != NULL)
{
gimp_tool_push_status (tool, display, status_help);
g_free (status_help);
}
}
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
display);
}

View File

@ -252,7 +252,8 @@ gimp_color_tool_button_press (GimpTool *tool,
_("Move Sample Point: "),
color_tool->sample_point_x,
", ",
color_tool->sample_point_y);
color_tool->sample_point_y,
NULL);
}
else
{
@ -428,7 +429,8 @@ gimp_color_tool_motion (GimpTool *tool,
_("Add Sample Point: "),
color_tool->sample_point_x,
", ",
color_tool->sample_point_y);
color_tool->sample_point_y,
NULL);
}
}
else

View File

@ -398,7 +398,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
/* initialize the statusbar display */
gimp_tool_push_status_coords (GIMP_TOOL (edit_select), display,
_("Move: "), 0, ", ", 0);
_("Move: "), 0, ", ", 0, NULL);
gimp_draw_tool_start (GIMP_DRAW_TOOL (edit_select), display);
}
@ -670,7 +670,8 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
_("Move: "),
edit_select->cumlx,
", ",
edit_select->cumly);
edit_select->cumly,
NULL);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}

View File

@ -266,7 +266,8 @@ gimp_move_tool_button_press (GimpTool *tool,
gimp_tool_push_status_length (tool, display,
_("Move Guide: "),
SWAP_ORIENT (move->guide_orientation),
move->guide_position);
move->guide_position,
NULL);
return;
}
@ -543,7 +544,8 @@ gimp_move_tool_motion (GimpTool *tool,
move->guide ?
_("Move Guide: ") : _("Add Guide: "),
SWAP_ORIENT (move->guide_orientation),
move->guide_position);
move->guide_position,
NULL);
}
}
}

View File

@ -1049,7 +1049,7 @@ gimp_rectangle_tool_motion (GimpTool *tool,
if (w > 0 && h > 0)
gimp_tool_push_status_coords (tool, display,
_("Rectangle: "), w, " × ", h);
_("Rectangle: "), w, " × ", h, NULL);
}
if (private->function == RECT_CREATING)
@ -1693,7 +1693,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rectangle)
/* initialize the statusbar display */
gimp_tool_push_status_coords (tool, tool->display,
_("Rectangle: "), 0, " x ", 0);
_("Rectangle: "), 0, " x ", 0, NULL);
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), tool->display);
}

View File

@ -740,7 +740,8 @@ gimp_tool_push_status_coords (GimpTool *tool,
const gchar *title,
gdouble x,
const gchar *separator,
gdouble y)
gdouble y,
const gchar *help)
{
GimpDisplayShell *shell;
@ -751,7 +752,7 @@ gimp_tool_push_status_coords (GimpTool *tool,
gimp_statusbar_push_coords (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool),
title, x, separator, y);
title, x, separator, y, help);
}
void
@ -759,7 +760,8 @@ gimp_tool_push_status_length (GimpTool *tool,
GimpDisplay *display,
const gchar *title,
GimpOrientationType axis,
gdouble value)
gdouble value,
const gchar *help)
{
GimpDisplayShell *shell;
@ -770,7 +772,7 @@ gimp_tool_push_status_length (GimpTool *tool,
gimp_statusbar_push_length (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool),
title, axis, value);
title, axis, value, help);
}
void

View File

@ -182,12 +182,14 @@ void gimp_tool_push_status_coords (GimpTool *tool,
const gchar *title,
gdouble x,
const gchar *separator,
gdouble y);
gdouble y,
const gchar *help);
void gimp_tool_push_status_length (GimpTool *tool,
GimpDisplay *display,
const gchar *title,
GimpOrientationType axis,
gdouble value);
gdouble value,
const gchar *help);
void gimp_tool_replace_status (GimpTool *tool,
GimpDisplay *display,
const gchar *format,