gimp/app/widgets/gimpcolormapeditor.c

1002 lines
29 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"
add appconfig.lib. Statically link libgimptool/gimptool.lib. 2001-05-11 Hans Breuer <hans@breuer.org> * app/makefile.msc : add appconfig.lib. Statically link libgimptool/gimptool.lib. * app/main.c : use gimp_locale_directory() * app/config/gimpconfig-utils.c : <string.h> * app/config/makefile.msc : add gimpscanner * app/core/gimpimagefile.c : some G_OS_WIN32 mess to get mkdir() and chmod() * app/display/gimpdisplayshell.c app/plug-in/plug-in-progrss.c app/tool/gimpcolorpickertool.c app/tool/gimpcroptool.c app/tool/gimpmeasuretool.c app/tool/gimpperspectivetool.c app/tool/gimprotatetool.c app/tool/gimpscaletool.c app/tool/gimpsheartool.c app/tool/gimptransformtool.c app/widgets/gimpcolormapeditor.c app/widgets/gimpcolorpanel.c app/widgets/gimptoolbox-color-area.c add #ifdef __GNUC__ to avoid breaking on non standard pragma #warning * app/tools/makefile.msc : add gimptoolcontrol remove tools-enum * app/tools/tool_manager.c : need to include libgimptool/gimptoolcontrol.h after core includes otherwise we would compile without prototypes or break miserably * app/gui/plug-in-menus.c : replace LOCALEDIR with gimp_locale_directory () * app/gui/preferences-dialog.c (prefs_notebook_append_page) : only try to gdk_pixbuf_new_from_file() with a valid filename. It should simply return NULL otherwise, but fails if the filename is an empty string. * app/paint-funcs/makefile.msc : add -FImsvc_recommended_pragmas.h * app/widgets/gimpcolormapeditor.c : the 'row' allocated needs to be 'xn * cellsize * 2' (to avoid accessing unowned memory) not only width, which has become allocation.width by someone commenting out the correct size calculation * app/widgets/gimpdialogfactory.c : varargs to macros are GCCism or at least non standard. #define DEBUG to g_print or nothing - without arguments - does fix it somewhat dirty as the compiler needs to tolerate the '(blah, foo, bar);' statement than * app/widgets/makefile.msc : updated * app/xcf/makefile.msc : add -FImsvc_recommended_pragmas.h * etc/gimprc.win32 : use ';' to separate theme-path * libgimpbase/gimpenv.c : #include <stdio.h> for sprintf() * app/widgets/gimpdnd.c (gimp_dnd_set_file_data) : the passed in vals chunk is not always null-terminated (at least not on win32). Use the length parameter too to avoid reading junk filenames. * libgimp/gimp.def : export gimp_image_get_name() * libgimpbase/gimpbase.def : export gimp_locale_directory() * libgimpbase/gimpenv.[ch] : added gimp_locale_directory () * libgimpbase/makefile.msc : define DATADIR and SYSCONFDIR to empty string to let gimp find its files in the common place (win32: relative to the top level gimp dir) * plug-ins/common/pixelize.c : <string.h> * plug-ins/flame/cmap.c : #include <glib.h> for g_random_int() * plug-ins/makefile.msc : -FImsvc_recommended_pragams.h and a little hack to give imagemap the prototypes it desires without changing the lexed source * themes/Default/images/makefile.msc : now added (see below) * themes/Default/images/stock-button-reset.png : made it binary
2002-05-11 07:30:09 +08:00
#ifdef __GNUC__
app/Makefile.am removed. 2002-05-07 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/nav_window.[ch]: removed. * app/display/Makefile.am * app/display/display-types.h * app/display/gimpnavigationview.[ch]: new widget partially based on the removed nav_window. * libgimpproxy/gimpproxytypes.h: regnenerated. * app/display/gimpdisplay-foreach.[ch]: removed gdisplays_nav_preview_resized(). The new config system will allow us to get notified of changes. * app/display/gimpdisplayshell.[ch]: added "scaled" and "scrolled" signals. * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-scroll.c: emit "scaled" and "scrolled" appropriately. Removed nav_window stuff. * app/display/gimpdisplay.c * app/display/gimpdisplayshell-callbacks.c: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c * app/gui/menus.c: made the navigation dialog dockable. * app/gui/view-commands.c: changed the nav_dialog callback accordingly. * app/gui/preferences-dialog.c * app/gimprc.[ch] * app/config/gimpguiconfig.[ch]: removed "nav_window_per_display" as it's now a dockable and it's state is saved in sessionrc. * app/widgets/gimpnavigationpreview.[ch]: added context sensitive mouse cursors. * app/widgets/gimpimagedock.c: made it capable of holding display-related dialogs (like GimpNavigationView) by connecting to the context's "display_changed" signal. * app/widgets/widgets-types.h: removed inclusion of "display/display-types.h". * app/widgets/gimpbufferview.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpdocumentview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpitemlistitem.c * app/widgets/gimpitemlistview.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/gimpvectorslistview.c: warn about inclusion of "display/display-types.h".
2002-05-08 00:23:14 +08:00
#warning FIXME #include "display/display-types.h"
add appconfig.lib. Statically link libgimptool/gimptool.lib. 2001-05-11 Hans Breuer <hans@breuer.org> * app/makefile.msc : add appconfig.lib. Statically link libgimptool/gimptool.lib. * app/main.c : use gimp_locale_directory() * app/config/gimpconfig-utils.c : <string.h> * app/config/makefile.msc : add gimpscanner * app/core/gimpimagefile.c : some G_OS_WIN32 mess to get mkdir() and chmod() * app/display/gimpdisplayshell.c app/plug-in/plug-in-progrss.c app/tool/gimpcolorpickertool.c app/tool/gimpcroptool.c app/tool/gimpmeasuretool.c app/tool/gimpperspectivetool.c app/tool/gimprotatetool.c app/tool/gimpscaletool.c app/tool/gimpsheartool.c app/tool/gimptransformtool.c app/widgets/gimpcolormapeditor.c app/widgets/gimpcolorpanel.c app/widgets/gimptoolbox-color-area.c add #ifdef __GNUC__ to avoid breaking on non standard pragma #warning * app/tools/makefile.msc : add gimptoolcontrol remove tools-enum * app/tools/tool_manager.c : need to include libgimptool/gimptoolcontrol.h after core includes otherwise we would compile without prototypes or break miserably * app/gui/plug-in-menus.c : replace LOCALEDIR with gimp_locale_directory () * app/gui/preferences-dialog.c (prefs_notebook_append_page) : only try to gdk_pixbuf_new_from_file() with a valid filename. It should simply return NULL otherwise, but fails if the filename is an empty string. * app/paint-funcs/makefile.msc : add -FImsvc_recommended_pragmas.h * app/widgets/gimpcolormapeditor.c : the 'row' allocated needs to be 'xn * cellsize * 2' (to avoid accessing unowned memory) not only width, which has become allocation.width by someone commenting out the correct size calculation * app/widgets/gimpdialogfactory.c : varargs to macros are GCCism or at least non standard. #define DEBUG to g_print or nothing - without arguments - does fix it somewhat dirty as the compiler needs to tolerate the '(blah, foo, bar);' statement than * app/widgets/makefile.msc : updated * app/xcf/makefile.msc : add -FImsvc_recommended_pragmas.h * etc/gimprc.win32 : use ';' to separate theme-path * libgimpbase/gimpenv.c : #include <stdio.h> for sprintf() * app/widgets/gimpdnd.c (gimp_dnd_set_file_data) : the passed in vals chunk is not always null-terminated (at least not on win32). Use the length parameter too to avoid reading junk filenames. * libgimp/gimp.def : export gimp_image_get_name() * libgimpbase/gimpbase.def : export gimp_locale_directory() * libgimpbase/gimpenv.[ch] : added gimp_locale_directory () * libgimpbase/makefile.msc : define DATADIR and SYSCONFDIR to empty string to let gimp find its files in the common place (win32: relative to the top level gimp dir) * plug-ins/common/pixelize.c : <string.h> * plug-ins/flame/cmap.c : #include <glib.h> for g_random_int() * plug-ins/makefile.msc : -FImsvc_recommended_pragams.h and a little hack to give imagemap the prototypes it desires without changing the lexed source * themes/Default/images/makefile.msc : now added (see below) * themes/Default/images/stock-button-reset.png : made it binary
2002-05-11 07:30:09 +08:00
#endif
app/Makefile.am removed. 2002-05-07 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/nav_window.[ch]: removed. * app/display/Makefile.am * app/display/display-types.h * app/display/gimpnavigationview.[ch]: new widget partially based on the removed nav_window. * libgimpproxy/gimpproxytypes.h: regnenerated. * app/display/gimpdisplay-foreach.[ch]: removed gdisplays_nav_preview_resized(). The new config system will allow us to get notified of changes. * app/display/gimpdisplayshell.[ch]: added "scaled" and "scrolled" signals. * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-scroll.c: emit "scaled" and "scrolled" appropriately. Removed nav_window stuff. * app/display/gimpdisplay.c * app/display/gimpdisplayshell-callbacks.c: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c * app/gui/menus.c: made the navigation dialog dockable. * app/gui/view-commands.c: changed the nav_dialog callback accordingly. * app/gui/preferences-dialog.c * app/gimprc.[ch] * app/config/gimpguiconfig.[ch]: removed "nav_window_per_display" as it's now a dockable and it's state is saved in sessionrc. * app/widgets/gimpnavigationpreview.[ch]: added context sensitive mouse cursors. * app/widgets/gimpimagedock.c: made it capable of holding display-related dialogs (like GimpNavigationView) by connecting to the context's "display_changed" signal. * app/widgets/widgets-types.h: removed inclusion of "display/display-types.h". * app/widgets/gimpbufferview.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpdocumentview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpitemlistitem.c * app/widgets/gimpitemlistview.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/gimpvectorslistview.c: warn about inclusion of "display/display-types.h".
2002-05-08 00:23:14 +08:00
#include "display/display-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-colormap.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 "gimpdialogfactory.h"
#include "gimphelp-ids.h"
Move away from creating all item_factories statically in menus_init() but 2003-01-10 Michael Natterer <mitch@gimp.org> Move away from creating all item_factories statically in menus_init() but create a new one for each place where one is needed: * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpmenufactory.[ch]: new factory which creates and configures the GimpItemFactories it knows about on-the-fly. * app/widgets/gimpitemfactory.[ch]: added gimp_item_factory_update() which calls the "update_func". Added "gboolean update_on_popup" so item_factories can be configured to require manual updates (used for the <Image> factory). * app/gui/menus.[ch]: create a "global_menu_factory" and register all menus we have with it. Added various setup functions which do stuff like adding the "Open Recent" menu or reorder plug-in menu entries. Removed the debugging stuff... * app/gui/Makefile.am * app/gui/debug-commands.[ch]: ...and added it here. * app/gui/gui.c: create the <Toolbox>, the popup-<Image> and the <Paths> factories here because they are still global. * app/gui/plug-in-menus.[ch]: changed the "image_factory" parameters to "item_factory" and create/update the entries for the passed item_factory only. Makes the whole stuff much more straightforward. * app/plug-in/plug-ins.c: don't call plug_in_make_menu(). * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added "menu_factory" and "popup_factory" parameters to gimp_display_new() and gimp_display_shell_new(). Create the menubar_factory and the qmask_factory dynamically. Pass the shell, not a Gimp to the QMask callbacks. Changed gimp_display_shell_set_menu_sensitivity() to gimp_display_shell_menu_update() and don't call it directly (it's a GimpItemFactory update_func now). Call gimp_item_factory_update() on the resp. factories instead. * app/gui/qmask-commands.c * app/display/gimpdisplayshell-callbacks.c * app/tools/gimpimagemaptool.c: changed accordingly. * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdock.c * app/widgets/gimpdockbook.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemlistview.[ch] * app/widgets/gimppaletteeditor.[ch]: pass around lots of GimpMenuFactory pointers and menu_identifiers so all views can create their item_factories themselves. Unref the factories when they are no longer needed because they belong to the views now. * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/dialogs.c * app/gui/brush-select.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/pattern-select.c: changed accordingly. * app/gui/file-dialog-utils.[ch] (file_dialog_new): require menu_factory and menu_identifier parameters. * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.[ch]: removed file_*_dialog_menu_init() (they went to menus.c as setup_funcs). Added file_*_dialog_set_type() and moved the <Load> and <Save> factory callbacks to file-commands.c * app/gui/file-commands.[ch]: changed accordingly. * app/gui/view-commands.c: changed the statusbar, menubar, rulers and guides callbacks to do their job only if the setting has actually changed. Don't update whole item factories afterwards. Instead, just change the state of the items that actually need update. Unrelated: * app/core/gimpchannel.c (gimp_channel_init): set "bounds_known" and friends to FALSE since we don't know that the new channel will be empty (fixes QMask and probably other stuff). * app/gui/image-commands.c * app/gui/vectors-commands.c: cleanup.
2003-01-11 01:55:53 +08:00
#include "gimpmenufactory.h"
#include "gimpuimanager.h"
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
#include "gimpwidgets-utils.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 "gimp-intl.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
};
#define HAVE_COLORMAP(gimage) \
(gimage != NULL && \
gimp_image_base_type (gimage) == GIMP_INDEXED && \
gimp_image_get_colormap (gimage) != NULL)
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_set_image (GimpImageEditor *editor,
GimpImage *gimage);
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 gboolean gimp_colormap_hex_entry_focus_out (GtkEntry *entry,
GdkEvent *event,
GimpColormapEditor *editor);
static void gimp_colormap_edit_clicked (GtkWidget *widget,
GimpColormapEditor *editor);
static void gimp_colormap_add_clicked (GtkWidget *widget,
GimpColormapEditor *editor);
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
static void gimp_colormap_add_ext_clicked (GtkWidget *widget,
GdkModifierType state,
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 GimpImageEditorClass *parent_class = NULL;
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_IMAGE_EDITOR,
"GimpColormapEditor",
&gcd_info, 0);
}
return gcd_type;
}
static void
gimp_colormap_editor_class_init (GimpColormapEditorClass* klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GimpImageEditorClass *image_editor_class;
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
image_editor_class = GIMP_IMAGE_EDITOR_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,
gimp_marshal_VOID__FLAGS,
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
G_TYPE_NONE, 1,
GDK_TYPE_MODIFIER_TYPE);
object_class->destroy = gimp_colormap_editor_destroy;
widget_class->unmap = gimp_colormap_editor_unmap;
image_editor_class->set_image = gimp_colormap_editor_set_image;
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
klass->selected = NULL;
}
static void
gimp_colormap_editor_init (GimpColormapEditor *editor)
{
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
gchar *str;
editor->col_index = 0;
editor->dnd_col_index = 0;
editor->palette = NULL;
editor->xn = 0;
editor->yn = 0;
editor->cellsize = 0;
editor->index_adjustment = NULL;
editor->index_spinbutton = NULL;
editor->color_entry = NULL;
editor->color_notebook = NULL;
editor->edit_button =
gimp_editor_add_button (GIMP_EDITOR (editor),
GIMP_STOCK_EDIT, _("Edit Color"),
GIMP_HELP_INDEXED_PALETTE_EDIT,
G_CALLBACK (gimp_colormap_edit_clicked),
NULL,
editor);
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
str = g_strdup_printf (_("Add Color from FG\n%s from BG"),
gimp_get_mod_name_control ());
editor->add_button =
gimp_editor_add_button (GIMP_EDITOR (editor),
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
GTK_STOCK_ADD, str,
GIMP_HELP_INDEXED_PALETTE_ADD,
G_CALLBACK (gimp_colormap_add_clicked),
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
G_CALLBACK (gimp_colormap_add_ext_clicked),
editor);
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
g_free (str);
}
static void
gimp_colormap_editor_destroy (GtkObject *object)
{
GimpColormapEditor *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 = GIMP_COLORMAP_EDITOR (widget);
if (editor->color_notebook)
Move away from creating all item_factories statically in menus_init() but 2003-01-10 Michael Natterer <mitch@gimp.org> Move away from creating all item_factories statically in menus_init() but create a new one for each place where one is needed: * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpmenufactory.[ch]: new factory which creates and configures the GimpItemFactories it knows about on-the-fly. * app/widgets/gimpitemfactory.[ch]: added gimp_item_factory_update() which calls the "update_func". Added "gboolean update_on_popup" so item_factories can be configured to require manual updates (used for the <Image> factory). * app/gui/menus.[ch]: create a "global_menu_factory" and register all menus we have with it. Added various setup functions which do stuff like adding the "Open Recent" menu or reorder plug-in menu entries. Removed the debugging stuff... * app/gui/Makefile.am * app/gui/debug-commands.[ch]: ...and added it here. * app/gui/gui.c: create the <Toolbox>, the popup-<Image> and the <Paths> factories here because they are still global. * app/gui/plug-in-menus.[ch]: changed the "image_factory" parameters to "item_factory" and create/update the entries for the passed item_factory only. Makes the whole stuff much more straightforward. * app/plug-in/plug-ins.c: don't call plug_in_make_menu(). * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added "menu_factory" and "popup_factory" parameters to gimp_display_new() and gimp_display_shell_new(). Create the menubar_factory and the qmask_factory dynamically. Pass the shell, not a Gimp to the QMask callbacks. Changed gimp_display_shell_set_menu_sensitivity() to gimp_display_shell_menu_update() and don't call it directly (it's a GimpItemFactory update_func now). Call gimp_item_factory_update() on the resp. factories instead. * app/gui/qmask-commands.c * app/display/gimpdisplayshell-callbacks.c * app/tools/gimpimagemaptool.c: changed accordingly. * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdock.c * app/widgets/gimpdockbook.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemlistview.[ch] * app/widgets/gimppaletteeditor.[ch]: pass around lots of GimpMenuFactory pointers and menu_identifiers so all views can create their item_factories themselves. Unref the factories when they are no longer needed because they belong to the views now. * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/dialogs.c * app/gui/brush-select.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/pattern-select.c: changed accordingly. * app/gui/file-dialog-utils.[ch] (file_dialog_new): require menu_factory and menu_identifier parameters. * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.[ch]: removed file_*_dialog_menu_init() (they went to menus.c as setup_funcs). Added file_*_dialog_set_type() and moved the <Load> and <Save> factory callbacks to file-commands.c * app/gui/file-commands.[ch]: changed accordingly. * app/gui/view-commands.c: changed the statusbar, menubar, rulers and guides callbacks to do their job only if the setting has actually changed. Don't update whole item factories afterwards. Instead, just change the state of the items that actually need update. Unrelated: * app/core/gimpchannel.c (gimp_channel_init): set "bounds_known" and friends to FALSE since we don't know that the new channel will be empty (fixes QMask and probably other stuff). * app/gui/image-commands.c * app/gui/vectors-commands.c: cleanup.
2003-01-11 01:55:53 +08:00
color_notebook_hide (editor->color_notebook);
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
}
static void
gimp_colormap_editor_set_image (GimpImageEditor *image_editor,
GimpImage *gimage)
{
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (image_editor);
if (image_editor->gimage)
{
g_signal_handlers_disconnect_by_func (image_editor->gimage,
gimp_colormap_image_mode_changed,
editor);
g_signal_handlers_disconnect_by_func (image_editor->gimage,
gimp_colormap_image_colormap_changed,
editor);
if (editor->color_notebook)
color_notebook_hide (editor->color_notebook);
if (! HAVE_COLORMAP (gimage))
{
editor->index_adjustment->upper = 0;
gtk_adjustment_changed (editor->index_adjustment);
if (GTK_WIDGET_MAPPED (GTK_WIDGET (editor)))
gimp_colormap_editor_clear (editor, -1);
}
}
GIMP_IMAGE_EDITOR_CLASS (parent_class)->set_image (image_editor, gimage);
editor->col_index = 0;
editor->dnd_col_index = 0;
if (gimage)
{
g_signal_connect (gimage, "mode_changed",
G_CALLBACK (gimp_colormap_image_mode_changed),
editor);
g_signal_connect (gimage, "colormap_changed",
G_CALLBACK (gimp_colormap_image_colormap_changed),
editor);
if (HAVE_COLORMAP (gimage))
{
gimp_colormap_editor_draw (editor);
editor->index_adjustment->upper =
gimp_image_get_colormap_size (gimage) - 1;
gtk_adjustment_changed (editor->index_adjustment);
}
}
gimp_colormap_editor_update_entries (editor);
}
/* public functions */
GtkWidget *
Move away from creating all item_factories statically in menus_init() but 2003-01-10 Michael Natterer <mitch@gimp.org> Move away from creating all item_factories statically in menus_init() but create a new one for each place where one is needed: * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpmenufactory.[ch]: new factory which creates and configures the GimpItemFactories it knows about on-the-fly. * app/widgets/gimpitemfactory.[ch]: added gimp_item_factory_update() which calls the "update_func". Added "gboolean update_on_popup" so item_factories can be configured to require manual updates (used for the <Image> factory). * app/gui/menus.[ch]: create a "global_menu_factory" and register all menus we have with it. Added various setup functions which do stuff like adding the "Open Recent" menu or reorder plug-in menu entries. Removed the debugging stuff... * app/gui/Makefile.am * app/gui/debug-commands.[ch]: ...and added it here. * app/gui/gui.c: create the <Toolbox>, the popup-<Image> and the <Paths> factories here because they are still global. * app/gui/plug-in-menus.[ch]: changed the "image_factory" parameters to "item_factory" and create/update the entries for the passed item_factory only. Makes the whole stuff much more straightforward. * app/plug-in/plug-ins.c: don't call plug_in_make_menu(). * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added "menu_factory" and "popup_factory" parameters to gimp_display_new() and gimp_display_shell_new(). Create the menubar_factory and the qmask_factory dynamically. Pass the shell, not a Gimp to the QMask callbacks. Changed gimp_display_shell_set_menu_sensitivity() to gimp_display_shell_menu_update() and don't call it directly (it's a GimpItemFactory update_func now). Call gimp_item_factory_update() on the resp. factories instead. * app/gui/qmask-commands.c * app/display/gimpdisplayshell-callbacks.c * app/tools/gimpimagemaptool.c: changed accordingly. * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdock.c * app/widgets/gimpdockbook.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemlistview.[ch] * app/widgets/gimppaletteeditor.[ch]: pass around lots of GimpMenuFactory pointers and menu_identifiers so all views can create their item_factories themselves. Unref the factories when they are no longer needed because they belong to the views now. * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/dialogs.c * app/gui/brush-select.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/pattern-select.c: changed accordingly. * app/gui/file-dialog-utils.[ch] (file_dialog_new): require menu_factory and menu_identifier parameters. * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.[ch]: removed file_*_dialog_menu_init() (they went to menus.c as setup_funcs). Added file_*_dialog_set_type() and moved the <Load> and <Save> factory callbacks to file-commands.c * app/gui/file-commands.[ch]: changed accordingly. * app/gui/view-commands.c: changed the statusbar, menubar, rulers and guides callbacks to do their job only if the setting has actually changed. Don't update whole item factories afterwards. Instead, just change the state of the items that actually need update. Unrelated: * app/core/gimpchannel.c (gimp_channel_init): set "bounds_known" and friends to FALSE since we don't know that the new channel will be empty (fixes QMask and probably other stuff). * app/gui/image-commands.c * app/gui/vectors-commands.c: cleanup.
2003-01-11 01:55:53 +08:00
gimp_colormap_editor_new (GimpImage *gimage,
GimpMenuFactory *menu_factory)
{
GimpColormapEditor *editor;
GtkWidget *frame;
GtkWidget *table;
g_return_val_if_fail (! gimage || GIMP_IS_IMAGE (gimage), NULL);
Move away from creating all item_factories statically in menus_init() but 2003-01-10 Michael Natterer <mitch@gimp.org> Move away from creating all item_factories statically in menus_init() but create a new one for each place where one is needed: * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpmenufactory.[ch]: new factory which creates and configures the GimpItemFactories it knows about on-the-fly. * app/widgets/gimpitemfactory.[ch]: added gimp_item_factory_update() which calls the "update_func". Added "gboolean update_on_popup" so item_factories can be configured to require manual updates (used for the <Image> factory). * app/gui/menus.[ch]: create a "global_menu_factory" and register all menus we have with it. Added various setup functions which do stuff like adding the "Open Recent" menu or reorder plug-in menu entries. Removed the debugging stuff... * app/gui/Makefile.am * app/gui/debug-commands.[ch]: ...and added it here. * app/gui/gui.c: create the <Toolbox>, the popup-<Image> and the <Paths> factories here because they are still global. * app/gui/plug-in-menus.[ch]: changed the "image_factory" parameters to "item_factory" and create/update the entries for the passed item_factory only. Makes the whole stuff much more straightforward. * app/plug-in/plug-ins.c: don't call plug_in_make_menu(). * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added "menu_factory" and "popup_factory" parameters to gimp_display_new() and gimp_display_shell_new(). Create the menubar_factory and the qmask_factory dynamically. Pass the shell, not a Gimp to the QMask callbacks. Changed gimp_display_shell_set_menu_sensitivity() to gimp_display_shell_menu_update() and don't call it directly (it's a GimpItemFactory update_func now). Call gimp_item_factory_update() on the resp. factories instead. * app/gui/qmask-commands.c * app/display/gimpdisplayshell-callbacks.c * app/tools/gimpimagemaptool.c: changed accordingly. * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdock.c * app/widgets/gimpdockbook.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemlistview.[ch] * app/widgets/gimppaletteeditor.[ch]: pass around lots of GimpMenuFactory pointers and menu_identifiers so all views can create their item_factories themselves. Unref the factories when they are no longer needed because they belong to the views now. * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/dialogs.c * app/gui/brush-select.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/pattern-select.c: changed accordingly. * app/gui/file-dialog-utils.[ch] (file_dialog_new): require menu_factory and menu_identifier parameters. * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.[ch]: removed file_*_dialog_menu_init() (they went to menus.c as setup_funcs). Added file_*_dialog_set_type() and moved the <Load> and <Save> factory callbacks to file-commands.c * app/gui/file-commands.[ch]: changed accordingly. * app/gui/view-commands.c: changed the statusbar, menubar, rulers and guides callbacks to do their job only if the setting has actually changed. Don't update whole item factories afterwards. Instead, just change the state of the items that actually need update. Unrelated: * app/core/gimpchannel.c (gimp_channel_init): set "bounds_known" and friends to FALSE since we don't know that the new channel will be empty (fixes QMask and probably other stuff). * app/gui/image-commands.c * app/gui/vectors-commands.c: cleanup.
2003-01-11 01:55:53 +08:00
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
editor = g_object_new (GIMP_TYPE_COLORMAP_EDITOR, NULL);
gimp_editor_create_menu (GIMP_EDITOR (editor),
app/widgets/Makefile.am app/widgets/widgets-types.h new GtkUIManager 2004-04-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpuimanager.[ch]: new GtkUIManager subclass. Adds API to update all action groups and knows which UIs it can create from which XML files. * app/widgets/gimpmenufactory.[ch]: register the XML file basenames along with path of their toplevel menus. Create GimpUIManagers instead of GtkUIManagers and register the XML files and menu paths with them. * app/gui/menus.c: register all XML files and their toplevel menu paths. * app/widgets/gimpeditor.[ch]: also create a GimpUIManager when creating the GtkItemFactory. Added "const gchar *ui_identifier" parameter to gimp_editor_create_menu(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpitemtreeview.[ch]: added "ui_identifier" parameters to all constructors. * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpdocumentview.c * app/widgets/gimperrorconsole.c * app/widgets/gimpfontview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpimageview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimppatternfactoryview.c * app/widgets/gimptemplateview.c * app/widgets/gimptooloptionseditor.c * app/gui/dialogs-constructors.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/pattern-select.c: pass UI identifiers to the changed functions above. * app/display/gimpdisplayshell.[ch]: added a GimpUIManager for the menubar (menubar creating code still commented out). * app/display/gimpdisplay.c * app/gui/gui-vtable.c: update the ui manager.
2004-04-22 00:33:17 +08:00
menu_factory, "<ColormapEditor>",
"/colormap-editor-popup", editor);
Move away from creating all item_factories statically in menus_init() but 2003-01-10 Michael Natterer <mitch@gimp.org> Move away from creating all item_factories statically in menus_init() but create a new one for each place where one is needed: * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpmenufactory.[ch]: new factory which creates and configures the GimpItemFactories it knows about on-the-fly. * app/widgets/gimpitemfactory.[ch]: added gimp_item_factory_update() which calls the "update_func". Added "gboolean update_on_popup" so item_factories can be configured to require manual updates (used for the <Image> factory). * app/gui/menus.[ch]: create a "global_menu_factory" and register all menus we have with it. Added various setup functions which do stuff like adding the "Open Recent" menu or reorder plug-in menu entries. Removed the debugging stuff... * app/gui/Makefile.am * app/gui/debug-commands.[ch]: ...and added it here. * app/gui/gui.c: create the <Toolbox>, the popup-<Image> and the <Paths> factories here because they are still global. * app/gui/plug-in-menus.[ch]: changed the "image_factory" parameters to "item_factory" and create/update the entries for the passed item_factory only. Makes the whole stuff much more straightforward. * app/plug-in/plug-ins.c: don't call plug_in_make_menu(). * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added "menu_factory" and "popup_factory" parameters to gimp_display_new() and gimp_display_shell_new(). Create the menubar_factory and the qmask_factory dynamically. Pass the shell, not a Gimp to the QMask callbacks. Changed gimp_display_shell_set_menu_sensitivity() to gimp_display_shell_menu_update() and don't call it directly (it's a GimpItemFactory update_func now). Call gimp_item_factory_update() on the resp. factories instead. * app/gui/qmask-commands.c * app/display/gimpdisplayshell-callbacks.c * app/tools/gimpimagemaptool.c: changed accordingly. * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdock.c * app/widgets/gimpdockbook.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemlistview.[ch] * app/widgets/gimppaletteeditor.[ch]: pass around lots of GimpMenuFactory pointers and menu_identifiers so all views can create their item_factories themselves. Unref the factories when they are no longer needed because they belong to the views now. * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/dialogs.c * app/gui/brush-select.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/pattern-select.c: changed accordingly. * app/gui/file-dialog-utils.[ch] (file_dialog_new): require menu_factory and menu_identifier parameters. * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.[ch]: removed file_*_dialog_menu_init() (they went to menus.c as setup_funcs). Added file_*_dialog_set_type() and moved the <Load> and <Save> factory callbacks to file-commands.c * app/gui/file-commands.[ch]: changed accordingly. * app/gui/view-commands.c: changed the statusbar, menubar, rulers and guides callbacks to do their job only if the setting has actually changed. Don't update whole item factories afterwards. Instead, just change the state of the items that actually need update. Unrelated: * app/core/gimpchannel.c (gimp_channel_init): set "bounds_known" and friends to FALSE since we don't know that the new channel will be empty (fixes QMask and probably other stuff). * app/gui/image-commands.c * app/gui/vectors-commands.c: cleanup.
2003-01-11 01:55:53 +08:00
/* 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 (editor->palette, "size_allocate",
G_CALLBACK (gimp_colormap_preview_size_allocate),
editor);
g_signal_connect (editor->palette, "button_press_event",
G_CALLBACK (gimp_colormap_preview_button_press),
editor);
gimp_dnd_color_source_add (editor->palette, gimp_colormap_preview_drag_color,
editor);
DND cleanup part 1: 2002-09-02 Michael Natterer <mitch@gimp.org> DND cleanup part 1: * app/widgets/gimpdnd.[ch]: changed all gimp_dnd_*_dest_set() and _unset() functions to _dest_add() and _dest_remove(). Switch from using static arrays of GtkTargetEntries to dynamic GtkTargetLists. The _add() and _remove() functions configure the drag dest automatically if not already done, so there is no need to call gtk_drag_dest_set() on the widget any more. Drag source cleanup will follow... Renamed silly function names gimp_gtk_* to gimp_dnd_* * app/display/gimpdisplayshell.c * app/tools/gimpblendtool.c * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimplistitem.c * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimpselectioneditor.c * app/widgets/gimptoolbox-color-area.c * app/widgets/gimptoolbox-indicator-area.c * app/widgets/gimptoolbox.c * app/gui/about-dialog.c * app/gui/color-select.c * app/gui/device-status-dialog.c * app/gui/tool-options-dialog.c: changed accordingly. Removed all calls to gtk_drag_dest_set() and their GtkTargetEntry tables. * app/widgets/gimpchannellistitem.c: enabled some commented out dnd code (which will not work since dnd needs more love...) * app/widgets/gimpitemlistview.[ch]: added a third "gboolean interactive" parameter to GimpItemNewFunc. * app/gui/channels-commands.[ch] * app/gui/layers-commands.[ch] * app/gui/vectors-commands.[ch]: if the new_item_func is called with "interactive == FALSE", don't pop up a dialog but silently create a new item of the image's size. * app/widgets/gimpdrawablelistview.c: use the new feature to allow color and pattern drops to the "New" button, which creates a new layer/channel filled with the color/pattern. (special feature for drc ;-) * app/widgets/gimppaletteeditor.c: fixed event handling so we see the context menu again. Also, don't redraw on "expose", since GtkPreview does that for us.
2002-09-02 22:39:08 +08:00
gimp_dnd_color_dest_add (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:"), 0.0, 0.5,
editor->index_spinbutton, 1, TRUE);
g_signal_connect (editor->index_adjustment, "value_changed",
G_CALLBACK (gimp_colormap_adjustment_changed),
editor);
editor->color_entry = gtk_entry_new ();
gtk_entry_set_width_chars (GTK_ENTRY (editor->color_entry), 8);
gtk_entry_set_max_length (GTK_ENTRY (editor->color_entry), 6);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("He_x Triplet:"), 0.0, 0.5,
editor->color_entry, 1, TRUE);
g_signal_connect (editor->color_entry, "activate",
G_CALLBACK (gimp_colormap_hex_entry_activate),
editor);
g_signal_connect (editor->color_entry, "focus_out_event",
G_CALLBACK (gimp_colormap_hex_entry_focus_out),
editor);
if (gimage)
gimp_image_editor_set_image (GIMP_IMAGE_EDITOR (editor), gimage);
return GTK_WIDGET (editor);
}
void
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
gimp_colormap_editor_selected (GimpColormapEditor *editor,
GdkModifierType state)
{
g_return_if_fail (GIMP_IS_COLORMAP_EDITOR (editor));
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
g_signal_emit (editor, editor_signals[SELECTED], 0, state);
}
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 = GIMP_IMAGE_EDITOR (editor)->gimage;
palette = editor->palette;
width = palette->allocation.width;
height = palette->allocation.height;
ncol = gimp_image_get_colormap_size (gimage);
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);
/* We used to render just multiples of "cellsize" here, but the
* colormap as dockable looks better if it always fills the
* available allocation->width (which should always be larger than
* "xn * cellsize"). Defensively, we use MAX(width,xn*cellsize)
* below --Mitch
*
width = xn * cellsize;
height = yn * cellsize; */
editor->xn = xn;
editor->yn = yn;
editor->cellsize = cellsize;
row = g_new (guchar, MAX (width, xn * cellsize) * 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)
{
GimpImage *gimage;
guchar *row;
gint cellsize, x, y, k;
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
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] = gimage->cmap[col * 3];
row[k*3+1] = gimage->cmap[col * 3 + 1];
row[k*3+2] = 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] = gimage->cmap[col * 3];
row[k*3+1] = gimage->cmap[col * 3 + 1];
row[k*3+2] = 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;
width = palette->allocation.width;
height = 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)
{
GimpImage *gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
if (! HAVE_COLORMAP (gimage))
{
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), "");
gtk_widget_set_sensitive (GIMP_EDITOR (editor)->button_box, FALSE);
}
else
{
gchar *string;
guchar *col;
gtk_adjustment_set_value (editor->index_adjustment, editor->col_index);
col = &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);
gtk_widget_set_sensitive (GIMP_EDITOR (editor)->button_box, TRUE);
gtk_widget_set_sensitive (editor->add_button,
gimp_image_get_colormap_size (gimage) < 256);
}
}
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)
{
GimpImage *gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
if (HAVE_COLORMAP (gimage))
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;
guint col;
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
if (! HAVE_COLORMAP (gimage))
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 >= gimp_image_get_colormap_size (gimage))
return TRUE;
switch (bevent->button)
{
case 1:
gimp_colormap_editor_set_index (editor, col);
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
gimp_colormap_editor_selected (editor, bevent->state);
if (bevent->type == GDK_2BUTTON_PRESS)
gimp_colormap_edit_clicked (editor->edit_button, editor);
return TRUE;
case 2:
editor->dnd_col_index = col;
break;
case 3:
Move away from creating all item_factories statically in menus_init() but 2003-01-10 Michael Natterer <mitch@gimp.org> Move away from creating all item_factories statically in menus_init() but create a new one for each place where one is needed: * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpmenufactory.[ch]: new factory which creates and configures the GimpItemFactories it knows about on-the-fly. * app/widgets/gimpitemfactory.[ch]: added gimp_item_factory_update() which calls the "update_func". Added "gboolean update_on_popup" so item_factories can be configured to require manual updates (used for the <Image> factory). * app/gui/menus.[ch]: create a "global_menu_factory" and register all menus we have with it. Added various setup functions which do stuff like adding the "Open Recent" menu or reorder plug-in menu entries. Removed the debugging stuff... * app/gui/Makefile.am * app/gui/debug-commands.[ch]: ...and added it here. * app/gui/gui.c: create the <Toolbox>, the popup-<Image> and the <Paths> factories here because they are still global. * app/gui/plug-in-menus.[ch]: changed the "image_factory" parameters to "item_factory" and create/update the entries for the passed item_factory only. Makes the whole stuff much more straightforward. * app/plug-in/plug-ins.c: don't call plug_in_make_menu(). * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added "menu_factory" and "popup_factory" parameters to gimp_display_new() and gimp_display_shell_new(). Create the menubar_factory and the qmask_factory dynamically. Pass the shell, not a Gimp to the QMask callbacks. Changed gimp_display_shell_set_menu_sensitivity() to gimp_display_shell_menu_update() and don't call it directly (it's a GimpItemFactory update_func now). Call gimp_item_factory_update() on the resp. factories instead. * app/gui/qmask-commands.c * app/display/gimpdisplayshell-callbacks.c * app/tools/gimpimagemaptool.c: changed accordingly. * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdock.c * app/widgets/gimpdockbook.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemlistview.[ch] * app/widgets/gimppaletteeditor.[ch]: pass around lots of GimpMenuFactory pointers and menu_identifiers so all views can create their item_factories themselves. Unref the factories when they are no longer needed because they belong to the views now. * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/dialogs.c * app/gui/brush-select.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/pattern-select.c: changed accordingly. * app/gui/file-dialog-utils.[ch] (file_dialog_new): require menu_factory and menu_identifier parameters. * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.[ch]: removed file_*_dialog_menu_init() (they went to menus.c as setup_funcs). Added file_*_dialog_set_type() and moved the <Load> and <Save> factory callbacks to file-commands.c * app/gui/file-commands.[ch]: changed accordingly. * app/gui/view-commands.c: changed the statusbar, menubar, rulers and guides callbacks to do their job only if the setting has actually changed. Don't update whole item factories afterwards. Instead, just change the state of the items that actually need update. Unrelated: * app/core/gimpchannel.c (gimp_channel_init): set "bounds_known" and friends to FALSE since we don't know that the new channel will be empty (fixes QMask and probably other stuff). * app/gui/image-commands.c * app/gui/vectors-commands.c: cleanup.
2003-01-11 01:55:53 +08:00
gimp_colormap_editor_set_index (editor, col);
Switch from GtkItemFactory to GtkUIManager. The migration is almost 2004-04-29 Michael Natterer <mitch@gimp.org> Switch from GtkItemFactory to GtkUIManager. The migration is almost complete, still stuff missing/incomplete, definitely added a bunch of new bugs... * app/actions/*-commands.[ch]: converted all callback from GtkItemFactory callbacks to GtkAction callbacks. * app/actions/debug-actions.c * app/actions/gradient-editor-actions.c * app/actions/help-actions.c * app/actions/plug-in-actions.c * app/actions/qmask-actions.c * app/actions/tool-options-actions.c: various fixes. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell-appearance.[ch] * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.[ch]: move everything from GtkItemFactory to GtkUIManager. * app/gui/dialogs.[ch]: added new function dialogs_get_toolbox(). Needed because the action callbacks don't have a widget parameter and sometimes we need a parent window for showing dialogs. * app/gui/Makefile.am * app/gui/brushes-menu.[ch] * app/gui/buffers-menu.[ch] * app/gui/channels-menu.[ch] * app/gui/colormap-editor-menu.[ch] * app/gui/dialogs-menu.[ch] * app/gui/documents-menu.[ch] * app/gui/error-console-menu.[ch] * app/gui/fonts-menu.[ch] * app/gui/gradient-editor-menu.[ch] * app/gui/gradients-menu.[ch] * app/gui/images-menu.[ch] * app/gui/layers-menu.[ch] * app/gui/palette-editor-menu.[ch] * app/gui/palettes-menu.[ch] * app/gui/patterns-menu.[ch] * app/gui/qmask-menu.[ch] * app/gui/templates-menu.[ch] * app/gui/vectors-menu.[ch]: removed these files. * app/gui/gui.c: create a global UI manager for the image popup menu and the toolbox menubar. * app/gui/menus.[ch]: removed all GtkItemFactory code. * app/gui/image-menu.[ch] * app/gui/toolbox-menu.[ch]: removed everything except the trivial setup_funcs. * app/gui/file-open-menu.c * app/gui/file-save-menu.c * app/gui/tool-options-menu.c: don't use the macros from menus.h any more, they are gone. * app/gui/gui-vtable.c * app/gui/plug-in-menus.[ch]: create/destroy the dynamic plug-in menu entries. * app/tools/gimpimagemaptool.c: s/gimp_item_factory_update/ gimp_ui_manager_update/g * app/widgets/gimpuimanager.[ch]: added API to get an action group by name. * app/widgets/gimpmenufactory.c: don't choke on the item_factory entries being NULL. * app/widgets/gimpactiongroup.c: make sure booleans set using g_object_set() only have TRUE or FALSE values. * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdockable.[ch] * app/widgets/gimpdocked.[ch] * app/widgets/gimpeditor.[ch] * app/widgets/gimperrorconsole.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c: removed all GtkItemFactory code and enable the #if 0'ed UI manager stuff. * menus/gradient-editor-menu.xml: fixed typos. * menus/image-menu.xml: duplicate everything so we have both an image menubar and an image popup menu. Badly cries for an XSL processor. * menus/toolbox-menu.xml: added an "Extensions" placeholder.
2004-04-29 20:52:29 +08:00
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_ui_popup (GIMP_EDITOR (editor)->ui_manager,
Switch from GtkItemFactory to GtkUIManager. The migration is almost 2004-04-29 Michael Natterer <mitch@gimp.org> Switch from GtkItemFactory to GtkUIManager. The migration is almost complete, still stuff missing/incomplete, definitely added a bunch of new bugs... * app/actions/*-commands.[ch]: converted all callback from GtkItemFactory callbacks to GtkAction callbacks. * app/actions/debug-actions.c * app/actions/gradient-editor-actions.c * app/actions/help-actions.c * app/actions/plug-in-actions.c * app/actions/qmask-actions.c * app/actions/tool-options-actions.c: various fixes. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell-appearance.[ch] * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.[ch]: move everything from GtkItemFactory to GtkUIManager. * app/gui/dialogs.[ch]: added new function dialogs_get_toolbox(). Needed because the action callbacks don't have a widget parameter and sometimes we need a parent window for showing dialogs. * app/gui/Makefile.am * app/gui/brushes-menu.[ch] * app/gui/buffers-menu.[ch] * app/gui/channels-menu.[ch] * app/gui/colormap-editor-menu.[ch] * app/gui/dialogs-menu.[ch] * app/gui/documents-menu.[ch] * app/gui/error-console-menu.[ch] * app/gui/fonts-menu.[ch] * app/gui/gradient-editor-menu.[ch] * app/gui/gradients-menu.[ch] * app/gui/images-menu.[ch] * app/gui/layers-menu.[ch] * app/gui/palette-editor-menu.[ch] * app/gui/palettes-menu.[ch] * app/gui/patterns-menu.[ch] * app/gui/qmask-menu.[ch] * app/gui/templates-menu.[ch] * app/gui/vectors-menu.[ch]: removed these files. * app/gui/gui.c: create a global UI manager for the image popup menu and the toolbox menubar. * app/gui/menus.[ch]: removed all GtkItemFactory code. * app/gui/image-menu.[ch] * app/gui/toolbox-menu.[ch]: removed everything except the trivial setup_funcs. * app/gui/file-open-menu.c * app/gui/file-save-menu.c * app/gui/tool-options-menu.c: don't use the macros from menus.h any more, they are gone. * app/gui/gui-vtable.c * app/gui/plug-in-menus.[ch]: create/destroy the dynamic plug-in menu entries. * app/tools/gimpimagemaptool.c: s/gimp_item_factory_update/ gimp_ui_manager_update/g * app/widgets/gimpuimanager.[ch]: added API to get an action group by name. * app/widgets/gimpmenufactory.c: don't choke on the item_factory entries being NULL. * app/widgets/gimpactiongroup.c: make sure booleans set using g_object_set() only have TRUE or FALSE values. * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdockable.[ch] * app/widgets/gimpdocked.[ch] * app/widgets/gimpeditor.[ch] * app/widgets/gimperrorconsole.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c: removed all GtkItemFactory code and enable the #if 0'ed UI manager stuff. * menus/gradient-editor-menu.xml: fixed typos. * menus/image-menu.xml: duplicate everything so we have both an image menubar and an image popup menu. Badly cries for an XSL processor. * menus/toolbox-menu.xml: added an "Extensions" placeholder.
2004-04-29 20:52:29 +08:00
GIMP_EDITOR (editor)->ui_path,
GIMP_EDITOR (editor)->ui_manager,
GTK_WIDGET (editor),
NULL, NULL, NULL);
return TRUE;
default:
break;
}
return FALSE;
}
static void
gimp_colormap_preview_drag_color (GtkWidget *widget,
GimpRGB *color,
gpointer data)
{
GimpColormapEditor *editor;
GimpImage *gimage;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
if (HAVE_COLORMAP (gimage))
gimp_image_get_colormap_entry (gimage, editor->dnd_col_index, color);
}
static void
gimp_colormap_preview_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data)
{
GimpColormapEditor *editor;
GimpImage *gimage;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
if (HAVE_COLORMAP (gimage) && gimp_image_get_colormap_size (gimage) < 256)
{
gimp_image_add_colormap_entry (gimage, color);
}
}
static void
gimp_colormap_adjustment_changed (GtkAdjustment *adjustment,
GimpColormapEditor *editor)
{
GimpImage *gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
if (HAVE_COLORMAP (gimage))
{
gimp_colormap_editor_set_index (editor, adjustment->value + 0.5);
gimp_colormap_editor_update_entries (editor);
}
}
static void
gimp_colormap_hex_entry_activate (GtkEntry *entry,
GimpColormapEditor *editor)
{
GimpImage *gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
if (gimage)
{
const gchar *s;
gulong i;
s = gtk_entry_get_text (entry);
if (sscanf (s, "%lx", &i))
{
GimpRGB color;
guchar r, g, b;
r = (i & 0xFF0000) >> 16;
g = (i & 0x00FF00) >> 8;
b = (i & 0x0000FF);
gimp_rgb_set_uchar (&color, r, g, b);
gimp_image_set_colormap_entry (gimage, editor->col_index, &color,
TRUE);
gimp_image_flush (gimage);
}
}
}
static gboolean
gimp_colormap_hex_entry_focus_out (GtkEntry *entry,
GdkEvent *event,
GimpColormapEditor *editor)
{
gimp_colormap_hex_entry_activate (entry, editor);
return FALSE;
}
static void
gimp_colormap_color_notebook_callback (ColorNotebook *color_notebook,
const GimpRGB *color,
ColorNotebookState state,
gpointer data)
{
GimpColormapEditor *editor;
GimpImage *gimage;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
switch (state)
{
case COLOR_NOTEBOOK_UPDATE:
break;
case COLOR_NOTEBOOK_OK:
gimp_image_set_colormap_entry (gimage, editor->col_index, color, TRUE);
gimp_image_flush (gimage);
/* Fall through */
case COLOR_NOTEBOOK_CANCEL:
color_notebook_hide (editor->color_notebook);
break;
}
}
static void
gimp_colormap_edit_clicked (GtkWidget *widget,
GimpColormapEditor *editor)
{
GimpImage *gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
if (gimage)
{
GimpRGB color;
gimp_rgba_set_uchar (&color,
gimage->cmap[editor->col_index * 3],
gimage->cmap[editor->col_index * 3 + 1],
gimage->cmap[editor->col_index * 3 + 2],
OPAQUE_OPACITY);
if (! editor->color_notebook)
{
GimpDialogFactory *toplevel_factory;
toplevel_factory = gimp_dialog_factory_from_name ("toplevel");
editor->color_notebook =
color_notebook_new (GIMP_VIEWABLE (gimage),
_("Edit Indexed Color"),
GIMP_STOCK_CONVERT_INDEXED,
_("Edit Indexed Image Palette Color"),
GTK_WIDGET (editor),
toplevel_factory,
"gimp-colormap-editor-color-dialog",
(const GimpRGB *) &color,
gimp_colormap_color_notebook_callback,
editor,
FALSE, FALSE);
}
else
{
color_notebook_set_viewable (editor->color_notebook,
GIMP_VIEWABLE (gimage));
color_notebook_show (editor->color_notebook);
color_notebook_set_color (editor->color_notebook, &color);
}
}
}
static void
gimp_colormap_add_clicked (GtkWidget *widget,
GimpColormapEditor *editor)
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
{
gimp_colormap_add_ext_clicked (widget, 0, editor);
}
static void
gimp_colormap_add_ext_clicked (GtkWidget *widget,
GdkModifierType state,
GimpColormapEditor *editor)
{
GimpImage *gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
if (gimage && gimage->num_cols < 256)
{
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
GimpContext *context;
GimpRGB color;
Cleaned up all places which pick colors to work consistently: the concept 2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
2003-09-26 21:33:54 +08:00
context = gimp_get_user_context (gimage->gimp);
if (state & GDK_CONTROL_MASK)
gimp_context_get_background (context, &color);
else
gimp_context_get_foreground (context, &color);
gimp_image_add_colormap_entry (gimage, &color);
}
}
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 (HAVE_COLORMAP (gimage))
{
if (ncol < 0)
{
gimp_colormap_editor_draw (editor);
}
else
{
gimp_colormap_editor_draw_cell (editor, ncol);
}
if (editor->index_adjustment->upper !=
(gimp_image_get_colormap_size (gimage) - 1))
{
editor->index_adjustment->upper =
gimp_image_get_colormap_size (gimage) - 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);
}