put all tool_manager variables into a struct which is attached to a
2001-07-07 Michael Natterer <mitch@gimp.org> * app/tools/tool_manager.[ch]: put all tool_manager variables into a struct which is attached to a "Gimp". Pass a Gimp* to all tool_manager functions. * app/disp_callbacks.c * app/gdisplay.c * app/gimage.c * app/scale.c * app/scroll.c * app/undo.c * app/gui/convert-dialog.c * app/gui/edit-commands.c * app/gui/tool-options-dialog.c * app/gui/tools-commands.c: changed accordingly. * app/tools/gimpbezierselecttool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimpeditselectiontool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/gimptool.c * app/tools/gimptransformtool.c: mostly bad hacks for tool dialogs which exist without a real context. Needs some more review.
This commit is contained in:
committed by
Michael Natterer
parent
5693956664
commit
b70ee4b76d
@ -176,6 +176,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpTool *active_tool;
|
||||
GdkEventExpose *eevent;
|
||||
GdkEventMotion *mevent;
|
||||
GdkEventButton *bevent;
|
||||
@ -193,6 +194,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
||||
if (!canvas->window)
|
||||
return FALSE;
|
||||
|
||||
active_tool = tool_manager_get_active (gdisp->gimage->gimp);
|
||||
|
||||
/* If this is the first event... */
|
||||
if (!gdisp->select)
|
||||
{
|
||||
@ -294,9 +297,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
||||
GTK_SIGNAL_FUNC (gtk_true),
|
||||
NULL);
|
||||
|
||||
/* FIXME!!! This code is ugly, and active_tool shouldn't be referenced
|
||||
* directly
|
||||
*/
|
||||
/* FIXME!!! This code is ugly */
|
||||
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL (active_tool) ||
|
||||
! gimp_image_is_empty (gdisp->gimage)))
|
||||
@ -322,6 +323,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
||||
{
|
||||
tool_manager_initialize_tool (gdisp->gimage->gimp,
|
||||
active_tool, gdisp);
|
||||
|
||||
active_tool = tool_manager_get_active (gdisp->gimage->gimp);
|
||||
}
|
||||
|
||||
/* otherwise set it's drawable if it has none */
|
||||
@ -681,19 +684,32 @@ gdisplay_hruler_button_press (GtkWidget *widget,
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) data;
|
||||
|
||||
if (gimp_busy)
|
||||
return TRUE;
|
||||
|
||||
if (event->button == 1)
|
||||
{
|
||||
gdisp = data;
|
||||
GimpToolInfo *tool_info;
|
||||
GimpTool *active_tool;
|
||||
|
||||
gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp),
|
||||
tool_manager_get_info_by_type (gdisp->gimage->gimp,
|
||||
GIMP_TYPE_MOVE_TOOL));
|
||||
tool_info = tool_manager_get_info_by_type (gdisp->gimage->gimp,
|
||||
GIMP_TYPE_MOVE_TOOL);
|
||||
|
||||
gimp_move_tool_start_hguide (active_tool, gdisp);
|
||||
gtk_grab_add (gdisp->canvas);
|
||||
if (tool_info)
|
||||
{
|
||||
gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp),
|
||||
tool_info);
|
||||
|
||||
active_tool = tool_manager_get_active (gdisp->gimage->gimp);
|
||||
|
||||
if (active_tool)
|
||||
{
|
||||
gimp_move_tool_start_hguide (active_tool, gdisp);
|
||||
gtk_grab_add (gdisp->canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@ -706,19 +722,32 @@ gdisplay_vruler_button_press (GtkWidget *widget,
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) data;
|
||||
|
||||
if (gimp_busy)
|
||||
return TRUE;
|
||||
|
||||
if (event->button == 1)
|
||||
{
|
||||
gdisp = data;
|
||||
GimpToolInfo *tool_info;
|
||||
GimpTool *active_tool;
|
||||
|
||||
gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp),
|
||||
tool_manager_get_info_by_type (gdisp->gimage->gimp,
|
||||
GIMP_TYPE_MOVE_TOOL));
|
||||
tool_info = tool_manager_get_info_by_type (gdisp->gimage->gimp,
|
||||
GIMP_TYPE_MOVE_TOOL);
|
||||
|
||||
gimp_move_tool_start_vguide (active_tool, gdisp);
|
||||
gtk_grab_add (gdisp->canvas);
|
||||
if (tool_info)
|
||||
{
|
||||
gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp),
|
||||
tool_info);
|
||||
|
||||
active_tool = tool_manager_get_active (gdisp->gimage->gimp);
|
||||
|
||||
if (active_tool)
|
||||
{
|
||||
gimp_move_tool_start_vguide (active_tool, gdisp);
|
||||
gtk_grab_add (gdisp->canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user