gimp/app/widgets/gimpcolormapeditor.c

852 lines
26 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"
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"
#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 GObject * gimp_colormap_editor_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
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,
gint x,
gint y,
const GimpRGB *color,
gpointer data);
static void gimp_colormap_adjustment_changed (GtkAdjustment *adjustment,
GimpColormapEditor *editor);
static void gimp_colormap_hex_entry_changed (GimpColorHexEntry *entry,
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 type = 0;
if (! type)
{
static const GTypeInfo 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,
};
type = g_type_register_static (GIMP_TYPE_IMAGE_EDITOR,
"GimpColormapEditor",
&info, 0);
}
return type;
}
static void
gimp_colormap_editor_class_init (GimpColormapEditorClass* klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpImageEditorClass *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),
NULL, NULL,
gimp_marshal_VOID__FLAGS,
G_TYPE_NONE, 1,
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
GDK_TYPE_MODIFIER_TYPE);
object_class->constructor = gimp_colormap_editor_constructor;
gtk_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)
{
GtkWidget *frame;
GtkWidget *table;
editor->col_index = 0;
editor->dnd_col_index = 0;
editor->xn = 0;
editor->yn = 0;
editor->cellsize = 0;
/* 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);
gimp_dnd_color_dest_add (editor->palette, gimp_colormap_preview_drop_color,
editor);
/* Some helpful hints */
table = gtk_table_new (2, 2, FALSE);
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 = gimp_color_hex_entry_new ();
gtk_entry_set_width_chars (GTK_ENTRY (editor->color_entry), 12);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("HTML notation:"), 0.0, 0.5,
editor->color_entry, 1, TRUE);
g_signal_connect (editor->color_entry, "color-changed",
G_CALLBACK (gimp_colormap_hex_entry_changed),
editor);
}
static GObject *
gimp_colormap_editor_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObject *object;
GimpColormapEditor *editor;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
editor = GIMP_COLORMAP_EDITOR (object);
editor->edit_button =
gimp_editor_add_action_button (GIMP_EDITOR (editor), "colormap-editor",
"colormap-editor-edit-color",
NULL);
editor->add_button =
gimp_editor_add_action_button (GIMP_EDITOR (editor), "colormap-editor",
"colormap-editor-add-color-from-fg",
"colormap-editor-add-color-from-bg",
GDK_CONTROL_MASK,
NULL);
return object;
}
static void
gimp_colormap_editor_destroy (GtkObject *object)
{
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (object);
configure.in added new directory app/dialogs and link libappdialogs.c into 2004-09-13 Michael Natterer <mitch@gimp.org> * configure.in * app/Makefile.am: added new directory app/dialogs and link libappdialogs.c into the gimp binary. * app/gui/Makefile.am * app/gui/gui-types.h * app/gui/gui-vtable.c * app/gui/gui.c * app/gui/about-dialog.[ch] * app/gui/authors.h * app/gui/color-notebook.[ch] * app/gui/convert-dialog.[ch] * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.[ch] * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.[ch] * app/gui/file-open-dialog.[ch] * app/gui/file-open-location-dialog.[ch] * app/gui/file-save-dialog.[ch] * app/gui/grid-dialog.[ch] * app/gui/info-dialog.[ch] * app/gui/info-window.[ch] * app/gui/module-browser.[ch] * app/gui/offset-dialog.[ch] * app/gui/palette-import-dialog.[ch] * app/gui/preferences-dialog.[ch] * app/gui/quit-dialog.[ch] * app/gui/resize-dialog.[ch] * app/gui/resolution-calibrate-dialog.[ch] * app/gui/stroke-dialog.[ch] * app/gui/tips-dialog.[ch] * app/gui/tips-parser.[ch] * app/gui/user-install-dialog.[ch]: removed these files... * app/dialogs/Makefile.am * app/dialogs/dialogs-types.h * app/dialogs/*.[ch]: ...and added them here. Changed some filenames like module-browser -> module-dialog. * app/app_procs.c * app/actions/actions-types.h * app/actions/actions.c * app/actions/dialogs-actions.c * app/actions/dialogs-commands.c * app/actions/dockable-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/file-commands.c * app/actions/gradient-editor-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/templates-commands.c * app/actions/templates-commands.h * app/actions/vectors-commands.c * app/actions/view-commands.c * app/display/gimpdisplayshell-cursor.c * app/display/gimpdisplayshell-title.c * app/display/gimpdisplayshell.[ch] * app/tools/gimpcroptool.c * app/tools/gimpperspectivetool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimptransformtool.[ch] * app/tools/gimpvectortool.c * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcolorpanel.c * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimppaletteeditor.[ch] * app/widgets/gimptoolbox-color-area.c * menus/toolbox-menu.xml.in * tools/authorsgen/authorsgen.pl: changed accordingly.
2004-09-13 23:15:23 +08:00
if (editor->color_dialog)
{
gtk_widget_destroy (editor->color_dialog);
configure.in added new directory app/dialogs and link libappdialogs.c into 2004-09-13 Michael Natterer <mitch@gimp.org> * configure.in * app/Makefile.am: added new directory app/dialogs and link libappdialogs.c into the gimp binary. * app/gui/Makefile.am * app/gui/gui-types.h * app/gui/gui-vtable.c * app/gui/gui.c * app/gui/about-dialog.[ch] * app/gui/authors.h * app/gui/color-notebook.[ch] * app/gui/convert-dialog.[ch] * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.[ch] * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.[ch] * app/gui/file-open-dialog.[ch] * app/gui/file-open-location-dialog.[ch] * app/gui/file-save-dialog.[ch] * app/gui/grid-dialog.[ch] * app/gui/info-dialog.[ch] * app/gui/info-window.[ch] * app/gui/module-browser.[ch] * app/gui/offset-dialog.[ch] * app/gui/palette-import-dialog.[ch] * app/gui/preferences-dialog.[ch] * app/gui/quit-dialog.[ch] * app/gui/resize-dialog.[ch] * app/gui/resolution-calibrate-dialog.[ch] * app/gui/stroke-dialog.[ch] * app/gui/tips-dialog.[ch] * app/gui/tips-parser.[ch] * app/gui/user-install-dialog.[ch]: removed these files... * app/dialogs/Makefile.am * app/dialogs/dialogs-types.h * app/dialogs/*.[ch]: ...and added them here. Changed some filenames like module-browser -> module-dialog. * app/app_procs.c * app/actions/actions-types.h * app/actions/actions.c * app/actions/dialogs-actions.c * app/actions/dialogs-commands.c * app/actions/dockable-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/file-commands.c * app/actions/gradient-editor-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/templates-commands.c * app/actions/templates-commands.h * app/actions/vectors-commands.c * app/actions/view-commands.c * app/display/gimpdisplayshell-cursor.c * app/display/gimpdisplayshell-title.c * app/display/gimpdisplayshell.[ch] * app/tools/gimpcroptool.c * app/tools/gimpperspectivetool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimptransformtool.[ch] * app/tools/gimpvectortool.c * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcolorpanel.c * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimppaletteeditor.[ch] * app/widgets/gimptoolbox-color-area.c * menus/toolbox-menu.xml.in * tools/authorsgen/authorsgen.pl: changed accordingly.
2004-09-13 23:15:23 +08:00
editor->color_dialog = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_colormap_editor_unmap (GtkWidget *widget)
{
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (widget);
configure.in added new directory app/dialogs and link libappdialogs.c into 2004-09-13 Michael Natterer <mitch@gimp.org> * configure.in * app/Makefile.am: added new directory app/dialogs and link libappdialogs.c into the gimp binary. * app/gui/Makefile.am * app/gui/gui-types.h * app/gui/gui-vtable.c * app/gui/gui.c * app/gui/about-dialog.[ch] * app/gui/authors.h * app/gui/color-notebook.[ch] * app/gui/convert-dialog.[ch] * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.[ch] * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.[ch] * app/gui/file-open-dialog.[ch] * app/gui/file-open-location-dialog.[ch] * app/gui/file-save-dialog.[ch] * app/gui/grid-dialog.[ch] * app/gui/info-dialog.[ch] * app/gui/info-window.[ch] * app/gui/module-browser.[ch] * app/gui/offset-dialog.[ch] * app/gui/palette-import-dialog.[ch] * app/gui/preferences-dialog.[ch] * app/gui/quit-dialog.[ch] * app/gui/resize-dialog.[ch] * app/gui/resolution-calibrate-dialog.[ch] * app/gui/stroke-dialog.[ch] * app/gui/tips-dialog.[ch] * app/gui/tips-parser.[ch] * app/gui/user-install-dialog.[ch]: removed these files... * app/dialogs/Makefile.am * app/dialogs/dialogs-types.h * app/dialogs/*.[ch]: ...and added them here. Changed some filenames like module-browser -> module-dialog. * app/app_procs.c * app/actions/actions-types.h * app/actions/actions.c * app/actions/dialogs-actions.c * app/actions/dialogs-commands.c * app/actions/dockable-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/file-commands.c * app/actions/gradient-editor-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/templates-commands.c * app/actions/templates-commands.h * app/actions/vectors-commands.c * app/actions/view-commands.c * app/display/gimpdisplayshell-cursor.c * app/display/gimpdisplayshell-title.c * app/display/gimpdisplayshell.[ch] * app/tools/gimpcroptool.c * app/tools/gimpperspectivetool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimptransformtool.[ch] * app/tools/gimpvectortool.c * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcolorpanel.c * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimppaletteeditor.[ch] * app/widgets/gimptoolbox-color-area.c * menus/toolbox-menu.xml.in * tools/authorsgen/authorsgen.pl: changed accordingly.
2004-09-13 23:15:23 +08:00
if (editor->color_dialog)
gtk_widget_hide (editor->color_dialog);
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);
configure.in added new directory app/dialogs and link libappdialogs.c into 2004-09-13 Michael Natterer <mitch@gimp.org> * configure.in * app/Makefile.am: added new directory app/dialogs and link libappdialogs.c into the gimp binary. * app/gui/Makefile.am * app/gui/gui-types.h * app/gui/gui-vtable.c * app/gui/gui.c * app/gui/about-dialog.[ch] * app/gui/authors.h * app/gui/color-notebook.[ch] * app/gui/convert-dialog.[ch] * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.[ch] * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.[ch] * app/gui/file-open-dialog.[ch] * app/gui/file-open-location-dialog.[ch] * app/gui/file-save-dialog.[ch] * app/gui/grid-dialog.[ch] * app/gui/info-dialog.[ch] * app/gui/info-window.[ch] * app/gui/module-browser.[ch] * app/gui/offset-dialog.[ch] * app/gui/palette-import-dialog.[ch] * app/gui/preferences-dialog.[ch] * app/gui/quit-dialog.[ch] * app/gui/resize-dialog.[ch] * app/gui/resolution-calibrate-dialog.[ch] * app/gui/stroke-dialog.[ch] * app/gui/tips-dialog.[ch] * app/gui/tips-parser.[ch] * app/gui/user-install-dialog.[ch]: removed these files... * app/dialogs/Makefile.am * app/dialogs/dialogs-types.h * app/dialogs/*.[ch]: ...and added them here. Changed some filenames like module-browser -> module-dialog. * app/app_procs.c * app/actions/actions-types.h * app/actions/actions.c * app/actions/dialogs-actions.c * app/actions/dialogs-commands.c * app/actions/dockable-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/file-commands.c * app/actions/gradient-editor-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/templates-commands.c * app/actions/templates-commands.h * app/actions/vectors-commands.c * app/actions/view-commands.c * app/display/gimpdisplayshell-cursor.c * app/display/gimpdisplayshell-title.c * app/display/gimpdisplayshell.[ch] * app/tools/gimpcroptool.c * app/tools/gimpperspectivetool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimptransformtool.[ch] * app/tools/gimpvectortool.c * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcolorpanel.c * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimppaletteeditor.[ch] * app/widgets/gimptoolbox-color-area.c * menus/toolbox-menu.xml.in * tools/authorsgen/authorsgen.pl: changed accordingly.
2004-09-13 23:15:23 +08:00
if (editor->color_dialog)
gtk_widget_hide (editor->color_dialog);
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 *
gimp_colormap_editor_new (GimpMenuFactory *menu_factory)
{
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);
return g_object_new (GIMP_TYPE_COLORMAP_EDITOR,
"menu-factory", menu_factory,
"menu-identifier", "<ColormapEditor>",
"ui-path", "/colormap-editor-popup",
NULL);
}
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), "");
}
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);
}
}
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)
{
GtkAction *action;
action = gimp_ui_manager_find_action (GIMP_EDITOR (editor)->ui_manager,
"colormap-editor",
"colormap-editor-edit-color");
if (action)
gtk_action_activate (action);
}
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);
put the image popup menu into a dummy menubar to work around the silly 2004-05-17 Michael Natterer <mitch@gimp.org> * menus/menus.xsl: put the image popup menu into a dummy menubar to work around the silly GtkUIManager restriction that popup menus can't have tearoff items. * app/menus/menus.c * app/menus/image-menu.c * app/display/gimpdisplayshell-callbacks.c * app/gui/gui-vtable.c * app/menus/plug-in-menus.c: changed accordingly. * app/gui/gui.c (gui_restore_after_callback): connect to "notify::tearoff-menus" of GimpGuiConfig and reconfigure the global image UI manager accordingly. * app/config/gimpguiconfig.c: removed GIMP_PARAM_RESTART from the "tearoff-menus" property because GtkUIManager can change this on the fly. * app/display/gimpdisplayshell.[ch]: added the menubar to the GimpDisplayShell struct. Some cleanup in gimp_display_shell_new(). * app/display/gimpdisplayshell-appearance.c (gimp_display_shell_set_show_menubar): use shell->menubar instead of asking the UI manager. * app/widgets/gimpuimanager.[ch]: changed gimp_ui_manager_ui_get() to transparently load the XML files even if a sub-widget was requested. Reordered parameters of gimp_ui_manager_ui_popup(). Lots of internal cleanups. * app/widgets/gimpdockable.c * app/widgets/gimptooloptionseditor.c: simplified accordingly. * app/widgets/gimpeditor.[ch]: added new function gimp_editor_popup_menu() which takes a GimpMenuPositionFunc and updates/shows the editor's menu. * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimperrorconsole.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppaletteeditor.c: use gimp_editor_popup_menu(). * app/widgets/gimptoolbox.c: moved all code from gimp_toolbox_new() to GObject::constructor().
2004-05-17 21:38:03 +08:00
gimp_editor_popup_menu (GIMP_EDITOR (editor), 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,
gint x,
gint y,
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_changed (GimpColorHexEntry *entry,
GimpColormapEditor *editor)
{
GimpImage *gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
if (gimage)
{
GimpRGB color;
gimp_color_hex_entry_get_color (entry, &color);
gimp_image_set_colormap_entry (gimage, editor->col_index, &color, TRUE);
gimp_image_flush (gimage);
}
}
static void
gimp_colormap_image_mode_changed (GimpImage *gimage,
GimpColormapEditor *editor)
{
if (editor->color_dialog)
gtk_widget_hide (editor->color_dialog);
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);
}