Commit 27042a7b authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

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.
parent d2cf185c
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.
......
......@@ -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,
", ",
......
......@@ -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;
}
......
......@@ -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__ */
......@@ -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."));
}
}
......
......@@ -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: "),
......
......@@ -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);
}
......
......@@ -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,
", ",
......
......@@ -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));
......
......@@ -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)
{
......
......@@ -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),
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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__ */
......@@ -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
......
......@@ -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);
}
......
......@@ -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));
...</