Commit 9071470d authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

app/tools/gimppainttool.[ch] export paint tool statusbar API.

2005-04-04  Sven Neumann  <sven@gimp.org>

	* app/tools/gimppainttool.[ch] export paint tool statusbar API.

	* app/tools/gimpclonetool.c: added statusbar hint.
parent cc2af3db
2005-04-04 Sven Neumann <sven@gimp.org>
* app/tools/gimppainttool.[ch] export paint tool statusbar API.
* app/tools/gimpclonetool.c: added statusbar hint.
2005-04-04 Sven Neumann <sven@gimp.org>
* libgimpbase/gimpenv.c (gimp_directory): use g_ascii_isalnum()
......
......@@ -120,12 +120,6 @@ static void gimp_paint_tool_notify_brush (GimpDisplayConfig *config,
GParamSpec *pspec,
GimpPaintTool *paint_tool);
static void gimp_paint_tool_push_status (GimpTool *tool,
GimpDisplayShell *shell,
const gchar *message);
static void gimp_paint_tool_pop_status (GimpTool *tool,
GimpDisplayShell *status);
static GimpColorToolClass *parent_class = NULL;
......@@ -294,6 +288,38 @@ 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,
......@@ -644,7 +670,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, shell);
gimp_paint_tool_pop_status (tool, gdisp);
if (tool->gdisp &&
tool->gdisp != gdisp &&
......@@ -666,13 +692,13 @@ gimp_paint_tool_oper_update (GimpTool *tool,
if (gdisp == tool->gdisp && (state & GDK_SHIFT_MASK))
{
/* If shift is down and this is not the first paint stroke,
* draw a line
* draw a line.
*/
gdouble dx, dy, dist;
gchar status_str[STATUSBAR_SIZE];
gint off_x, off_y;
gboolean hard;
gdouble dx, dy, dist;
gchar status_str[STATUSBAR_SIZE];
gint off_x, off_y;
gboolean hard;
core->cur_coords = *coords;
......@@ -712,14 +738,14 @@ gimp_paint_tool_oper_update (GimpTool *tool,
g_snprintf (status_str, sizeof (status_str), format_str, dist);
}
gimp_paint_tool_push_status (tool, shell, status_str);
gimp_paint_tool_push_status (tool, gdisp, status_str);
paint_tool->draw_line = TRUE;
}
else
{
if (gdisp == tool->gdisp)
gimp_paint_tool_push_status (tool, shell,
gimp_paint_tool_push_status (tool, gdisp,
_("Press Shift to "
"draw a straight line."));
......@@ -937,20 +963,3 @@ gimp_paint_tool_notify_brush (GimpDisplayConfig *config,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (paint_tool));
}
static void
gimp_paint_tool_push_status (GimpTool *tool,
GimpDisplayShell *shell,
const gchar *message)
{
gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool), message);
}
static void
gimp_paint_tool_pop_status (GimpTool *tool,
GimpDisplayShell *shell)
{
gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool));
}
......@@ -59,5 +59,14 @@ 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__ */
......@@ -66,6 +66,10 @@ static void gimp_clone_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_clone_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_clone_tool_draw (GimpDrawTool *draw_tool);
......@@ -132,6 +136,7 @@ gimp_clone_tool_class_init (GimpCloneToolClass *klass)
tool_class->button_press = gimp_clone_tool_button_press;
tool_class->motion = gimp_clone_tool_motion;
tool_class->cursor_update = gimp_clone_tool_cursor_update;
tool_class->oper_update = gimp_clone_tool_oper_update;
draw_tool_class->draw = gimp_clone_tool_draw;
}
......@@ -173,7 +178,9 @@ gimp_clone_tool_button_press (GimpTool *tool,
}
}
else
GIMP_CLONE (paint_tool->core)->set_source = FALSE;
{
GIMP_CLONE (paint_tool->core)->set_source = FALSE;
}
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
gdisp);
......@@ -196,7 +203,7 @@ gimp_clone_tool_motion (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state, gdisp);
}
void
static void
gimp_clone_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
......@@ -233,6 +240,19 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
}
static void
gimp_clone_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
{
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, gdisp);
if (! GIMP_CLONE (GIMP_PAINT_TOOL (tool)->core)->src_drawable)
gimp_paint_tool_replace_status (tool, gdisp,
_("Ctrl-Click to set a clone source."));
}
static void
gimp_clone_tool_draw (GimpDrawTool *draw_tool)
{
......
......@@ -120,12 +120,6 @@ static void gimp_paint_tool_notify_brush (GimpDisplayConfig *config,
GParamSpec *pspec,
GimpPaintTool *paint_tool);
static void gimp_paint_tool_push_status (GimpTool *tool,
GimpDisplayShell *shell,
const gchar *message);
static void gimp_paint_tool_pop_status (GimpTool *tool,
GimpDisplayShell *status);
static GimpColorToolClass *parent_class = NULL;
......@@ -294,6 +288,38 @@ 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,
......@@ -644,7 +670,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, shell);
gimp_paint_tool_pop_status (tool, gdisp);
if (tool->gdisp &&
tool->gdisp != gdisp &&
......@@ -666,13 +692,13 @@ gimp_paint_tool_oper_update (GimpTool *tool,
if (gdisp == tool->gdisp && (state & GDK_SHIFT_MASK))
{
/* If shift is down and this is not the first paint stroke,
* draw a line
* draw a line.
*/
gdouble dx, dy, dist;
gchar status_str[STATUSBAR_SIZE];
gint off_x, off_y;
gboolean hard;
gdouble dx, dy, dist;
gchar status_str[STATUSBAR_SIZE];
gint off_x, off_y;
gboolean hard;
core->cur_coords = *coords;
......@@ -712,14 +738,14 @@ gimp_paint_tool_oper_update (GimpTool *tool,
g_snprintf (status_str, sizeof (status_str), format_str, dist);
}
gimp_paint_tool_push_status (tool, shell, status_str);
gimp_paint_tool_push_status (tool, gdisp, status_str);
paint_tool->draw_line = TRUE;
}
else
{
if (gdisp == tool->gdisp)
gimp_paint_tool_push_status (tool, shell,
gimp_paint_tool_push_status (tool, gdisp,
_("Press Shift to "
"draw a straight line."));
......@@ -937,20 +963,3 @@ gimp_paint_tool_notify_brush (GimpDisplayConfig *config,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (paint_tool));
}
static void
gimp_paint_tool_push_status (GimpTool *tool,
GimpDisplayShell *shell,
const gchar *message)
{
gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool), message);
}
static void
gimp_paint_tool_pop_status (GimpTool *tool,
GimpDisplayShell *shell)
{
gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool));
}
......@@ -59,5 +59,14 @@ 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__ */
......@@ -66,6 +66,10 @@ static void gimp_clone_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_clone_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_clone_tool_draw (GimpDrawTool *draw_tool);
......@@ -132,6 +136,7 @@ gimp_clone_tool_class_init (GimpCloneToolClass *klass)
tool_class->button_press = gimp_clone_tool_button_press;
tool_class->motion = gimp_clone_tool_motion;
tool_class->cursor_update = gimp_clone_tool_cursor_update;
tool_class->oper_update = gimp_clone_tool_oper_update;
draw_tool_class->draw = gimp_clone_tool_draw;
}
......@@ -173,7 +178,9 @@ gimp_clone_tool_button_press (GimpTool *tool,
}
}
else
GIMP_CLONE (paint_tool->core)->set_source = FALSE;
{
GIMP_CLONE (paint_tool->core)->set_source = FALSE;
}
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
gdisp);
......@@ -196,7 +203,7 @@ gimp_clone_tool_motion (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state, gdisp);
}
void
static void
gimp_clone_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
......@@ -233,6 +240,19 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
}
static void
gimp_clone_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
{
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, gdisp);
if (! GIMP_CLONE (GIMP_PAINT_TOOL (tool)->core)->src_drawable)
gimp_paint_tool_replace_status (tool, gdisp,
_("Ctrl-Click to set a clone source."));
}
static void
gimp_clone_tool_draw (GimpDrawTool *draw_tool)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment