app/tools/gimppainttool.[ch] unified tool and paint-tool statusbar APIs.

2005-05-07  Sven Neumann  <sven@gimp.org>

	* app/tools/gimppainttool.[ch]
	* app/tools/gimptool.[ch]: unified tool and paint-tool statusbar APIs.

	* app/tools/gimpblendtool.c
	* app/tools/gimpclonetool.c
	* app/tools/gimpcolortool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpfuzzyselecttool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimpmovetool.c
	* app/tools/gimpnewrectselecttool.c
	* app/tools/gimprectangletool.c
	* app/tools/gimprectselecttool.c
	* app/tools/gimpvectortool.c: changed accordingly.

	* app/tools/gimpselectiontool.c: give more hints in the statusbar.
	Some of the selection tools should probably override these.
This commit is contained in:
Sven Neumann 2005-05-07 13:24:47 +00:00 committed by Sven Neumann
parent d2cf185c30
commit 27042a7b36
23 changed files with 189 additions and 256 deletions

View file

@ -1,3 +1,24 @@
2005-05-07 Sven Neumann <sven@gimp.org>
* app/tools/gimppainttool.[ch]
* app/tools/gimptool.[ch]: unified tool and paint-tool statusbar APIs.
* app/tools/gimpblendtool.c
* app/tools/gimpclonetool.c
* app/tools/gimpcolortool.c
* app/tools/gimpcroptool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/tools/gimpnewrectselecttool.c
* app/tools/gimprectangletool.c
* app/tools/gimprectselecttool.c
* app/tools/gimpvectortool.c: changed accordingly.
* app/tools/gimpselectiontool.c: give more hints in the statusbar.
Some of the selection tools should probably override these.
2005-05-07 Sven Neumann <sven@gimp.org>
* app/core/gimppreviewcache.c: minor code cleanup.

View file

