gimp/app/tools/gimpcurvestool.c

762 lines
26 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
1997-11-25 06:05:25 +08:00
* 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.
1997-11-25 06:05:25 +08:00
*/
#include "config.h"
#include <errno.h>
#include <glib/gstdio.h>
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpconfig/gimpconfig.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"
devel-docs/Makefile.am new file documenting the core's include policy. 2002-05-03 Michael Natterer <mitch@gimp.org> * devel-docs/Makefile.am * devel-docs/includes.txt: new file documenting the core's include policy. * HACKING: mention it here. * libgimptool/gimptooltypes.h: removed GimpToolOptions here. * app/core/core-types.h: and added it here. This is a temp hack needed because GimpToolInfo needs to know the GimpToolOptions type. * libgimpproxy/gimpproxytypes.h: regenerated. * libgimptool/gimptoolmodule.h: don't include gimptooltypes.h here... * libgimptool/gimptoolmodule.c: ...but here. * app/config/gimpconfig-params.c: include "libgimpbase/gimpbase.h" entirely, not single files from it. * app/core/gimp.c * app/core/gimpcontext.c * app/core/gimpcoreconfig.c * app/core/gimpdatafactory.c * app/core/gimpdocuments.c * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpdrawable-offset.c * app/core/gimpdrawable-transform.c * app/core/gimpdrawable.c * app/core/gimpedit.c * app/core/gimpimage-convert.c * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimpimage-new.c * app/core/gimpimage-projection.c * app/core/gimpimage-qmask.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.c * app/core/gimpitem.c * app/core/gimpmodules.c * app/core/gimppaintinfo.c * app/core/gimpparasite.c * app/core/gimppreviewcache.c * app/core/gimptoolinfo.c * app/core/gimpunit.c: include "core-types.h" and no other types file. * app/display/gimpdisplay.c * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.c: include "tools/tools-types.h" instead of "libgimptool/gimptooltypes.h", warn about inclusion on "gui/gui-types.h" * app/file/file-open.c * app/file/file-save.c: don't include "libgimptool/gimptooltypes.h". * app/gui/about-dialog.c * app/gui/brush-select.c * app/gui/brushes-commands.c * app/gui/color-select.c * app/gui/data-commands.c * app/gui/device-status-dialog.c * app/gui/dialogs.c * app/gui/gradients-commands.c * app/gui/help-commands.c * app/gui/info-window.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/resize-dialog.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c: include "gui-types.h" and no other types file. * app/paint/gimpairbrush.c * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/paint/gimppaintcore-stroke.c * app/paint/gimppaintcore.c * app/paint/gimppaintoptions.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint.c: include "paint-types.h" and no other types file. * app/pdb/pdb-types.h: don't include "libgimptool/gimptooltypes.h". * app/plug-in/plug-in-progress.c: warn about inclusion of "display/display-types.h" * app/tools/tools-types.h: include "libgimptool/gimptooltypes.h". * app/tools/gimpairbrushtool.c * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.c * app/tools/gimppenciltool.c * app/tools/gimpperspectivetool.c * app/tools/gimpposterizetool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/gimptoolcontrol.c * app/tools/gimptoolcontrol.h * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c * app/tools/tools.c: include "tools-types.h" and no other types file, warn about inclusion of "gui/gui-types.h". * app/widgets/gimpcolorpanel.c * app/widgets/gimptoolbox-color-area.c: warn about inclusion of "gui/gui-types.h". * app/xcf/xcf-load.c * app/xcf/xcf.c: don't include "libgimptool/gimptooltypes.h". Split tool-safe-mode up in two files, one including libgimpproxy, one libgimp. * plug-ins/tools/Makefile.am * plug-ins/tools/tool-safe-mode-plug-in.[ch]: new files including libgimp/ stuff only. * plug-ins/tools/tool-safe-mode.[ch]: include libgimpproxy/ and libgimptool/ but don't include libgimp/ because of conflicting declarations. Unrelated: * app/tools/gimpclonetool.c: create the clone core so we don't crash. * app/gui/file-open-dialog.c: changed the way we create previews so that only out-of-date previews are created on a click in the preview area. Unconditional creation can still be forced by <Ctrl>+click. Changed the tooltip to document this.
2002-05-03 20:45:22 +08:00
#include "tools-types.h"
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
#include "base/curves.h"
#include "base/gimphistogram.h"
#include "base/gimplut.h"
#include "gegl/gimpcurvesconfig.h"
#include "gegl/gimpoperationcurves.h"
#include "core/gimp.h"
#include "core/gimpcurve.h"
#include "core/gimpcurve-map.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-histogram.h"
#include "core/gimpimage.h"
#include "widgets/gimpcolorbar.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpcurveview.h"
#include "display/gimpdisplay.h"
#include "gimpcurvestool.h"
#include "gimphistogramoptions.h"
#include "gimp-intl.h"
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
#define GRAPH_SIZE 256
#define BAR_SIZE 12
#define RADIUS 4
1997-11-25 06:05:25 +08:00
/* local function prototypes */
static void gimp_curves_tool_finalize (GObject *object);
static gboolean gimp_curves_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error);
static void gimp_curves_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display);
static gboolean gimp_curves_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display);
static void gimp_curves_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display);
static void gimp_curves_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
static GeglNode * gimp_curves_tool_get_operation (GimpImageMapTool *image_map_tool,
GObject **config);
static void gimp_curves_tool_map (GimpImageMapTool *image_map_tool);
static void gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool);
static void gimp_curves_tool_reset (GimpImageMapTool *image_map_tool);
static gboolean gimp_curves_tool_settings_load (GimpImageMapTool *image_map_tool,
const gchar *filename,
GError **error);
static gboolean gimp_curves_tool_settings_save (GimpImageMapTool *image_map_tool,
const gchar *filename,
GError **error);
static void gimp_curves_tool_config_notify (GObject *object,
GParamSpec *pspec,
GimpCurvesTool *tool);
static void curves_channel_callback (GtkWidget *widget,
GimpCurvesTool *tool);
static void curves_channel_reset_callback (GtkWidget *widget,
GimpCurvesTool *tool);
static gboolean curves_menu_sensitivity (gint value,
gpointer data);
static void curves_curve_type_callback (GtkWidget *widget,
GimpCurvesTool *tool);
G_DEFINE_TYPE (GimpCurvesTool, gimp_curves_tool, GIMP_TYPE_IMAGE_MAP_TOOL)
#define parent_class gimp_curves_tool_parent_class
/* public functions */
void
2002-03-29 11:50:29 +08:00
gimp_curves_tool_register (GimpToolRegisterCallback callback,
app/tools/gimpairbrushtool.[ch] app/tools/gimpbezierselecttool.[ch] 2002-05-03 Sven Neumann <sven@gimp.org> * app/tools/gimpairbrushtool.[ch] * app/tools/gimpbezierselecttool.[ch] * app/tools/gimpblendtool.[ch] * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbucketfilltool[.ch] * app/tools/gimpbycolorselecttool[.ch] * app/tools/gimpclonetool[.ch] * app/tools/gimpcolorbalancetool[.ch] * app/tools/gimpcolorpickertool[.ch] * app/tools/gimpconvolvetool[.ch] * app/tools/gimpcroptool[.ch] * app/tools/gimpcurvestool[.ch] * app/tools/gimpdodgeburntool[.ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool[.ch] * app/tools/gimperasertool[.ch] * app/tools/gimpfliptool[.ch] * app/tools/gimpfreeselecttool[.ch] * app/tools/gimpfuzzyselecttool[.ch] * app/tools/gimphistogramtool[.ch] * app/tools/gimphuesaturationtool[.ch] * app/tools/gimpinktool[.ch] * app/tools/gimpiscissorstool[.ch] * app/tools/gimplevelstool[.ch] * app/tools/gimpmagnifytool[.ch] * app/tools/gimpmeasuretool[.ch] * app/tools/gimpmovetool[.ch] * app/tools/gimppaintbrushtool[.ch] * app/tools/gimppainttool.c * app/tools/gimppathtool[.ch] * app/tools/gimppenciltool[.ch] * app/tools/gimpperspectivetool[.ch] * app/tools/gimpposterizetool[.ch] * app/tools/gimprectselecttool[.ch] * app/tools/gimprotatetool[.ch] * app/tools/gimpscaletool[.ch] * app/tools/gimpselectiontool.c * app/tools/gimpsheartool[.ch] * app/tools/gimpsmudgetool[.ch] * app/tools/gimptexttool[.ch] * app/tools/gimpthresholdtool[.ch] * app/tools/gimptool.c * app/tools/gimptoolcontrol.h * app/tools/gimptoolmodule[.ch] * app/tools/gimptransformtool.c * app/tools/gimpvectortool[.ch] * app/tools/path_tool.c * app/tools/tool_manager[.ch] * app/tools/tools.c * libgimptool/gimptool.c * libgimptool/gimptoolcontrol.h * libgimptool/gimptoolmodule.h: removed tons of warnings. Do we need to add -Werror to the CFLAGS to avoid such a mess in the future ?! Also had to enforce the GIMP coding style in lots of places :-( * libgimp/gimppixelrgn.c: got sick and tired of debugging plug-ins, so I've added checks for most parameters passed to the GimpPixelRgn functions. This will slow down plug-in execution a little bit but should help to find bugs early.
2002-05-03 19:31:08 +08:00
gpointer data)
{
2002-03-29 11:50:29 +08:00
(* callback) (GIMP_TYPE_CURVES_TOOL,
GIMP_TYPE_HISTOGRAM_OPTIONS,
gimp_color_options_gui,
0,
./mitch --sanitize-identifier-namespace 2002-03-20 Michael Natterer <mitch@gimp.org> ./mitch --sanitize-identifier-namespace * app/core/gimpcontext.c * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-dnd.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/dialogs.c * app/gui/edit-commands.c * app/gui/gui.c * app/gui/menus.c * app/gui/vectors-commands.c * app/gui/view-commands.c * app/tools/gimpairbrushtool.c * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpellipseselecttool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimplevelstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppathtool.c * app/tools/gimppenciltool.c * app/tools/gimpperspectivetool.c * app/tools/gimpposterizetool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/gimpvectortool.c * app/widgets/gimpdnd.c * app/widgets/gimptoolbox-indicator-area.c * app/widgets/gimptoolbox.c: s/gimp:/gimp-/g and s/_/-/g for all identifier strings (e.g. gimp:eraser_tool -> gimp-eraser-tool, gimp:layer-list -> gimp-layer-list, ...) * plug-ins/tools/common/gimpbrushselecttool.c: s/gimp:brush_select_tool/gimp-brush-select-tool-module/ Don't quite remember why I introduced the "gimp:" prefix in the first place, but we can always add it back if we need it (for whatever reason) You may want to edit your ~/.gimp-1.3/sessionrc and devicerc or all session settings will be lost due to parse errors.
2002-03-21 20:17:17 +08:00
"gimp-curves-tool",
_("Curves"),
2006-09-19 02:00:22 +08:00
_("Curves Tool: Adjust color curves"),
N_("_Curves..."), NULL,
NULL, GIMP_HELP_TOOL_CURVES,
2002-03-29 11:50:29 +08:00
GIMP_STOCK_TOOL_CURVES,
app/tools/gimpairbrushtool.[ch] app/tools/gimpbezierselecttool.[ch] 2002-05-03 Sven Neumann <sven@gimp.org> * app/tools/gimpairbrushtool.[ch] * app/tools/gimpbezierselecttool.[ch] * app/tools/gimpblendtool.[ch] * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbucketfilltool[.ch] * app/tools/gimpbycolorselecttool[.ch] * app/tools/gimpclonetool[.ch] * app/tools/gimpcolorbalancetool[.ch] * app/tools/gimpcolorpickertool[.ch] * app/tools/gimpconvolvetool[.ch] * app/tools/gimpcroptool[.ch] * app/tools/gimpcurvestool[.ch] * app/tools/gimpdodgeburntool[.ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool[.ch] * app/tools/gimperasertool[.ch] * app/tools/gimpfliptool[.ch] * app/tools/gimpfreeselecttool[.ch] * app/tools/gimpfuzzyselecttool[.ch] * app/tools/gimphistogramtool[.ch] * app/tools/gimphuesaturationtool[.ch] * app/tools/gimpinktool[.ch] * app/tools/gimpiscissorstool[.ch] * app/tools/gimplevelstool[.ch] * app/tools/gimpmagnifytool[.ch] * app/tools/gimpmeasuretool[.ch] * app/tools/gimpmovetool[.ch] * app/tools/gimppaintbrushtool[.ch] * app/tools/gimppainttool.c * app/tools/gimppathtool[.ch] * app/tools/gimppenciltool[.ch] * app/tools/gimpperspectivetool[.ch] * app/tools/gimpposterizetool[.ch] * app/tools/gimprectselecttool[.ch] * app/tools/gimprotatetool[.ch] * app/tools/gimpscaletool[.ch] * app/tools/gimpselectiontool.c * app/tools/gimpsheartool[.ch] * app/tools/gimpsmudgetool[.ch] * app/tools/gimptexttool[.ch] * app/tools/gimpthresholdtool[.ch] * app/tools/gimptool.c * app/tools/gimptoolcontrol.h * app/tools/gimptoolmodule[.ch] * app/tools/gimptransformtool.c * app/tools/gimpvectortool[.ch] * app/tools/path_tool.c * app/tools/tool_manager[.ch] * app/tools/tools.c * libgimptool/gimptool.c * libgimptool/gimptoolcontrol.h * libgimptool/gimptoolmodule.h: removed tons of warnings. Do we need to add -Werror to the CFLAGS to avoid such a mess in the future ?! Also had to enforce the GIMP coding style in lots of places :-( * libgimp/gimppixelrgn.c: got sick and tired of debugging plug-ins, so I've added checks for most parameters passed to the GimpPixelRgn functions. This will slow down plug-in execution a little bit but should help to find bugs early.
2002-05-03 19:31:08 +08:00
data);
}
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
/* private functions */
static void
gimp_curves_tool_class_init (GimpCurvesToolClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass);
GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
object_class->finalize = gimp_curves_tool_finalize;
tool_class->initialize = gimp_curves_tool_initialize;
tool_class->button_release = gimp_curves_tool_button_release;
tool_class->key_press = gimp_curves_tool_key_press;
tool_class->oper_update = gimp_curves_tool_oper_update;
color_tool_class->picked = gimp_curves_tool_color_picked;
im_tool_class->shell_desc = _("Adjust Color Curves");
im_tool_class->settings_name = "curves";
im_tool_class->load_dialog_title = _("Load Curves");
im_tool_class->load_button_tip = _("Load curves settings from file");
im_tool_class->save_dialog_title = _("Save Curves");
im_tool_class->save_button_tip = _("Save curves settings to file");
im_tool_class->get_operation = gimp_curves_tool_get_operation;
im_tool_class->map = gimp_curves_tool_map;
im_tool_class->dialog = gimp_curves_tool_dialog;
im_tool_class->reset = gimp_curves_tool_reset;
im_tool_class->settings_load = gimp_curves_tool_settings_load;
im_tool_class->settings_save = gimp_curves_tool_settings_save;
}
static void
gimp_curves_tool_init (GimpCurvesTool *tool)
{
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
gint i;
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
tool->lut = gimp_lut_new ();
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
for (i = 0; i < G_N_ELEMENTS (tool->picked_color); i++)
tool->picked_color[i] = -1.0;
im_tool->apply_func = (GimpImageMapApplyFunc) gimp_lut_process;
im_tool->apply_data = tool->lut;
}
static void
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gimp_curves_tool_finalize (GObject *object)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (object);
gimp_lut_free (tool->lut);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
added GError** parameter to GimpPaintCore::start(). 2006-09-26 Michael Natterer <mitch@gimp.org> * app/paint/gimppaintcore.[ch]: added GError** parameter to GimpPaintCore::start(). * app/tools/gimppainttool.c (button_press): display the error in the statusbar. * app/paint/gimppaintcore-stroke.c: pass a NULL error, effectively swallowing mssages. Will fix that later. * app/paint/gimpbrushcore.c * app/paint/gimpclone.c * app/paint/gimpsourcecore.c: changed accordingly. Set the error instead of calling g_message(). * app/paint/gimpheal.c * app/paint/gimpperspectiveclone.c: implement start() and bail out early on indexed drawables instead of showing a g_message() in other functions that are called later. * app/tools/gimptool.[ch]: added GError** to GimpTool::initialize(). * app/tools/gimptool.c (gimp_tool_initialize): display the error in the statusbar. Keep the external API GError-free. * app/tools/gimprectangletool.[ch]: added GError** to gimp_rectangle_tool_initialize(). * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorizetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpimagemaptool.c * app/tools/gimplevelstool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c: changed accordingly. Set the errors in initialize() instead of using gimp_message(). * app/tools/gimpblendtool.c: implement initialize() and bail out early on indexed images instead of showing a gimp_message() in button_press().
2006-09-27 04:55:40 +08:00
gimp_curves_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
GimpHistogram *histogram;
if (! drawable)
return FALSE;
if (gimp_drawable_is_indexed (drawable))
{
added GError** parameter to GimpPaintCore::start(). 2006-09-26 Michael Natterer <mitch@gimp.org> * app/paint/gimppaintcore.[ch]: added GError** parameter to GimpPaintCore::start(). * app/tools/gimppainttool.c (button_press): display the error in the statusbar. * app/paint/gimppaintcore-stroke.c: pass a NULL error, effectively swallowing mssages. Will fix that later. * app/paint/gimpbrushcore.c * app/paint/gimpclone.c * app/paint/gimpsourcecore.c: changed accordingly. Set the error instead of calling g_message(). * app/paint/gimpheal.c * app/paint/gimpperspectiveclone.c: implement start() and bail out early on indexed drawables instead of showing a g_message() in other functions that are called later. * app/tools/gimptool.[ch]: added GError** to GimpTool::initialize(). * app/tools/gimptool.c (gimp_tool_initialize): display the error in the statusbar. Keep the external API GError-free. * app/tools/gimprectangletool.[ch]: added GError** to gimp_rectangle_tool_initialize(). * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorizetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpimagemaptool.c * app/tools/gimplevelstool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c: changed accordingly. Set the errors in initialize() instead of using gimp_message(). * app/tools/gimpblendtool.c: implement initialize() and bail out early on indexed images instead of showing a gimp_message() in button_press().
2006-09-27 04:55:40 +08:00
g_set_error (error, 0, 0,
_("Curves does not operate on indexed layers."));
return FALSE;
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
}
gimp_config_reset (GIMP_CONFIG (c_tool->config));
added GError** parameter to GimpPaintCore::start(). 2006-09-26 Michael Natterer <mitch@gimp.org> * app/paint/gimppaintcore.[ch]: added GError** parameter to GimpPaintCore::start(). * app/tools/gimppainttool.c (button_press): display the error in the statusbar. * app/paint/gimppaintcore-stroke.c: pass a NULL error, effectively swallowing mssages. Will fix that later. * app/paint/gimpbrushcore.c * app/paint/gimpclone.c * app/paint/gimpsourcecore.c: changed accordingly. Set the error instead of calling g_message(). * app/paint/gimpheal.c * app/paint/gimpperspectiveclone.c: implement start() and bail out early on indexed drawables instead of showing a g_message() in other functions that are called later. * app/tools/gimptool.[ch]: added GError** to GimpTool::initialize(). * app/tools/gimptool.c (gimp_tool_initialize): display the error in the statusbar. Keep the external API GError-free. * app/tools/gimprectangletool.[ch]: added GError** to gimp_rectangle_tool_initialize(). * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorizetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpimagemaptool.c * app/tools/gimplevelstool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c: changed accordingly. Set the errors in initialize() instead of using gimp_message(). * app/tools/gimpblendtool.c: implement initialize() and bail out early on indexed images instead of showing a gimp_message() in button_press().
2006-09-27 04:55:40 +08:00
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
/* always pick colors */
gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
GIMP_COLOR_TOOL_GET_OPTIONS (tool));
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
curves_menu_sensitivity, drawable, NULL);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
histogram = gimp_histogram_new ();
gimp_drawable_calculate_histogram (drawable, histogram);
gimp_histogram_view_set_background (GIMP_HISTOGRAM_VIEW (c_tool->graph),
histogram);
gimp_histogram_unref (histogram);
return TRUE;
}
static void
gimp_curves_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display)
{
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
GimpCurvesConfig *config = c_tool->config;
build display/ before tools/. 2001-11-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am: build display/ before tools/. * app/devices.c: devices_check_change(): added all events which have a GdkDevice pointer. * app/gimpprogress.c: include "display-types.h" instead of "core-types.h". * app/core/Makefile.am * app/core/gimpdrawable-bucket-fill.[ch]: new files: the bucket_fill stuff taken from tools/gimpbucketfilltool.[ch]. * app/core/core-types.h: added "BucketFillMode". * app/core/gimpimage-mask-select.[ch]: cleanup. * app/core/gimpmarshal.list: added more marshallers for GimpTool's new signal signatures. * app/core/gimpmarshal.[ch]: regenerated. * app/display/Makefile.am * app/display/gimpdisplayshell-dnd.[ch] * app/display/gimpdisplayshell-layer-select.[ch]: new files: the canvas drop callbacks from gimpdisplayshell-callbacks.[ch] and the stuff formerly knows as gui/layer-select.[ch]. * app/display/gimpdisplay.h: don't include "gui/gui-types.h". * app/display/gximage.c: include "display-types.h". * app/display/gimpdisplay-foreach.c * app/display/gimpdisplayshell.[ch]: call gdsplay_delete(), don't destroy the shell widget. * app/gui/Makefile.am * app/gui/layer-select.[ch]: removed. * app/gui/gradients-commands.c: fixed "Save as POV" fprintf()s. * app/gui/preferences-dialog.c: removed the layer_select stuff because it is useless with the new preview system. * app/gui/tool-options-dialog.c: send the correct data to the close_callback. * app/gui/tools-commands.c: changed to follow the new gimp_tool_initialize() semantics (see below). Tool & canvas event handling chainsawing: * app/tools/tools-types.h: new struct GimpCoords which contains x, y, pressure, tilt etc. * app/display/gimpdisplayshell-callbacks.[ch]: added utility functions which transparently retreive the current event's GimpCoords or take it from the device directly if the event has none. Pass GimpCoords _in_image_coordinates_ to all tool functions. Most important: don't pass GdkEvents and display coordinates to tools any more. * app/tools/gimptool.[ch]: changed virtual functions to take GimpCoords, time and state separately instead of GdkEvents. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.[ch] * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.[ch] * app/tools/gimpfuzzyselecttool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.[ch] * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.[ch] * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.[ch] * app/tools/path_tool.[ch] * app/tools/selection_options.c: tons and tons of changes: - changed to use the new virtual function parameters. - removed zillions of gdisplay_untransform_coords(). - get the active drawable's offsets manually in many cases. (questionable, but IMHO ok because it's obvious and not simply a "TRUE" passed to some function) - reordered some functions to be consistent across tools. - some tools had to be changed to work on image coords, not display ones (esp. crop). - fixed strange rotate tool behaviour which should be backported to stable. - some stuff i came across. - indentation and other paranoia. - rounding of coordinated may be broken in some tools. - new bugs guaranteed. * app/tools/tool_manager.[ch]: new semantic of tool_manager_initialize_active() (looked at the places where it was used from and put common code together). Should be a bit better now :) * app/tools/gimpblendtool.c * app/tools/transform_options.c: use the new GTK+ feature that a widget (toggle button) can be a frame's title for this tools' tool options. * app/widgets/widgets-types.h: stuff. * themes/Default/gtkrc: s/GtkDialog/GimpDialog/. * tools/pdbgen/Makefile.am: don't scan tools/gimpbucketfilltool.h any more. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb/tools.pdb: changed bucket_fill wrapper. * app/pdb/tools_cmds.c: regenerated.
2001-11-09 03:14:51 +08:00
if (state & GDK_SHIFT_MASK)
{
GimpCurve *curve = config->curve[config->channel];
gdouble value = c_tool->picked_color[config->channel];
gint closest;
closest = gimp_curve_get_closest_point (curve, value);
gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph),
closest);
gimp_curve_set_point (curve, closest,
value, gimp_curve_map_value (curve, value));
}
build display/ before tools/. 2001-11-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am: build display/ before tools/. * app/devices.c: devices_check_change(): added all events which have a GdkDevice pointer. * app/gimpprogress.c: include "display-types.h" instead of "core-types.h". * app/core/Makefile.am * app/core/gimpdrawable-bucket-fill.[ch]: new files: the bucket_fill stuff taken from tools/gimpbucketfilltool.[ch]. * app/core/core-types.h: added "BucketFillMode". * app/core/gimpimage-mask-select.[ch]: cleanup. * app/core/gimpmarshal.list: added more marshallers for GimpTool's new signal signatures. * app/core/gimpmarshal.[ch]: regenerated. * app/display/Makefile.am * app/display/gimpdisplayshell-dnd.[ch] * app/display/gimpdisplayshell-layer-select.[ch]: new files: the canvas drop callbacks from gimpdisplayshell-callbacks.[ch] and the stuff formerly knows as gui/layer-select.[ch]. * app/display/gimpdisplay.h: don't include "gui/gui-types.h". * app/display/gximage.c: include "display-types.h". * app/display/gimpdisplay-foreach.c * app/display/gimpdisplayshell.[ch]: call gdsplay_delete(), don't destroy the shell widget. * app/gui/Makefile.am * app/gui/layer-select.[ch]: removed. * app/gui/gradients-commands.c: fixed "Save as POV" fprintf()s. * app/gui/preferences-dialog.c: removed the layer_select stuff because it is useless with the new preview system. * app/gui/tool-options-dialog.c: send the correct data to the close_callback. * app/gui/tools-commands.c: changed to follow the new gimp_tool_initialize() semantics (see below). Tool & canvas event handling chainsawing: * app/tools/tools-types.h: new struct GimpCoords which contains x, y, pressure, tilt etc. * app/display/gimpdisplayshell-callbacks.[ch]: added utility functions which transparently retreive the current event's GimpCoords or take it from the device directly if the event has none. Pass GimpCoords _in_image_coordinates_ to all tool functions. Most important: don't pass GdkEvents and display coordinates to tools any more. * app/tools/gimptool.[ch]: changed virtual functions to take GimpCoords, time and state separately instead of GdkEvents. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.[ch] * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.[ch] * app/tools/gimpfuzzyselecttool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.[ch] * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.[ch] * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.[ch] * app/tools/path_tool.[ch] * app/tools/selection_options.c: tons and tons of changes: - changed to use the new virtual function parameters. - removed zillions of gdisplay_untransform_coords(). - get the active drawable's offsets manually in many cases. (questionable, but IMHO ok because it's obvious and not simply a "TRUE" passed to some function) - reordered some functions to be consistent across tools. - some tools had to be changed to work on image coords, not display ones (esp. crop). - fixed strange rotate tool behaviour which should be backported to stable. - some stuff i came across. - indentation and other paranoia. - rounding of coordinated may be broken in some tools. - new bugs guaranteed. * app/tools/tool_manager.[ch]: new semantic of tool_manager_initialize_active() (looked at the places where it was used from and put common code together). Should be a bit better now :) * app/tools/gimpblendtool.c * app/tools/transform_options.c: use the new GTK+ feature that a widget (toggle button) can be a frame's title for this tools' tool options. * app/widgets/widgets-types.h: stuff. * themes/Default/gtkrc: s/GtkDialog/GimpDialog/. * tools/pdbgen/Makefile.am: don't scan tools/gimpbucketfilltool.h any more. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb/tools.pdb: changed bucket_fill wrapper. * app/pdb/tools_cmds.c: regenerated.
2001-11-09 03:14:51 +08:00
else if (state & GDK_CONTROL_MASK)
{
gint i;
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
for (i = 0; i < 5; i++)
{
GimpCurve *curve = config->curve[i];
gdouble value = c_tool->picked_color[i];
gint closest;
closest = gimp_curve_get_closest_point (curve, value);
gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph),
closest);
gimp_curve_set_point (curve, closest,
value, gimp_curve_map_value (curve, value));
}
}
/* chain up to halt the tool */
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
release_type, display);
}
static gboolean
gimp_curves_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display)
{
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
return gtk_widget_event (c_tool->graph, (GdkEvent *) kevent);
}
static void
gimp_curves_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display)
{
GimpColorPickMode mode = GIMP_COLOR_PICK_MODE_NONE;
const gchar *status = NULL;
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
display);
gimp_tool_pop_status (tool, display);
if (state & GDK_SHIFT_MASK)
{
mode = GIMP_COLOR_PICK_MODE_PALETTE;
status = _("Click to add a control point");
}
else if (state & GDK_CONTROL_MASK)
{
mode = GIMP_COLOR_PICK_MODE_PALETTE;
status = _("Click to add control points to all channels");
}
GIMP_COLOR_TOOL (tool)->pick_mode = mode;
if (status && proximity)
gimp_tool_push_status (tool, display, status);
}
static void
gimp_curves_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (color_tool);
GimpDrawable *drawable;
drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable;
tool->picked_color[GIMP_HISTOGRAM_RED] = color->r;
tool->picked_color[GIMP_HISTOGRAM_GREEN] = color->g;
tool->picked_color[GIMP_HISTOGRAM_BLUE] = color->b;
if (gimp_drawable_has_alpha (drawable))
tool->picked_color[GIMP_HISTOGRAM_ALPHA] = color->a;
tool->picked_color[GIMP_HISTOGRAM_VALUE] = MAX (MAX (color->r, color->g),
color->b);
gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph),
tool->picked_color[tool->config->channel]);
}
static GeglNode *
gimp_curves_tool_get_operation (GimpImageMapTool *image_map_tool,
GObject **config)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
GeglNode *node;
node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-curves",
NULL);
tool->config = g_object_new (GIMP_TYPE_CURVES_CONFIG, NULL);
*config = G_OBJECT (tool->config);
g_signal_connect_object (tool->config, "notify",
G_CALLBACK (gimp_curves_tool_config_notify),
tool, 0);
gegl_node_set (node,
"config", tool->config,
NULL);
return node;
}
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
static void
gimp_curves_tool_map (GimpImageMapTool *image_map_tool)
1997-11-25 06:05:25 +08:00
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
GimpDrawable *drawable = image_map_tool->drawable;
Curves curves;
gimp_curves_config_to_cruft (tool->config, &curves,
gimp_drawable_is_rgb (drawable));
gimp_lut_setup (tool->lut,
(GimpLutFunc) curves_lut_func,
&curves,
gimp_drawable_bytes (drawable));
1997-11-25 06:05:25 +08:00
}
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
/*******************/
/* Curves dialog */
/*******************/
1997-11-25 06:05:25 +08:00
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
static void
gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
1997-11-25 06:05:25 +08:00
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
GimpToolOptions *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool);
GimpCurvesConfig *config = tool->config;
GtkListStore *store;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *hbox;
GtkWidget *hbox2;
GtkWidget *label;
GtkWidget *frame;
GtkWidget *table;
GtkWidget *button;
GtkWidget *bar;
GtkWidget *combo;
vbox = image_map_tool->main_vbox;
1997-11-25 06:05:25 +08:00
/* The combo box for selecting channels */
hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
label = gtk_label_new_with_mnemonic (_("Cha_nnel:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL,
GIMP_HISTOGRAM_VALUE,
GIMP_HISTOGRAM_ALPHA);
tool->channel_menu =
gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));
g_object_unref (store);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
config->channel);
gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu),
"gimp-channel");
gtk_box_pack_start (GTK_BOX (hbox), tool->channel_menu, FALSE, FALSE, 0);
gtk_widget_show (tool->channel_menu);
g_signal_connect (tool->channel_menu, "changed",
G_CALLBACK (curves_channel_callback),
tool);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), tool->channel_menu);
button = gtk_button_new_with_mnemonic (_("R_eset Channel"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gtk_widget_show (button);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
g_signal_connect (button, "clicked",
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
G_CALLBACK (curves_channel_reset_callback),
tool);
1997-11-25 06:05:25 +08:00
/* The histogram scale radio buttons */
hbox2 = gimp_prop_enum_stock_box_new (G_OBJECT (tool_options),
"histogram-scale", "gimp-histogram",
0, 0);
gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
gtk_widget_show (hbox2);
/* The table for the color bars and the graph */
1997-11-25 06:05:25 +08:00
table = gtk_table_new (2, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
/* The left color bar */
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_table_attach (GTK_TABLE (table), vbox2, 0, 1, 0, 1,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (vbox2);
1997-11-25 06:05:25 +08:00
frame = gtk_frame_new (NULL);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox2), frame, TRUE, TRUE, RADIUS);
1997-11-25 06:05:25 +08:00
gtk_widget_show (frame);
tool->yrange = gimp_color_bar_new (GTK_ORIENTATION_VERTICAL);
gtk_widget_set_size_request (tool->yrange, BAR_SIZE, -1);
gtk_container_add (GTK_CONTAINER (frame), tool->yrange);
gtk_widget_show (tool->yrange);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
1997-11-25 06:05:25 +08:00
/* The curves graph */
frame = gtk_frame_new (NULL);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
1997-11-25 06:05:25 +08:00
gtk_table_attach (GTK_TABLE (table), frame, 1, 2, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gtk_widget_show (frame);
1997-11-25 06:05:25 +08:00
tool->graph = gimp_curve_view_new ();
gtk_widget_set_size_request (tool->graph,
GRAPH_SIZE + RADIUS * 2,
GRAPH_SIZE + RADIUS * 2);
g_object_set (tool->graph,
"border-width", RADIUS,
"subdivisions", 1,
NULL);
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph),
config->curve[config->channel]);
gtk_container_add (GTK_CONTAINER (frame), tool->graph);
gtk_widget_show (tool->graph);
gimp_histogram_options_connect_view (GIMP_HISTOGRAM_OPTIONS (tool_options),
GIMP_HISTOGRAM_VIEW (tool->graph));
/* The bottom color bar */
hbox2 = gtk_hbox_new (FALSE, 0);
gtk_table_attach (GTK_TABLE (table), hbox2, 1, 2, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (hbox2);
1997-11-25 06:05:25 +08:00
frame = gtk_frame_new (NULL);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (hbox2), frame, TRUE, TRUE, RADIUS);
1997-11-25 06:05:25 +08:00
gtk_widget_show (frame);
vbox2 = gtk_vbox_new (TRUE, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
tool->xrange = gimp_color_bar_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_size_request (tool->xrange, -1, BAR_SIZE / 2);
gtk_box_pack_start (GTK_BOX (vbox2), tool->xrange, TRUE, TRUE, 0);
gtk_widget_show (tool->xrange);
bar = gimp_color_bar_new (GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start (GTK_BOX (vbox2), bar, TRUE, TRUE, 0);
gtk_widget_show (bar);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gtk_widget_show (table);
1997-11-25 06:05:25 +08:00
hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
label = gtk_label_new_with_mnemonic (_("Curve _type:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
tool->curve_type = combo = gimp_enum_combo_box_new (GIMP_TYPE_CURVE_TYPE);
gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (combo),
"gimp-curve");
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), 0,
G_CALLBACK (curves_curve_type_callback),
tool);
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
gtk_widget_show (combo);
1997-11-25 06:05:25 +08:00
}
app/gimpprogress.[ch] s/GDisplay/GimpDisplay/ 2001-10-16 Michael Natterer <mitch@gimp.org> * app/gimpprogress.[ch] * app/undo.c: s/GDisplay/GimpDisplay/ * app/plug_in.[ch]: removed unused boolean "destroy" field of the PlugIn struct. * app/core/gimpedit.c: don't include "app_procs.h" * app/display/gimpdisplay-callbacks.c: moved the "grab_abd_scroll" stuff from gimpdisplay-scroll.* here (less complicated and easier to cleanup...) * app/display/gimpdisplay-scroll.[ch]: removed here. * app/display/gimpdisplay-render.[ch] * app/display/gimpdisplay-selection.[ch] * app/display/gimpdisplayshell.c: s/GDisplay/GimpDisplay/g * app/display/gimpdisplay.[ch]: ditto, removed gdisplay_active() which was just a wrapper around "gimp_context_get_display (gimp_get_user_context (the_gimp))" (which is more to type but makes the use of the global "the_gimp" variable more obvious). * app/gui/color-area.h * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/image-commands.c * app/gui/info-window.h * app/gui/paths-dialog.h * app/gui/select-commands.c * app/gui/tool-options-dialog.c * app/gui/tools-commands.c * app/gui/view-commands.c: s/GDisplay/GimpDisplay/, gdisplay_active() removal, include "app_procs.h" for "the_gimp". * app/tools/gimpbezierselecttool.h * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimpeditselectiontool.h * app/tools/gimphistogramtool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpmovetool.h * app/tools/gimpperspectivetool.h * app/tools/gimpposterizetool.[ch] * app/tools/gimprotatetool.h * app/tools/gimpscaletool.h * app/tools/gimpsheartool.h * app/tools/gimptexttool.h * app/tools/gimpthresholdtool.[ch] * app/tools/gimptool.[ch] * app/tools/gimptransformtool.h * app/tools/tool_manager.[ch]: lots of s/GDisplay/GimpDisplay/, made all *_dialog_hide() functions private, cleanup. * app/widgets/*: removed GtkType and gtk_type_* stuff entirely and use GObject functions, removed lots of empty "destroy" methods and use more type checking class cast macros instead of casting directly. * app/widgets/gimpcontainermenu.c: fixed item insert order. * app/widgets/gimphistogramview.[ch]: cleaned up and renamed all functions. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_dialog_hide() as Gtk+ does the right thing (TM) now. * tools/pdbgen/pdb/color.pdb: implemented "histogram" without digging into tools/ and widgets/ (needs to be done for all color PDB functions). * tools/pdbgen/pdb/gimprc.pdb: no need to use "the_gimp" in a PDB function as a "Gimp" pointer is passed to them all. * tools/pdbgen/pdb/image.pdb: don't include "app_procs.h" * app/pdb/color_cmds.c * app/pdb/gimprc_cmds.c * app/pdb/image_cmds.c: regenerated. * app/pdb/procedural_db.c: don't include "app_procs.h"
2001-10-17 19:33:43 +08:00
static void
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gimp_curves_tool_reset (GimpImageMapTool *image_map_tool)
app/gimpprogress.[ch] s/GDisplay/GimpDisplay/ 2001-10-16 Michael Natterer <mitch@gimp.org> * app/gimpprogress.[ch] * app/undo.c: s/GDisplay/GimpDisplay/ * app/plug_in.[ch]: removed unused boolean "destroy" field of the PlugIn struct. * app/core/gimpedit.c: don't include "app_procs.h" * app/display/gimpdisplay-callbacks.c: moved the "grab_abd_scroll" stuff from gimpdisplay-scroll.* here (less complicated and easier to cleanup...) * app/display/gimpdisplay-scroll.[ch]: removed here. * app/display/gimpdisplay-render.[ch] * app/display/gimpdisplay-selection.[ch] * app/display/gimpdisplayshell.c: s/GDisplay/GimpDisplay/g * app/display/gimpdisplay.[ch]: ditto, removed gdisplay_active() which was just a wrapper around "gimp_context_get_display (gimp_get_user_context (the_gimp))" (which is more to type but makes the use of the global "the_gimp" variable more obvious). * app/gui/color-area.h * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/image-commands.c * app/gui/info-window.h * app/gui/paths-dialog.h * app/gui/select-commands.c * app/gui/tool-options-dialog.c * app/gui/tools-commands.c * app/gui/view-commands.c: s/GDisplay/GimpDisplay/, gdisplay_active() removal, include "app_procs.h" for "the_gimp". * app/tools/gimpbezierselecttool.h * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimpeditselectiontool.h * app/tools/gimphistogramtool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpmovetool.h * app/tools/gimpperspectivetool.h * app/tools/gimpposterizetool.[ch] * app/tools/gimprotatetool.h * app/tools/gimpscaletool.h * app/tools/gimpsheartool.h * app/tools/gimptexttool.h * app/tools/gimpthresholdtool.[ch] * app/tools/gimptool.[ch] * app/tools/gimptransformtool.h * app/tools/tool_manager.[ch]: lots of s/GDisplay/GimpDisplay/, made all *_dialog_hide() functions private, cleanup. * app/widgets/*: removed GtkType and gtk_type_* stuff entirely and use GObject functions, removed lots of empty "destroy" methods and use more type checking class cast macros instead of casting directly. * app/widgets/gimpcontainermenu.c: fixed item insert order. * app/widgets/gimphistogramview.[ch]: cleaned up and renamed all functions. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_dialog_hide() as Gtk+ does the right thing (TM) now. * tools/pdbgen/pdb/color.pdb: implemented "histogram" without digging into tools/ and widgets/ (needs to be done for all color PDB functions). * tools/pdbgen/pdb/gimprc.pdb: no need to use "the_gimp" in a PDB function as a "Gimp" pointer is passed to them all. * tools/pdbgen/pdb/image.pdb: don't include "app_procs.h" * app/pdb/color_cmds.c * app/pdb/gimprc_cmds.c * app/pdb/image_cmds.c: regenerated. * app/pdb/procedural_db.c: don't include "app_procs.h"
2001-10-17 19:33:43 +08:00
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
GimpHistogramChannel channel;
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
{
gimp_curve_reset (tool->config->curve[channel], FALSE);
}
app/gimpprogress.[ch] s/GDisplay/GimpDisplay/ 2001-10-16 Michael Natterer <mitch@gimp.org> * app/gimpprogress.[ch] * app/undo.c: s/GDisplay/GimpDisplay/ * app/plug_in.[ch]: removed unused boolean "destroy" field of the PlugIn struct. * app/core/gimpedit.c: don't include "app_procs.h" * app/display/gimpdisplay-callbacks.c: moved the "grab_abd_scroll" stuff from gimpdisplay-scroll.* here (less complicated and easier to cleanup...) * app/display/gimpdisplay-scroll.[ch]: removed here. * app/display/gimpdisplay-render.[ch] * app/display/gimpdisplay-selection.[ch] * app/display/gimpdisplayshell.c: s/GDisplay/GimpDisplay/g * app/display/gimpdisplay.[ch]: ditto, removed gdisplay_active() which was just a wrapper around "gimp_context_get_display (gimp_get_user_context (the_gimp))" (which is more to type but makes the use of the global "the_gimp" variable more obvious). * app/gui/color-area.h * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/image-commands.c * app/gui/info-window.h * app/gui/paths-dialog.h * app/gui/select-commands.c * app/gui/tool-options-dialog.c * app/gui/tools-commands.c * app/gui/view-commands.c: s/GDisplay/GimpDisplay/, gdisplay_active() removal, include "app_procs.h" for "the_gimp". * app/tools/gimpbezierselecttool.h * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimpeditselectiontool.h * app/tools/gimphistogramtool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpmovetool.h * app/tools/gimpperspectivetool.h * app/tools/gimpposterizetool.[ch] * app/tools/gimprotatetool.h * app/tools/gimpscaletool.h * app/tools/gimpsheartool.h * app/tools/gimptexttool.h * app/tools/gimpthresholdtool.[ch] * app/tools/gimptool.[ch] * app/tools/gimptransformtool.h * app/tools/tool_manager.[ch]: lots of s/GDisplay/GimpDisplay/, made all *_dialog_hide() functions private, cleanup. * app/widgets/*: removed GtkType and gtk_type_* stuff entirely and use GObject functions, removed lots of empty "destroy" methods and use more type checking class cast macros instead of casting directly. * app/widgets/gimpcontainermenu.c: fixed item insert order. * app/widgets/gimphistogramview.[ch]: cleaned up and renamed all functions. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_dialog_hide() as Gtk+ does the right thing (TM) now. * tools/pdbgen/pdb/color.pdb: implemented "histogram" without digging into tools/ and widgets/ (needs to be done for all color PDB functions). * tools/pdbgen/pdb/gimprc.pdb: no need to use "the_gimp" in a PDB function as a "Gimp" pointer is passed to them all. * tools/pdbgen/pdb/image.pdb: don't include "app_procs.h" * app/pdb/color_cmds.c * app/pdb/gimprc_cmds.c * app/pdb/image_cmds.c: regenerated. * app/pdb/procedural_db.c: don't include "app_procs.h"
2001-10-17 19:33:43 +08:00
}
static gboolean
gimp_curves_tool_settings_load (GimpImageMapTool *image_map_tool,
const gchar *filename,
GError **error)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
FILE *file;
gboolean success;
file = g_fopen (filename, "rt");
if (! file)
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename),
g_strerror (errno));
return FALSE;
}
success = gimp_curves_config_load_cruft (tool->config, file, error);
fclose (file);
return success;
}
static gboolean
gimp_curves_tool_settings_save (GimpImageMapTool *image_map_tool,
const gchar *filename,
GError **error)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
FILE *file;
gboolean success;
file = g_fopen (filename, "wt");
if (! file)
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename),
g_strerror (errno));
return FALSE;
}
success = gimp_curves_config_save_cruft (tool->config, file, error);
fclose (file);
return success;
}
1997-11-25 06:05:25 +08:00
static void
gimp_curves_tool_config_notify (GObject *object,
GParamSpec *pspec,
GimpCurvesTool *tool)
1997-11-25 06:05:25 +08:00
{
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (object);
GimpCurve *curve = config->curve[config->channel];
if (! tool->xrange)
return;
if (! strcmp (pspec->name, "channel"))
app/tools/gimpairbrushtool.[ch] app/tools/gimpbezierselecttool.[ch] 2002-05-03 Sven Neumann <sven@gimp.org> * app/tools/gimpairbrushtool.[ch] * app/tools/gimpbezierselecttool.[ch] * app/tools/gimpblendtool.[ch] * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbucketfilltool[.ch] * app/tools/gimpbycolorselecttool[.ch] * app/tools/gimpclonetool[.ch] * app/tools/gimpcolorbalancetool[.ch] * app/tools/gimpcolorpickertool[.ch] * app/tools/gimpconvolvetool[.ch] * app/tools/gimpcroptool[.ch] * app/tools/gimpcurvestool[.ch] * app/tools/gimpdodgeburntool[.ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool[.ch] * app/tools/gimperasertool[.ch] * app/tools/gimpfliptool[.ch] * app/tools/gimpfreeselecttool[.ch] * app/tools/gimpfuzzyselecttool[.ch] * app/tools/gimphistogramtool[.ch] * app/tools/gimphuesaturationtool[.ch] * app/tools/gimpinktool[.ch] * app/tools/gimpiscissorstool[.ch] * app/tools/gimplevelstool[.ch] * app/tools/gimpmagnifytool[.ch] * app/tools/gimpmeasuretool[.ch] * app/tools/gimpmovetool[.ch] * app/tools/gimppaintbrushtool[.ch] * app/tools/gimppainttool.c * app/tools/gimppathtool[.ch] * app/tools/gimppenciltool[.ch] * app/tools/gimpperspectivetool[.ch] * app/tools/gimpposterizetool[.ch] * app/tools/gimprectselecttool[.ch] * app/tools/gimprotatetool[.ch] * app/tools/gimpscaletool[.ch] * app/tools/gimpselectiontool.c * app/tools/gimpsheartool[.ch] * app/tools/gimpsmudgetool[.ch] * app/tools/gimptexttool[.ch] * app/tools/gimpthresholdtool[.ch] * app/tools/gimptool.c * app/tools/gimptoolcontrol.h * app/tools/gimptoolmodule[.ch] * app/tools/gimptransformtool.c * app/tools/gimpvectortool[.ch] * app/tools/path_tool.c * app/tools/tool_manager[.ch] * app/tools/tools.c * libgimptool/gimptool.c * libgimptool/gimptoolcontrol.h * libgimptool/gimptoolmodule.h: removed tons of warnings. Do we need to add -Werror to the CFLAGS to avoid such a mess in the future ?! Also had to enforce the GIMP coding style in lots of places :-( * libgimp/gimppixelrgn.c: got sick and tired of debugging plug-ins, so I've added checks for most parameters passed to the GimpPixelRgn functions. This will slow down plug-in execution a little bit but should help to find bugs early.
2002-05-03 19:31:08 +08:00
{
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
config->channel);
switch (config->channel)
{
guchar r[256];
guchar g[256];
guchar b[256];
case GIMP_HISTOGRAM_VALUE:
case GIMP_HISTOGRAM_ALPHA:
case GIMP_HISTOGRAM_RGB:
gimp_curve_get_uchar (curve, sizeof (r), r);
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
r, r, r);
break;
case GIMP_HISTOGRAM_RED:
case GIMP_HISTOGRAM_GREEN:
case GIMP_HISTOGRAM_BLUE:
gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_RED],
sizeof (r), r);
gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_GREEN],
sizeof (g), g);
gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_BLUE],
sizeof (b), b);
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
r, g, b);
break;
}
gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->graph),
config->channel);
gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph),
tool->picked_color[config->channel]);
gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->yrange),
config->channel);
1997-11-25 06:05:25 +08:00
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph), curve);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->curve_type),
curve->curve_type);
}
else if (! strcmp (pspec->name, "curve"))
{
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->curve_type),
curve->curve_type);
}
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
}
static void
curves_channel_callback (GtkWidget *widget,
GimpCurvesTool *tool)
{
GimpCurvesConfig *config = tool->config;
gint value;
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value) &&
config->channel != value)
{
g_object_set (config,
"channel", value,
NULL);
}
1997-11-25 06:05:25 +08:00
}
static void
curves_channel_reset_callback (GtkWidget *widget,
GimpCurvesTool *tool)
1997-11-25 06:05:25 +08:00
{
gimp_curve_reset (tool->config->curve[tool->config->channel], FALSE);
1997-11-25 06:05:25 +08:00
}
static gboolean
curves_menu_sensitivity (gint value,
gpointer data)
{
GimpDrawable *drawable = GIMP_DRAWABLE (data);
GimpHistogramChannel channel = value;
switch (channel)
{
case GIMP_HISTOGRAM_VALUE:
return TRUE;
case GIMP_HISTOGRAM_RED:
case GIMP_HISTOGRAM_GREEN:
case GIMP_HISTOGRAM_BLUE:
return gimp_drawable_is_rgb (drawable);
case GIMP_HISTOGRAM_ALPHA:
return gimp_drawable_has_alpha (drawable);
case GIMP_HISTOGRAM_RGB:
return FALSE;
}
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
return FALSE;
}
1997-11-25 06:05:25 +08:00
static void
curves_curve_type_callback (GtkWidget *widget,
GimpCurvesTool *tool)
1997-11-25 06:05:25 +08:00
{
gint value;
1997-11-25 06:05:25 +08:00
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value))
{
GimpCurvesConfig *config = tool->config;
GimpCurveType curve_type = value;
1997-11-25 06:05:25 +08:00
if (config->curve[config->channel]->curve_type != curve_type)
gimp_curve_set_curve_type (config->curve[config->channel], curve_type);
}
1997-11-25 06:05:25 +08:00
}