Commit 625b5c71 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

put a g_object_ref() on a different line.

2001-11-20  Michael Natterer  <mitch@gimp.org>

	* app/core/gimp.c: put a g_object_ref() on a different line.

	* app/core/gimpdrawable-bucket-fill.c
	* app/core/gimpmodules.c: ne need to #include "core/..." here.

	* app/display/gimpdisplay-handlers.c: added debugging output
	because we have an image refcounting problem :(

	* app/display/gimpdisplayshell-handlers.c: fixed a signal
	disconnection.

	* app/tools/gimpbezierselecttool.[ch]
	* app/tools/gimpblendtool.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpclonetool.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpellipseselecttool.c
	* app/tools/gimpfreeselecttool.c
	* app/tools/gimpfuzzyselecttool.c
	* app/tools/gimpinktool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimpmagnifytool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimprectselecttool.c
	* app/tools/gimpsmudgetool.c: get the tool's options via
	tool->tool_info->tool_options, not from the local statis pointer.
	Some minor cleanups & function reordering.

	* app/widgets/gimpdockbook.c: return TRUE from the notebook tabs'
	"button_press" handler, connect DND before cnnecting to
	"button_press" because we now stop it's emission.
parent 8244713a
2001-11-20 Michael Natterer <mitch@gimp.org>
* app/core/gimp.c: put a g_object_ref() on a different line.
* app/core/gimpdrawable-bucket-fill.c
* app/core/gimpmodules.c: ne need to #include "core/..." here.
* app/display/gimpdisplay-handlers.c: added debugging output
because we have an image refcounting problem :(
* app/display/gimpdisplayshell-handlers.c: fixed a signal
disconnection.
* app/tools/gimpbezierselecttool.[ch]
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpclonetool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcroptool.c
* app/tools/gimpellipseselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimpinktool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpmagnifytool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimprectselecttool.c
* app/tools/gimpsmudgetool.c: get the tool's options via
tool->tool_info->tool_options, not from the local statis pointer.
Some minor cleanups & function reordering.
* app/widgets/gimpdockbook.c: return TRUE from the notebook tabs'
"button_press" handler, connect DND before cnnecting to
"button_press" because we now stop it's emission.
2001-11-19 Daniel Egger <degger@fhm.edu>
* app/paint-funcs/paint-funcs.h: Added magic comment to prevent
......
......@@ -36,12 +36,12 @@
#include "core-types.h"
#include "core/gimp.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimplist.h"
#include "core/gimpmoduleinfo.h"
#include "core/gimpmodules.h"
#include "gimp.h"
#include "gimpcoreconfig.h"
#include "gimpdatafiles.h"
#include "gimplist.h"
#include "gimpmoduleinfo.h"
#include "gimpmodules.h"
#include "gimprc.h"
......
......@@ -417,9 +417,9 @@ gimp_initialize (Gimp *gimp,
*/
context = gimp_create_context (gimp, "User", context);
gimp_set_user_context (gimp, context);
g_object_unref (G_OBJECT (context));
gimp_set_current_context (gimp, context);
g_object_unref (G_OBJECT (context));
/* register all internal procedures */
(* status_callback) (_("Procedural Database"), NULL, -1);
......
......@@ -30,15 +30,15 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-bucket-fill.h"
#include "core/gimpimage.h"
#include "core/gimpimage-contiguous-region.h"
#include "core/gimpimage-mask.h"
#include "core/gimppattern.h"
#include "gimp.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimpdrawable-bucket-fill.h"
#include "gimpimage.h"
#include "gimpimage-contiguous-region.h"
#include "gimpimage-mask.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "undo.h"
......
......@@ -285,12 +285,15 @@ gimp_color_picker_tool_button_press (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpColorPickerTool *cp_tool;
GimpDisplayShell *shell;
gint off_x, off_y;
GimpColorPickerTool *cp_tool;
GimpColorPickerToolOptions *options;
GimpDisplayShell *shell;
gint off_x, off_y;
cp_tool = GIMP_COLOR_PICKER_TOOL (tool);
options = (GimpColorPickerToolOptions *) tool->tool_info->tool_options;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
/* Make the tool active and set it's gdisplay & drawable */
......@@ -391,28 +394,30 @@ gimp_color_picker_tool_button_press (GimpTool *tool,
*/
if (state & GDK_SHIFT_MASK)
{
gimp_color_picker_tool_info_update
(tool, pick_color_do (gdisp->gimage, tool->drawable,
coords->x,
coords->y,
gimp_color_picker_tool_options->sample_merged,
gimp_color_picker_tool_options->sample_average,
gimp_color_picker_tool_options->average_radius,
gimp_color_picker_tool_options->update_active,
COLOR_NEW));
gimp_color_picker_tool_info_update (tool,
pick_color_do (gdisp->gimage,
tool->drawable,
coords->x,
coords->y,
options->sample_merged,
options->sample_average,
options->average_radius,
options->update_active,
COLOR_NEW));
update_type = COLOR_UPDATE_NEW;
}
else
{
gimp_color_picker_tool_info_update
(tool, pick_color_do (gdisp->gimage, tool->drawable,
coords->x,
coords->y,
gimp_color_picker_tool_options->sample_merged,
gimp_color_picker_tool_options->sample_average,
gimp_color_picker_tool_options->average_radius,
gimp_color_picker_tool_options->update_active,
COLOR_UPDATE));
gimp_color_picker_tool_info_update (tool,
pick_color_do (gdisp->gimage,
tool->drawable,
coords->x,
coords->y,
options->sample_merged,
options->sample_average,
options->average_radius,
options->update_active,
COLOR_UPDATE));
update_type = COLOR_UPDATE;
}
......@@ -427,22 +432,26 @@ gimp_color_picker_tool_button_release (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpColorPickerTool *cp_tool;
GimpColorPickerTool *cp_tool;
GimpColorPickerToolOptions *options;
cp_tool = GIMP_COLOR_PICKER_TOOL(tool);
options = (GimpColorPickerToolOptions *) tool->tool_info->tool_options;
gdk_pointer_ungrab (time);
gdk_flush ();
cp_tool = GIMP_COLOR_PICKER_TOOL(tool);
gimp_color_picker_tool_info_update
(tool, pick_color_do (gdisp->gimage, tool->drawable,
coords->x,
coords->y,
gimp_color_picker_tool_options->sample_merged,
gimp_color_picker_tool_options->sample_average,
gimp_color_picker_tool_options->average_radius,
gimp_color_picker_tool_options->update_active,
update_type));
gimp_color_picker_tool_info_update (tool,
pick_color_do (gdisp->gimage,
tool->drawable,
coords->x,
coords->y,
options->sample_merged,
options->sample_average,
options->average_radius,
options->update_active,
update_type));
gimp_draw_tool_stop (GIMP_DRAW_TOOL (cp_tool));
......@@ -456,11 +465,14 @@ gimp_color_picker_tool_motion (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpColorPickerTool *cp_tool;
gint off_x, off_y;
GimpColorPickerTool *cp_tool;
GimpColorPickerToolOptions *options;
gint off_x, off_y;
cp_tool = GIMP_COLOR_PICKER_TOOL (tool);
options = (GimpColorPickerToolOptions *) tool->tool_info->tool_options;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
......@@ -469,15 +481,16 @@ gimp_color_picker_tool_motion (GimpTool *tool,
cp_tool->centerx = coords->x - off_x;
cp_tool->centery = coords->y - off_y;
gimp_color_picker_tool_info_update
(tool, pick_color_do (gdisp->gimage, tool->drawable,
coords->x,
coords->y,
gimp_color_picker_tool_options->sample_merged,
gimp_color_picker_tool_options->sample_average,
gimp_color_picker_tool_options->average_radius,
gimp_color_picker_tool_options->update_active,
update_type));
gimp_color_picker_tool_info_update (tool,
pick_color_do (gdisp->gimage,
tool->drawable,
coords->x,
coords->y,
options->sample_merged,
options->sample_average,
options->average_radius,
options->update_active,
update_type));
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
......
......@@ -36,12 +36,12 @@
#include "core-types.h"
#include "core/gimp.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimplist.h"
#include "core/gimpmoduleinfo.h"
#include "core/gimpmodules.h"
#include "gimp.h"
#include "gimpcoreconfig.h"
#include "gimpdatafiles.h"
#include "gimplist.h"
#include "gimpmoduleinfo.h"
#include "gimpmodules.h"
#include "gimprc.h"
......
......@@ -61,6 +61,9 @@ gimp_display_connect (GimpDisplay *gdisp,
gimage->instance_count++; /* this is obsolete */
gimage->disp_count++;
g_print ("%s: gimage->ref_count before refing: %d\n",
G_GNUC_FUNCTION, G_OBJECT (gdisp->gimage)->ref_count);
g_object_ref (G_OBJECT (gimage));
g_signal_connect (G_OBJECT (gimage), "update",
......@@ -98,6 +101,9 @@ gimp_display_disconnect (GimpDisplay *gdisp)
gdisp->gimage->disp_count--;
g_print ("%s: gimage->ref_count before unrefing: %d\n",
G_GNUC_FUNCTION, G_OBJECT (gdisp->gimage)->ref_count);
g_object_unref (G_OBJECT (gdisp->gimage));
gdisp->gimage = NULL;
}
......
......@@ -127,7 +127,7 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
shell);
g_signal_handlers_disconnect_by_func (G_OBJECT (gimage),
gimp_display_shell_update_title,
gimp_display_shell_update_title_handler,
shell);
}
......
......@@ -33,12 +33,13 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimppattern.h"
#include "core/gimpcontext.h"
#include "core/gimpbrush.h"
#include "core/gimptoolinfo.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
......@@ -279,17 +280,22 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state)
{
GimpTool *tool;
GimpDrawTool *draw_tool;
CloneOptions *options;
GimpDisplay *gdisp;
GimpDisplay *src_gdisp;
gint x1, y1, x2, y2;
static gint orig_src_x, orig_src_y;
GimpDrawTool *draw_tool;
GimpContext *context;
gdisp = (GimpDisplay *) tool_manager_get_active (drawable->gimage->gimp)->gdisp;
tool = GIMP_TOOL (paint_tool);
draw_tool = GIMP_DRAW_TOOL (paint_tool);
options = (CloneOptions *) tool->tool_info->tool_options;
gdisp = tool->gdisp;
context = gimp_get_current_context (gdisp->gimage->gimp);
switch (state)
......@@ -317,7 +323,7 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool,
dest_x = x1;
dest_y = y1;
if (clone_options->aligned == ALIGN_REGISTERED)
if (options->aligned == ALIGN_REGISTERED)
{
offset_x = 0;
offset_y = 0;
......@@ -333,8 +339,9 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool,
src_y = dest_y + offset_y;
gimp_clone_tool_motion (paint_tool, drawable, src_drawable_,
clone_options->paint_options.pressure_options,
clone_options->type, offset_x, offset_y);
options->paint_options.pressure_options,
options->type,
offset_x, offset_y);
}
break;
......@@ -348,20 +355,21 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool,
src_y = paint_tool->cur_coords.y;
first = TRUE;
}
else if (clone_options->aligned == ALIGN_NO)
else if (options->aligned == ALIGN_NO)
{
first = TRUE;
orig_src_x = src_x;
orig_src_y = src_y;
}
if (clone_options->type == PATTERN_CLONE)
if (options->type == PATTERN_CLONE)
if (! gimp_context_get_pattern (context))
g_message (_("No patterns available for this operation."));
break;
case FINISH_PAINT:
gimp_draw_tool_stop (draw_tool);
if (clone_options->aligned == ALIGN_NO && !first)
if (options->aligned == ALIGN_NO && !first)
{
src_x = orig_src_x;
src_y = orig_src_y;
......@@ -405,10 +413,13 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
CloneOptions *options;
GimpDisplayShell *shell;
GimpLayer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
options = (CloneOptions *) tool->tool_info->tool_options;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
......@@ -432,7 +443,7 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
}
}
if (clone_options->type == IMAGE_CLONE)
if (options->type == IMAGE_CLONE)
{
if (state & GDK_CONTROL_MASK)
ctype = GIMP_CROSSHAIR_SMALL_CURSOR;
......@@ -451,7 +462,11 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
static void
gimp_clone_tool_draw (GimpDrawTool *draw_tool)
{
if (draw_tool->gc != NULL && clone_options->type == IMAGE_CLONE)
CloneOptions *options;
options = (CloneOptions *) GIMP_TOOL (draw_tool)->tool_info->tool_options;
if (draw_tool->gc != NULL && options->type == IMAGE_CLONE)
{
gdk_draw_line (draw_tool->win, draw_tool->gc,
trans_tx - (TARGET_WIDTH >> 1), trans_ty,
......
This diff is collapsed.
......@@ -36,6 +36,7 @@
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimptoolinfo.h"
#include "gimpsmudgetool.h"
#include "paint_options.h"
......@@ -189,18 +190,23 @@ gimp_smudge_tool_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state)
{
SmudgeOptions *options;
/* initialization fails if the user starts outside the drawable */
static gboolean initialized = FALSE;
options = (SmudgeOptions *) GIMP_TOOL (paint_tool)->tool_info->tool_options;
switch (state)
{
case MOTION_PAINT:
if (!initialized)
if (! initialized)
initialized = gimp_smudge_tool_start (paint_tool, drawable);
if (initialized)
gimp_smudge_tool_motion (paint_tool,
smudge_options->paint_options.pressure_options,
smudge_options->rate, drawable);
options->paint_options.pressure_options,
options->rate,
drawable);
break;
case FINISH_PAINT:
......
......@@ -33,12 +33,13 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimppattern.h"
#include "core/gimpcontext.h"
#include "core/gimpbrush.h"
#include "core/gimptoolinfo.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
......@@ -279,17 +280,22 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state)
{
GimpTool *tool;
GimpDrawTool *draw_tool;
CloneOptions *options;
GimpDisplay *gdisp;
GimpDisplay *src_gdisp;
gint x1, y1, x2, y2;
static gint orig_src_x, orig_src_y;
GimpDrawTool *draw_tool;
GimpContext *context;
gdisp = (GimpDisplay *) tool_manager_get_active (drawable->gimage->gimp)->gdisp;
tool = GIMP_TOOL (paint_tool);
draw_tool = GIMP_DRAW_TOOL (paint_tool);
options = (CloneOptions *) tool->tool_info->tool_options;
gdisp = tool->gdisp;
context = gimp_get_current_context (gdisp->gimage->gimp);
switch (state)
......@@ -317,7 +323,7 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool,
dest_x = x1;
dest_y = y1;
if (clone_options->aligned == ALIGN_REGISTERED)
if (options->aligned == ALIGN_REGISTERED)
{
offset_x = 0;
offset_y = 0;
......@@ -333,8 +339,9 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool,
src_y = dest_y + offset_y;
gimp_clone_tool_motion (paint_tool, drawable, src_drawable_,
clone_options->paint_options.pressure_options,
clone_options->type, offset_x, offset_y);
options->paint_options.pressure_options,
options->type,
offset_x, offset_y);
}
break;
......@@ -348,20 +355,21 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool,
src_y = paint_tool->cur_coords.y;
first = TRUE;
}
else if (clone_options->aligned == ALIGN_NO)
else if (options->aligned == ALIGN_NO)
{
first = TRUE;
orig_src_x = src_x;
orig_src_y = src_y;
}
if (clone_options->type == PATTERN_CLONE)
if (options->type == PATTERN_CLONE)
if (! gimp_context_get_pattern (context))
g_message (_("No patterns available for this operation."));
break;
case FINISH_PAINT:
gimp_draw_tool_stop (draw_tool);
if (clone_options->aligned == ALIGN_NO && !first)
if (options->aligned == ALIGN_NO && !first)
{
src_x = orig_src_x;
src_y = orig_src_y;
......@@ -405,10 +413,13 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
CloneOptions *options;
GimpDisplayShell *shell;
GimpLayer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
options = (CloneOptions *) tool->tool_info->tool_options;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
......@@ -432,7 +443,7 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
}
}
if (clone_options->type == IMAGE_CLONE)
if (options->type == IMAGE_CLONE)
{
if (state & GDK_CONTROL_MASK)
ctype = GIMP_CROSSHAIR_SMALL_CURSOR;
......@@ -451,7 +462,11 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
static void
gimp_clone_tool_draw (GimpDrawTool *draw_tool)
{
if (draw_tool->gc != NULL && clone_options->type == IMAGE_CLONE)
CloneOptions *options;
options = (CloneOptions *) GIMP_TOOL (draw_tool)->tool_info->tool_options;
if (draw_tool->gc != NULL && options->type == IMAGE_CLONE)
{
gdk_draw_line (draw_tool->win, draw_tool->gc,
trans_tx - (TARGET_WIDTH >> 1), trans_ty,
......
......@@ -50,7 +50,6 @@
#include "gimpeditselectiontool.h"
#include "gimpbezierselecttool.h"
#include "selection_options.h"
#include "tool_options.h"
#include "tool_manager.h"
#include "app_procs.h"
......@@ -118,45 +117,6 @@ typedef struct
gint found;
} BezierCheckPnts;
/* the bezier selection tool options */
static SelectionOptions *bezier_options = NULL;
/* local variables */
static BezierMatrix basis =
{
{ -1, 3, -3, 1 },
{ 3, -6, 3, 0 },
{ -3, 3, 0, 0 },
{ 1, 0, 0, 0 },
};
/*
static BezierMatrix basis =
{
{ -1/6.0, 3/6.0, -3/6.0, 1/6.0 },
{ 3/6.0, -6/6.0, 3/6.0, 0 },
{ -3/6.0, 0, 3/6.0, 0 },
{ 1/6.0, 4/6.0, 1, 0 },
};
*/
/* Global Static Variable to maintain informations about the "context" */
static GimpBezierSelectTool *curSel = NULL;
static GimpTool *curTool = NULL;
static GimpDisplay *curGdisp = NULL;
static GimpDrawTool *curCore = NULL;
static gint ModeEdit = EXTEND_NEW;
enum
{
BEZIER_SELECT,
LAST_SIGNAL
};
static GimpSelectionToolClass *parent_class = NULL;
static guint bezier_select_signals[LAST_SIGNAL] = { 0 };
static void gimp_bezier_select_tool_class_init (GimpBezierSelectToolClass *klass);
static void gimp_bezier_select_tool_init (GimpBezierSelectTool *bezier_select);
......@@ -281,6 +241,37 @@ static void bezier_start_new_segment (GimpBezierSelectTool *bezier_sel,
gint y);
/* local variables */
static BezierMatrix basis =
{
{ -1, 3, -3, 1 },
{ 3, -6, 3, 0 },
{ -3, 3, 0, 0 },
{ 1, 0, 0, 0 },
};
/*
static BezierMatrix basis =
{
{ -1/6.0, 3/6.0, -3/6.0, 1/6.0 },
{ 3/6.0, -6/6.0, 3/6.0, 0 },