gimp/app/widgets/gimpcolormapeditor.c

854 lines
24 KiB
C
Raw Normal View History

/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
derive from GtkDrawingArea instead of deprecated GtkPreview. 2002-01-30 Sven Neumann <sven@gimp.org> * libgimpwidgets/gimpcolorarea.[ch]: derive from GtkDrawingArea instead of deprecated GtkPreview. * app/nav_window.c * app/gui/brush-editor.c * app/gui/buffers-commands.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/device-status-dialog.c * app/gui/dialogs-constructors.c * app/gui/file-open-dialog.c * app/gui/gradient-editor.c * app/gui/indicator-area.c * app/gui/info-window.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palettes-commands.c * app/gui/test-commands.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpdnd.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpimagedock.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.c * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.c * libgimp/gimpbrushmenu.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/blinds.c * plug-ins/common/curve_bend.c * plug-ins/common/depthmerge.c * plug-ins/common/despeckle.c * plug-ins/common/destripe.c * plug-ins/common/diffraction.c * plug-ins/common/emboss.c * plug-ins/common/exchange.c * plug-ins/common/flarefx.c * plug-ins/common/fractaltrace.c * plug-ins/common/glasstile.c * plug-ins/common/gqbist.c * plug-ins/common/grid.c * plug-ins/common/illusion.c * plug-ins/common/iwarp.c * plug-ins/common/jigsaw.c * plug-ins/common/mapcolor.c * plug-ins/common/max_rgb.c * plug-ins/common/newsprint.c * plug-ins/common/nlfilt.c * plug-ins/common/noisify.c * plug-ins/common/nova.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/sample_colorize.c * plug-ins/common/scatter_hsv.c * plug-ins/common/sharpen.c * plug-ins/common/sinus.c * plug-ins/common/tileit.c * plug-ins/common/video.c * plug-ins/common/waves.c * plug-ins/common/whirlpinch.c * plug-ins/common/wind.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gimpressionist/brush.c * plug-ins/mosaic/mosaic.c * plug-ins/rcm/rcm_dialog.c: define GTK_DISABLE_DEPRECATED to make it compile. We really need a generic plug-in preview system that doesn't use GtkPreview.
2002-01-30 22:54:27 +08:00
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
Makefile.am configure.in added stuff for the new library below. 2001-01-23 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added stuff for the new library below. * libgimpcolor/.cvsignore * libgimpcolor/Makefile.am * libgimpcolor/gimpcolor.h * libgimpcolor/gimpcolorspace.c * libgimpcolor/gimpcolorspace.h * libgimpcolor/gimpcolortypes.h * libgimpcolor/gimphsv.c * libgimpcolor/gimphsv.h * libgimpcolor/gimprgb.c * libgimpcolor/gimprgb.h: new shared library which both the app and plug-ins link against. The library depends only on glib. * libgimpcolor/gimpcolor.def * libgimpcolor/makefile.mingw.in * libgimpcolor/makefile.msc: added Win32 build files which definitely don't work. * libgimp/Makefile.am * libgimp/gimpcolor.[ch] * libgimp/gimpcolorspace.[ch]: removed. * libgimp/gimp.h * libgimp/gimpadaptivesupersample.c * libgimp/gimpbilinear.c * libgimp/gimppalette.c * libgimp/gimptypes.h: include the stuff from libgimpcolor. Plug-Ins don't need to include <libgimpcolor/gimpcolor.h> explicitely. LibGimp depends on libgimpcolor and thus also includes it's headers. * libgimp/gimp.def * libgimp/makefile.mingw.in: fiddled around with Win32 stuff... * app/Makefile.am: link against libgimpcolor.la * app/apptypes.h: include "libgimpcolor/gimpcolortypes.h" * app/asupsample.c * app/channels_dialog.c * app/colormap_dialog.c * app/commands.c * app/convert.c * app/devices.c * app/disp_callbacks.c * app/drawable.c * app/gimpcontext.c * app/gimpdnd.c * app/gimpimage.c * app/gimppalette.c * app/gimprc.c * app/gradient.c * app/libgimp_glue.c * app/palette.c * app/palette_import.c * app/qmask.c * app/xcf.c * app/tools/paint_core.c * app/tools/paintbrush.c * app/tools/pencil.c: include "libgimpcolor/gimpcolor.h" before all gimp includes because it's a standalone library. * plug-ins/FractalExplorer/Makefile.am * plug-ins/Lighting/Makefile.am * plug-ins/MapObject/Makefile.am * plug-ins/bmp/Makefile.am * plug-ins/common/Makefile.am * plug-ins/common/mkgen.pl * plug-ins/dbbrowser/Makefile.am * plug-ins/faxg3/Makefile.am * plug-ins/fits/Makefile.am * plug-ins/flame/Makefile.am * plug-ins/fp/Makefile.am * plug-ins/gap/Makefile.am * plug-ins/gdyntext/Makefile.am * plug-ins/gfig/Makefile.am * plug-ins/gflare/Makefile.am * plug-ins/gfli/Makefile.am * plug-ins/gimpressionist/Makefile.am * plug-ins/helpbrowser/Makefile.am * plug-ins/ifscompose/Makefile.am * plug-ins/imagemap/Makefile.am * plug-ins/maze/Makefile.am * plug-ins/mosaic/Makefile.am * plug-ins/pagecurl/Makefile.am * plug-ins/print/Makefile.am * plug-ins/rcm/Makefile.am * plug-ins/script-fu/Makefile.am * plug-ins/sel2path/Makefile.am * plug-ins/sgi/Makefile.am * plug-ins/webbrowser/Makefile.am * plug-ins/xjt/Makefile.am: add libgimpcolor.la to LDADD. * INSTALL: don't recommend to --disable-shared for development. * TODO.xml: increased some percentages, added plug-in help stuff.
2001-01-24 02:49:44 +08:00
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
Makefile.am configure.in added the new library below. 2001-01-24 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added the new library below. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.[ch] * libgimpwidgets/gimpcolorbutton.[ch] * libgimpwidgets/gimpdialog.[ch] * libgimpwidgets/gimpfileselection.[ch] * libgimpwidgets/gimphelpui.[ch] * libgimpwidgets/gimppatheditor.[ch] * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpquerybox.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch] * libgimpwidgets/gimpwidgets.[ch] * libgimpwidgets/gimpwidgets.def * libgimpwidgets/gimpwidgetstypes.h: new shared library. Currently there are some ugly dependencies into libgimp. These will be removed and go to a "libgimpglue" library which will be a library for functions which share a common interface between plug-ins and the app but have different implementations. Include "libgimp/gimpunit.h" from "libgimpwidgets/gimpwidgetstypes.h" to simulate this upcoming separation. * libgimp/Makefile.am * libgimp/gimpchainbutton.[ch] * libgimp/gimpcolorarea.[ch] * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimpfileselection.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimppixmap.[ch] * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: removed from here. * libgimp/gimpui.h * libgimp/gimpuitypes.h * libgimp/makefile.mingw.in * libgimp/makefile.msc: changed accordingly. * app/[all ui files] * app/pdb/palette_cmds.c * app/pdb/tools_cmds.c * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/tools.pdb: #include "libgimpwidgets/gimpwidgets.h" and removed useless includes. * app/apptypes.h: #include "libgimpwidgets/gimpwidgetstypes.h" * app/Makefile.am * plug-ins/[all makefiles which link against libgimpui]: link against libgimpwidgets.la * po-libgimp/POTFILES.in: changed file locations.
2001-01-25 06:36:18 +08:00
#include "libgimpwidgets/gimpwidgets.h"
Makefile.am configure.in added stuff for the new library below. 2001-01-23 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added stuff for the new library below. * libgimpcolor/.cvsignore * libgimpcolor/Makefile.am * libgimpcolor/gimpcolor.h * libgimpcolor/gimpcolorspace.c * libgimpcolor/gimpcolorspace.h * libgimpcolor/gimpcolortypes.h * libgimpcolor/gimphsv.c * libgimpcolor/gimphsv.h * libgimpcolor/gimprgb.c * libgimpcolor/gimprgb.h: new shared library which both the app and plug-ins link against. The library depends only on glib. * libgimpcolor/gimpcolor.def * libgimpcolor/makefile.mingw.in * libgimpcolor/makefile.msc: added Win32 build files which definitely don't work. * libgimp/Makefile.am * libgimp/gimpcolor.[ch] * libgimp/gimpcolorspace.[ch]: removed. * libgimp/gimp.h * libgimp/gimpadaptivesupersample.c * libgimp/gimpbilinear.c * libgimp/gimppalette.c * libgimp/gimptypes.h: include the stuff from libgimpcolor. Plug-Ins don't need to include <libgimpcolor/gimpcolor.h> explicitely. LibGimp depends on libgimpcolor and thus also includes it's headers. * libgimp/gimp.def * libgimp/makefile.mingw.in: fiddled around with Win32 stuff... * app/Makefile.am: link against libgimpcolor.la * app/apptypes.h: include "libgimpcolor/gimpcolortypes.h" * app/asupsample.c * app/channels_dialog.c * app/colormap_dialog.c * app/commands.c * app/convert.c * app/devices.c * app/disp_callbacks.c * app/drawable.c * app/gimpcontext.c * app/gimpdnd.c * app/gimpimage.c * app/gimppalette.c * app/gimprc.c * app/gradient.c * app/libgimp_glue.c * app/palette.c * app/palette_import.c * app/qmask.c * app/xcf.c * app/tools/paint_core.c * app/tools/paintbrush.c * app/tools/pencil.c: include "libgimpcolor/gimpcolor.h" before all gimp includes because it's a standalone library. * plug-ins/FractalExplorer/Makefile.am * plug-ins/Lighting/Makefile.am * plug-ins/MapObject/Makefile.am * plug-ins/bmp/Makefile.am * plug-ins/common/Makefile.am * plug-ins/common/mkgen.pl * plug-ins/dbbrowser/Makefile.am * plug-ins/faxg3/Makefile.am * plug-ins/fits/Makefile.am * plug-ins/flame/Makefile.am * plug-ins/fp/Makefile.am * plug-ins/gap/Makefile.am * plug-ins/gdyntext/Makefile.am * plug-ins/gfig/Makefile.am * plug-ins/gflare/Makefile.am * plug-ins/gfli/Makefile.am * plug-ins/gimpressionist/Makefile.am * plug-ins/helpbrowser/Makefile.am * plug-ins/ifscompose/Makefile.am * plug-ins/imagemap/Makefile.am * plug-ins/maze/Makefile.am * plug-ins/mosaic/Makefile.am * plug-ins/pagecurl/Makefile.am * plug-ins/print/Makefile.am * plug-ins/rcm/Makefile.am * plug-ins/script-fu/Makefile.am * plug-ins/sel2path/Makefile.am * plug-ins/sgi/Makefile.am * plug-ins/webbrowser/Makefile.am * plug-ins/xjt/Makefile.am: add libgimpcolor.la to LDADD. * INSTALL: don't recommend to --disable-shared for development. * TODO.xml: increased some percentages, added plug-in help stuff.
2001-01-24 02:49:44 +08:00
#include "widgets-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
bumped version number to 1.3.1. Require Glib/GTK+-1.3.11 and Pango-0.22. 2001-11-23 Sven Neumann <sven@gimp.org> * configure.in: bumped version number to 1.3.1. Require Glib/GTK+-1.3.11 and Pango-0.22. Removed GDK_DISABLE_COMPAT_H and GTK_DISABLE_COMPAT_H from our default CFLAGS since they don't exist any longer. * RELEASE-TO-CVS.patch: removed since the glib/gtk+ API is supposed to be frozen now. * HACKING: removed reference to RELEASE-TO-CVS.patch * app/gui/menus.c * app/tools/gimptexttool.c: applied RELEASE-TO-CVS.patch to conform to the new GTK+/Pango API. * app/core/Makefile.am: generate marshallers with gimp_marshal prefix. * app/core/gimpmarshal.list: added all marshallers we use. * app/core/gimpmarshal.[ch]: regenerated. * app/[lots of .c files]: use gimp_marshal_* for all marshallers. * data/images/ * app/app_procs.c * app/gui/splash.c: * libgimpbase/Makefile.am * libgimpbase/gimpbase.h * libgimpbase/gimputils.[ch]: removed since they are no longer needed. * app/gimprc.c * plug-ins/common/ps.c * plug-ins/gdyntext/gdyntext.c * plug-ins/gdyntext/gdyntextcompat.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/script-fu/script-fu-scripts.c: use glib functions instead of gimp_strescape() and gimpstrcompress(). * cleaned up all header files: use G_BEGIN_DECLS/G_END_DECLS, declared all _get_type function as G_GNUC_CONST. * tools/pdbgen/enumcode.pl * tools/pdbgen/lib.pl: make them generate header files using G_BEGIN_DECLS/G_END_DECLS. * pixmaps/Makefile.am * pixmaps/wilber3.xpm: removed ... * data/images/tips_wilber.png: ... and added here as PNG * app/gui/tips-dialog.c: load the Wilber on demand using GdkPixbuf. * data/images/gimp_splash.ppm: removed ... * data/images/gimp_splash.png: ... and added as PNG * app/app_procs.c * app/gui/splash.[ch]: load the splash image using GdkPixbuf. * app/gui/about-dialog.c: sink the GtkPreview.
2001-11-23 07:46:13 +08:00
#include "core/gimpmarshal.h"
app/display/Makefile.am app/display/gimpdisplay-callbacks.[ch] 2001-11-01 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/gimpdisplay-callbacks.[ch] * app/display/gimpdisplay-render.[ch] * app/display/gimpdisplay-scale.[ch] * app/display/gimpdisplay-scroll.[ch]: removed and added as gimpdisplayshell-foo.[ch] because they are all methods of the shell. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: moved the "offset" and "size" variables from GimpDisplay to GimpDisplayShell. GimpDisplay should know nothing about screen coordinates. The gdisplay_[un]transform_foo() methods are still part of GimpDisplay but will be moved to GimpDisplayShell as soon as the tools' vitrual functions speak in image coordinates instead of GdkEvents. * app/display/gimpdisplayshell-callbacks.[ch]: prefixed all functions with gimp_display_shell_*. Moved some stuff to a "realize" callback File still has to be renamed. * app/display/gimpdisplay-foreach.[ch]: removed gdisplays_shrink_wrap(). * app/gui/menus.c * app/gui/view-commands.[ch] * app/display/gimpdisplayshell-scale.[ch]: implemented "Zoom to Fit Window" function (#57670). * app/nav_window.c * app/display/gimpdisplay-handlers.c * app/display/gimpdisplayshell-render.[ch] * app/display/gimpdisplayshell-scale.[ch] * app/display/gimpdisplayshell-scroll.[ch] * app/gui/colormap-dialog.c * app/gui/gui.c * app/gui/preferences-dialog.c * app/tools/gimpmagnifytool.c * app/tools/gimpmovetool.c * app/widgets/gimppreview.c: changed according to variable and filename changes. * app/tools/tool_manager.c: tool_manager_select_tool(): send the active tool a "HALT" command before selecting the new one. Fixes stale tool dialogs which were there because some other hack was removed (This is IMHO the right place to shut down the active tool). * app/tools/gimpcroptool.c: don't shrink wrap after cropping but let gimprc.allow_resize_windows decide. * app/tools/gimpselectiontool.c: gimage_mask_value() takes image, not screen coordinates. A good example of how braindead it is to pass GdkEvents to tools :-) Fixes incorrect cursor and oper update of the selection tools. * app/tools/gimptransformtool.c * app/undo.c: removed (#if 0 for now) some strange code which did manual exposing of GimpDisplayShell areas. This was definitely a hack and should not be there given the image emits correct "update" signals.
2001-11-02 17:31:21 +08:00
#include "display/gimpdisplayshell-render.h"
#include "gimpcolormapeditor.h"
#include "gimpdnd.h"
#include "gimpitemfactory.h"
#include "gui/color-notebook.h"
app/Makefile.am app/gui/Makefile.am app/about_dialog.[ch] 2001-04-17 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gui/Makefile.am * app/about_dialog.[ch] * app/brush_edit.[ch] * app/brush_select.[ch] * app/channels_dialog.[ch] * app/color_area.[ch] * app/color_notebook.[ch] * app/color_select.[ch] * app/colormap_dialog.[ch] * app/commands.[ch] * app/file_new_dialog.[ch] * app/gradient_editor.[ch] * app/gradient_select.[ch] * app/indicator_area.[ch] * app/info_dialog.[ch] * app/info_window.[ch] * app/layer_select.[ch] * app/layers_dialog.[ch] * app/menus.[ch] * app/palette.[ch] * app/palette_import.[ch] * app/palette_select.[ch] * app/paths_dialog.[ch] * app/pattern_select.[ch] * app/preferences_dialog.[ch] * app/session.[ch] * app/test_commands.[ch] * app/tips_dialog.[ch] * app/toolbox.[ch]: moved to gui/ (s/_/-/ and some more useful filenames on the way). * app/app_procs.c * app/context_manager.c * app/convert.c * app/disp_callbacks.c * app/errorconsole.c * app/file-open.c * app/file-save.c * app/file-utils.c * app/gdisplay.c * app/gimage.c * app/gimprc.c * app/image_new.c * app/interface.c * app/nav_window.c * app/path.c * app/plug_in.c * app/gui/dialogs-constructors.c * app/pdb/brush_select_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/pattern_select_cmds.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpscaletool.c * app/tools/gimptransformtool.c * app/widgets/gimpcolorpanel.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/pattern_select.pdb * po/POTFILES.in: changed accordingly.
2001-04-18 05:43:29 +08:00
#include "libgimp/gimpintl.h"
/* Add these features:
*
* load/save colormaps
* requantize
* add color--by clicking in the checked region
* all changes need to flush colormap lookup cache
*/
enum
{
SELECTED,
LAST_SIGNAL
};
static void gimp_colormap_editor_class_init (GimpColormapEditorClass *klass);
static void gimp_colormap_editor_init (GimpColormapEditor *colormap_editor);
static void gimp_colormap_editor_destroy (GtkObject *object);
static void gimp_colormap_editor_unmap (GtkWidget *widget);
static void gimp_colormap_editor_draw (GimpColormapEditor *editor);
static void gimp_colormap_editor_draw_cell (GimpColormapEditor *editor,
gint col);
static void gimp_colormap_editor_clear (GimpColormapEditor *editor,
gint start_row);
static void gimp_colormap_editor_update_entries (GimpColormapEditor *editor);
static void gimp_colormap_editor_set_index (GimpColormapEditor *editor,
gint i);
static void gimp_colormap_preview_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
GimpColormapEditor *editor);
static gboolean
gimp_colormap_preview_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GimpColormapEditor *editor);
static void gimp_colormap_preview_drag_color (GtkWidget *widget,
GimpRGB *color,
gpointer data);
static void gimp_colormap_preview_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data);
static void gimp_colormap_adjustment_changed (GtkAdjustment *adjustment,
GimpColormapEditor *editor);
static void gimp_colormap_hex_entry_activate (GtkEntry *entry,
GimpColormapEditor *editor);
static void gimp_colormap_hex_entry_focus_out (GtkEntry *entry,
GdkEvent *event,
GimpColormapEditor *editor);
static void gimp_colormap_image_mode_changed (GimpImage *gimage,
GimpColormapEditor *editor);
static void gimp_colormap_image_colormap_changed (GimpImage *gimage,
gint ncol,
GimpColormapEditor *editor);
static guint editor_signals[LAST_SIGNAL] = { 0 };
static GimpEditorClass *parent_class = NULL;
static GtkTargetEntry color_palette_target_table[] =
{
GIMP_TARGET_COLOR
};
GType
gimp_colormap_editor_get_type (void)
{
static GType gcd_type = 0;
if (! gcd_type)
{
static const GTypeInfo gcd_info =
{
sizeof (GimpColormapEditorClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_colormap_editor_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpColormapEditor),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_colormap_editor_init,
};
gcd_type = g_type_register_static (GIMP_TYPE_EDITOR,
"GimpColormapEditor",
&gcd_info, 0);
}
return gcd_type;
}
static void
gimp_colormap_editor_class_init (GimpColormapEditorClass* klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
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
parent_class = g_type_class_peek_parent (klass);
editor_signals[SELECTED] =
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_new ("selected",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColormapEditorClass, selected),
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, NULL,
bumped version number to 1.3.1. Require Glib/GTK+-1.3.11 and Pango-0.22. 2001-11-23 Sven Neumann <sven@gimp.org> * configure.in: bumped version number to 1.3.1. Require Glib/GTK+-1.3.11 and Pango-0.22. Removed GDK_DISABLE_COMPAT_H and GTK_DISABLE_COMPAT_H from our default CFLAGS since they don't exist any longer. * RELEASE-TO-CVS.patch: removed since the glib/gtk+ API is supposed to be frozen now. * HACKING: removed reference to RELEASE-TO-CVS.patch * app/gui/menus.c * app/tools/gimptexttool.c: applied RELEASE-TO-CVS.patch to conform to the new GTK+/Pango API. * app/core/Makefile.am: generate marshallers with gimp_marshal prefix. * app/core/gimpmarshal.list: added all marshallers we use. * app/core/gimpmarshal.[ch]: regenerated. * app/[lots of .c files]: use gimp_marshal_* for all marshallers. * data/images/ * app/app_procs.c * app/gui/splash.c: * libgimpbase/Makefile.am * libgimpbase/gimpbase.h * libgimpbase/gimputils.[ch]: removed since they are no longer needed. * app/gimprc.c * plug-ins/common/ps.c * plug-ins/gdyntext/gdyntext.c * plug-ins/gdyntext/gdyntextcompat.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/script-fu/script-fu-scripts.c: use glib functions instead of gimp_strescape() and gimpstrcompress(). * cleaned up all header files: use G_BEGIN_DECLS/G_END_DECLS, declared all _get_type function as G_GNUC_CONST. * tools/pdbgen/enumcode.pl * tools/pdbgen/lib.pl: make them generate header files using G_BEGIN_DECLS/G_END_DECLS. * pixmaps/Makefile.am * pixmaps/wilber3.xpm: removed ... * data/images/tips_wilber.png: ... and added here as PNG * app/gui/tips-dialog.c: load the Wilber on demand using GdkPixbuf. * data/images/gimp_splash.ppm: removed ... * data/images/gimp_splash.png: ... and added as PNG * app/app_procs.c * app/gui/splash.[ch]: load the splash image using GdkPixbuf. * app/gui/about-dialog.c: sink the GtkPreview.
2001-11-23 07:46:13 +08:00
gimp_marshal_VOID__VOID,
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_TYPE_NONE, 0);
object_class->destroy = gimp_colormap_editor_destroy;
widget_class->unmap = gimp_colormap_editor_unmap;
klass->selected = NULL;
}
static void
gimp_colormap_editor_init (GimpColormapEditor *colormap_editor)
{
colormap_editor->gimage = NULL;
colormap_editor->col_index = 0;
colormap_editor->dnd_col_index = 0;
colormap_editor->palette = NULL;
colormap_editor->xn = 0;
colormap_editor->yn = 0;
colormap_editor->cellsize = 0;
colormap_editor->index_adjustment = NULL;
colormap_editor->index_spinbutton = NULL;
colormap_editor->color_entry = NULL;
colormap_editor->color_notebook = NULL;
}
static void
gimp_colormap_editor_destroy (GtkObject *object)
{
GimpColormapEditor *editor;
editor = GIMP_COLORMAP_EDITOR (object);
if (editor->color_notebook)
{
color_notebook_free (editor->color_notebook);
editor->color_notebook = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_colormap_editor_unmap (GtkWidget *widget)
{
GimpColormapEditor *editor;
editor = GIMP_COLORMAP_EDITOR (widget);
if (editor->color_notebook)
{
color_notebook_hide (editor->color_notebook);
}
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
}
/* public functions */
GtkWidget *
gimp_colormap_editor_new (GimpImage *gimage)
{
GimpColormapEditor *editor;
GtkWidget *frame;
GtkWidget *table;
g_return_val_if_fail (! gimage || GIMP_IS_IMAGE (gimage), NULL);
editor = g_object_new (GIMP_TYPE_COLORMAP_EDITOR, NULL);
/* The palette frame */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (editor), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
editor->palette = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_widget_set_size_request (editor->palette, -1, 60);
gtk_preview_set_expand (GTK_PREVIEW (editor->palette), TRUE);
gtk_widget_add_events (editor->palette, GDK_BUTTON_PRESS_MASK);
gtk_container_add (GTK_CONTAINER (frame), editor->palette);
gtk_widget_show (editor->palette);
g_signal_connect_after (G_OBJECT (editor->palette), "size_allocate",
G_CALLBACK (gimp_colormap_preview_size_allocate),
editor);
g_signal_connect (G_OBJECT (editor->palette), "button_press_event",
G_CALLBACK (gimp_colormap_preview_button_press),
editor);
/* dnd stuff */
gtk_drag_source_set (editor->palette,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
color_palette_target_table,
G_N_ELEMENTS (color_palette_target_table),
GDK_ACTION_COPY | GDK_ACTION_MOVE);
gimp_dnd_color_source_set (editor->palette, gimp_colormap_preview_drag_color,
editor);
gtk_drag_dest_set (editor->palette,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
color_palette_target_table,
G_N_ELEMENTS (color_palette_target_table),
GDK_ACTION_COPY);
gimp_dnd_color_dest_set (editor->palette, gimp_colormap_preview_drop_color,
editor);
/* some helpful hints */
table = gtk_table_new (2, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
gtk_box_pack_end (GTK_BOX (editor), table, FALSE, FALSE, 0);
gtk_widget_show (table);
editor->index_spinbutton =
gimp_spin_button_new ((GtkObject **) &editor->index_adjustment,
0, 0, 0, 1, 10, 10, 1.0, 0);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Color Index:"), 1.0, 0.5,
editor->index_spinbutton, 1, TRUE);
g_signal_connect (G_OBJECT (editor->index_adjustment), "value_changed",
G_CALLBACK (gimp_colormap_adjustment_changed),
editor);
editor->color_entry = gtk_entry_new ();
gtk_entry_set_max_length (GTK_ENTRY (editor->color_entry), 7);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Hex Triplet:"), 1.0, 0.5,
editor->color_entry, 1, TRUE);
g_signal_connect (G_OBJECT (editor->color_entry), "activate",
G_CALLBACK (gimp_colormap_hex_entry_activate),
editor);
g_signal_connect (G_OBJECT (editor->color_entry), "focus_out_event",
G_CALLBACK (gimp_colormap_hex_entry_focus_out),
editor);
gimp_colormap_editor_set_image (editor, gimage);
return GTK_WIDGET (editor);
}
void
gimp_colormap_editor_selected (GimpColormapEditor *editor)
{
g_return_if_fail (GIMP_IS_COLORMAP_EDITOR (editor));
g_signal_emit (G_OBJECT (editor), editor_signals[SELECTED], 0);
}
void
gimp_colormap_editor_set_image (GimpColormapEditor *editor,
GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_COLORMAP_EDITOR (editor));
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
if (editor->gimage)
{
g_signal_handlers_disconnect_by_func (G_OBJECT (editor->gimage),
gimp_colormap_image_mode_changed,
editor);
g_signal_handlers_disconnect_by_func (G_OBJECT (editor->gimage),
gimp_colormap_image_colormap_changed,
editor);
if (editor->color_notebook)
color_notebook_hide (editor->color_notebook);
2001-12-11 23:58:07 +08:00
if (! gimage || (gimp_image_base_type (gimage) != GIMP_INDEXED))
{
editor->index_adjustment->upper = 0;
gtk_adjustment_changed (editor->index_adjustment);
if (GTK_WIDGET_MAPPED (GTK_WIDGET (editor)))
gimp_colormap_editor_clear (editor, -1);
}
}
editor->gimage = gimage;
editor->col_index = 0;
editor->dnd_col_index = 0;
if (gimage)
{
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
g_signal_connect (G_OBJECT (gimage), "mode_changed",
G_CALLBACK (gimp_colormap_image_mode_changed),
editor);
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
g_signal_connect (G_OBJECT (gimage), "colormap_changed",
G_CALLBACK (gimp_colormap_image_colormap_changed),
editor);
2001-12-11 23:58:07 +08:00
if (gimp_image_base_type (gimage) == GIMP_INDEXED)
{
gimp_colormap_editor_draw (editor);
editor->index_adjustment->upper = editor->gimage->num_cols - 1;
gtk_adjustment_changed (editor->index_adjustment);
}
}
gimp_colormap_editor_update_entries (editor);
}
GimpImage *
gimp_colormap_editor_get_image (GimpColormapEditor *editor)
{
g_return_val_if_fail (GIMP_IS_COLORMAP_EDITOR (editor), NULL);
return editor->gimage;
}
gint
gimp_colormap_editor_col_index (GimpColormapEditor *editor)
{
g_return_val_if_fail (GIMP_IS_COLORMAP_EDITOR (editor), 0);
return editor->col_index;
}
/* private functions */
#define MIN_CELL_SIZE 4
static void
gimp_colormap_editor_draw (GimpColormapEditor *editor)
{
GimpImage *gimage;
gint i, j, k, l, b;
gint col;
guchar *row;
gint cellsize, ncol, xn, yn, width, height;
GtkWidget *palette;
gimage = editor->gimage;
palette = editor->palette;
width = palette->allocation.width;
height = palette->allocation.height;
ncol = gimage->num_cols;
if (! ncol)
{
gimp_colormap_editor_clear (editor, -1);
return;
}
cellsize = sqrt (width * height / ncol);
while (cellsize >= MIN_CELL_SIZE
&& (xn = width / cellsize) * (yn = height / cellsize) < ncol)
cellsize--;
if (cellsize < MIN_CELL_SIZE)
{
cellsize = MIN_CELL_SIZE;
xn = yn = ceil (sqrt (ncol));
}
yn = ((ncol + xn - 1) / xn);
/*
width = xn * cellsize;
height = yn * cellsize;
*/
editor->xn = xn;
editor->yn = yn;
editor->cellsize = cellsize;
row = g_new (guchar, width * 3);
col = 0;
for (i = 0; i < yn; i++)
{
for (j = 0; j < xn && col < ncol; j++, col++)
{
for (k = 0; k < cellsize; k++)
for (b = 0; b < 3; b++)
row[(j * cellsize + k) * 3 + b] = gimage->cmap[col * 3 + b];
}
for (k = 0; k < cellsize; k++)
{
for (l = j * cellsize; l < width; l++)
for (b = 0; b < 3; b++)
row[l * 3 + b] = (((((i * cellsize + k) & 0x4) ?
(l) :
(l + 0x4)) & 0x4) ?
render_blend_light_check[0] :
render_blend_dark_check[0]);
gtk_preview_draw_row (GTK_PREVIEW (editor->palette), row, 0,
i * cellsize + k,
width);
}
}
gimp_colormap_editor_clear (editor, yn * cellsize);
gimp_colormap_editor_draw_cell (editor, editor->col_index);
g_free (row);
gtk_widget_queue_draw (palette);
}
static void
gimp_colormap_editor_draw_cell (GimpColormapEditor *editor,
gint col)
{
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
guchar *row;
gint cellsize, x, y, k;
g_assert (editor);
g_assert (editor->gimage);
g_assert (col < editor->gimage->num_cols);
cellsize = editor->cellsize;
row = g_new (guchar, cellsize * 3);
x = (col % editor->xn) * cellsize;
y = (col / editor->xn) * cellsize;
if (col == editor->col_index)
{
for(k = 0; k < cellsize; k++)
row[k*3] = row[k*3+1] = row[k*3+2] = (k & 1) * 255;
gtk_preview_draw_row (GTK_PREVIEW (editor->palette), row, x, y, cellsize);
if (!(cellsize & 1))
for (k = 0; k < cellsize; k++)
row[k*3] = row[k*3+1] = row[k*3+2] = ((x+y+1) & 1) * 255;
gtk_preview_draw_row (GTK_PREVIEW (editor->palette), row,
x, y+cellsize-1, cellsize);
row[0]=row[1]=row[2]=255;
row[cellsize*3-3] = row[cellsize*3-2] = row[cellsize*3-1]
= 255 * (cellsize & 1);
for (k = 1; k < cellsize - 1; k++)
{
row[k*3] = editor->gimage->cmap[col * 3];
row[k*3+1] = editor->gimage->cmap[col * 3 + 1];
row[k*3+2] = editor->gimage->cmap[col * 3 + 2];
}
for (k = 1; k < cellsize - 1; k+=2)
gtk_preview_draw_row (GTK_PREVIEW (editor->palette), row,
x, y+k, cellsize);
row[0] = row[1] = row[2] = 0;
row[cellsize*3-3] = row[cellsize*3-2] = row[cellsize*3-1]
= 255 * ((cellsize+1) & 1);
for (k = 2; k < cellsize - 1; k += 2)
gtk_preview_draw_row (GTK_PREVIEW (editor->palette), row,
x, y+k, cellsize);
}
else
{
for (k = 0; k < cellsize; k++)
{
row[k*3] = editor->gimage->cmap[col * 3];
row[k*3+1] = editor->gimage->cmap[col * 3 + 1];
row[k*3+2] = editor->gimage->cmap[col * 3 + 2];
}
for (k = 0; k < cellsize; k++)
gtk_preview_draw_row (GTK_PREVIEW (editor->palette), row,
x, y+k, cellsize);
}
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
gtk_widget_queue_draw_area (editor->palette,
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
x, y,
cellsize, cellsize);
}
static void
gimp_colormap_editor_clear (GimpColormapEditor *editor,
gint start_row)
{
gint i, j;
gint offset;
gint width, height;
guchar *row = NULL;
GtkWidget *palette;
palette = editor->palette;
/* Watch out for negative values (at least on Win32) */
width = (int) (gint16) palette->allocation.width;
height = (int) (gint16) palette->allocation.height;
if (start_row < 0)
start_row = 0;
if (start_row >= height)
return;
if (width > 0)
row = g_new (guchar, width * 3);
if (start_row & 0x3)
{
offset = (start_row & 0x4) ? 0x4 : 0x0;
for (j = 0; j < width; j++)
{
row[j * 3 + 0] = row[j * 3 + 1] = row[j * 3 + 2] =
((j + offset) & 0x4) ?
render_blend_dark_check[0] : render_blend_light_check[0];
}
for (j = 0; j < (4 - (start_row & 0x3)) && start_row + j < height; j++)
gtk_preview_draw_row (GTK_PREVIEW (editor->palette), row,
0, start_row + j, width);
start_row += (4 - (start_row & 0x3));
}
for (i = start_row; i < height; i += 4)
{
offset = (i & 0x4) ? 0x4 : 0x0;
for (j = 0; j < width; j++)
{
row[j * 3 + 0] = row[j * 3 + 1] = row[j * 3 + 2] =
((j + offset) & 0x4) ?
render_blend_dark_check[0] : render_blend_light_check[0];
}
for (j = 0; j < 4 && i + j < height; j++)
gtk_preview_draw_row (GTK_PREVIEW (editor->palette), row,
0, i + j, width);
}
if (width > 0)
g_free (row);
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
gtk_widget_queue_draw (palette);
}
static void
gimp_colormap_editor_update_entries (GimpColormapEditor *editor)
{
if (! editor->gimage ||
(gimp_image_base_type (editor->gimage) != GIMP_INDEXED))
{
gtk_widget_set_sensitive (editor->index_spinbutton, FALSE);
gtk_widget_set_sensitive (editor->color_entry, FALSE);
gtk_adjustment_set_value (editor->index_adjustment, 0);
gtk_entry_set_text (GTK_ENTRY (editor->color_entry), "");
}
else
{
gchar *string;
guchar *col;
gtk_adjustment_set_value (editor->index_adjustment, editor->col_index);
col = &editor->gimage->cmap[editor->col_index * 3];
string = g_strdup_printf ("#%02x%02x%02x", col[0], col[1], col[2]);
gtk_entry_set_text (GTK_ENTRY (editor->color_entry), string);
g_free (string);
gtk_widget_set_sensitive (editor->index_spinbutton, TRUE);
gtk_widget_set_sensitive (editor->color_entry, TRUE);
}
}
static void
gimp_colormap_editor_set_index (GimpColormapEditor *editor,
gint i)
{
if (i != editor->col_index)
{
gint old = editor->col_index;
editor->col_index = i;
editor->dnd_col_index = i;
gimp_colormap_editor_draw_cell (editor, old);
gimp_colormap_editor_draw_cell (editor, i);
gimp_colormap_editor_update_entries (editor);
}
}
static void
gimp_colormap_preview_size_allocate (GtkWidget *widget,
GtkAllocation *alloc,
GimpColormapEditor *editor)
{
if (editor->gimage && (gimp_image_base_type (editor->gimage) == GIMP_INDEXED))
gimp_colormap_editor_draw (editor);
else
gimp_colormap_editor_clear (editor, -1);
}
static gboolean
gimp_colormap_preview_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GimpColormapEditor *editor)
{
GimpImage *gimage;
guchar r, g, b;
guint col;
gimage = editor->gimage;
if (! (gimage && (gimp_image_base_type (gimage) == GIMP_INDEXED)))
return TRUE;
if (!(bevent->y < editor->cellsize * editor->yn
&& bevent->x < editor->cellsize * editor->xn))
return TRUE;
col = (editor->xn * ((gint) bevent->y / editor->cellsize) +
((gint) bevent->x / editor->cellsize));
if (col >= editor->gimage->num_cols)
return TRUE;
r = gimage->cmap[col * 3 + 0];
g = gimage->cmap[col * 3 + 1];
b = gimage->cmap[col * 3 + 2];
switch (bevent->button)
{
case 1:
gimp_colormap_editor_set_index (editor, col);
gimp_colormap_editor_selected (editor);
break;
case 2:
editor->dnd_col_index = col;
break;
case 3:
{
GimpItemFactory *factory;
factory = gimp_item_factory_from_path ("<ColormapEditor>");
gimp_colormap_editor_set_index (editor, col);
gimp_item_factory_popup_with_data (factory, editor, NULL);
}
break;
default:
break;
}
return TRUE;
}
static void
gimp_colormap_preview_drag_color (GtkWidget *widget,
GimpRGB *color,
gpointer data)
{
GimpColormapEditor *editor;
GimpImage *gimage;
editor = (GimpColormapEditor *) data;
gimage = editor->gimage;
if (gimage && (gimp_image_base_type (gimage) == GIMP_INDEXED))
{
guint col;
col = editor->dnd_col_index;
gimp_rgba_set_uchar (color,
gimage->cmap[col * 3 + 0],
gimage->cmap[col * 3 + 1],
gimage->cmap[col * 3 + 2],
OPAQUE_OPACITY);
}
}
static void
gimp_colormap_preview_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data)
{
GimpColormapEditor *editor;
GimpImage *gimage;
editor = (GimpColormapEditor *) data;
gimage = editor->gimage;
if (gimage && (gimp_image_base_type (gimage) == GIMP_INDEXED) &&
gimage->num_cols < 256)
{
gimp_rgb_get_uchar (color,
&gimage->cmap[editor->gimage->num_cols * 3],
&gimage->cmap[editor->gimage->num_cols * 3 + 1],
&gimage->cmap[editor->gimage->num_cols * 3 + 2]);
gimage->num_cols++;
gimp_image_colormap_changed (gimage, -1);
}
}
static void
gimp_colormap_adjustment_changed (GtkAdjustment *adjustment,
GimpColormapEditor *editor)
{
if (! editor->gimage)
return;
gimp_colormap_editor_set_index (editor, (gint) (adjustment->value + 0.5));
gimp_colormap_editor_update_entries (editor);
}
static void
gimp_colormap_hex_entry_activate (GtkEntry *entry,
GimpColormapEditor *editor)
{
const gchar *s;
gulong i;
s = gtk_entry_get_text (entry);
if (sscanf (s, "#%lx", &i))
{
guchar *c = &editor->gimage->cmap[3 * editor->col_index];
c[0] = (i & 0xFF0000) >> 16;
c[1] = (i & 0x00FF00) >> 8;
c[2] = (i & 0x0000FF);
gimp_image_colormap_changed (editor->gimage, editor->col_index);
}
gimp_colormap_editor_update_entries (editor);
}
static void
gimp_colormap_hex_entry_focus_out (GtkEntry *entry,
GdkEvent *event,
GimpColormapEditor *editor)
{
gimp_colormap_hex_entry_activate (entry, editor);
}
static void
gimp_colormap_image_mode_changed (GimpImage *gimage,
GimpColormapEditor *editor)
{
gimp_colormap_image_colormap_changed (gimage, -1, editor);
}
static void
gimp_colormap_image_colormap_changed (GimpImage *gimage,
gint ncol,
GimpColormapEditor *editor)
{
if (gimp_image_base_type (gimage) == GIMP_INDEXED)
{
if (ncol < 0)
{
gimp_colormap_editor_draw (editor);
}
else
{
gimp_colormap_editor_draw_cell (editor, ncol);
}
if ((editor->index_adjustment->upper + 1) < gimage->num_cols)
{
editor->index_adjustment->upper = gimage->num_cols - 1;
gtk_adjustment_changed (editor->index_adjustment);
}
}
else
{
gimp_colormap_editor_clear (editor, -1);
}
if (ncol == editor->col_index || ncol == -1)
gimp_colormap_editor_update_entries (editor);
}