mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 06:14:03 +00:00
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.
This commit is contained in:
parent
8244713a2a
commit
625b5c716c
36
ChangeLog
36
ChangeLog
|
@ -1,3 +1,39 @@
|
|||
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,
|
||||
|
|
1054
app/paint/gimpink.c
1054
app/paint/gimpink.c
File diff suppressed because it is too large
Load diff
|
@ -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 },
|
||||
{ -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;
|
||||
|
||||
static SelectionOptions *bezier_options = NULL;
|
||||
|
||||
static GimpSelectionToolClass *parent_class = NULL;
|
||||
|
||||
|
||||
/* Public functions */
|
||||
|
||||
|
@ -342,19 +333,6 @@ gimp_bezier_select_tool_class_init (GimpBezierSelectToolClass *klass)
|
|||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
bezier_select_signals[BEZIER_SELECT] =
|
||||
g_signal_new ("bezier_select",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpBezierSelectToolClass, bezier_select),
|
||||
NULL, NULL,
|
||||
gimp_cclosure_marshal_VOID__INT_INT_INT_INT,
|
||||
G_TYPE_NONE, 4,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT);
|
||||
|
||||
tool_class->button_press = gimp_bezier_select_tool_button_press;
|
||||
tool_class->button_release = gimp_bezier_select_tool_button_release;
|
||||
tool_class->motion = gimp_bezier_select_tool_motion;
|
||||
|
@ -362,8 +340,6 @@ gimp_bezier_select_tool_class_init (GimpBezierSelectToolClass *klass)
|
|||
tool_class->cursor_update = gimp_bezier_select_tool_cursor_update;
|
||||
|
||||
draw_tool_class->draw = bezier_select_draw;
|
||||
|
||||
/* klass->bezier_select = gimp_bezier_select_tool_real_bezier_select; */
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3034,18 +3010,22 @@ bezier_to_sel_internal (GimpBezierSelectTool *bezier_sel,
|
|||
GimpDisplay *gdisp,
|
||||
ChannelOps op)
|
||||
{
|
||||
SelectionOptions *sel_options;
|
||||
|
||||
sel_options = (SelectionOptions *) GIMP_TOOL (bezier_sel)->tool_info->tool_options;
|
||||
|
||||
/* If we're antialiased, then recompute the mask...
|
||||
*/
|
||||
if (bezier_options->antialias)
|
||||
if (sel_options->antialias)
|
||||
bezier_convert (bezier_sel, tool->gdisp, SUBDIVIDE, TRUE);
|
||||
|
||||
gimp_image_mask_select_channel (gdisp->gimage,
|
||||
NULL, FALSE,
|
||||
bezier_sel->mask,
|
||||
op,
|
||||
bezier_options->feather,
|
||||
bezier_options->feather_radius,
|
||||
bezier_options->feather_radius);
|
||||
sel_options->feather,
|
||||
sel_options->feather_radius,
|
||||
sel_options->feather_radius);
|
||||
|
||||
/* show selection on all views */
|
||||
gdisplays_flush ();
|
||||
|
|
|
@ -90,12 +90,6 @@ struct _GimpBezierSelectTool
|
|||
struct _GimpBezierSelectToolClass
|
||||
{
|
||||
GimpSelectionToolClass parent_class;
|
||||
|
||||
void (* bezier_select) (GimpBezierSelectTool *rect_tool,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
};
|
||||
|
||||
typedef void (* GimpBezierSelectPointsFunc) (GimpBezierSelectTool *bezier_sel,
|
||||
|
|
|
@ -294,9 +294,10 @@ gimp_blend_tool_button_release (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpBlendTool *blend_tool;
|
||||
BlendOptions *options;
|
||||
GimpDisplayShell *shell;
|
||||
GimpImage *gimage;
|
||||
#ifdef BLEND_UI_CALLS_VIA_PDB
|
||||
Argument *return_vals;
|
||||
gint nreturn_vals;
|
||||
|
@ -306,6 +307,8 @@ gimp_blend_tool_button_release (GimpTool *tool,
|
|||
|
||||
blend_tool = GIMP_BLEND_TOOL (tool);
|
||||
|
||||
options = (BlendOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
@ -331,15 +334,15 @@ gimp_blend_tool_button_release (GimpTool *tool,
|
|||
procedural_db_run_proc ("gimp_blend",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimp_image_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
PDB_FLOAT, (gdouble) blend_options->offset,
|
||||
PDB_INT32, (gint32) blend_options->repeat,
|
||||
PDB_INT32, (gint32) blend_options->supersample,
|
||||
PDB_INT32, (gint32) blend_options->max_depth,
|
||||
PDB_FLOAT, (gdouble) blend_options->threshold,
|
||||
PDB_INT32, (gint32) options->blend_mode,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (options),
|
||||
PDB_INT32, (gint32) options->gradient_type,
|
||||
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (options) * 100,
|
||||
PDB_FLOAT, (gdouble) options->offset,
|
||||
PDB_INT32, (gint32) options->repeat,
|
||||
PDB_INT32, (gint32) options->supersample,
|
||||
PDB_INT32, (gint32) options->max_depth,
|
||||
PDB_FLOAT, (gdouble) options->threshold,
|
||||
PDB_FLOAT, (gdouble) blend_tool->startx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->starty,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endx,
|
||||
|
@ -358,15 +361,15 @@ gimp_blend_tool_button_release (GimpTool *tool,
|
|||
progress = progress_start (gdisp, _("Blending..."), FALSE, NULL, NULL);
|
||||
|
||||
gimp_drawable_blend (gimp_image_active_drawable (gimage),
|
||||
blend_options->blend_mode,
|
||||
options->blend_mode,
|
||||
gimp_context_get_paint_mode (gimp_get_current_context (gimage->gimp)),
|
||||
blend_options->gradient_type,
|
||||
options->gradient_type,
|
||||
gimp_context_get_opacity (gimp_get_current_context (gimage->gimp)),
|
||||
blend_options->offset,
|
||||
blend_options->repeat,
|
||||
blend_options->supersample,
|
||||
blend_options->max_depth,
|
||||
blend_options->threshold,
|
||||
options->offset,
|
||||
options->repeat,
|
||||
options->supersample,
|
||||
options->max_depth,
|
||||
options->threshold,
|
||||
blend_tool->startx,
|
||||
blend_tool->starty,
|
||||
blend_tool->endx,
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "core/gimpdrawable-bucket-fill.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "pdb/procedural_db.h"
|
||||
|
||||
|
@ -191,16 +192,19 @@ gimp_bucket_fill_tool_button_press (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpBucketFillTool *bucket_tool;
|
||||
BucketOptions *options;
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
bucket_tool = GIMP_BUCKET_FILL_TOOL (tool);
|
||||
|
||||
options = (BucketOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
bucket_tool->target_x = coords->x;
|
||||
bucket_tool->target_y = coords->y;
|
||||
|
||||
if (! bucket_options->sample_merged)
|
||||
if (! options->sample_merged)
|
||||
{
|
||||
gint off_x, off_y;
|
||||
|
||||
|
@ -230,11 +234,14 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpBucketFillTool *bucket_tool;
|
||||
BucketOptions *options;
|
||||
Argument *return_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
bucket_tool = GIMP_BUCKET_FILL_TOOL (tool);
|
||||
|
||||
options = (BucketOptions *) tool->tool_info->tool_options;
|
||||
|
||||
gdk_pointer_ungrab (time);
|
||||
gdk_flush ();
|
||||
|
||||
|
@ -250,11 +257,11 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
|
|||
"gimp_bucket_fill",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, gimp_drawable_get_ID (gimp_image_active_drawable (gdisp->gimage)),
|
||||
GIMP_PDB_INT32, (gint32) bucket_options->fill_mode,
|
||||
GIMP_PDB_INT32, (gint32) options->fill_mode,
|
||||
GIMP_PDB_INT32, (gint32) gimp_context_get_paint_mode (context),
|
||||
GIMP_PDB_FLOAT, (gdouble) gimp_context_get_opacity (context) * 100,
|
||||
GIMP_PDB_FLOAT, (gdouble) bucket_options->threshold,
|
||||
GIMP_PDB_INT32, (gint32) bucket_options->sample_merged,
|
||||
GIMP_PDB_FLOAT, (gdouble) options->threshold,
|
||||
GIMP_PDB_INT32, (gint32) options->sample_merged,
|
||||
GIMP_PDB_FLOAT, (gdouble) bucket_tool->target_x,
|
||||
GIMP_PDB_FLOAT, (gdouble) bucket_tool->target_y,
|
||||
GIMP_PDB_END);
|
||||
|
@ -277,19 +284,21 @@ gimp_bucket_fill_tool_modifier_key (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
BucketOptions *options;
|
||||
|
||||
options = (BucketOptions *) tool->tool_info->tool_options;
|
||||
|
||||
if (key == GDK_CONTROL_MASK)
|
||||
{
|
||||
switch (bucket_options->fill_mode)
|
||||
switch (options->fill_mode)
|
||||
{
|
||||
case FG_BUCKET_FILL:
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (bucket_options->fill_mode_w[BG_BUCKET_FILL]),
|
||||
TRUE);
|
||||
(GTK_TOGGLE_BUTTON (options->fill_mode_w[BG_BUCKET_FILL]), TRUE);
|
||||
break;
|
||||
case BG_BUCKET_FILL:
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (bucket_options->fill_mode_w[FG_BUCKET_FILL]),
|
||||
TRUE);
|
||||
(GTK_TOGGLE_BUTTON (options->fill_mode_w[FG_BUCKET_FILL]), TRUE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -303,12 +312,15 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
BucketOptions *options;
|
||||
GimpDisplayShell *shell;
|
||||
GimpLayer *layer;
|
||||
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
|
||||
GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE;
|
||||
gint off_x, off_y;
|
||||
|
||||
options = (BucketOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
|
||||
|
@ -328,7 +340,7 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
|
|||
{
|
||||
ctype = GIMP_MOUSE_CURSOR;
|
||||
|
||||
switch (bucket_options->fill_mode)
|
||||
switch (options->fill_mode)
|
||||
{
|
||||
case FG_BUCKET_FILL:
|
||||
cmodifier = GIMP_CURSOR_MODIFIER_FOREGROUND;
|
||||
|
|
|
@ -33,13 +33,14 @@
|
|||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage-contiguous-region.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimpimage-mask-select.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "widgets/gimpdnd.h"
|
||||
|
||||
|
@ -49,7 +50,6 @@
|
|||
|
||||
#include "gimpbycolorselecttool.h"
|
||||
#include "selection_options.h"
|
||||
#include "tool_options.h"
|
||||
#include "tool_manager.h"
|
||||
|
||||
#include "gimprc.h"
|
||||
|
@ -313,11 +313,14 @@ by_color_select_button_press (GimpTool *tool,
|
|||
{
|
||||
GimpByColorSelectTool *by_color_sel;
|
||||
GimpDrawTool *draw_tool;
|
||||
SelectionOptions *sel_options;
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
by_color_sel = GIMP_BY_COLOR_SELECT_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
@ -331,7 +334,7 @@ by_color_select_button_press (GimpTool *tool,
|
|||
by_color_sel->x = coords->x;
|
||||
by_color_sel->y = coords->y;
|
||||
|
||||
if (! by_color_options->sample_merged)
|
||||
if (! sel_options->sample_merged)
|
||||
{
|
||||
gint off_x, off_y;
|
||||
|
||||
|
@ -374,12 +377,15 @@ by_color_select_button_release (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpByColorSelectTool *by_color_sel;
|
||||
SelectionOptions *sel_options;
|
||||
GimpDrawable *drawable;
|
||||
guchar *col;
|
||||
GimpRGB color;
|
||||
|
||||
by_color_sel = GIMP_BY_COLOR_SELECT_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
gdk_pointer_ungrab (time);
|
||||
|
@ -395,7 +401,7 @@ by_color_select_button_release (GimpTool *tool,
|
|||
by_color_sel->y < gimp_drawable_height (drawable))
|
||||
{
|
||||
/* Get the start color */
|
||||
if (by_color_options->sample_merged)
|
||||
if (sel_options->sample_merged)
|
||||
{
|
||||
if (!(col = gimp_image_get_color_at (gdisp->gimage,
|
||||
by_color_sel->x,
|
||||
|
@ -416,14 +422,14 @@ by_color_select_button_release (GimpTool *tool,
|
|||
|
||||
/* select the area */
|
||||
gimp_image_mask_select_by_color (gdisp->gimage, drawable,
|
||||
by_color_options->sample_merged,
|
||||
sel_options->sample_merged,
|
||||
&color,
|
||||
by_color_dialog->threshold,
|
||||
by_color_sel->operation,
|
||||
by_color_options->antialias,
|
||||
by_color_options->feather,
|
||||
by_color_options->feather_radius,
|
||||
by_color_options->feather_radius);
|
||||
sel_options->antialias,
|
||||
sel_options->feather,
|
||||
sel_options->feather_radius,
|
||||
sel_options->feather_radius);
|
||||
|
||||
/* show selection on all views */
|
||||
gdisplays_flush ();
|
||||
|
@ -481,16 +487,19 @@ by_color_select_cursor_update (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpByColorSelectTool *by_col_sel;
|
||||
SelectionOptions *sel_options;
|
||||
GimpDisplayShell *shell;
|
||||
GimpLayer *layer;
|
||||
|
||||
by_col_sel = GIMP_BY_COLOR_SELECT_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
layer = gimp_image_pick_correlate_layer (gdisp->gimage, coords->x, coords->y);
|
||||
|
||||
if (by_color_options->sample_merged ||
|
||||
if (sel_options->sample_merged ||
|
||||
(layer && layer == gdisp->gimage->active_layer))
|
||||
{
|
||||
switch (by_col_sel->operation)
|
||||
|
@ -992,7 +1001,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
|
|||
guchar *col;
|
||||
GimpRGB color;
|
||||
|
||||
if (!bcd->gimage)
|
||||
if (! bcd->gimage)
|
||||
return;
|
||||
|
||||
drawable = gimp_image_active_drawable (bcd->gimage);
|
||||
|
@ -1081,6 +1090,7 @@ by_color_select_color_drop (GtkWidget *widget,
|
|||
ByColorDialog *bcd;
|
||||
|
||||
bcd = (ByColorDialog*) data;
|
||||
|
||||
drawable = gimp_image_active_drawable (bcd->gimage);
|
||||
|
||||
gimp_image_mask_select_by_color (bcd->gimage, drawable,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -32,13 +32,14 @@
|
|||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-crop.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
|
||||
#include "gui/info-dialog.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
||||
#include "gui/info-dialog.h"
|
||||
|
||||
#include "gimpcroptool.h"
|
||||
#include "gimpdrawtool.h"
|
||||
#include "gimptool.h"
|
||||
|
@ -422,10 +423,13 @@ gimp_crop_tool_button_release (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
gdk_pointer_ungrab (time);
|
||||
|
@ -437,17 +441,17 @@ gimp_crop_tool_button_release (GimpTool *tool,
|
|||
{
|
||||
if (crop->function == CROPPING)
|
||||
{
|
||||
if (crop_options->type == CROP_CROP)
|
||||
if (options->type == CROP_CROP)
|
||||
crop_tool_crop_image (gdisp->gimage,
|
||||
crop->x1, crop->y1,
|
||||
crop->x2, crop->y2,
|
||||
crop_options->layer_only,
|
||||
options->layer_only,
|
||||
TRUE);
|
||||
else
|
||||
crop_tool_crop_image (gdisp->gimage,
|
||||
crop->x1, crop->y1,
|
||||
crop->x2, crop->y2,
|
||||
crop_options->layer_only,
|
||||
options->layer_only,
|
||||
FALSE);
|
||||
|
||||
/* Finish the tool */
|
||||
|
@ -468,6 +472,7 @@ gimp_crop_tool_motion (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
GimpDisplayShell *shell;
|
||||
GimpLayer *layer;
|
||||
gint x1, y1, x2, y2;
|
||||
|
@ -478,6 +483,8 @@ gimp_crop_tool_motion (GimpTool *tool,
|
|||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
/* This is the only case when the motion events should be ignored--
|
||||
|
@ -502,7 +509,7 @@ gimp_crop_tool_motion (GimpTool *tool,
|
|||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
if (crop_options->layer_only)
|
||||
if (options->layer_only)
|
||||
{
|
||||
layer = gimp_image_get_active_layer (gdisp->gimage);
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &min_x, &min_y);
|
||||
|
@ -519,7 +526,7 @@ gimp_crop_tool_motion (GimpTool *tool,
|
|||
switch (crop->function)
|
||||
{
|
||||
case CREATING:
|
||||
if (! crop_options->allow_enlarge)
|
||||
if (! options->allow_enlarge)
|
||||
{
|
||||
x1 = CLAMP (x1, min_x, max_x);
|
||||
y1 = CLAMP (y1, min_y, max_y);
|
||||
|
@ -531,7 +538,7 @@ gimp_crop_tool_motion (GimpTool *tool,
|
|||
case RESIZING_LEFT:
|
||||
x1 = crop->x1 + inc_x;
|
||||
y1 = crop->y1 + inc_y;
|
||||
if (! crop_options->allow_enlarge)
|
||||
if (! options->allow_enlarge)
|
||||
{
|
||||
x1 = CLAMP (x1, min_x, max_x);
|
||||
y1 = CLAMP (y1, min_y, max_y);
|
||||
|
@ -545,7 +552,7 @@ gimp_crop_tool_motion (GimpTool *tool,
|
|||
case RESIZING_RIGHT:
|
||||
x2 = crop->x2 + inc_x;
|
||||
y2 = crop->y2 + inc_y;
|
||||
if (! crop_options->allow_enlarge)
|
||||
if (! options->allow_enlarge)
|
||||
{
|
||||
x2 = CLAMP (x2, min_x, max_x);
|
||||
y2 = CLAMP (y2, min_y, max_y);
|
||||
|
@ -556,8 +563,8 @@ gimp_crop_tool_motion (GimpTool *tool,
|
|||
crop->starty = cury;
|
||||
break;
|
||||
|
||||
case MOVING :
|
||||
if (! crop_options->allow_enlarge)
|
||||
case MOVING:
|
||||
if (! options->allow_enlarge)
|
||||
{
|
||||
inc_x = CLAMP (inc_x, min_x - crop->x1, max_x - crop->x2);
|
||||
inc_y = CLAMP (inc_y, min_y - crop->y1, max_y - crop->y2);
|
||||
|
@ -619,14 +626,17 @@ gimp_crop_tool_arrow_key (GimpTool *tool,
|
|||
GdkEventKey *kevent,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpLayer *layer;
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
GimpLayer *layer;
|
||||
gint inc_x, inc_y;
|
||||
gint min_x, min_y;
|
||||
gint max_x, max_y;
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
if (tool->state == ACTIVE)
|
||||
{
|
||||
inc_x = inc_y = 0;
|
||||
|
@ -648,7 +658,7 @@ gimp_crop_tool_arrow_key (GimpTool *tool,
|
|||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
if (crop_options->layer_only)
|
||||
if (options->layer_only)
|
||||
{
|
||||
layer = gimp_image_get_active_layer (gdisp->gimage);
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &min_x, &min_y);
|
||||
|
@ -666,7 +676,7 @@ gimp_crop_tool_arrow_key (GimpTool *tool,
|
|||
{
|
||||
crop->x2 = crop->x2 + inc_x;
|
||||
crop->y2 = crop->y2 + inc_y;
|
||||
if (!crop_options->allow_enlarge)
|
||||
if (! options->allow_enlarge)
|
||||
{
|
||||
crop->x2 = CLAMP (crop->x2, min_x, max_x);
|
||||
crop->y2 = CLAMP (crop->y2, min_y, max_y);
|
||||
|
@ -676,7 +686,7 @@ gimp_crop_tool_arrow_key (GimpTool *tool,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!crop_options->allow_enlarge)
|
||||
if (! options->allow_enlarge)
|
||||
{
|
||||
inc_x = CLAMP (inc_x,
|
||||
-crop->x1, gdisp->gimage->width - crop->x2);
|
||||
|
@ -702,34 +712,38 @@ gimp_crop_tool_modifier_key (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
CropOptions *options;
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
if (state & GDK_MOD1_MASK)
|
||||
{
|
||||
if (! crop_options->allow_enlarge)
|
||||
if (! options->allow_enlarge)
|
||||
{
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), TRUE);
|
||||
(GTK_TOGGLE_BUTTON (options->allow_enlarge_w), TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (crop_options->allow_enlarge)
|
||||
if (options->allow_enlarge)
|
||||
{
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), FALSE);
|
||||
(GTK_TOGGLE_BUTTON (options->allow_enlarge_w), FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (key == GDK_CONTROL_MASK)
|
||||
{
|
||||
switch (crop_options->type)
|
||||
switch (options->type)
|
||||
{
|
||||
case CROP_CROP:
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE);
|
||||
(GTK_TOGGLE_BUTTON (options->type_w[RESIZE_CROP]), TRUE);
|
||||
break;
|
||||
case RESIZE_CROP:
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE);
|
||||
(GTK_TOGGLE_BUTTON (options->type_w[CROP_CROP]), TRUE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -745,6 +759,7 @@ gimp_crop_tool_cursor_update (GimpTool *tool,
|
|||
{
|
||||
GimpCropTool *crop;
|
||||
GimpDrawTool *draw_tool;
|
||||
CropOptions *options;
|
||||
GimpDisplayShell *shell;
|
||||
GdkCursorType ctype = GIMP_MOUSE_CURSOR;
|
||||
GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE;
|
||||
|
@ -752,6 +767,8 @@ gimp_crop_tool_cursor_update (GimpTool *tool,
|
|||
crop = GIMP_CROP_TOOL (tool);
|
||||
draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
if (tool->state == INACTIVE ||
|
||||
|
@ -801,7 +818,7 @@ gimp_crop_tool_cursor_update (GimpTool *tool,
|
|||
|
||||
gimp_display_shell_install_tool_cursor (shell,
|
||||
ctype,
|
||||
crop_options->type == CROP_CROP ?
|
||||
options->type == CROP_CROP ?
|
||||
GIMP_CROP_TOOL_CURSOR :
|
||||
GIMP_RESIZE_TOOL_CURSOR,
|
||||
cmodifier);
|
||||
|
@ -1091,19 +1108,26 @@ static void
|
|||
crop_crop_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpCropTool *crop;
|
||||
GimpTool *tool;
|
||||
|
||||
/* XXX active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
{
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
|
||||
crop_tool_crop_image (tool->gdisp->gimage,
|
||||
crop->x1, crop->y1,
|
||||
crop->x2, crop->y2,
|
||||
crop_options->layer_only,
|
||||
TRUE);
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
crop_tool_crop_image (tool->gdisp->gimage,
|
||||
crop->x1, crop->y1,
|
||||
crop->x2, crop->y2,
|
||||
options->layer_only,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
/* Finish the tool */
|
||||
crop_close_callback (NULL, NULL);
|
||||
|
@ -1113,19 +1137,26 @@ static void
|
|||
crop_resize_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpCropTool *crop;
|
||||
GimpTool *tool;
|
||||
|
||||
/* XXX active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
{
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
|
||||
crop_tool_crop_image (tool->gdisp->gimage,
|
||||
crop->x1, crop->y1,
|
||||
crop->x2, crop->y2,
|
||||
crop_options->layer_only,
|
||||
FALSE);
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
crop_tool_crop_image (tool->gdisp->gimage,
|
||||
crop->x1, crop->y1,
|
||||
crop->x2, crop->y2,
|
||||
options->layer_only,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/* Finish the tool */
|
||||
crop_close_callback (NULL, NULL);
|
||||
|
@ -1140,122 +1171,140 @@ crop_close_callback (GtkWidget *widget,
|
|||
/* XXX active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
|
||||
if (tool->state == ACTIVE)
|
||||
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
{
|
||||
if (tool->state == ACTIVE)
|
||||
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
tool->state = INACTIVE;
|
||||
}
|
||||
|
||||
info_dialog_popdown (crop_info);
|
||||
|
||||
tool->state = INACTIVE;
|
||||
}
|
||||
|
||||
static void
|
||||
crop_selection_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpCropTool *crop;
|
||||
GimpLayer *layer;
|
||||
GimpDisplay *gdisp;
|
||||
GimpTool *tool;
|
||||
|
||||
/* XXX active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
gdisp = tool->gdisp;
|
||||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
if (! gimage_mask_bounds (gdisp->gimage,
|
||||
&crop->x1, &crop->y1, &crop->x2, &crop->y2))
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
{
|
||||
if (crop_options->layer_only)
|
||||
{
|
||||
layer = gimp_image_get_active_layer (gdisp->gimage);
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &crop->x1, &crop->y1);
|
||||
crop->x2 = gimp_drawable_width (GIMP_DRAWABLE (layer)) + crop->x1;
|
||||
crop->y2 = gimp_drawable_height (GIMP_DRAWABLE (layer)) + crop->y1;
|
||||
}
|
||||
else
|
||||
{
|
||||
crop->x1 = crop->y1 = 0;
|
||||
crop->x2 = gdisp->gimage->width;
|
||||
crop->y2 = gdisp->gimage->height;
|
||||
}
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
GimpLayer *layer;
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
gdisp = tool->gdisp;
|
||||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
if (! gimage_mask_bounds (gdisp->gimage,
|
||||
&crop->x1, &crop->y1, &crop->x2, &crop->y2))
|
||||
{
|
||||
if (options->layer_only)
|
||||
{
|
||||
layer = gimp_image_get_active_layer (gdisp->gimage);
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer),
|
||||
&crop->x1, &crop->y1);
|
||||
crop->x2 = gimp_drawable_width (GIMP_DRAWABLE (layer)) + crop->x1;
|
||||
crop->y2 = gimp_drawable_height (GIMP_DRAWABLE (layer)) + crop->y1;
|
||||
}
|
||||
else
|
||||
{
|
||||
crop->x1 = crop->y1 = 0;
|
||||
crop->x2 = gdisp->gimage->width;
|
||||
crop->y2 = gdisp->gimage->height;
|
||||
}
|
||||
}
|
||||
|
||||
crop_recalc (tool, crop);
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
|
||||
crop_recalc (tool, crop);
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
|
||||
static void
|
||||
crop_automatic_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpCropTool *crop;
|
||||
GimpDisplay *gdisp;
|
||||
GimpDrawable *active_drawable;
|
||||
gint offset_x, offset_y;
|
||||
gint width, height;
|
||||
gint x1, y1, x2, y2;
|
||||
gint shrunk_x1;
|
||||
gint shrunk_y1;
|
||||
gint shrunk_x2;
|
||||
gint shrunk_y2;
|
||||
GimpTool *tool;
|
||||
|
||||
/* FIXME: active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
gdisp = tool->gdisp;
|
||||
|
||||
if (crop_options->layer_only)
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
{
|
||||
active_drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
GimpDisplay *gdisp;
|
||||
GimpDrawable *active_drawable;
|
||||
gint offset_x, offset_y;
|
||||
gint width, height;
|
||||
gint x1, y1, x2, y2;
|
||||
gint shrunk_x1;
|
||||
gint shrunk_y1;
|
||||
gint shrunk_x2;
|
||||
gint shrunk_y2;
|
||||
|
||||
if (! active_drawable)
|
||||
return;
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
width = gimp_drawable_width (GIMP_DRAWABLE (active_drawable));
|
||||
height = gimp_drawable_height (GIMP_DRAWABLE (active_drawable));
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (active_drawable),
|
||||
&offset_x, &offset_y);
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
gdisp = tool->gdisp;
|
||||
|
||||
if (options->layer_only)
|
||||
{
|
||||
active_drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (! active_drawable)
|
||||
return;
|
||||
|
||||
width = gimp_drawable_width (GIMP_DRAWABLE (active_drawable));
|
||||
height = gimp_drawable_height (GIMP_DRAWABLE (active_drawable));
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (active_drawable),
|
||||
&offset_x, &offset_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = gdisp->gimage->width;
|
||||
height = gdisp->gimage->height;
|
||||
offset_x = 0;
|
||||
offset_y = 0;
|
||||
}
|
||||
|
||||
x1 = crop->x1 - offset_x > 0 ? crop->x1 - offset_x : 0;
|
||||
x2 = crop->x2 - offset_x < width ? crop->x2 - offset_x : width;
|
||||
y1 = crop->y1 - offset_y > 0 ? crop->y1 - offset_y : 0;
|
||||
y2 = crop->y2 - offset_y < height ? crop->y2 - offset_y : height;
|
||||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
if (gimp_image_crop_auto_shrink (gdisp->gimage,
|
||||
x1, y1, x2, y2,
|
||||
options->layer_only,
|
||||
&shrunk_x1,
|
||||
&shrunk_y1,
|
||||
&shrunk_x2,
|
||||
&shrunk_y2))
|
||||
{
|
||||
crop->x1 = offset_x + shrunk_x1;
|
||||
crop->x2 = offset_x + shrunk_x2;
|
||||
crop->y1 = offset_y + shrunk_y1;
|
||||
crop->y2 = offset_y + shrunk_y2;
|
||||
|
||||
crop_recalc (tool, crop);
|
||||
}
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
else
|
||||
{
|
||||
width = gdisp->gimage->width;
|
||||
height = gdisp->gimage->height;
|
||||
offset_x = 0;
|
||||
offset_y = 0;
|
||||
}
|
||||
|
||||
x1 = crop->x1 - offset_x > 0 ? crop->x1 - offset_x : 0;
|
||||
x2 = crop->x2 - offset_x < width ? crop->x2 - offset_x : width;
|
||||
y1 = crop->y1 - offset_y > 0 ? crop->y1 - offset_y : 0;
|
||||
y2 = crop->y2 - offset_y < height ? crop->y2 - offset_y : height;
|
||||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
if (gimp_image_crop_auto_shrink (gdisp->gimage,
|
||||
x1, y1, x2, y2,
|
||||
crop_options->layer_only,
|
||||
&shrunk_x1,
|
||||
&shrunk_y1,
|
||||
&shrunk_x2,
|
||||
&shrunk_y2))
|
||||
{
|
||||
crop->x1 = offset_x + shrunk_x1;
|
||||
crop->x2 = offset_x + shrunk_x2;
|
||||
crop->y1 = offset_y + shrunk_y1;
|
||||
crop->y2 = offset_y + shrunk_y2;
|
||||
|
||||
crop_recalc (tool, crop);
|
||||
}
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include "gimpellipseselecttool.h"
|
||||
#include "selection_options.h"
|
||||
#include "tool_options.h"
|
||||
#include "tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimpimage-mask-select.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
|
@ -41,7 +42,6 @@
|
|||
#include "gimpeditselectiontool.h"
|
||||
#include "gimpfreeselecttool.h"
|
||||
#include "selection_options.h"
|
||||
#include "tool_options.h"
|
||||
#include "tool_manager.h"
|
||||
|
||||
#include "errors.h"
|
||||
|
@ -245,9 +245,12 @@ gimp_free_select_tool_button_release (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpFreeSelectTool *free_sel;
|
||||
SelectionOptions *sel_options;
|
||||
|
||||
free_sel = GIMP_FREE_SELECT_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
gdk_pointer_ungrab (time);
|
||||
gdk_flush ();
|
||||
|
||||
|
@ -275,10 +278,10 @@ gimp_free_select_tool_button_release (GimpTool *tool,
|
|||
free_sel->num_points,
|
||||
free_sel->points,
|
||||
GIMP_SELECTION_TOOL (tool)->op,
|
||||
free_options->antialias,
|
||||
free_options->feather,
|
||||
free_options->feather_radius,
|
||||
free_options->feather_radius);
|
||||
sel_options->antialias,
|
||||
sel_options->feather,
|
||||
sel_options->feather_radius,
|
||||
sel_options->feather_radius);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "core/gimpimage-contiguous-region.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimpimage-mask-select.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
|
@ -47,9 +48,7 @@
|
|||
|
||||
#include "gimpeditselectiontool.h"
|
||||
#include "gimpfuzzyselecttool.h"
|
||||
#include "gimptool.h"
|
||||
#include "selection_options.h"
|
||||
#include "tool_options.h"
|
||||
#include "tool_manager.h"
|
||||
|
||||
#include "gimprc.h"
|
||||
|
@ -215,17 +214,20 @@ gimp_fuzzy_select_tool_button_press (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpFuzzySelectTool *fuzzy_sel;
|
||||
SelectionOptions *sel_options;
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
fuzzy_sel->x = coords->x;
|
||||
fuzzy_sel->y = coords->y;
|
||||
fuzzy_sel->first_x = fuzzy_sel->x;
|
||||
fuzzy_sel->first_y = fuzzy_sel->y;
|
||||
fuzzy_sel->first_threshold = fuzzy_options->threshold;
|
||||
fuzzy_sel->first_threshold = sel_options->threshold;
|
||||
|
||||
tool->state = ACTIVE;
|
||||
tool->gdisp = gdisp;
|
||||
|
@ -262,10 +264,13 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpFuzzySelectTool *fuzzy_sel;
|
||||
SelectionOptions *sel_options;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
gdk_pointer_ungrab (time);
|
||||
gdk_flush ();
|
||||
|
||||
|
@ -279,12 +284,12 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool,
|
|||
|
||||
gimp_image_mask_select_channel (gdisp->gimage,
|
||||
drawable,
|
||||
fuzzy_options->sample_merged,
|
||||
sel_options->sample_merged,
|
||||
fuzzy_sel->fuzzy_mask,
|
||||
GIMP_SELECTION_TOOL (tool)->op,
|
||||
fuzzy_options->feather,
|
||||
fuzzy_options->feather_radius,
|
||||
fuzzy_options->feather_radius);
|
||||
sel_options->feather,
|
||||
sel_options->feather_radius,
|
||||
sel_options->feather_radius);
|
||||
|
||||
g_object_unref (G_OBJECT (fuzzy_sel->fuzzy_mask));
|
||||
fuzzy_sel->fuzzy_mask = NULL;
|
||||
|
@ -309,6 +314,7 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool,
|
|||
{
|
||||
GimpFuzzySelectTool *fuzzy_sel;
|
||||
GimpSelectionTool *sel_tool;
|
||||
SelectionOptions *sel_options;
|
||||
GdkSegment *new_segs;
|
||||
gint num_new_segs;
|
||||
gint diff_x, diff_y;
|
||||
|
@ -319,6 +325,8 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool,
|
|||
fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool);
|
||||
sel_tool = GIMP_SELECTION_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
if (tool->state != ACTIVE)
|
||||
return;
|
||||
|
||||
|
@ -333,7 +341,7 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool,
|
|||
|
||||
diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2.0;
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (fuzzy_options->threshold_w),
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (sel_options->threshold_w),
|
||||
fuzzy_sel->first_threshold + diff);
|
||||
|
||||
/* calculate the new fuzzy boundary */
|
||||
|
@ -356,22 +364,25 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
|||
GimpDisplay *gdisp,
|
||||
gint *nsegs)
|
||||
{
|
||||
PixelRegion maskPR;
|
||||
GimpChannel *new;
|
||||
GdkSegment *segs;
|
||||
BoundSeg *bsegs;
|
||||
GimpDrawable *drawable;
|
||||
gint i;
|
||||
gint x, y;
|
||||
SelectionOptions *sel_options;
|
||||
PixelRegion maskPR;
|
||||
GimpChannel *new;
|
||||
GdkSegment *segs;
|
||||
BoundSeg *bsegs;
|
||||
GimpDrawable *drawable;
|
||||
gint i;
|
||||
gint x, y;
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
sel_options = (SelectionOptions *) GIMP_TOOL (fuzzy_sel)->tool_info->tool_options;
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
gimp_set_busy (gdisp->gimage->gimp);
|
||||
|
||||
x = fuzzy_sel->x;
|
||||
y = fuzzy_sel->y;
|
||||
|
||||
if (! fuzzy_options->sample_merged)
|
||||
if (! sel_options->sample_merged)
|
||||
{
|
||||
gint off_x, off_y;
|
||||
|
||||
|
@ -382,9 +393,9 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
|||
}
|
||||
|
||||
new = gimp_image_contiguous_region_by_seed (gdisp->gimage, drawable,
|
||||
fuzzy_options->sample_merged,
|
||||
fuzzy_options->antialias,
|
||||
fuzzy_options->threshold,
|
||||
sel_options->sample_merged,
|
||||
sel_options->antialias,
|
||||
sel_options->threshold,
|
||||
x, y);
|
||||
|
||||
if (fuzzy_sel->fuzzy_mask)
|
||||
|
@ -413,14 +424,14 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
|||
gdisplay_transform_coords (gdisp,
|
||||
bsegs[i].x1, bsegs[i].y1,
|
||||
&x, &y,
|
||||
! fuzzy_options->sample_merged);
|
||||
! sel_options->sample_merged);
|
||||
segs[i].x1 = x;
|
||||
segs[i].y1 = y;
|
||||
|
||||
gdisplay_transform_coords (gdisp,
|
||||
bsegs[i].x2, bsegs[i].y2,
|
||||
&x, &y,
|
||||
! fuzzy_options->sample_merged);
|
||||
! sel_options->sample_merged);
|
||||
segs[i].x2 = x;
|
||||
segs[i].y2 = y;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -58,6 +58,7 @@
|
|||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimpimage-mask-select.h"
|
||||
#include "core/gimpscanconvert.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
|
@ -72,26 +73,6 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
struct _ICurve
|
||||
{
|
||||
gint x1, y1;
|
||||
gint x2, y2;
|
||||
GPtrArray *points;
|
||||
};
|
||||
|
||||
|
||||
typedef struct _IScissorsOptions IScissorsOptions;
|
||||
|
||||
struct _IScissorsOptions
|
||||
{
|
||||
SelectionOptions selection_options;
|
||||
};
|
||||
|
||||
|
||||
/**********************************************/
|
||||
/* Intelligent scissors selection apparatus */
|
||||
|
||||
|
||||
/* Other defines... */
|
||||
#define MAX_GRADIENT 179.606 /* == sqrt(127^2 + 127^2) */
|
||||
#define GRADIENT_SEARCH 32 /* how far to look when snapping to an edge */
|
||||
|
@ -123,7 +104,23 @@ struct _IScissorsOptions
|
|||
#define PIXEL_DIR(x) (x & 0x000000ff)
|
||||
|
||||
|
||||
/* Local function prototypes */
|
||||
struct _ICurve
|
||||
{
|
||||
gint x1, y1;
|
||||
gint x2, y2;
|
||||
GPtrArray *points;
|
||||
};
|
||||
|
||||
|
||||
typedef struct _IScissorsOptions IScissorsOptions;
|
||||
|
||||
struct _IScissorsOptions
|
||||
{
|
||||
SelectionOptions selection_options;
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_iscissors_tool_class_init (GimpIscissorsToolClass *klass);
|
||||
static void gimp_iscissors_tool_init (GimpIscissorsTool *iscissors);
|
||||
|
@ -208,9 +205,6 @@ static GPtrArray * plot_pixels (GimpIscissorsTool *iscissors,
|
|||
|
||||
/* static variables */
|
||||
|
||||
static IScissorsOptions *iscissors_options = NULL;
|
||||
|
||||
|
||||
/* where to move on a given link direction */
|
||||
static gint move[8][2] =
|
||||
{
|
||||
|
@ -269,6 +263,8 @@ static gint direction_value[256][4];
|
|||
static gboolean initialized = FALSE;
|
||||
static Tile *cur_tile = NULL;
|
||||
|
||||
static IScissorsOptions *iscissors_options = NULL;
|
||||
|
||||
static GimpDrawTool *parent_class = NULL;
|
||||
|
||||
|
||||
|
@ -451,12 +447,15 @@ gimp_iscissors_tool_button_press (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpIscissorsTool *iscissors;
|
||||
SelectionOptions *sel_options;
|
||||
GimpDisplayShell *shell;
|
||||
GimpDrawable *drawable;
|
||||
gboolean grab_pointer = FALSE;
|
||||
|
||||
iscissors = GIMP_ISCISSORS_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
@ -508,7 +507,7 @@ gimp_iscissors_tool_button_press (GimpTool *tool,
|
|||
iscissors->state = SEED_ADJUSTMENT;
|
||||
iscissors->draw = DRAW_ACTIVE_CURVE;
|
||||
|
||||
if (((SelectionOptions *) iscissors_options)->interactive)
|
||||
if (sel_options->interactive)
|
||||
iscissors->draw |= DRAW_LIVEWIRE;
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
|
@ -530,9 +529,9 @@ gimp_iscissors_tool_button_press (GimpTool *tool,
|
|||
NULL, TRUE,
|
||||
iscissors->mask,
|
||||
iscissors->op,
|
||||
((SelectionOptions *) iscissors_options)->feather,
|
||||
((SelectionOptions *) iscissors_options)->feather_radius,
|
||||
((SelectionOptions *) iscissors_options)->feather_radius);
|
||||
sel_options->feather,
|
||||
sel_options->feather_radius,
|
||||
sel_options->feather_radius);
|
||||
|
||||
gimp_iscissors_tool_reset (iscissors);
|
||||
|
||||
|
@ -544,7 +543,7 @@ gimp_iscissors_tool_button_press (GimpTool *tool,
|
|||
iscissors->state = SEED_PLACEMENT;
|
||||
iscissors->draw = DRAW_CURRENT_SEED;
|
||||
|
||||
if (((SelectionOptions *) iscissors_options)->interactive)
|
||||
if (sel_options->interactive)
|
||||
iscissors->draw |= DRAW_LIVEWIRE;
|
||||
|
||||
grab_pointer = TRUE;
|
||||
|
@ -617,10 +616,13 @@ gimp_iscissors_tool_button_release (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpIscissorsTool *iscissors;
|
||||
SelectionOptions *sel_options;
|
||||
ICurve *curve;
|
||||
|
||||
iscissors = GIMP_ISCISSORS_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
/* Make sure X didn't skip the button release event -- as it's known
|
||||
* to do
|
||||
*/
|
||||
|
@ -635,12 +637,12 @@ gimp_iscissors_tool_button_release (GimpTool *tool,
|
|||
{
|
||||
case SEED_PLACEMENT:
|
||||
iscissors->draw = DRAW_CURVE | DRAW_CURRENT_SEED;
|
||||
if (((SelectionOptions *) iscissors_options)->interactive)
|
||||
if (sel_options->interactive)
|
||||
iscissors->draw |= DRAW_LIVEWIRE;
|
||||
break;
|
||||
case SEED_ADJUSTMENT:
|
||||
iscissors->draw = DRAW_CURVE | DRAW_ACTIVE_CURVE;
|
||||
if (((SelectionOptions *) iscissors_options)->interactive)
|
||||
if (sel_options->interactive)
|
||||
iscissors->draw |= DRAW_LIVEWIRE;
|
||||
break;
|
||||
default:
|
||||
|
@ -733,9 +735,12 @@ gimp_iscissors_tool_motion (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpIscissorsTool *iscissors;
|
||||
SelectionOptions *sel_options;
|
||||
|
||||
iscissors = GIMP_ISCISSORS_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
if (tool->state != ACTIVE || iscissors->state == NO_ACTION)
|
||||
return;
|
||||
|
||||
|
@ -743,7 +748,7 @@ gimp_iscissors_tool_motion (GimpTool *tool,
|
|||
{
|
||||
iscissors->draw = DRAW_CURRENT_SEED;
|
||||
|
||||
if (((SelectionOptions *) iscissors_options)->interactive)
|
||||
if (sel_options->interactive)
|
||||
iscissors->draw = DRAW_CURRENT_SEED | DRAW_LIVEWIRE;
|
||||
}
|
||||
else if (iscissors->state == SEED_ADJUSTMENT)
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include "tools-types.h"
|
||||
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
#include "display/gimpdisplayshell-scale.h"
|
||||
|
@ -87,17 +89,15 @@ static void gimp_magnify_tool_cursor_update (GimpTool *tool,
|
|||
|
||||
static void gimp_magnify_tool_draw (GimpDrawTool *draw_tool);
|
||||
|
||||
static void zoom_in (gint *src,
|
||||
gint *dest,
|
||||
gint scale);
|
||||
static void zoom_out (gint *src,
|
||||
gint *dest,
|
||||
gint scale);
|
||||
|
||||
/* magnify utility functions */
|
||||
static void zoom_in (gint *src,
|
||||
gint *dest,
|
||||
gint scale);
|
||||
static void zoom_out (gint *src,
|
||||
gint *dest,
|
||||
gint scale);
|
||||
|
||||
static MagnifyOptions * magnify_options_new (void);
|
||||
static void magnify_options_reset (GimpToolOptions *tool_options);
|
||||
static MagnifyOptions * magnify_options_new (void);
|
||||
static void magnify_options_reset (GimpToolOptions *tool_options);
|
||||
|
||||
|
||||
static MagnifyOptions *magnify_options = NULL;
|
||||
|
@ -105,6 +105,8 @@ static MagnifyOptions *magnify_options = NULL;
|
|||
static GimpDrawToolClass *parent_class = NULL;
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_magnify_tool_register (Gimp *gimp)
|
||||
{
|
||||
|
@ -147,6 +149,9 @@ gimp_magnify_tool_get_type (void)
|
|||
return tool_type;
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_magnify_tool_class_init (GimpMagnifyToolClass *klass)
|
||||
{
|
||||
|
@ -193,111 +198,6 @@ gimp_magnify_tool_init (GimpMagnifyTool *magnify_tool)
|
|||
tool->auto_snap_to = FALSE; /* Don't snap to guides */
|
||||
}
|
||||
|
||||
|
||||
/* magnify tool options functions */
|
||||
|
||||
static void
|
||||
magnify_options_reset (GimpToolOptions *tool_options)
|
||||
{
|
||||
MagnifyOptions *options;
|
||||
|
||||
options = (MagnifyOptions *) tool_options;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->allow_resize_w),
|
||||
options->allow_resize_d);
|
||||
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
}
|
||||
|
||||
static MagnifyOptions *
|
||||
magnify_options_new (void)
|
||||
{
|
||||
MagnifyOptions *options;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
|
||||
/* the new magnify tool options structure */
|
||||
options = g_new0 (MagnifyOptions, 1);
|
||||
|
||||
tool_options_init ((GimpToolOptions *) options,
|
||||
magnify_options_reset);
|
||||
|
||||
options->allow_resize_d = gimprc.resize_windows_on_zoom;
|
||||
options->type_d = options->type = GIMP_ZOOM_IN;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* the allow_resize toggle button */
|
||||
options->allow_resize_w =
|
||||
gtk_check_button_new_with_label (_("Allow Window Resizing"));
|
||||
g_signal_connect (G_OBJECT (options->allow_resize_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&(gimprc.resize_windows_on_zoom));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->allow_resize_w),
|
||||
gimprc.resize_windows_on_zoom);
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
options->allow_resize_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->allow_resize_w);
|
||||
|
||||
/* tool toggle */
|
||||
frame =
|
||||
gimp_radio_group_new2 (TRUE, _("Tool Toggle"),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&options->type,
|
||||
(gpointer) options->type,
|
||||
|
||||
_("Zoom in"), (gpointer) GIMP_ZOOM_IN,
|
||||
&options->type_w[0],
|
||||
_("Zoom out"), (gpointer) GIMP_ZOOM_OUT,
|
||||
&options->type_w[1],
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
/* magnify utility functions */
|
||||
|
||||
static void
|
||||
zoom_in (gint *src,
|
||||
gint *dest,
|
||||
gint scale)
|
||||
{
|
||||
while (scale--)
|
||||
{
|
||||
if (*src > 1)
|
||||
(*src)--;
|
||||
else
|
||||
if (*dest < 0x10)
|
||||
(*dest)++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
zoom_out (gint *src,
|
||||
gint *dest,
|
||||
gint scale)
|
||||
{
|
||||
while (scale--)
|
||||
{
|
||||
if (*dest > 1)
|
||||
(*dest)--;
|
||||
else
|
||||
if (*src < 0x10)
|
||||
(*src)++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* magnify action functions */
|
||||
|
||||
static void
|
||||
gimp_magnify_tool_button_press (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
|
@ -337,6 +237,7 @@ gimp_magnify_tool_button_release (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpMagnifyTool *magnify;
|
||||
MagnifyOptions *options;
|
||||
GimpDisplayShell *shell;
|
||||
gint win_width, win_height;
|
||||
gint width, height;
|
||||
|
@ -346,6 +247,8 @@ gimp_magnify_tool_button_release (GimpTool *tool,
|
|||
|
||||
magnify = GIMP_MAGNIFY_TOOL (tool);
|
||||
|
||||
options = (MagnifyOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (tool->gdisp->shell);
|
||||
|
||||
gdk_pointer_ungrab (time);
|
||||
|
@ -381,7 +284,7 @@ gimp_magnify_tool_button_release (GimpTool *tool,
|
|||
else
|
||||
scale = MIN ((width / w), (height / h));
|
||||
|
||||
magnify->op = magnify_options->type;
|
||||
magnify->op = options->type;
|
||||
|
||||
switch (magnify->op)
|
||||
{
|
||||
|
@ -435,17 +338,21 @@ gimp_magnify_tool_modifier_key (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
MagnifyOptions *options;
|
||||
|
||||
options = (MagnifyOptions *) tool->tool_info->tool_options;
|
||||
|
||||
if (key == GDK_CONTROL_MASK)
|
||||
{
|
||||
switch (magnify_options->type)
|
||||
switch (options->type)
|
||||
{
|
||||
case GIMP_ZOOM_IN:
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (magnify_options->type_w[GIMP_ZOOM_OUT]), TRUE);
|
||||
(GTK_TOGGLE_BUTTON (options->type_w[GIMP_ZOOM_OUT]), TRUE);
|
||||
break;
|
||||
case GIMP_ZOOM_OUT:
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (magnify_options->type_w[GIMP_ZOOM_IN]), TRUE);
|
||||
(GTK_TOGGLE_BUTTON (options->type_w[GIMP_ZOOM_IN]), TRUE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -459,11 +366,14 @@ gimp_magnify_tool_cursor_update (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
MagnifyOptions *options;
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
options = (MagnifyOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
if (magnify_options->type == GIMP_ZOOM_IN)
|
||||
if (options->type == GIMP_ZOOM_IN)
|
||||
{
|
||||
gimp_display_shell_install_tool_cursor (shell,
|
||||
GIMP_ZOOM_CURSOR,
|
||||
|
@ -494,3 +404,106 @@ gimp_magnify_tool_draw (GimpDrawTool *draw_tool)
|
|||
magnify->h,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
|
||||
/* magnify utility functions */
|
||||
|
||||
static void
|
||||
zoom_in (gint *src,
|
||||
gint *dest,
|
||||
gint scale)
|
||||
{
|
||||
while (scale--)
|
||||
{
|
||||
if (*src > 1)
|
||||
(*src)--;
|
||||
else
|
||||
if (*dest < 0x10)
|
||||
(*dest)++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
zoom_out (gint *src,
|
||||
gint *dest,
|
||||
gint scale)
|
||||
{
|
||||
while (scale--)
|
||||
{
|
||||
if (*dest > 1)
|
||||
(*dest)--;
|
||||
else
|
||||
if (*src < 0x10)
|
||||
(*src)++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* magnify tool options functions */
|
||||
|
||||
static MagnifyOptions *
|
||||
magnify_options_new (void)
|
||||
{
|
||||
MagnifyOptions *options;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
|
||||
/* the new magnify tool options structure */
|
||||
options = g_new0 (MagnifyOptions, 1);
|
||||
|
||||
tool_options_init ((GimpToolOptions *) options,
|
||||
magnify_options_reset);
|
||||
|
||||
options->allow_resize_d = gimprc.resize_windows_on_zoom;
|
||||
options->type_d = options->type = GIMP_ZOOM_IN;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* the allow_resize toggle button */
|
||||
options->allow_resize_w =
|
||||
gtk_check_button_new_with_label (_("Allow Window Resizing"));
|
||||
g_signal_connect (G_OBJECT (options->allow_resize_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&(gimprc.resize_windows_on_zoom));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->allow_resize_w),
|
||||
gimprc.resize_windows_on_zoom);
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
options->allow_resize_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->allow_resize_w);
|
||||
|
||||
/* tool toggle */
|
||||
frame =
|
||||
gimp_radio_group_new2 (TRUE, _("Tool Toggle"),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&options->type,
|
||||
(gpointer) options->type,
|
||||
|
||||
_("Zoom in"), (gpointer) GIMP_ZOOM_IN,
|
||||
&options->type_w[0],
|
||||
_("Zoom out"), (gpointer) GIMP_ZOOM_OUT,
|
||||
&options->type_w[1],
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
static void
|
||||
magnify_options_reset (GimpToolOptions *tool_options)
|
||||
{
|
||||
MagnifyOptions *options;
|
||||
|
||||
options = (MagnifyOptions *) tool_options;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->allow_resize_w),
|
||||
options->allow_resize_d);
|
||||
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
}
|
||||
|
|
|
@ -33,13 +33,14 @@
|
|||
#include "gui/gui-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gui/info-dialog.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
||||
#include "gui/info-dialog.h"
|
||||
|
||||
#include "gimpdrawtool.h"
|
||||
#include "gimpmeasuretool.h"
|
||||
#include "tool_manager.h"
|
||||
|
@ -248,11 +249,14 @@ gimp_measure_tool_button_press (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpMeasureTool *measure_tool;
|
||||
MeasureOptions *options;
|
||||
GimpDisplayShell *shell;
|
||||
gint i;
|
||||
|
||||
measure_tool = GIMP_MEASURE_TOOL (tool);
|
||||
|
||||
options = (MeasureOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
/* if we are changing displays, pop the statusbar of the old one */
|
||||
|
@ -402,9 +406,8 @@ gimp_measure_tool_button_press (GimpTool *tool,
|
|||
}
|
||||
|
||||
/* create the info window if necessary */
|
||||
if (! measure_tool_info &&
|
||||
(measure_tool_options->use_info_window ||
|
||||
! GTK_WIDGET_VISIBLE (shell->statusarea)))
|
||||
if (! measure_tool_info && (options->use_info_window ||
|
||||
! GTK_WIDGET_VISIBLE (shell->statusarea)))
|
||||
{
|
||||
measure_tool_info = info_dialog_new (_("Measure Tool"),
|
||||
tool_manager_help_func, NULL);
|
||||
|
@ -462,6 +465,7 @@ gimp_measure_tool_motion (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpMeasureTool *measure_tool;
|
||||
MeasureOptions *options;
|
||||
GimpDisplayShell *shell;
|
||||
gint ax, ay;
|
||||
gint bx, by;
|
||||
|
@ -474,6 +478,8 @@ gimp_measure_tool_motion (GimpTool *tool,
|
|||
|
||||
measure_tool = GIMP_MEASURE_TOOL (tool);
|
||||
|
||||
options = (MeasureOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL(measure_tool));
|
||||
|
@ -606,14 +612,11 @@ gimp_measure_tool_motion (GimpTool *tool,
|
|||
|
||||
g_snprintf (status_str, sizeof (status_str), "%.1f %s, %.2f %s",
|
||||
distance, _("pixels"), angle, _("degrees"));
|
||||
|
||||
if (measure_tool_options)
|
||||
{
|
||||
g_snprintf (distance_buf, sizeof (distance_buf), "%.1f %s",
|
||||
distance, _("pixels"));
|
||||
g_snprintf (angle_buf, sizeof (angle_buf), "%.2f %s",
|
||||
angle, _("degrees"));
|
||||
}
|
||||
|
||||
g_snprintf (distance_buf, sizeof (distance_buf), "%.1f %s",
|
||||
distance, _("pixels"));
|
||||
g_snprintf (angle_buf, sizeof (angle_buf), "%.2f %s",
|
||||
angle, _("degrees"));
|
||||
}
|
||||
else /* show real world units */
|
||||
{
|
||||
|
@ -644,18 +647,15 @@ gimp_measure_tool_motion (GimpTool *tool,
|
|||
distance, angle);
|
||||
g_free (format_str);
|
||||
|
||||
if (measure_tool_options)
|
||||
{
|
||||
gchar *format_str =
|
||||
g_strdup_printf ("%%.%df %s",
|
||||
gimp_unit_get_digits (gdisp->gimage->unit),
|
||||
gimp_unit_get_symbol (gdisp->gimage->unit));
|
||||
g_snprintf (distance_buf, sizeof (distance_buf), format_str,
|
||||
distance);
|
||||
g_snprintf (angle_buf, sizeof (angle_buf), "%.2f %s",
|
||||
angle, _("degrees"));
|
||||
g_free (format_str);
|
||||
}
|
||||
format_str =
|
||||
g_strdup_printf ("%%.%df %s",
|
||||
gimp_unit_get_digits (gdisp->gimage->unit),
|
||||
gimp_unit_get_symbol (gdisp->gimage->unit));
|
||||
g_snprintf (distance_buf, sizeof (distance_buf), format_str,
|
||||
distance);
|
||||
g_snprintf (angle_buf, sizeof (angle_buf), "%.2f %s",
|
||||
angle, _("degrees"));
|
||||
g_free (format_str);
|
||||
}
|
||||
|
||||
/* show info in statusbar */
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "gimpeditselectiontool.h"
|
||||
#include "gimprectselecttool.h"
|
||||
#include "selection_options.h"
|
||||
#include "tool_options.h"
|
||||
#include "tool_manager.h"
|
||||
|
||||
#include "floating_sel.h"
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "core/gimpimage-contiguous-region.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimpimage-mask-select.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
|
@ -47,9 +48,7 @@
|
|||
|
||||
#include "gimpeditselectiontool.h"
|
||||
#include "gimpfuzzyselecttool.h"
|
||||
#include "gimptool.h"
|
||||
#include "selection_options.h"
|
||||
#include "tool_options.h"
|
||||
#include "tool_manager.h"
|
||||
|
||||
#include "gimprc.h"
|
||||
|
@ -215,17 +214,20 @@ gimp_fuzzy_select_tool_button_press (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpFuzzySelectTool *fuzzy_sel;
|
||||
SelectionOptions *sel_options;
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
fuzzy_sel->x = coords->x;
|
||||
fuzzy_sel->y = coords->y;
|
||||
fuzzy_sel->first_x = fuzzy_sel->x;
|
||||
fuzzy_sel->first_y = fuzzy_sel->y;
|
||||
fuzzy_sel->first_threshold = fuzzy_options->threshold;
|
||||
fuzzy_sel->first_threshold = sel_options->threshold;
|
||||
|
||||
tool->state = ACTIVE;
|
||||
tool->gdisp = gdisp;
|
||||
|
@ -262,10 +264,13 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool,
|
|||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpFuzzySelectTool *fuzzy_sel;
|
||||
SelectionOptions *sel_options;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
gdk_pointer_ungrab (time);
|
||||
gdk_flush ();
|
||||
|
||||
|
@ -279,12 +284,12 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool,
|
|||
|
||||
gimp_image_mask_select_channel (gdisp->gimage,
|
||||
drawable,
|
||||
fuzzy_options->sample_merged,
|
||||
sel_options->sample_merged,
|
||||
fuzzy_sel->fuzzy_mask,
|
||||
GIMP_SELECTION_TOOL (tool)->op,
|
||||
fuzzy_options->feather,
|
||||
fuzzy_options->feather_radius,
|
||||
fuzzy_options->feather_radius);
|
||||
sel_options->feather,
|
||||
sel_options->feather_radius,
|
||||
sel_options->feather_radius);
|
||||
|
||||
g_object_unref (G_OBJECT (fuzzy_sel->fuzzy_mask));
|
||||
fuzzy_sel->fuzzy_mask = NULL;
|
||||
|
@ -309,6 +314,7 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool,
|
|||
{
|
||||
GimpFuzzySelectTool *fuzzy_sel;
|
||||
GimpSelectionTool *sel_tool;
|
||||
SelectionOptions *sel_options;
|
||||
GdkSegment *new_segs;
|
||||
gint num_new_segs;
|
||||
gint diff_x, diff_y;
|
||||
|
@ -319,6 +325,8 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool,
|
|||
fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool);
|
||||
sel_tool = GIMP_SELECTION_TOOL (tool);
|
||||
|
||||
sel_options = (SelectionOptions *) tool->tool_info->tool_options;
|
||||
|
||||
if (tool->state != ACTIVE)
|
||||
return;
|
||||
|
||||
|
@ -333,7 +341,7 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool,
|
|||
|
||||
diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2.0;
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (fuzzy_options->threshold_w),
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (sel_options->threshold_w),
|
||||
fuzzy_sel->first_threshold + diff);
|
||||
|
||||
/* calculate the new fuzzy boundary */
|
||||
|
@ -356,22 +364,25 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
|||
GimpDisplay *gdisp,
|
||||
gint *nsegs)
|
||||
{
|
||||
PixelRegion maskPR;
|
||||
GimpChannel *new;
|
||||
GdkSegment *segs;
|
||||
BoundSeg *bsegs;
|
||||
GimpDrawable *drawable;
|
||||
gint i;
|
||||
gint x, y;
|
||||
SelectionOptions *sel_options;
|
||||
PixelRegion maskPR;
|
||||
GimpChannel *new;
|
||||
GdkSegment *segs;
|
||||
BoundSeg *bsegs;
|
||||
GimpDrawable *drawable;
|
||||
gint i;
|
||||
gint x, y;
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
sel_options = (SelectionOptions *) GIMP_TOOL (fuzzy_sel)->tool_info->tool_options;
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
gimp_set_busy (gdisp->gimage->gimp);
|
||||
|
||||
x = fuzzy_sel->x;
|
||||
y = fuzzy_sel->y;
|
||||
|
||||
if (! fuzzy_options->sample_merged)
|
||||
if (! sel_options->sample_merged)
|
||||
{
|
||||
gint off_x, off_y;
|
||||
|
||||
|
@ -382,9 +393,9 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
|||
}
|
||||
|
||||
new = gimp_image_contiguous_region_by_seed (gdisp->gimage, drawable,
|
||||
fuzzy_options->sample_merged,
|
||||
fuzzy_options->antialias,
|
||||
fuzzy_options->threshold,
|
||||
sel_options->sample_merged,
|
||||
sel_options->antialias,
|
||||
sel_options->threshold,
|
||||
x, y);
|
||||
|
||||
if (fuzzy_sel->fuzzy_mask)
|
||||
|
@ -413,14 +424,14 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
|||
gdisplay_transform_coords (gdisp,
|
||||
bsegs[i].x1, bsegs[i].y1,
|
||||
&x, &y,
|
||||
! fuzzy_options->sample_merged);
|
||||
! sel_options->sample_merged);
|
||||
segs[i].x1 = x;
|
||||
segs[i].y1 = y;
|
||||
|
||||
gdisplay_transform_coords (gdisp,
|
||||
bsegs[i].x2, bsegs[i].y2,
|
||||
&x, &y,
|
||||
! fuzzy_options->sample_merged);
|
||||
! sel_options->sample_merged);
|
||||
segs[i].x2 = x;
|
||||
segs[i].y2 = y;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -212,6 +212,28 @@ gimp_dockbook_add (GimpDockbook *dockbook,
|
|||
|
||||
g_object_set_data (G_OBJECT (tab_widget), "gimp-dockable", dockable);
|
||||
|
||||
/* set the drag source *before* connecting button_press because we
|
||||
* stop button_press emission by returning TRUE from the callback
|
||||
*/
|
||||
gtk_drag_source_set (GTK_WIDGET (tab_widget),
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
|
||||
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
||||
GDK_ACTION_MOVE);
|
||||
g_signal_connect (G_OBJECT (tab_widget), "drag_begin",
|
||||
G_CALLBACK (gimp_dockbook_tab_drag_begin),
|
||||
dockable);
|
||||
g_signal_connect (G_OBJECT (tab_widget), "drag_end",
|
||||
G_CALLBACK (gimp_dockbook_tab_drag_end),
|
||||
dockable);
|
||||
|
||||
gtk_drag_dest_set (GTK_WIDGET (tab_widget),
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
||||
GDK_ACTION_MOVE);
|
||||
g_signal_connect (G_OBJECT (tab_widget), "drag_drop",
|
||||
G_CALLBACK (gimp_dockbook_tab_drag_drop),
|
||||
dockbook);
|
||||
|
||||
g_signal_connect (G_OBJECT (tab_widget), "button_press_event",
|
||||
G_CALLBACK (gimp_dockbook_tab_button_press),
|
||||
dockable);
|
||||
|
@ -307,25 +329,6 @@ gimp_dockbook_add (GimpDockbook *dockbook,
|
|||
|
||||
gtk_widget_show (GTK_WIDGET (dockable));
|
||||
|
||||
gtk_drag_source_set (GTK_WIDGET (tab_widget),
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
|
||||
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
||||
GDK_ACTION_MOVE);
|
||||
g_signal_connect (G_OBJECT (tab_widget), "drag_begin",
|
||||
G_CALLBACK (gimp_dockbook_tab_drag_begin),
|
||||
dockable);
|
||||
g_signal_connect (G_OBJECT (tab_widget), "drag_end",
|
||||
G_CALLBACK (gimp_dockbook_tab_drag_end),
|
||||
dockable);
|
||||
|
||||
gtk_drag_dest_set (GTK_WIDGET (tab_widget),
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
||||
GDK_ACTION_MOVE);
|
||||
g_signal_connect (G_OBJECT (tab_widget), "drag_drop",
|
||||
G_CALLBACK (gimp_dockbook_tab_drag_drop),
|
||||
dockbook);
|
||||
|
||||
dockable->dockbook = dockbook;
|
||||
|
||||
gimp_dockable_set_context (dockable, dockbook->dock->context);
|
||||
|
@ -484,7 +487,7 @@ gimp_dockbook_tab_button_press (GtkWidget *widget,
|
|||
3, bevent->time);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue