1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2001-02-04 12:51:17 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-03-08 04:00:07 +08:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
|
2001-01-24 20:21:50 +08:00
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 20:21:50 +08:00
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-15 19:25:25 +08:00
|
|
|
#include "base/pixel-region.h"
|
|
|
|
#include "base/temp-buf.h"
|
|
|
|
|
2001-05-14 05:51:20 +08:00
|
|
|
#include "paint-funcs/paint-funcs.h"
|
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
#include "core/gimpdrawable.h"
|
2001-10-22 20:13:44 +08:00
|
|
|
#include "core/gimpimage-contiguous-region.h"
|
2001-05-10 16:10:25 +08:00
|
|
|
#include "core/gimpimage-mask.h"
|
2001-10-22 20:13:44 +08:00
|
|
|
#include "core/gimpimage-mask-select.h"
|
2001-05-10 16:10:25 +08:00
|
|
|
#include "core/gimpchannel.h"
|
|
|
|
#include "core/gimpcontainer.h"
|
|
|
|
#include "core/gimpimage.h"
|
2001-05-14 05:51:20 +08:00
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
#include "widgets/gimpdnd.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2001-10-13 20:52:30 +08:00
|
|
|
#include "display/gimpdisplay-foreach.h"
|
2001-11-01 05:20:09 +08:00
|
|
|
#include "display/gimpdisplayshell.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
#include "gimpbycolorselecttool.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "selection_options.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "tool_options.h"
|
2001-05-10 16:10:25 +08:00
|
|
|
#include "tool_manager.h"
|
1999-10-10 04:33:53 +08:00
|
|
|
|
2001-05-26 00:04:54 +08:00
|
|
|
#include "gimprc.h"
|
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
#define PREVIEW_WIDTH 256
|
|
|
|
#define PREVIEW_HEIGHT 256
|
1997-11-25 06:05:25 +08:00
|
|
|
#define PREVIEW_EVENT_MASK GDK_EXPOSURE_MASK | \
|
|
|
|
GDK_BUTTON_PRESS_MASK | \
|
|
|
|
GDK_ENTER_NOTIFY_MASK
|
|
|
|
|
|
|
|
typedef struct _ByColorDialog ByColorDialog;
|
1999-11-22 19:14:29 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
struct _ByColorDialog
|
|
|
|
{
|
1999-11-22 19:14:29 +08:00
|
|
|
GtkWidget *shell;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
GtkWidget *preview;
|
|
|
|
GtkWidget *gimage_name;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-19 22:02:05 +08:00
|
|
|
GtkWidget *replace_button;
|
|
|
|
GtkObject *threshold_adj;
|
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
gint threshold; /* threshold value for color select */
|
|
|
|
gint operation; /* Add, Subtract, Replace */
|
|
|
|
GimpImage *gimage; /* gimpimage which is currently under examination */
|
1999-11-22 19:14:29 +08:00
|
|
|
};
|
1999-04-13 01:55:06 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
/* Local functions */
|
|
|
|
static void gimp_by_color_select_tool_class_init (GimpByColorSelectToolClass *klass);
|
|
|
|
static void gimp_by_color_select_tool_init (GimpByColorSelectTool *by_color_select);
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-06-01 03:53:13 +08:00
|
|
|
static void gimp_by_color_select_tool_initialize_by_image (GimpImage *gimage);
|
1999-06-22 06:12:07 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static void by_color_select_color_drop (GtkWidget *widget,
|
2001-01-20 23:37:26 +08:00
|
|
|
const GimpRGB *color,
|
2000-12-31 12:07:42 +08:00
|
|
|
gpointer data);
|
1999-06-22 06:12:07 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
/* by_color select action functions */
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
static void by_color_select_initialize (GimpTool *tool,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
static void by_color_select_control (GimpTool *tool,
|
|
|
|
ToolAction action,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void by_color_select_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void by_color_select_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void by_color_select_oper_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void by_color_select_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
static void by_color_select_mask_changed (GimpImage *gimage);
|
2000-12-31 12:07:42 +08:00
|
|
|
|
|
|
|
static ByColorDialog * by_color_select_dialog_new (void);
|
|
|
|
|
|
|
|
static void by_color_select_render (ByColorDialog *,
|
2001-05-10 16:10:25 +08:00
|
|
|
GimpImage *);
|
2000-12-31 12:07:42 +08:00
|
|
|
static void by_color_select_draw (ByColorDialog *,
|
2001-05-10 16:10:25 +08:00
|
|
|
GimpImage *);
|
2000-12-31 12:07:42 +08:00
|
|
|
static gint by_color_select_preview_events (GtkWidget *,
|
1999-11-22 19:14:29 +08:00
|
|
|
GdkEventButton *,
|
2000-12-31 12:07:42 +08:00
|
|
|
ByColorDialog *);
|
|
|
|
static void by_color_select_invert_callback (GtkWidget *,
|
|
|
|
gpointer );
|
|
|
|
static void by_color_select_select_all_callback (GtkWidget *,
|
|
|
|
gpointer );
|
|
|
|
static void by_color_select_select_none_callback (GtkWidget *,
|
|
|
|
gpointer );
|
|
|
|
static void by_color_select_reset_callback (GtkWidget *,
|
|
|
|
gpointer );
|
|
|
|
static void by_color_select_close_callback (GtkWidget *,
|
|
|
|
gpointer );
|
|
|
|
static void by_color_select_preview_button_press (ByColorDialog *,
|
1999-06-22 06:12:07 +08:00
|
|
|
GdkEventButton *);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-10-22 20:13:44 +08:00
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
static GimpSelectionToolClass *parent_class = NULL;
|
2001-10-22 20:13:44 +08:00
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
/* the by color selection tool options */
|
2001-10-22 20:13:44 +08:00
|
|
|
static SelectionOptions *by_color_options = NULL;
|
2001-05-10 16:10:25 +08:00
|
|
|
|
|
|
|
/* the by color selection dialog */
|
2001-10-22 20:13:44 +08:00
|
|
|
static ByColorDialog *by_color_dialog = NULL;
|
2001-05-10 16:10:25 +08:00
|
|
|
|
|
|
|
/* dnd stuff */
|
|
|
|
static GtkTargetEntry by_color_select_targets[] =
|
|
|
|
{
|
|
|
|
GIMP_TARGET_COLOR
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
void
|
2001-07-07 20:17:23 +08:00
|
|
|
gimp_by_color_select_tool_register (Gimp *gimp)
|
2001-05-10 16:10:25 +08:00
|
|
|
{
|
2001-07-07 20:17:23 +08:00
|
|
|
tool_manager_register_tool (gimp,
|
|
|
|
GIMP_TYPE_BY_COLOR_SELECT_TOOL,
|
|
|
|
FALSE,
|
2001-05-10 16:10:25 +08:00
|
|
|
"gimp:by_color_select_tool",
|
|
|
|
_("Select By Color"),
|
|
|
|
_("Select regions by color"),
|
|
|
|
_("/Tools/Selection Tools/By Color Select"), "C",
|
|
|
|
NULL, "tools/by_color_select.html",
|
2001-08-06 00:08:19 +08:00
|
|
|
GIMP_STOCK_TOOL_BY_COLOR_SELECT);
|
2001-05-10 16:10:25 +08:00
|
|
|
}
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-05-10 16:10:25 +08:00
|
|
|
gimp_by_color_select_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
2001-05-10 16:10:25 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
if (! tool_type)
|
2001-05-10 16:10:25 +08:00
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-05-10 16:10:25 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpByColorSelectToolClass),
|
2001-08-14 22:53:55 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_by_color_select_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpByColorSelectTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_by_color_select_tool_init,
|
2001-05-10 16:10:25 +08:00
|
|
|
};
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL,
|
|
|
|
"GimpByColorSelectTool",
|
|
|
|
&tool_info, 0);
|
2001-05-10 16:10:25 +08:00
|
|
|
}
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
return tool_type;
|
2001-05-10 16:10:25 +08:00
|
|
|
}
|
|
|
|
|
2001-05-11 05:01:02 +08:00
|
|
|
void
|
|
|
|
gimp_by_color_select_tool_initialize_by_image (GimpImage *gimage)
|
|
|
|
{
|
|
|
|
/* update the preview window */
|
|
|
|
if (by_color_dialog)
|
|
|
|
{
|
|
|
|
by_color_dialog->gimage = gimage;
|
|
|
|
by_color_select_render (by_color_dialog, gimage);
|
|
|
|
by_color_select_draw (by_color_dialog, gimage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_by_color_select_tool_class_init (GimpByColorSelectToolClass *klass)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
GimpToolClass *tool_class;
|
2001-05-10 16:10:25 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_class = GIMP_TOOL_CLASS (klass);
|
2001-05-10 16:10:25 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-05-10 16:10:25 +08:00
|
|
|
|
|
|
|
tool_class->initialize = by_color_select_initialize;
|
2001-11-09 03:14:51 +08:00
|
|
|
tool_class->control = by_color_select_control;
|
2001-05-10 16:10:25 +08:00
|
|
|
tool_class->button_press = by_color_select_button_press;
|
|
|
|
tool_class->button_release = by_color_select_button_release;
|
|
|
|
tool_class->oper_update = by_color_select_oper_update;
|
2001-11-09 03:14:51 +08:00
|
|
|
tool_class->cursor_update = by_color_select_cursor_update;
|
2001-05-10 16:10:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_by_color_select_tool_init (GimpByColorSelectTool *by_color_select)
|
|
|
|
{
|
|
|
|
GimpTool *tool;
|
|
|
|
GimpSelectionTool *select_tool;
|
|
|
|
|
|
|
|
tool = GIMP_TOOL (by_color_select);
|
|
|
|
select_tool = GIMP_SELECTION_TOOL (by_color_select);
|
|
|
|
|
|
|
|
if (! by_color_options)
|
|
|
|
{
|
|
|
|
by_color_options = selection_options_new (GIMP_TYPE_BY_COLOR_SELECT_TOOL,
|
|
|
|
selection_options_reset);
|
|
|
|
|
|
|
|
tool_manager_register_tool_options (GIMP_TYPE_BY_COLOR_SELECT_TOOL,
|
2001-07-18 04:50:01 +08:00
|
|
|
(GimpToolOptions *) by_color_options);
|
2001-05-10 16:10:25 +08:00
|
|
|
}
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
tool->tool_cursor = GIMP_RECT_SELECT_TOOL_CURSOR;
|
|
|
|
tool->preserve = FALSE; /* Don't preserve on drawable change */
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
by_color_select->x = 0;
|
|
|
|
by_color_select->y = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
by_color_select_control (GimpTool *tool,
|
|
|
|
ToolAction action,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case PAUSE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RESUME:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HALT:
|
|
|
|
if (by_color_dialog)
|
|
|
|
by_color_select_close_callback (NULL, (gpointer) by_color_dialog);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
by_color_select_initialize (GimpTool *tool,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
/* The "by color" dialog */
|
|
|
|
if (!by_color_dialog)
|
|
|
|
{
|
|
|
|
by_color_dialog = by_color_select_dialog_new ();
|
|
|
|
/* Catch the "mask_changed" signal and attach a handler that does
|
|
|
|
* stuff with it. Need to do this somewhere with the relevant
|
|
|
|
* GimpImage in context
|
|
|
|
*/
|
|
|
|
g_signal_connect (G_OBJECT (gdisp->gimage), "mask_changed",
|
|
|
|
G_CALLBACK (by_color_select_mask_changed),
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (!GTK_WIDGET_VISIBLE (by_color_dialog->shell))
|
|
|
|
gtk_widget_show (by_color_dialog->shell);
|
|
|
|
|
|
|
|
gimp_by_color_select_tool_initialize_by_image (gdisp->gimage);
|
2001-05-10 16:10:25 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
by_color_select_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-05-10 16:10:25 +08:00
|
|
|
GimpByColorSelectTool *by_color_sel;
|
2001-10-22 20:13:44 +08:00
|
|
|
GimpDrawTool *draw_tool;
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
draw_tool = GIMP_DRAW_TOOL (tool);
|
|
|
|
by_color_sel = GIMP_BY_COLOR_SELECT_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
|
1998-04-02 12:51:44 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
if (! by_color_dialog)
|
1997-11-25 06:05:25 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
tool->state = ACTIVE;
|
2000-12-31 12:07:42 +08:00
|
|
|
tool->gdisp = gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
by_color_sel->x = coords->x;
|
|
|
|
by_color_sel->y = coords->y;
|
|
|
|
|
|
|
|
if (! by_color_options->sample_merged)
|
|
|
|
{
|
|
|
|
gint off_x, off_y;
|
|
|
|
|
|
|
|
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
|
|
|
|
&off_x, &off_y);
|
|
|
|
|
|
|
|
by_color_sel->x -= off_x;
|
|
|
|
by_color_sel->y -= off_y;
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Make sure the "by color" select dialog is visible */
|
|
|
|
if (! GTK_WIDGET_VISIBLE (by_color_dialog->shell))
|
|
|
|
gtk_widget_show (by_color_dialog->shell);
|
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
if (by_color_dialog->gimage != gdisp->gimage)
|
|
|
|
{
|
|
|
|
gdk_draw_rectangle
|
|
|
|
(by_color_dialog->preview->window,
|
|
|
|
by_color_dialog->preview->style->bg_gc[GTK_STATE_NORMAL],
|
|
|
|
TRUE,
|
|
|
|
0, 0,
|
|
|
|
by_color_dialog->preview->allocation.width,
|
|
|
|
by_color_dialog->preview->allocation.width);
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
by_color_dialog->gimage = gdisp->gimage;
|
|
|
|
}
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
gdk_pointer_grab (shell->canvas->window, FALSE,
|
2000-02-09 07:35:41 +08:00
|
|
|
GDK_POINTER_MOTION_HINT_MASK |
|
|
|
|
GDK_BUTTON1_MOTION_MASK |
|
1999-11-22 19:14:29 +08:00
|
|
|
GDK_BUTTON_RELEASE_MASK,
|
2001-11-09 03:14:51 +08:00
|
|
|
NULL, NULL, time);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
by_color_select_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-05-10 16:10:25 +08:00
|
|
|
GimpByColorSelectTool *by_color_sel;
|
2001-10-22 20:13:44 +08:00
|
|
|
GimpDrawable *drawable;
|
|
|
|
guchar *col;
|
|
|
|
GimpRGB color;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
by_color_sel = GIMP_BY_COLOR_SELECT_TOOL (tool);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
drawable = gimp_image_active_drawable (gdisp->gimage);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
gdk_pointer_ungrab (time);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
tool->state = INACTIVE;
|
|
|
|
|
|
|
|
/* First take care of the case where the user "cancels" the action */
|
2001-11-09 03:14:51 +08:00
|
|
|
if (! (state & GDK_BUTTON3_MASK))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
if (by_color_sel->x >= 0 &&
|
|
|
|
by_color_sel->y >= 0 &&
|
|
|
|
by_color_sel->x < gimp_drawable_width (drawable) &&
|
|
|
|
by_color_sel->y < gimp_drawable_height (drawable))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-02-28 10:40:44 +08:00
|
|
|
/* Get the start color */
|
|
|
|
if (by_color_options->sample_merged)
|
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
if (!(col = gimp_image_get_color_at (gdisp->gimage,
|
|
|
|
by_color_sel->x,
|
|
|
|
by_color_sel->y)))
|
2000-02-28 10:40:44 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
if (!(col = gimp_drawable_get_color_at (drawable,
|
|
|
|
by_color_sel->x,
|
|
|
|
by_color_sel->y)))
|
2000-02-28 10:40:44 +08:00
|
|
|
return;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-10-22 20:13:44 +08:00
|
|
|
gimp_rgba_set_uchar (&color, col[0], col[1], col[2], col[3]);
|
|
|
|
|
|
|
|
g_free (col);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-10-22 20:13:44 +08:00
|
|
|
/* select the area */
|
|
|
|
gimp_image_mask_select_by_color (gdisp->gimage, drawable,
|
|
|
|
by_color_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);
|
1999-02-16 16:53:54 +08:00
|
|
|
|
2000-02-28 10:40:44 +08:00
|
|
|
/* show selection on all views */
|
|
|
|
gdisplays_flush ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 10:40:44 +08:00
|
|
|
/* update the preview window */
|
|
|
|
by_color_select_render (by_color_dialog, gdisp->gimage);
|
|
|
|
by_color_select_draw (by_color_dialog, gdisp->gimage);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
by_color_select_oper_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
GimpByColorSelectTool *by_col_sel;
|
|
|
|
|
|
|
|
if (tool->state == ACTIVE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
by_col_sel = GIMP_BY_COLOR_SELECT_TOOL (tool);
|
|
|
|
|
|
|
|
if ((state & GDK_CONTROL_MASK) && (state & GDK_SHIFT_MASK))
|
|
|
|
{
|
|
|
|
by_col_sel->operation = SELECTION_INTERSECT; /* intersect with selection */
|
|
|
|
}
|
|
|
|
else if (state & GDK_SHIFT_MASK)
|
|
|
|
{
|
|
|
|
by_col_sel->operation = SELECTION_ADD; /* add to the selection */
|
|
|
|
}
|
|
|
|
else if (state & GDK_CONTROL_MASK)
|
|
|
|
{
|
|
|
|
by_col_sel->operation = SELECTION_SUB; /* subtract from the selection */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (by_color_dialog)
|
|
|
|
{
|
|
|
|
/* To be careful, set it to by_select_dialog's default */
|
|
|
|
by_col_sel->operation = by_color_dialog->operation;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
by_col_sel->operation = SELECTION_REPLACE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
by_color_select_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-05-10 16:10:25 +08:00
|
|
|
GimpByColorSelectTool *by_col_sel;
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
2001-10-22 20:13:44 +08:00
|
|
|
GimpLayer *layer;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-05-10 16:10:25 +08:00
|
|
|
by_col_sel = GIMP_BY_COLOR_SELECT_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
layer = gimp_image_pick_correlate_layer (gdisp->gimage, coords->x, coords->y);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2000-03-08 04:00:07 +08:00
|
|
|
if (by_color_options->sample_merged ||
|
2001-11-09 03:14:51 +08:00
|
|
|
(layer && layer == gdisp->gimage->active_layer))
|
2000-03-29 07:39:32 +08:00
|
|
|
{
|
|
|
|
switch (by_col_sel->operation)
|
|
|
|
{
|
|
|
|
case SELECTION_ADD:
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_TOOL_CURSOR_NONE,
|
|
|
|
GIMP_CURSOR_MODIFIER_PLUS);
|
2000-03-29 07:39:32 +08:00
|
|
|
break;
|
|
|
|
case SELECTION_SUB:
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_TOOL_CURSOR_NONE,
|
|
|
|
GIMP_CURSOR_MODIFIER_MINUS);
|
2000-03-29 07:39:32 +08:00
|
|
|
break;
|
|
|
|
case SELECTION_INTERSECT:
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_TOOL_CURSOR_NONE,
|
|
|
|
GIMP_CURSOR_MODIFIER_INTERSECT);
|
2000-03-29 07:39:32 +08:00
|
|
|
break;
|
|
|
|
case SELECTION_REPLACE:
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_TOOL_CURSOR_NONE,
|
|
|
|
GIMP_CURSOR_MODIFIER_NONE);
|
2000-03-29 07:39:32 +08:00
|
|
|
break;
|
|
|
|
case SELECTION_MOVE_MASK:
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_RECT_SELECT_TOOL_CURSOR,
|
|
|
|
GIMP_CURSOR_MODIFIER_MOVE);
|
2000-03-29 07:39:32 +08:00
|
|
|
break;
|
|
|
|
case SELECTION_MOVE:
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_MOVE_TOOL_CURSOR,
|
|
|
|
GIMP_CURSOR_MODIFIER_NONE);
|
2000-07-30 00:12:40 +08:00
|
|
|
break;
|
|
|
|
case SELECTION_ANCHOR:
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_RECT_SELECT_TOOL_CURSOR,
|
|
|
|
GIMP_CURSOR_MODIFIER_ANCHOR);
|
2000-03-29 07:39:32 +08:00
|
|
|
}
|
2000-02-09 07:35:41 +08:00
|
|
|
|
2000-03-29 07:39:32 +08:00
|
|
|
return;
|
|
|
|
}
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_BAD_CURSOR,
|
|
|
|
GIMP_TOOL_CURSOR_NONE,
|
|
|
|
GIMP_CURSOR_MODIFIER_NONE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-10-22 20:13:44 +08:00
|
|
|
void
|
|
|
|
by_color_select_mask_changed (GimpImage *gimage)
|
2001-06-01 03:53:13 +08:00
|
|
|
{
|
|
|
|
if (by_color_dialog)
|
2001-10-22 20:13:44 +08:00
|
|
|
gimp_by_color_select_tool_initialize_by_image (gimage);
|
2001-06-01 03:53:13 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/****************************/
|
|
|
|
/* Select by Color dialog */
|
|
|
|
/****************************/
|
|
|
|
|
1998-03-19 06:35:31 +08:00
|
|
|
static ByColorDialog *
|
1999-11-22 19:14:29 +08:00
|
|
|
by_color_select_dialog_new (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ByColorDialog *bcd;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *options_box;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *util_box;
|
|
|
|
GtkWidget *slider;
|
2000-04-19 22:02:05 +08:00
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *button;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-28 01:58:10 +08:00
|
|
|
bcd = g_new (ByColorDialog, 1);
|
|
|
|
bcd->gimage = NULL;
|
2000-03-29 07:39:32 +08:00
|
|
|
bcd->operation = SELECTION_REPLACE;
|
2001-06-04 04:40:50 +08:00
|
|
|
bcd->threshold = gimprc.default_threshold;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* The shell and main vbox */
|
1999-09-28 01:58:10 +08:00
|
|
|
bcd->shell = gimp_dialog_new (_("By Color Selection"), "by_color_selection",
|
2001-05-10 16:10:25 +08:00
|
|
|
NULL, NULL,
|
1999-09-28 01:58:10 +08:00
|
|
|
GTK_WIN_POS_NONE,
|
|
|
|
FALSE, TRUE, FALSE,
|
|
|
|
|
|
|
|
_("Reset"), by_color_select_reset_callback,
|
2000-01-07 00:40:17 +08:00
|
|
|
bcd, NULL, NULL, FALSE, FALSE,
|
2001-08-04 03:43:19 +08:00
|
|
|
GTK_STOCK_CLOSE, by_color_select_close_callback,
|
2000-01-07 00:40:17 +08:00
|
|
|
bcd, NULL, NULL, TRUE, TRUE,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-28 01:58:10 +08:00
|
|
|
NULL);
|
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
/* The main hbox */
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
|
|
|
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (bcd->shell)->vbox), hbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* The preview */
|
1999-11-22 19:14:29 +08:00
|
|
|
util_box = gtk_vbox_new (FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), util_box, FALSE, FALSE, 0);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_box_pack_start (GTK_BOX (util_box), frame, FALSE, FALSE, 0);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
bcd->preview = gtk_preview_new (GTK_PREVIEW_GRAYSCALE);
|
|
|
|
gtk_preview_size (GTK_PREVIEW (bcd->preview), PREVIEW_WIDTH, PREVIEW_HEIGHT);
|
|
|
|
gtk_widget_set_events (bcd->preview, PREVIEW_EVENT_MASK);
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), bcd->preview);
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_connect (G_OBJECT (bcd->preview), "button_press_event",
|
|
|
|
G_CALLBACK (by_color_select_preview_events),
|
|
|
|
bcd);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
/* dnd colors to the image window */
|
1999-10-10 04:33:53 +08:00
|
|
|
gtk_drag_dest_set (bcd->preview,
|
|
|
|
GTK_DEST_DEFAULT_HIGHLIGHT |
|
|
|
|
GTK_DEST_DEFAULT_MOTION |
|
|
|
|
GTK_DEST_DEFAULT_DROP,
|
1999-11-22 19:14:29 +08:00
|
|
|
by_color_select_targets,
|
2001-10-22 20:13:44 +08:00
|
|
|
G_N_ELEMENTS (by_color_select_targets),
|
1999-10-10 04:33:53 +08:00
|
|
|
GDK_ACTION_COPY);
|
|
|
|
gimp_dnd_color_dest_set (bcd->preview, by_color_select_color_drop, bcd);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (bcd->preview);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
gtk_widget_show (util_box);
|
|
|
|
|
|
|
|
/* options box */
|
1999-11-22 19:14:29 +08:00
|
|
|
options_box = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), options_box, FALSE, FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-03-30 20:10:54 +08:00
|
|
|
/* Create the active image label */
|
1997-11-25 06:05:25 +08:00
|
|
|
util_box = gtk_hbox_new (FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (options_box), util_box, FALSE, FALSE, 0);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
bcd->gimage_name = gtk_label_new (_("Inactive"));
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (util_box), bcd->gimage_name, FALSE, FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gtk_widget_show (bcd->gimage_name);
|
|
|
|
gtk_widget_show (util_box);
|
|
|
|
|
|
|
|
/* Create the selection mode radio box */
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
frame = gimp_radio_group_new2
|
|
|
|
(TRUE, _("Selection Mode"),
|
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
|
|
|
&bcd->operation,
|
|
|
|
GINT_TO_POINTER (bcd->operation),
|
1997-11-25 06:05:25 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
_("Replace"), GINT_TO_POINTER (SELECTION_REPLACE), &bcd->replace_button,
|
|
|
|
_("Add"), GINT_TO_POINTER (SELECTION_ADD), NULL,
|
|
|
|
_("Subtract"), GINT_TO_POINTER (SELECTION_SUB), NULL,
|
|
|
|
_("Intersect"), GINT_TO_POINTER (SELECTION_INTERSECT), NULL,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
NULL);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (options_box), frame, FALSE, FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
/* Create the opacity scale widget */
|
|
|
|
util_box = gtk_vbox_new (FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (options_box), util_box, FALSE, FALSE, 0);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
label = gtk_label_new (_("Fuzziness Threshold"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_widget_show (util_box);
|
|
|
|
|
2000-04-19 22:02:05 +08:00
|
|
|
bcd->threshold_adj =
|
|
|
|
gtk_adjustment_new (bcd->threshold, 0.0, 255.0, 1.0, 1.0, 0.0);
|
|
|
|
slider = gtk_hscale_new (GTK_ADJUSTMENT (bcd->threshold_adj));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (util_box), slider, TRUE, TRUE, 0);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
|
|
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_connect (G_OBJECT (bcd->threshold_adj), "value_changed",
|
|
|
|
G_CALLBACK (gimp_int_adjustment_update),
|
|
|
|
&bcd->threshold);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gtk_widget_show (slider);
|
|
|
|
|
2000-04-19 22:02:05 +08:00
|
|
|
frame = gtk_frame_new (_("Selection"));
|
|
|
|
gtk_box_pack_end (GTK_BOX (options_box), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
table = gtk_table_new (2, 2, TRUE);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label (_("Invert"));
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 2, 0, 1);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_connect (G_OBJECT (button), "clicked",
|
|
|
|
G_CALLBACK (by_color_select_invert_callback),
|
|
|
|
bcd);
|
|
|
|
|
2000-04-19 22:02:05 +08:00
|
|
|
button = gtk_button_new_with_label (_("All"));
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 1, 2);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_connect (G_OBJECT (button), "clicked",
|
|
|
|
G_CALLBACK (by_color_select_select_all_callback),
|
|
|
|
bcd);
|
|
|
|
|
2000-04-19 22:02:05 +08:00
|
|
|
button = gtk_button_new_with_label (_("None"));
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 1, 2);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_connect (G_OBJECT (button), "clicked",
|
|
|
|
G_CALLBACK (by_color_select_select_none_callback),
|
|
|
|
bcd);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (options_box);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
gtk_widget_show (bcd->shell);
|
|
|
|
|
|
|
|
return bcd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
by_color_select_render (ByColorDialog *bcd,
|
2001-05-10 16:10:25 +08:00
|
|
|
GimpImage *gimage)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-01-29 10:45:02 +08:00
|
|
|
GimpChannel *mask;
|
|
|
|
MaskBuf *scaled_buf = NULL;
|
|
|
|
guchar *buf;
|
|
|
|
PixelRegion srcPR, destPR;
|
|
|
|
guchar *src;
|
|
|
|
gint subsample;
|
|
|
|
gint width, height;
|
|
|
|
gint srcwidth;
|
|
|
|
gint i;
|
|
|
|
gint scale;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
mask = gimp_image_get_mask (gimage);
|
2001-01-15 05:11:52 +08:00
|
|
|
if ((gimp_drawable_width (GIMP_DRAWABLE(mask)) > PREVIEW_WIDTH) ||
|
|
|
|
(gimp_drawable_height (GIMP_DRAWABLE(mask)) > PREVIEW_HEIGHT))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-01-15 05:11:52 +08:00
|
|
|
if (((float) gimp_drawable_width (GIMP_DRAWABLE (mask)) / (float) PREVIEW_WIDTH) >
|
|
|
|
((float) gimp_drawable_height (GIMP_DRAWABLE (mask)) / (float) PREVIEW_HEIGHT))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
width = PREVIEW_WIDTH;
|
2001-01-15 05:11:52 +08:00
|
|
|
height = ((gimp_drawable_height (GIMP_DRAWABLE (mask)) * PREVIEW_WIDTH) /
|
|
|
|
gimp_drawable_width (GIMP_DRAWABLE (mask)));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-01-15 05:11:52 +08:00
|
|
|
width = ((gimp_drawable_width (GIMP_DRAWABLE (mask)) * PREVIEW_HEIGHT) /
|
|
|
|
gimp_drawable_height (GIMP_DRAWABLE (mask)));
|
1997-11-25 06:05:25 +08:00
|
|
|
height = PREVIEW_HEIGHT;
|
|
|
|
}
|
|
|
|
|
|
|
|
scale = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-01-15 05:11:52 +08:00
|
|
|
width = gimp_drawable_width (GIMP_DRAWABLE (mask));
|
|
|
|
height = gimp_drawable_height (GIMP_DRAWABLE (mask));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
scale = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((width != bcd->preview->requisition.width) ||
|
|
|
|
(height != bcd->preview->requisition.height))
|
|
|
|
gtk_preview_size (GTK_PREVIEW (bcd->preview), width, height);
|
|
|
|
|
|
|
|
/* clear the image buf */
|
1999-11-22 19:14:29 +08:00
|
|
|
buf = g_new0 (guchar, bcd->preview->requisition.width);
|
1997-11-25 06:05:25 +08:00
|
|
|
for (i = 0; i < bcd->preview->requisition.height; i++)
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (bcd->preview), buf,
|
|
|
|
0, i, bcd->preview->requisition.width);
|
1997-11-25 06:05:25 +08:00
|
|
|
g_free (buf);
|
|
|
|
|
|
|
|
/* if the mask is empty, no need to scale and update again */
|
|
|
|
if (gimage_mask_is_empty (gimage))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (scale)
|
|
|
|
{
|
|
|
|
/* calculate 'acceptable' subsample */
|
|
|
|
subsample = 1;
|
2001-01-15 05:11:52 +08:00
|
|
|
while ((width * (subsample + 1) * 2 < gimp_drawable_width (GIMP_DRAWABLE (mask))) &&
|
|
|
|
(height * (subsample + 1) * 2 < gimp_drawable_height (GIMP_DRAWABLE (mask))))
|
1997-11-25 06:05:25 +08:00
|
|
|
subsample = subsample + 1;
|
|
|
|
|
2001-01-15 05:11:52 +08:00
|
|
|
pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE (mask)),
|
1998-01-22 15:02:57 +08:00
|
|
|
0, 0,
|
2001-01-15 05:11:52 +08:00
|
|
|
gimp_drawable_width (GIMP_DRAWABLE (mask)),
|
|
|
|
gimp_drawable_height (GIMP_DRAWABLE (mask)), FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
scaled_buf = mask_buf_new (width, height);
|
|
|
|
destPR.bytes = 1;
|
|
|
|
destPR.x = 0;
|
|
|
|
destPR.y = 0;
|
|
|
|
destPR.w = width;
|
|
|
|
destPR.h = height;
|
|
|
|
destPR.rowstride = srcPR.bytes * width;
|
|
|
|
destPR.data = mask_buf_data (scaled_buf);
|
|
|
|
destPR.tiles = NULL;
|
|
|
|
|
|
|
|
subsample_region (&srcPR, &destPR, subsample);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-01-15 05:11:52 +08:00
|
|
|
pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE (mask)),
|
1998-01-22 15:02:57 +08:00
|
|
|
0, 0,
|
2001-01-15 05:11:52 +08:00
|
|
|
gimp_drawable_width (GIMP_DRAWABLE (mask)),
|
|
|
|
gimp_drawable_height (GIMP_DRAWABLE (mask)), FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
scaled_buf = mask_buf_new (width, height);
|
|
|
|
destPR.bytes = 1;
|
|
|
|
destPR.x = 0;
|
|
|
|
destPR.y = 0;
|
|
|
|
destPR.w = width;
|
|
|
|
destPR.h = height;
|
|
|
|
destPR.rowstride = srcPR.bytes * width;
|
|
|
|
destPR.data = mask_buf_data (scaled_buf);
|
|
|
|
destPR.tiles = NULL;
|
|
|
|
|
|
|
|
copy_region (&srcPR, &destPR);
|
|
|
|
}
|
|
|
|
|
|
|
|
src = mask_buf_data (scaled_buf);
|
|
|
|
srcwidth = scaled_buf->width;
|
|
|
|
for (i = 0; i < height; i++)
|
|
|
|
{
|
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (bcd->preview), src, 0, i, width);
|
|
|
|
src += srcwidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
mask_buf_free (scaled_buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
by_color_select_draw (ByColorDialog *bcd,
|
2001-05-10 16:10:25 +08:00
|
|
|
GimpImage *gimage)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-08-30 01:48:28 +08:00
|
|
|
gchar *basename;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Draw the image buf to the preview window */
|
|
|
|
gtk_widget_draw (bcd->preview, NULL);
|
|
|
|
|
|
|
|
/* Update the gimage label to reflect the displayed gimage name */
|
2001-08-30 01:48:28 +08:00
|
|
|
basename = g_path_get_basename (gimp_image_filename (gimage));
|
|
|
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (bcd->gimage_name), basename);
|
|
|
|
|
|
|
|
g_free (basename);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
by_color_select_preview_events (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
ByColorDialog *bcd)
|
|
|
|
{
|
|
|
|
switch (bevent->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
by_color_select_preview_button_press (bcd, bevent);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
by_color_select_reset_callback (GtkWidget *widget,
|
1999-11-22 19:14:29 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ByColorDialog *bcd;
|
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
bcd = (ByColorDialog *) data;
|
1998-03-30 20:10:54 +08:00
|
|
|
|
2000-04-19 22:02:05 +08:00
|
|
|
gtk_widget_activate (bcd->replace_button);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (bcd->threshold_adj),
|
2001-06-04 04:40:50 +08:00
|
|
|
gimprc.default_threshold);
|
2000-04-19 22:02:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
by_color_select_invert_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ByColorDialog *bcd;
|
|
|
|
|
|
|
|
bcd = (ByColorDialog *) data;
|
|
|
|
|
|
|
|
if (!bcd->gimage)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* check if the image associated to the mask still exists */
|
2001-01-15 05:11:52 +08:00
|
|
|
if (! gimp_drawable_gimage (GIMP_DRAWABLE (gimp_image_get_mask (bcd->gimage))))
|
2000-04-19 22:02:05 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* invert the mask */
|
|
|
|
gimage_mask_invert (bcd->gimage);
|
|
|
|
|
|
|
|
/* show selection on all views */
|
|
|
|
gdisplays_flush ();
|
|
|
|
|
|
|
|
/* update the preview window */
|
|
|
|
by_color_select_render (bcd, bcd->gimage);
|
|
|
|
by_color_select_draw (bcd, bcd->gimage);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
by_color_select_select_all_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ByColorDialog *bcd;
|
|
|
|
|
|
|
|
bcd = (ByColorDialog *) data;
|
|
|
|
|
|
|
|
if (!bcd->gimage)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* check if the image associated to the mask still exists */
|
2001-01-15 05:11:52 +08:00
|
|
|
if (! gimp_drawable_gimage (GIMP_DRAWABLE (gimp_image_get_mask (bcd->gimage))))
|
2000-04-19 22:02:05 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* fill the mask */
|
|
|
|
gimage_mask_all (bcd->gimage);
|
|
|
|
|
|
|
|
/* show selection on all views */
|
|
|
|
gdisplays_flush ();
|
|
|
|
|
|
|
|
/* update the preview window */
|
|
|
|
by_color_select_render (bcd, bcd->gimage);
|
|
|
|
by_color_select_draw (bcd, bcd->gimage);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
by_color_select_select_none_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ByColorDialog *bcd;
|
|
|
|
|
|
|
|
bcd = (ByColorDialog *) data;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (!bcd->gimage)
|
|
|
|
return;
|
|
|
|
|
1998-03-30 20:10:54 +08:00
|
|
|
/* check if the image associated to the mask still exists */
|
2001-01-15 05:11:52 +08:00
|
|
|
if (! gimp_drawable_gimage (GIMP_DRAWABLE (gimp_image_get_mask (bcd->gimage))))
|
1998-03-30 20:10:54 +08:00
|
|
|
return;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* reset the mask */
|
|
|
|
gimage_mask_clear (bcd->gimage);
|
|
|
|
|
|
|
|
/* show selection on all views */
|
|
|
|
gdisplays_flush ();
|
|
|
|
|
|
|
|
/* update the preview window */
|
|
|
|
by_color_select_render (bcd, bcd->gimage);
|
|
|
|
by_color_select_draw (bcd, bcd->gimage);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
by_color_select_close_callback (GtkWidget *widget,
|
1999-11-22 19:14:29 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ByColorDialog *bcd;
|
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
bcd = (ByColorDialog *) data;
|
2000-02-08 20:14:53 +08:00
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
gtk_widget_hide (bcd->shell);
|
1999-06-23 23:24:46 +08:00
|
|
|
|
2001-06-01 03:53:13 +08:00
|
|
|
/* if (bcd->gimage && gimp_container_have (image_context,
|
|
|
|
* GIMP_OBJECT (bcd->gimage)))
|
|
|
|
* {
|
|
|
|
* bcd->gimage->by_color_select = FALSE;
|
|
|
|
* }
|
|
|
|
* Temporarily commented out. */
|
2001-02-04 06:05:41 +08:00
|
|
|
|
|
|
|
bcd->gimage = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
by_color_select_preview_button_press (ByColorDialog *bcd,
|
|
|
|
GdkEventButton *bevent)
|
|
|
|
{
|
2000-03-29 07:39:32 +08:00
|
|
|
gint x, y;
|
|
|
|
gboolean replace;
|
|
|
|
SelectOps operation;
|
1998-01-22 15:02:57 +08:00
|
|
|
GimpDrawable *drawable;
|
2000-03-29 07:39:32 +08:00
|
|
|
guchar *col;
|
2001-10-22 20:13:44 +08:00
|
|
|
GimpRGB color;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (!bcd->gimage)
|
|
|
|
return;
|
1998-03-30 20:10:54 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
drawable = gimp_image_active_drawable (bcd->gimage);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-03-30 20:10:54 +08:00
|
|
|
/* check if the gimage associated to the drawable still exists */
|
2001-01-15 05:11:52 +08:00
|
|
|
if (! gimp_drawable_gimage (drawable))
|
1998-03-30 20:10:54 +08:00
|
|
|
return;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Defaults */
|
|
|
|
replace = FALSE;
|
2000-03-29 07:39:32 +08:00
|
|
|
operation = SELECTION_REPLACE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Based on modifiers, and the "by color" dialog's selection mode */
|
2000-02-09 07:35:41 +08:00
|
|
|
if ((bevent->state & GDK_SHIFT_MASK) &&
|
|
|
|
!(bevent->state & GDK_CONTROL_MASK))
|
|
|
|
operation = SELECTION_ADD;
|
|
|
|
else if ((bevent->state & GDK_CONTROL_MASK) &&
|
|
|
|
!(bevent->state & GDK_SHIFT_MASK))
|
|
|
|
operation = SELECTION_SUB;
|
|
|
|
else if ((bevent->state & GDK_CONTROL_MASK) &&
|
|
|
|
(bevent->state & GDK_SHIFT_MASK))
|
|
|
|
operation = SELECTION_INTERSECT;
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
|
|
|
operation = by_color_dialog->operation;
|
|
|
|
|
|
|
|
/* Find x, y and modify selection */
|
|
|
|
|
|
|
|
/* Get the start color */
|
|
|
|
if (by_color_options->sample_merged)
|
|
|
|
{
|
2001-10-22 20:13:44 +08:00
|
|
|
x = bcd->gimage->width * bevent->x / bcd->preview->requisition.width;
|
1997-11-25 06:05:25 +08:00
|
|
|
y = bcd->gimage->height * bevent->y / bcd->preview->requisition.height;
|
2001-10-22 20:13:44 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (x < 0 || y < 0 || x >= bcd->gimage->width || y >= bcd->gimage->height)
|
|
|
|
return;
|
2001-10-22 20:13:44 +08:00
|
|
|
|
|
|
|
col = gimp_image_get_color_at (bcd->gimage, x, y);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-03-29 07:39:32 +08:00
|
|
|
gint offx, offy;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-01-15 05:11:52 +08:00
|
|
|
gimp_drawable_offsets (drawable, &offx, &offy);
|
2001-10-22 20:13:44 +08:00
|
|
|
|
|
|
|
x = (gimp_drawable_width (drawable) * bevent->x /
|
|
|
|
bcd->preview->requisition.width - offx);
|
|
|
|
y = (gimp_drawable_height (drawable) * bevent->y /
|
|
|
|
bcd->preview->requisition.height - offy);
|
|
|
|
|
2000-02-09 07:35:41 +08:00
|
|
|
if (x < 0 || y < 0 ||
|
2001-01-15 05:11:52 +08:00
|
|
|
x >= gimp_drawable_width (drawable) || y >= gimp_drawable_height (drawable))
|
1997-11-25 06:05:25 +08:00
|
|
|
return;
|
2001-10-22 20:13:44 +08:00
|
|
|
|
|
|
|
col = gimp_drawable_get_color_at (drawable, x, y);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-10-22 20:13:44 +08:00
|
|
|
gimp_rgba_set_uchar (&color, col[0], col[1], col[2], col[3]);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-10-22 20:13:44 +08:00
|
|
|
g_free (col);
|
|
|
|
|
|
|
|
gimp_image_mask_select_by_color (bcd->gimage, drawable,
|
|
|
|
by_color_options->sample_merged,
|
|
|
|
&color,
|
|
|
|
bcd->threshold,
|
|
|
|
operation,
|
|
|
|
by_color_options->antialias,
|
|
|
|
by_color_options->feather,
|
|
|
|
by_color_options->feather_radius,
|
|
|
|
by_color_options->feather_radius);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* show selection on all views */
|
|
|
|
gdisplays_flush ();
|
|
|
|
|
|
|
|
/* update the preview window */
|
|
|
|
by_color_select_render (bcd, bcd->gimage);
|
|
|
|
by_color_select_draw (bcd, bcd->gimage);
|
|
|
|
}
|
1999-10-10 04:33:53 +08:00
|
|
|
|
|
|
|
static void
|
2001-01-20 23:37:26 +08:00
|
|
|
by_color_select_color_drop (GtkWidget *widget,
|
|
|
|
const GimpRGB *color,
|
|
|
|
gpointer data)
|
1999-10-10 04:33:53 +08:00
|
|
|
|
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
GimpDrawable *drawable;
|
1999-10-10 04:33:53 +08:00
|
|
|
ByColorDialog *bcd;
|
|
|
|
|
|
|
|
bcd = (ByColorDialog*) data;
|
2000-12-29 23:22:01 +08:00
|
|
|
drawable = gimp_image_active_drawable (bcd->gimage);
|
2001-01-15 09:48:53 +08:00
|
|
|
|
2001-10-22 20:13:44 +08:00
|
|
|
gimp_image_mask_select_by_color (bcd->gimage, drawable,
|
|
|
|
by_color_options->sample_merged,
|
|
|
|
color,
|
|
|
|
bcd->threshold,
|
|
|
|
bcd->operation,
|
|
|
|
by_color_options->antialias,
|
|
|
|
by_color_options->feather,
|
|
|
|
by_color_options->feather_radius,
|
|
|
|
by_color_options->feather_radius);
|
1999-10-10 04:33:53 +08:00
|
|
|
|
|
|
|
/* show selection on all views */
|
|
|
|
gdisplays_flush ();
|
|
|
|
|
|
|
|
/* update the preview window */
|
|
|
|
by_color_select_render (bcd, bcd->gimage);
|
|
|
|
by_color_select_draw (bcd, bcd->gimage);
|
|
|
|
}
|