@ -201,7 +201,7 @@ gimp_blend_tool_button_press (GimpTool *tool,
gimp_tool_control_activate (tool->control);
/* initialize the statusbar display */
gimp_tool_push_status_coords (tool, _("Blend: "), 0, ", ", 0);
gimp_tool_push_status_coords (tool, gdisp, _("Blend: "), 0, ", ", 0);
/* Start drawing the blend tool */
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), gdisp);
@ -226,7 +226,7 @@ gimp_blend_tool_button_release (GimpTool *tool,
gimage = gdisp->gimage;
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
@ -294,9 +294,8 @@ gimp_blend_tool_motion (GimpTool *tool,
&blend_tool->endx, &blend_tool->endy);
}
gimp_tool_pop_status (tool);
gimp_tool_push_status_coords (tool,
gimp_tool_pop_status (tool, gdisp);
gimp_tool_push_status_coords (tool, gdisp,
_("Blend: "),
blend_tool->endx - blend_tool->startx,
", ",

View file

@ -288,39 +288,6 @@ gimp_paint_tool_enable_color_picker (GimpPaintTool *tool,
GIMP_COLOR_TOOL (tool)->pick_mode = mode;
}
void
gimp_paint_tool_push_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool), message);
}
void
gimp_paint_tool_replace_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_replace (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool), message);
}
void
gimp_paint_tool_pop_status (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool));
}
static void
gimp_paint_tool_control (GimpTool *tool,
GimpToolAction action,
@ -352,9 +319,7 @@ gimp_paint_tool_control (GimpTool *tool,
for (list = display_list; list; list = g_slist_next (list))
{
GimpDisplay *tmp_disp;
tmp_disp = (GimpDisplay *) list->data;
GimpDisplay *tmp_disp = list->data;
if (tmp_disp != gdisp && tmp_disp->gimage == gdisp->gimage)
{
@ -670,7 +635,7 @@ gimp_paint_tool_oper_update (GimpTool *tool,
if (gimp_draw_tool_is_active (draw_tool))
gimp_draw_tool_stop (draw_tool);
gimp_paint_tool_pop_status (tool, gdisp);
gimp_tool_pop_status (tool, gdisp);
if (tool->gdisp &&
tool->gdisp != gdisp &&
@ -738,16 +703,15 @@ gimp_paint_tool_oper_update (GimpTool *tool,
g_snprintf (status_str, sizeof (status_str), format_str, dist);
}
gimp_paint_tool_push_status (tool, gdisp, status_str);
gimp_tool_push_status (tool, gdisp, status_str);
paint_tool->draw_line = TRUE;
}
else
{
if (gdisp == tool->gdisp)
gimp_paint_tool_push_status (tool, gdisp,
_("Press Shift to "
"draw a straight line."));
gimp_tool_push_status (tool, gdisp,
_("Press Shift to draw a straight line."));
paint_tool->draw_line = FALSE;
}

View file

@ -59,14 +59,5 @@ GType gimp_paint_tool_get_type (void) G_GNUC_CONST;
void gimp_paint_tool_enable_color_picker (GimpPaintTool *tool,
GimpColorPickMode mode);
void gimp_paint_tool_push_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message);
void gimp_paint_tool_replace_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message);
void gimp_paint_tool_pop_status (GimpTool *tool,
GimpDisplay *gdisp);
#endif /* __GIMP_PAINT_TOOL_H__ */

View file

@ -253,8 +253,8 @@ gimp_clone_tool_oper_update (GimpTool *tool,
if (GIMP_CLONE_OPTIONS (options)->clone_type == GIMP_IMAGE_CLONE &&
GIMP_CLONE (GIMP_PAINT_TOOL (tool)->core)->src_drawable == NULL)
{
gimp_paint_tool_replace_status (tool, gdisp,
_("Ctrl-Click to set a clone source."));
gimp_tool_replace_status (tool, gdisp,
_("Ctrl-Click to set a clone source."));
}
}

View file

@ -268,7 +268,8 @@ gimp_color_tool_button_press (GimpTool *tool,
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), gdisp);
gimp_tool_push_status_coords (tool, _("Move Sample Point: "),
gimp_tool_push_status_coords (tool, gdisp,
_("Move Sample Point: "),
color_tool->sample_point_x,
", ",
color_tool->sample_point_y);
@ -309,7 +310,7 @@ gimp_color_tool_button_release (GimpTool *tool,
{
gint x, y, width, height;
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
@ -429,18 +430,18 @@ gimp_color_tool_motion (GimpTool *tool,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
if (delete_point)
{
gimp_tool_push_status (tool,
gimp_tool_push_status (tool, gdisp,
color_tool->sample_point ?
_("Remove Sample Point") :
_("Cancel Sample Point"));
}
else
{
gimp_tool_push_status_coords (tool,
gimp_tool_push_status_coords (tool, gdisp,
color_tool->sample_point ?
_("Move Sample Point: ") :
_("Add Sample Point: "),

View file

@ -314,7 +314,7 @@ gimp_crop_tool_button_release (GimpTool *tool,
GimpCropOptions *options = GIMP_CROP_OPTIONS (tool->tool_info->tool_options);
gimp_tool_control_halt (tool->control);
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
if (! (state & GDK_BUTTON3_MASK))
{
@ -493,9 +493,8 @@ gimp_crop_tool_motion (GimpTool *tool,
crop->function == RESIZING_LEFT ||
crop->function == RESIZING_RIGHT)
{
gimp_tool_pop_status (tool);
gimp_tool_push_status_coords (tool,
gimp_tool_pop_status (tool, gdisp);
gimp_tool_push_status_coords (tool, gdisp,
_("Crop: "),
crop->x2 - crop->x1,
" x ",
@ -980,7 +979,7 @@ crop_start (GimpCropTool *crop,
}
/* initialize the statusbar display */
gimp_tool_push_status_coords (tool, _("Crop: "), 0, " x ", 0);
gimp_tool_push_status_coords (tool, tool->gdisp, _("Crop: "), 0, " x ", 0);
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), tool->gdisp);
}

View file

@ -460,7 +460,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
gimp_display_shell_selection_visibility (shell, GIMP_SELECTION_PAUSE);
/* initialize the statusbar display */
gimp_tool_push_status_coords (GIMP_TOOL (edit_select),
gimp_tool_push_status_coords (GIMP_TOOL (edit_select), gdisp,
_("Move: "), 0, ", ", 0);
gimp_draw_tool_start (GIMP_DRAW_TOOL (edit_select), gdisp);
@ -481,7 +481,7 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
/* resume the current selection */
gimp_display_shell_selection_visibility (shell, GIMP_SELECTION_RESUME);
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
/* Stop and free the selection core */
gimp_draw_tool_stop (GIMP_DRAW_TOOL (edit_select));
@ -726,9 +726,8 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
/********************************************************************/
/********************************************************************/
gimp_tool_pop_status (tool);
gimp_tool_push_status_coords (tool,
gimp_tool_pop_status (tool, gdisp);
gimp_tool_push_status_coords (tool, gdisp,
_("Move: "),
edit_select->cumlx,
", ",

View file

@ -213,7 +213,7 @@ gimp_fuzzy_select_tool_button_press (GimpTool *tool,
if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (fuzzy_sel), coords))
return;
gimp_tool_push_status (tool, _("Move the mouse to change threshold."));
gimp_tool_push_status (tool, gdisp, _("Move the mouse to change threshold."));
/* calculate the region boundary */
fuzzy_sel->segs = gimp_fuzzy_select_tool_calculate (fuzzy_sel, gdisp,
@ -234,7 +234,7 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool,
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));

View file

@ -220,7 +220,7 @@ gimp_measure_tool_button_press (GimpTool *tool,
/* if we are changing displays, pop the statusbar of the old one */
if (gimp_tool_control_is_active (tool->control) && gdisp != tool->gdisp)
{
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
}
mtool->function = CREATING;
@ -342,8 +342,7 @@ gimp_measure_tool_button_press (GimpTool *tool,
if (gimp_tool_control_is_active (tool->control))
{
gimp_tool_pop_status (tool);
gimp_tool_push_status (tool, " ");
gimp_tool_replace_status (tool, gdisp, " ");
}
else
{
@ -685,7 +684,7 @@ gimp_measure_tool_halt (GimpMeasureTool *mtool)
if (mtool->dialog)
gtk_widget_destroy (mtool->dialog);
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, tool->gdisp);
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (mtool)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (mtool));
@ -814,8 +813,7 @@ gimp_measure_tool_dialog_update (GimpMeasureTool *mtool,
unit_width, unit_height);
}
gimp_tool_pop_status (GIMP_TOOL (mtool));
gimp_tool_push_status (GIMP_TOOL (mtool), buf);
gimp_tool_replace_status (GIMP_TOOL (mtool), gdisp, buf);
if (mtool->dialog)
{

View file

@ -295,7 +295,8 @@ gimp_move_tool_button_press (GimpTool *tool,
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), gdisp);
gimp_tool_push_status_length (tool, _("Move Guide: "),
gimp_tool_push_status_length (tool, gdisp,
_("Move Guide: "),
SWAP_ORIENT (move->guide_orientation),
move->guide_position);
@ -384,7 +385,7 @@ gimp_move_tool_button_release (GimpTool *tool,
gboolean delete_guide = FALSE;
gint x, y, width, height;
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
gimp_tool_control_set_scroll_lock (tool->control, FALSE);
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
@ -561,17 +562,17 @@ gimp_move_tool_motion (GimpTool *tool,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
if (delete_guide)
{
gimp_tool_push_status (tool,
gimp_tool_push_status (tool, gdisp,
move->guide ?
_("Remove Guide") : _("Cancel Guide"));
}
else
{
gimp_tool_push_status_length (tool,
gimp_tool_push_status_length (tool, gdisp,
move->guide ?
_("Move Guide: ") : _("Add Guide: "),
SWAP_ORIENT (move->guide_orientation),

View file

@ -19,11 +19,7 @@
#include "config.h"
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpconfig/gimpconfig.h"
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
@ -162,7 +158,7 @@ gimp_new_rect_select_tool_button_press (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords,
time, state, gdisp);
@ -172,24 +168,6 @@ gimp_new_rect_select_tool_button_press (GimpTool *tool,
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
return;
}
switch (sel_tool->op)
{
case SELECTION_ADD:
gimp_tool_push_status (tool, _("Selection: ADD"));
break;
case SELECTION_SUBTRACT:
gimp_tool_push_status (tool, _("Selection: SUBTRACT"));
break;
case SELECTION_INTERSECT:
gimp_tool_push_status (tool, _("Selection: INTERSECT"));
break;
case SELECTION_REPLACE:
gimp_tool_push_status (tool, _("Selection: REPLACE"));
break;
default:
break;
}
}
static void

View file

@ -288,39 +288,6 @@ gimp_paint_tool_enable_color_picker (GimpPaintTool *tool,
GIMP_COLOR_TOOL (tool)->pick_mode = mode;
}
void
gimp_paint_tool_push_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool), message);
}
void
gimp_paint_tool_replace_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_replace (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool), message);
}
void
gimp_paint_tool_pop_status (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool));
}
static void
gimp_paint_tool_control (GimpTool *tool,
GimpToolAction action,
@ -352,9 +319,7 @@ gimp_paint_tool_control (GimpTool *tool,
for (list = display_list; list; list = g_slist_next (list))
{
GimpDisplay *tmp_disp;
tmp_disp = (GimpDisplay *) list->data;
GimpDisplay *tmp_disp = list->data;
if (tmp_disp != gdisp && tmp_disp->gimage == gdisp->gimage)
{
@ -670,7 +635,7 @@ gimp_paint_tool_oper_update (GimpTool *tool,
if (gimp_draw_tool_is_active (draw_tool))
gimp_draw_tool_stop (draw_tool);
gimp_paint_tool_pop_status (tool, gdisp);
gimp_tool_pop_status (tool, gdisp);
if (tool->gdisp &&
tool->gdisp != gdisp &&
@ -738,16 +703,15 @@ gimp_paint_tool_oper_update (GimpTool *tool,
g_snprintf (status_str, sizeof (status_str), format_str, dist);
}
gimp_paint_tool_push_status (tool, gdisp, status_str);
gimp_tool_push_status (tool, gdisp, status_str);
paint_tool->draw_line = TRUE;
}
else
{
if (gdisp == tool->gdisp)
gimp_paint_tool_push_status (tool, gdisp,
_("Press Shift to "
"draw a straight line."));
gimp_tool_push_status (tool, gdisp,
_("Press Shift to draw a straight line."));
paint_tool->draw_line = FALSE;
}

View file

@ -59,14 +59,5 @@ GType gimp_paint_tool_get_type (void) G_GNUC_CONST;
void gimp_paint_tool_enable_color_picker (GimpPaintTool *tool,
GimpColorPickMode mode);
void gimp_paint_tool_push_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message);
void gimp_paint_tool_replace_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message);
void gimp_paint_tool_pop_status (GimpTool *tool,
GimpDisplay *gdisp);
#endif /* __GIMP_PAINT_TOOL_H__ */

View file

@ -19,11 +19,7 @@
#include "config.h"
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpconfig/gimpconfig.h"
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
@ -162,7 +158,7 @@ gimp_new_rect_select_tool_button_press (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords,
time, state, gdisp);
@ -172,24 +168,6 @@ gimp_new_rect_select_tool_button_press (GimpTool *tool,
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
return;
}
switch (sel_tool->op)
{
case SELECTION_ADD:
gimp_tool_push_status (tool, _("Selection: ADD"));
break;
case SELECTION_SUBTRACT:
gimp_tool_push_status (tool, _("Selection: SUBTRACT"));
break;
case SELECTION_INTERSECT:
gimp_tool_push_status (tool, _("Selection: INTERSECT"));
break;
case SELECTION_REPLACE:
gimp_tool_push_status (tool, _("Selection: REPLACE"));
break;
default:
break;
}
}
static void

View file

@ -369,7 +369,7 @@ gimp_rectangle_tool_button_release (GimpTool *tool,
options = GIMP_RECTANGLE_OPTIONS (tool->tool_info->tool_options);
gimp_tool_control_halt (tool->control);
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
if (! (state & GDK_BUTTON3_MASK))
{
@ -811,9 +811,8 @@ gimp_rectangle_tool_motion (GimpTool *tool,
rectangle->function == RECT_RESIZING_UPPER_LEFT ||
rectangle->function == RECT_RESIZING_LOWER_RIGHT)
{
gimp_tool_pop_status (tool);
gimp_tool_push_status_coords (tool,
gimp_tool_pop_status (tool, gdisp);
gimp_tool_push_status_coords (tool, gdisp,
_("Rectangle: "),
rectangle->x2 - rectangle->x1,
" x ",
@ -1169,12 +1168,13 @@ rectangle_recalc (GimpRectangleTool *rectangle)
static void
rectangle_tool_start (GimpRectangleTool *rectangle)
{
GimpTool *tool = GIMP_TOOL (rectangle);
GimpTool *tool = GIMP_TOOL (rectangle);
rectangle_recalc (rectangle);
/* initialize the statusbar display */
gimp_tool_push_status_coords (tool, _("Rectangle: "), 0, " x ", 0);
gimp_tool_push_status_coords (tool, tool->gdisp,
_("Rectangle: "), 0, " x ", 0);
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), tool->gdisp);
}

View file

@ -21,7 +21,6 @@
#include <stdlib.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "libgimpwidgets/gimpwidgets.h"
@ -220,24 +219,6 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
if (gimp_selection_tool_start_edit (sel_tool, coords))
return;
switch (sel_tool->op)
{
case SELECTION_ADD:
gimp_tool_push_status (tool, _("Selection: ADD"));
break;
case SELECTION_SUBTRACT:
gimp_tool_push_status (tool, _("Selection: SUBTRACT"));
break;
case SELECTION_INTERSECT:
gimp_tool_push_status (tool, _("Selection: INTERSECT"));
break;
case SELECTION_REPLACE:
gimp_tool_push_status (tool, _("Selection: REPLACE"));
break;
default:
break;
}
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), gdisp);
}
@ -250,7 +231,7 @@ gimp_rect_select_tool_button_release (GimpTool *tool,
{
GimpRectSelectTool *rect_sel = GIMP_RECT_SELECT_TOOL (tool);
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
@ -258,7 +239,7 @@ gimp_rect_select_tool_button_release (GimpTool *tool,
/* First take care of the case where the user "cancels" the action */
if (! (state & GDK_BUTTON3_MASK))
{
{
if (rect_sel->w == 0 || rect_sel->h == 0)
{
/* If there is a floating selection, anchor it */
@ -276,7 +257,7 @@ gimp_rect_select_tool_button_release (GimpTool *tool,
gimp_rect_select_tool_rect_select (rect_sel,
rect_sel->x, rect_sel->y,
rect_sel->w, rect_sel->h);
/* show selection on all views */
gimp_image_flush (gdisp->gimage);
}
@ -303,11 +284,11 @@ gimp_rect_select_tool_motion (GimpTool *tool,
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
if (state & GDK_MOD1_MASK)
{
/* Just move the selection rectangle around */
mx = RINT(coords->x) - rect_sel->lx;
my = RINT(coords->y) - rect_sel->ly;
@ -318,7 +299,7 @@ gimp_rect_select_tool_motion (GimpTool *tool,
}
else
{
/* Change the selection rectangle's size, first calculate absolute
/* Change the selection rectangle's size, first calculate absolute
* width and height, then take care of quadrants.
*/
@ -332,7 +313,7 @@ gimp_rect_select_tool_motion (GimpTool *tool,
rect_sel->w = abs(RINT(coords->x) - rect_sel->sx);
rect_sel->h = abs(RINT(coords->y) - rect_sel->sy);
}
if (rect_sel->fixed_mode == GIMP_RECT_SELECT_MODE_FIXED_RATIO)
{
ratio = rect_sel->fixed_height / rect_sel->fixed_width;
@ -345,7 +326,7 @@ gimp_rect_select_tool_motion (GimpTool *tool,
rect_sel->h = RINT(rect_sel->w * ratio);
}
}
/* If the shift key is down, then make the rectangle square (or
* ellipse circular)
@ -405,16 +386,13 @@ gimp_rect_select_tool_motion (GimpTool *tool,
rect_sel->lx = RINT(coords->x);
rect_sel->ly = RINT(coords->y);
gimp_rect_select_tool_update_options (rect_sel, gdisp);
gimp_tool_pop_status (tool);
gimp_tool_push_status_coords (tool,
gimp_tool_pop_status (tool, gdisp);
gimp_tool_push_status_coords (tool, gdisp,
_("Selection: "),
rect_sel->w,
" x ",
rect_sel->h);
rect_sel->w, " x ", rect_sel->h);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}

View file

@ -213,7 +213,7 @@ gimp_fuzzy_select_tool_button_press (GimpTool *tool,
if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (fuzzy_sel), coords))
return;
gimp_tool_push_status (tool, _("Move the mouse to change threshold."));
gimp_tool_push_status (tool, gdisp, _("Move the mouse to change threshold."));
/* calculate the region boundary */
fuzzy_sel->segs = gimp_fuzzy_select_tool_calculate (fuzzy_sel, gdisp,
@ -234,7 +234,7 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool,
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));

View file

@ -21,6 +21,7 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
@ -36,10 +37,15 @@
#include "gimpselectionoptions.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.h"
static void gimp_selection_tool_class_init (GimpSelectionToolClass *klass);
static void gimp_selection_tool_init (GimpSelectionTool *sel_tool);
static void gimp_selection_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp);
static void gimp_selection_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
@ -93,6 +99,7 @@ gimp_selection_tool_class_init (GimpSelectionToolClass *klass)
parent_class = g_type_class_peek_parent (klass);
tool_class->control = gimp_selection_tool_control;
tool_class->modifier_key = gimp_selection_tool_modifier_key;
tool_class->key_press = gimp_edit_selection_tool_key_press;
tool_class->oper_update = gimp_selection_tool_oper_update;
@ -106,6 +113,17 @@ gimp_selection_tool_init (GimpSelectionTool *selection_tool)
selection_tool->saved_op = SELECTION_REPLACE;
}
static void
gimp_selection_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp)
{
if (action == HALT)
gimp_tool_pop_status (tool, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
}
static void
gimp_selection_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
@ -172,6 +190,7 @@ gimp_selection_tool_oper_update (GimpTool *tool,
GimpChannel *selection;
GimpLayer *layer;
GimpLayer *floating_sel;
const gchar *status = NULL;
gboolean move_layer = FALSE;
gboolean move_floating_sel = FALSE;
@ -228,6 +247,34 @@ gimp_selection_tool_oper_update (GimpTool *tool,
{
selection_tool->op = options->operation;
}
if (! gimp_enum_get_value (GIMP_TYPE_CHANNEL_OPS, selection_tool->op,
NULL, NULL, &status, NULL))
{
switch (selection_tool->op)
{
case SELECTION_MOVE_MASK:
status = _("Move the selection mask");
break;
case SELECTION_MOVE:
status = _("Move the selected pixels");
break;
case SELECTION_MOVE_COPY:
status = _("Move a copy of the selected pixels");
break;
case SELECTION_ANCHOR:
status = _("Anchor the floating selection");
break;
default:
g_return_if_reached ();
}
}
gimp_tool_replace_status (tool, gdisp, status);
}
static void
@ -268,8 +315,7 @@ gimp_selection_tool_cursor_update (GimpTool *tool,
break;
}
gimp_tool_set_cursor (tool, gdisp,
GIMP_CURSOR_MOUSE, tool_cursor, cmodifier);
gimp_tool_set_cursor (tool, gdisp, GIMP_CURSOR_MOUSE, tool_cursor, cmodifier);
}

View file

@ -253,8 +253,8 @@ gimp_clone_tool_oper_update (GimpTool *tool,
if (GIMP_CLONE_OPTIONS (options)->clone_type == GIMP_IMAGE_CLONE &&
GIMP_CLONE (GIMP_PAINT_TOOL (tool)->core)->src_drawable == NULL)
{
gimp_paint_tool_replace_status (tool, gdisp,
_("Ctrl-Click to set a clone source."));
gimp_tool_replace_status (tool, gdisp,
_("Ctrl-Click to set a clone source."));
}
}

View file

@ -536,72 +536,90 @@ gimp_tool_cursor_update (GimpTool *tool,
void
gimp_tool_push_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message)
{
GimpStatusbar *statusbar;
GimpDisplayShell *shell;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (tool->gdisp));
g_return_if_fail (message != NULL);
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
statusbar =
GIMP_STATUSBAR (GIMP_DISPLAY_SHELL (tool->gdisp->shell)->statusbar);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_push (statusbar, G_OBJECT_TYPE_NAME (tool), message);
gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool),
message);
}
void
gimp_tool_push_status_coords (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *title,
gdouble x,
const gchar *separator,
gdouble y)
{
GimpStatusbar *statusbar;
GimpDisplayShell *shell;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (tool->gdisp));
g_return_if_fail (title != NULL);
g_return_if_fail (separator != NULL);
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
statusbar =
GIMP_STATUSBAR (GIMP_DISPLAY_SHELL (tool->gdisp->shell)->statusbar);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_push_coords (statusbar, G_OBJECT_TYPE_NAME (tool),
gimp_statusbar_push_coords (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool),
title, x, separator, y);
}
void
gimp_tool_push_status_length (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *title,
GimpOrientationType axis,
gdouble value)
{
GimpStatusbar *statusbar;
GimpDisplayShell *shell;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (tool->gdisp));
g_return_if_fail (title != NULL);
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
statusbar =
GIMP_STATUSBAR (GIMP_DISPLAY_SHELL (tool->gdisp->shell)->statusbar);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_push_length (statusbar, G_OBJECT_TYPE_NAME (tool),
gimp_statusbar_push_length (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool),
title, axis, value);
}
void
gimp_tool_pop_status (GimpTool *tool)
gimp_tool_replace_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message)
{
GimpStatusbar *statusbar;
GimpDisplayShell *shell;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (tool->gdisp));
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
statusbar =
GIMP_STATUSBAR (GIMP_DISPLAY_SHELL (tool->gdisp->shell)->statusbar);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_pop (statusbar, G_OBJECT_TYPE_NAME (tool));
gimp_statusbar_replace (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool),
message);
}
void
gimp_tool_pop_status (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpDisplayShell *shell;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool));
}
void

View file

@ -146,17 +146,24 @@ void gimp_tool_cursor_update (GimpTool *tool,
GimpDisplay *gdisp);
void gimp_tool_push_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message);
void gimp_tool_push_status_coords (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *title,
gdouble x,
const gchar *separator,
gdouble y);
void gimp_tool_push_status_length (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *title,
GimpOrientationType axis,
gdouble value);
void gimp_tool_pop_status (GimpTool *tool);
void gimp_tool_replace_status (GimpTool *tool,
GimpDisplay *gdisp,
const gchar *message);
void gimp_tool_pop_status (GimpTool *tool,
GimpDisplay *gdisp);
void gimp_tool_set_cursor (GimpTool *tool,
GimpDisplay *gdisp,

View file

@ -264,7 +264,7 @@ gimp_vector_tool_control (GimpTool *tool,
case HALT:
gimp_vector_tool_set_vectors (vector_tool, NULL);
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
break;
default:
@ -1245,9 +1245,9 @@ gimp_vector_tool_status_update (GimpTool *tool,
}
if (status)
gimp_tool_push_status (tool, status);
gimp_tool_push_status (tool, gdisp, status);
else
gimp_tool_pop_status (tool);
gimp_tool_pop_status (tool, gdisp);
}
}