gimp/app/tools/gimpcurvestool.c

1265 lines
36 KiB
C
Raw Normal View History

1997-11-25 06:05:25 +08:00
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1997-11-25 06:05:25 +08:00
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.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"
#include "config/gimpbaseconfig.h"
#include "config/gimpguiconfig.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 "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-histogram.h"
#include "core/gimpimage.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 "core/gimpimagemap.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpcolorbar.h"
#include "widgets/gimpcursor.h"
#include "widgets/gimpenumcombobox.h"
#include "widgets/gimpenumstore.h"
#include "widgets/gimpenumwidgets.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimphistogramview.h"
#include "widgets/gimppropwidgets.h"
#include "display/gimpdisplay.h"
#include "gimpcurvestool.h"
#include "gimphistogramoptions.h"
#include "gimptoolcontrol.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 XRANGE (1 << 0)
#define YRANGE (1 << 1)
#define GRAPH (1 << 2)
#define ALL (XRANGE | YRANGE | GRAPH)
1997-11-25 06:05:25 +08:00
#define GRAPH_SIZE 256
#define BAR_SIZE 12
#define RADIUS 3
#define MIN_DISTANCE 8
1997-11-25 06:05:25 +08:00
/* local function prototypes */
static void gimp_curves_tool_class_init (GimpCurvesToolClass *klass);
static void gimp_curves_tool_init (GimpCurvesTool *tool);
static void gimp_curves_tool_finalize (GObject *object);
static gboolean gimp_curves_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp);
static void gimp_curves_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_curves_tool_color_picked (GimpColorTool *color_tool,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
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,
gpointer fp);
static gboolean gimp_curves_tool_settings_save (GimpImageMapTool *image_map_tool,
gpointer fp);
static void curves_add_point (GimpCurvesTool *tool,
gint x,
gint y,
gint cchan);
static void curves_update (GimpCurvesTool *tool,
gint update);
static void curves_channel_callback (GtkWidget *widget,
GimpCurvesTool *tool);
static void curves_channel_reset_callback (GtkWidget *widget,
GimpCurvesTool *tool);
static gboolean curves_menu_visible_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data);
static void curves_curve_type_callback (GtkWidget *widget,
GimpCurvesTool *tool);
static gboolean curves_graph_events (GtkWidget *widget,
GdkEvent *event,
GimpCurvesTool *tool);
static gboolean curves_graph_expose (GtkWidget *widget,
GdkEventExpose *eevent,
GimpCurvesTool *tool);
static GimpImageMapToolClass *parent_class = NULL;
/* 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"),
_("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);
}
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
GType
gimp_curves_tool_get_type (void)
{
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
static GType tool_type = 0;
if (! tool_type)
{
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
static const GTypeInfo tool_info =
{
sizeof (GimpCurvesToolClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_curves_tool_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpCurvesTool),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_curves_tool_init,
};
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL,
"GimpCurvesTool",
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
&tool_info, 0);
}
return tool_type;
}
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)
{
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
GObjectClass *object_class;
GimpToolClass *tool_class;
GimpColorToolClass *color_tool_class;
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
GimpImageMapToolClass *image_map_tool_class;
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
object_class = G_OBJECT_CLASS (klass);
tool_class = GIMP_TOOL_CLASS (klass);
color_tool_class = GIMP_COLOR_TOOL_CLASS (klass);
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
image_map_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_curves_tool_finalize;
tool_class->initialize = gimp_curves_tool_initialize;
tool_class->button_release = gimp_curves_tool_button_release;
color_tool_class->picked = gimp_curves_tool_color_picked;
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
image_map_tool_class->shell_desc = _("Adjust Color Curves");
image_map_tool_class->settings_name = "curves";
image_map_tool_class->load_dialog_title = _("Load Curves");
image_map_tool_class->save_dialog_title = _("Save Curves");
image_map_tool_class->map = gimp_curves_tool_map;
image_map_tool_class->dialog = gimp_curves_tool_dialog;
image_map_tool_class->reset = gimp_curves_tool_reset;
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
image_map_tool_class->settings_load = gimp_curves_tool_settings_load;
image_map_tool_class->settings_save = gimp_curves_tool_settings_save;
}
static void
gimp_curves_tool_init (GimpCurvesTool *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->curves = g_new0 (Curves, 1);
tool->lut = gimp_lut_new ();
tool->channel = GIMP_HISTOGRAM_VALUE;
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_init (tool->curves);
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->col_value); i++)
tool->col_value[i] = -1;
tool->cursor_x = -1;
tool->cursor_y = -1;
}
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);
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
if (tool->curves)
{
g_free (tool->curves);
tool->curves = NULL;
}
if (tool->lut)
{
gimp_lut_free (tool->lut);
tool->lut = NULL;
}
if (tool->hist)
{
gimp_histogram_free (tool->hist);
tool->hist = NULL;
}
if (tool->cursor_layout)
{
g_object_unref (tool->cursor_layout);
tool->cursor_layout = NULL;
}
if (tool->xpos_layout)
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_unref (tool->xpos_layout);
tool->xpos_layout = 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
}
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
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_initialize (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
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
GimpDrawable *drawable;
drawable = gimp_image_active_drawable (gdisp->gimage);
if (! drawable)
return FALSE;
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Curves for indexed layers cannot be adjusted."));
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
}
if (! c_tool->hist)
{
Gimp *gimp = GIMP_TOOL (c_tool)->tool_info->gimp;
c_tool->hist = gimp_histogram_new (GIMP_BASE_CONFIG (gimp->config));
}
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_init (c_tool->curves);
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
c_tool->channel = GIMP_HISTOGRAM_VALUE;
c_tool->color = gimp_drawable_is_rgb (drawable);
c_tool->alpha = gimp_drawable_has_alpha (drawable);
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
c_tool->grab_point = -1;
c_tool->last = 0;
GIMP_TOOL_CLASS (parent_class)->initialize (tool, gdisp);
/* always pick colors */
gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
GIMP_COLOR_OPTIONS (tool->tool_info->tool_options));
gimp_enum_combo_box_set_visible (GIMP_ENUM_COMBO_BOX (c_tool->channel_menu),
curves_menu_visible_func, c_tool);
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_int_combo_box_set_active (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
c_tool->channel);
if (! c_tool->color && c_tool->alpha)
c_tool->channel = 1;
gimp_drawable_calculate_histogram (drawable, c_tool->hist);
gimp_histogram_view_set_histogram (GIMP_HISTOGRAM_VIEW (c_tool->graph),
c_tool->hist);
curves_update (c_tool, ALL);
return TRUE;
}
static void
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
gimp_curves_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
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
GimpDrawable *drawable;
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
drawable = gimp_image_active_drawable (gdisp->gimage);
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)
{
curves_add_point (c_tool, coords->x, coords->y, c_tool->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
curves_calculate_curve (c_tool->curves, c_tool->channel);
}
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++)
{
curves_add_point (c_tool, coords->x, coords->y, i);
curves_calculate_curve (c_tool->curves, c_tool->channel);
}
}
/* chain up to halt the tool */
GIMP_TOOL_CLASS (parent_class)->button_release (tool,
coords, time, state, gdisp);
}
static void
gimp_curves_tool_color_picked (GimpColorTool *color_tool,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
{
GimpCurvesTool *tool;
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
GimpDrawable *drawable;
guchar r, g, b, a;
tool = GIMP_CURVES_TOOL (color_tool);
drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable;
gimp_rgba_get_uchar (color, &r, &g, &b, &a);
tool->col_value[GIMP_HISTOGRAM_RED] = r;
tool->col_value[GIMP_HISTOGRAM_GREEN] = g;
tool->col_value[GIMP_HISTOGRAM_BLUE] = b;
if (gimp_drawable_has_alpha (drawable))
tool->col_value[GIMP_HISTOGRAM_ALPHA] = a;
if (gimp_drawable_is_indexed (drawable))
tool->col_value[GIMP_HISTOGRAM_ALPHA] = color_index;
tool->col_value[GIMP_HISTOGRAM_VALUE] = MAX (MAX (r, g), b);
curves_update (tool, GRAPH);
}
static void
curves_add_point (GimpCurvesTool *tool,
gint x,
gint y,
gint cchan)
{
/* Add point onto the curve */
gint closest_point = 0;
gint distance;
gint curvex;
gint i;
switch (tool->curves->curve_type[cchan])
{
case GIMP_CURVE_SMOOTH:
curvex = tool->col_value[cchan];
distance = G_MAXINT;
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 < 17; i++)
{
if (tool->curves->points[cchan][i][0] != -1)
if (abs (curvex - tool->curves->points[cchan][i][0]) < distance)
{
distance = abs (curvex - tool->curves->points[cchan][i][0]);
closest_point = i;
}
}
if (distance > MIN_DISTANCE)
closest_point = (curvex + 8) / 16;
tool->curves->points[cchan][closest_point][0] = curvex;
tool->curves->points[cchan][closest_point][1] = tool->curves->curve[cchan][curvex];
break;
case GIMP_CURVE_FREE:
tool->curves->curve[cchan][x] = 255 - y;
break;
}
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_map (GimpImageMapTool *image_map_tool)
1997-11-25 06:05:25 +08:00
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
gimp_lut_setup (tool->lut,
(GimpLutFunc) curves_lut_func,
tool->curves,
gimp_drawable_bytes (image_map_tool->drawable));
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_image_map_apply (image_map_tool->image_map,
(GimpImageMapApplyFunc) gimp_lut_process_2,
tool->lut);
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;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *hbox;
GtkWidget *hbox2;
GtkWidget *label;
GtkWidget *bbox;
GtkWidget *frame;
GtkWidget *menu;
GtkWidget *table;
GtkWidget *button;
GtkWidget *bar;
gint padding;
tool_options = GIMP_TOOL (tool)->tool_info->tool_options;
vbox = image_map_tool->main_vbox;
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
/* The option menu 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 (_("Channel:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
menu = gimp_enum_combo_box_new (GIMP_TYPE_HISTOGRAM_CHANNEL);
g_signal_connect (menu, "changed",
G_CALLBACK (curves_channel_callback),
tool);
gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (menu),
"gimp-channel");
gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
gtk_widget_show (menu);
tool->channel_menu = menu;
More color correction stuff cleanup: 2002-09-04 Michael Natterer <mitch@gimp.org> More color correction stuff cleanup: * app/base/Makefile.am * app/base/base-types.h * app/base/levels.[ch]: new files containing levels_lut_func(), a new "Levels" parameter struct and the "auto levels" stuff. * app/base/lut-funcs.[ch]: removed the levels stuff here, added lots of g_return_if_fail(). * app/base/color-balance.[ch] * app/base/hue-saturation.[ch]: added init() and reset() functions so we don't need to duplicate this code in the tool and the pdb wrappers. * app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made curves_channel_reset() initialize the curves array. * app/tools/gimpcolorbalancetool.[ch]: use the new functions, moved the "Range" frame to the top, added a per-range "Reset" button, made the global "Reset" button reset all ranges and the "Preserve Luminosity" toggle. * app/tools/gimpcurvestool.[ch]: don't initialize the curves array manually, as curves_channel_reset() does that, s/gint/GimpHistogramChannel/g. * app/tools/gimphuesaturationtool.c: use the new functions, added a per-channel "Reset" button and made the global "Reset" button reset all channels, cleaned up the GUI update function. * app/tools/gimplevelstool.[ch]: changed to use the new Levels parameter struct and it's utility functions. Removed stuff which now lives in base/levels.c * app/tools/gimpimagemaptool.c: align the "Preview" button bottom-left, not bottom-right. * tools/pdbgen/pdb/color.pdb: use the new stuff and removed uglyness because using the "Levels" struct makes the code more straightforward. * app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
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
menu = gimp_prop_enum_stock_box_new (G_OBJECT (tool_options),
"histogram-scale", "gimp-histogram",
0, 0);
gtk_box_pack_end (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
gtk_widget_show (menu);
/* 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_histogram_view_new (FALSE);
gtk_widget_set_size_request (tool->graph,
GRAPH_SIZE + RADIUS * 2,
GRAPH_SIZE + RADIUS * 2);
gtk_widget_add_events (tool->graph, (GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_LEAVE_NOTIFY_MASK));
g_object_set (tool->graph,
"border-width", RADIUS,
"subdivisions", 1,
NULL);
GIMP_HISTOGRAM_VIEW (tool->graph)->light_histogram = TRUE;
gtk_container_add (GTK_CONTAINER (frame), tool->graph);
gtk_widget_show (tool->graph);
g_signal_connect (tool->graph, "event",
G_CALLBACK (curves_graph_events),
tool);
g_signal_connect_after (tool->graph, "expose_event",
G_CALLBACK (curves_graph_expose),
tool);
1997-11-25 06:05:25 +08:00
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);
/* Horizontal button box for load / save */
frame = gimp_frame_new (_("All Channels"));
gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
bbox = gtk_hbutton_box_new ();
gtk_container_set_border_width (GTK_CONTAINER (bbox), 2);
gtk_box_set_spacing (GTK_BOX (bbox), 4);
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
gtk_container_add (GTK_CONTAINER (frame), bbox);
gtk_widget_show (bbox);
gtk_box_pack_start (GTK_BOX (bbox), image_map_tool->load_button,
FALSE, FALSE, 0);
gimp_help_set_help_data (image_map_tool->load_button,
_("Read curves settings from file"), NULL);
gtk_widget_show (image_map_tool->load_button);
gtk_box_pack_start (GTK_BOX (bbox), image_map_tool->save_button,
FALSE, FALSE, 0);
gimp_help_set_help_data (image_map_tool->save_button,
_("Save curves settings to file"), NULL);
gtk_widget_show (image_map_tool->save_button);
/* The radio box for selecting the curve type */
frame = gimp_frame_new (_("Curve Type"));
gtk_box_pack_end (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
hbox = gimp_enum_stock_box_new (GIMP_TYPE_CURVE_TYPE,
"gimp-curve", GTK_ICON_SIZE_MENU,
G_CALLBACK (curves_curve_type_callback),
tool,
&tool->curve_type);
gtk_widget_style_get (bbox, "child_internal_pad_x", &padding, NULL);
gimp_enum_stock_box_set_child_padding (hbox, padding, -1);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
gtk_box_set_spacing (GTK_BOX (hbox), 4);
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
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);
More color correction stuff cleanup: 2002-09-04 Michael Natterer <mitch@gimp.org> More color correction stuff cleanup: * app/base/Makefile.am * app/base/base-types.h * app/base/levels.[ch]: new files containing levels_lut_func(), a new "Levels" parameter struct and the "auto levels" stuff. * app/base/lut-funcs.[ch]: removed the levels stuff here, added lots of g_return_if_fail(). * app/base/color-balance.[ch] * app/base/hue-saturation.[ch]: added init() and reset() functions so we don't need to duplicate this code in the tool and the pdb wrappers. * app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made curves_channel_reset() initialize the curves array. * app/tools/gimpcolorbalancetool.[ch]: use the new functions, moved the "Range" frame to the top, added a per-range "Reset" button, made the global "Reset" button reset all ranges and the "Preserve Luminosity" toggle. * app/tools/gimpcurvestool.[ch]: don't initialize the curves array manually, as curves_channel_reset() does that, s/gint/GimpHistogramChannel/g. * app/tools/gimphuesaturationtool.c: use the new functions, added a per-channel "Reset" button and made the global "Reset" button reset all channels, cleaned up the GUI update function. * app/tools/gimplevelstool.[ch]: changed to use the new Levels parameter struct and it's utility functions. Removed stuff which now lives in base/levels.c * app/tools/gimpimagemaptool.c: align the "Preview" button bottom-left, not bottom-right. * tools/pdbgen/pdb/color.pdb: use the new stuff and removed uglyness because using the "Levels" struct makes the code more straightforward. * app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
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
tool->grab_point = -1;
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
More color correction stuff cleanup: 2002-09-04 Michael Natterer <mitch@gimp.org> More color correction stuff cleanup: * app/base/Makefile.am * app/base/base-types.h * app/base/levels.[ch]: new files containing levels_lut_func(), a new "Levels" parameter struct and the "auto levels" stuff. * app/base/lut-funcs.[ch]: removed the levels stuff here, added lots of g_return_if_fail(). * app/base/color-balance.[ch] * app/base/hue-saturation.[ch]: added init() and reset() functions so we don't need to duplicate this code in the tool and the pdb wrappers. * app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made curves_channel_reset() initialize the curves array. * app/tools/gimpcolorbalancetool.[ch]: use the new functions, moved the "Range" frame to the top, added a per-range "Reset" button, made the global "Reset" button reset all ranges and the "Preserve Luminosity" toggle. * app/tools/gimpcurvestool.[ch]: don't initialize the curves array manually, as curves_channel_reset() does that, s/gint/GimpHistogramChannel/g. * app/tools/gimphuesaturationtool.c: use the new functions, added a per-channel "Reset" button and made the global "Reset" button reset all channels, cleaned up the GUI update function. * app/tools/gimplevelstool.[ch]: changed to use the new Levels parameter struct and it's utility functions. Removed stuff which now lives in base/levels.c * app/tools/gimpimagemaptool.c: align the "Preview" button bottom-left, not bottom-right. * tools/pdbgen/pdb/color.pdb: use the new stuff and removed uglyness because using the "Levels" struct makes the code more straightforward. * app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
curves_channel_reset (tool->curves, 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
curves_update (tool, XRANGE | GRAPH);
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,
gpointer fp)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
FILE *file = fp;
gint i, j;
gint fields;
gchar buf[50];
gint index[5][17];
gint value[5][17];
if (! fgets (buf, sizeof (buf), file))
return FALSE;
if (strcmp (buf, "# GIMP Curves File\n") != 0)
return FALSE;
for (i = 0; i < 5; i++)
{
for (j = 0; j < 17; j++)
{
fields = fscanf (file, "%d %d ", &index[i][j], &value[i][j]);
if (fields != 2)
{
/* FIXME: should have a helpful error message here */
g_printerr ("fields != 2");
return FALSE;
}
}
}
for (i = 0; i < 5; i++)
{
tool->curves->curve_type[i] = GIMP_CURVE_SMOOTH;
for (j = 0; j < 17; j++)
{
tool->curves->points[i][j][0] = index[i][j];
tool->curves->points[i][j][1] = value[i][j];
}
}
for (i = 0; i < 5; i++)
curves_calculate_curve (tool->curves, i);
curves_update (tool, ALL);
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (tool->curve_type),
GIMP_CURVE_SMOOTH);
return TRUE;
}
static gboolean
gimp_curves_tool_settings_save (GimpImageMapTool *image_map_tool,
gpointer fp)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
FILE *file = fp;
gint i, j;
gint32 index;
for (i = 0; i < 5; i++)
if (tool->curves->curve_type[i] == GIMP_CURVE_FREE)
{
/* pick representative points from the curve
and make them control points */
for (j = 0; j <= 8; j++)
{
index = CLAMP0255 (j * 32);
tool->curves->points[i][j * 2][0] = index;
tool->curves->points[i][j * 2][1] = tool->curves->curve[i][index];
}
}
fprintf (file, "# GIMP Curves File\n");
for (i = 0; i < 5; i++)
{
for (j = 0; j < 17; j++)
fprintf (file, "%d %d ",
tool->curves->points[i][j][0],
tool->curves->points[i][j][1]);
fprintf (file, "\n");
}
return TRUE;
}
/* TODO: preview alpha channel stuff correctly. -- austin, 20/May/99 */
1997-11-25 06:05:25 +08:00
static void
curves_update (GimpCurvesTool *tool,
gint update)
1997-11-25 06:05:25 +08:00
{
GimpHistogramChannel channel;
if (tool->color)
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
{
channel = tool->channel;
}
else
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
{
if (tool->channel == 2)
channel = GIMP_HISTOGRAM_ALPHA;
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
else
channel = GIMP_HISTOGRAM_VALUE;
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
}
if (update & GRAPH)
gtk_widget_queue_draw (tool->graph);
if (update & XRANGE)
1997-11-25 06:05:25 +08:00
{
switch (channel)
{
case GIMP_HISTOGRAM_VALUE:
case GIMP_HISTOGRAM_ALPHA:
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
tool->curves->curve[channel],
tool->curves->curve[channel],
tool->curves->curve[channel]);
break;
case GIMP_HISTOGRAM_RED:
case GIMP_HISTOGRAM_GREEN:
case GIMP_HISTOGRAM_BLUE:
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
tool->curves->curve[GIMP_HISTOGRAM_RED],
tool->curves->curve[GIMP_HISTOGRAM_GREEN],
tool->curves->curve[GIMP_HISTOGRAM_BLUE]);
break;
}
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
1997-11-25 06:05:25 +08:00
if (update & YRANGE)
{
gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->yrange), channel);
1997-11-25 06:05:25 +08:00
}
}
static void
curves_channel_callback (GtkWidget *widget,
GimpCurvesTool *tool)
1997-11-25 06:05:25 +08:00
{
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
(gint *) &tool->channel);
gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->graph),
tool->channel);
/* FIXME: hack */
if (! tool->color && tool->alpha)
tool->channel = (tool->channel > 1) ? 2 : 1;
1997-11-25 06:05:25 +08:00
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (tool->curve_type),
tool->curves->curve_type[tool->channel]);
curves_update (tool, ALL);
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
{
tool->grab_point = -1;
1997-11-25 06:05:25 +08:00
curves_channel_reset (tool->curves, tool->channel);
1997-11-25 06:05:25 +08:00
curves_update (tool, XRANGE | GRAPH);
1997-11-25 06:05:25 +08:00
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
1997-11-25 06:05:25 +08:00
}
static gboolean
curves_menu_visible_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (data);
GimpHistogramChannel channel;
gtk_tree_model_get (model, iter,
GIMP_INT_STORE_VALUE, &channel,
-1);
switch (channel)
{
case GIMP_HISTOGRAM_VALUE:
return TRUE;
case GIMP_HISTOGRAM_RED:
case GIMP_HISTOGRAM_GREEN:
case GIMP_HISTOGRAM_BLUE:
return tool->color;
case GIMP_HISTOGRAM_ALPHA:
return tool->alpha;
}
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
{
GimpCurveType curve_type;
1997-11-25 06:05:25 +08:00
gimp_radio_button_update (widget, &curve_type);
1997-11-25 06:05:25 +08:00
if (tool->curves->curve_type[tool->channel] != curve_type)
1997-11-25 06:05:25 +08:00
{
tool->curves->curve_type[tool->channel] = curve_type;
if (curve_type == GIMP_CURVE_SMOOTH)
{
gint i;
gint32 index;
/* pick representative points from the curve
* and make them control points
*/
for (i = 0; i <= 8; i++)
{
index = CLAMP0255 (i * 32);
tool->curves->points[tool->channel][i * 2][0] = index;
tool->curves->points[tool->channel][i * 2][1] = tool->curves->curve[tool->channel][index];
}
}
curves_calculate_curve (tool->curves, tool->channel);
curves_update (tool, XRANGE | GRAPH);
1997-11-25 06:05:25 +08:00
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
}
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 gboolean
curves_graph_events (GtkWidget *widget,
GdkEvent *event,
GimpCurvesTool *tool)
1997-11-25 06:05:25 +08:00
{
static GimpCursorType cursor_type = GDK_TOP_LEFT_ARROW;
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
GimpCursorType new_cursor = GDK_X_CURSOR;
1997-11-25 06:05:25 +08:00
GdkEventButton *bevent;
GdkEventMotion *mevent;
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
gint i;
gint tx, ty;
gint x, y;
gint width, height;
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
gint closest_point;
gint distance;
gint x1, x2, y1, y2;
1997-11-25 06:05:25 +08:00
width = widget->allocation.width - 2 * RADIUS;
height = widget->allocation.height - 2 * RADIUS;
1997-11-25 06:05:25 +08:00
/* get the pointer position */
gdk_window_get_pointer (tool->graph->window, &tx, &ty, NULL);
x = ROUND (((gdouble) (tx - RADIUS) / (gdouble) width) * 255.0);
y = ROUND (((gdouble) (ty - RADIUS) / (gdouble) height) * 255.0);
x = CLAMP0255 (x);
y = CLAMP0255 (y);
1997-11-25 06:05:25 +08:00
distance = G_MAXINT;
for (i = 0, closest_point = 0; i < 17; i++)
1997-11-25 06:05:25 +08:00
{
if (tool->curves->points[tool->channel][i][0] != -1)
if (abs (x - tool->curves->points[tool->channel][i][0]) < distance)
{
distance = abs (x - tool->curves->points[tool->channel][i][0]);
closest_point = i;
}
1997-11-25 06:05:25 +08:00
}
1997-11-25 06:05:25 +08:00
if (distance > MIN_DISTANCE)
closest_point = (x + 8) / 16;
switch (event->type)
{
case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event;
if (bevent->button != 1)
return TRUE;
new_cursor = GDK_TCROSS;
1997-11-25 06:05:25 +08:00
switch (tool->curves->curve_type[tool->channel])
{
case GIMP_CURVE_SMOOTH:
/* determine the leftmost and rightmost points */
tool->leftmost = -1;
for (i = closest_point - 1; i >= 0; i--)
if (tool->curves->points[tool->channel][i][0] != -1)
{
tool->leftmost = tool->curves->points[tool->channel][i][0];
break;
}
tool->rightmost = 256;
for (i = closest_point + 1; i < 17; i++)
if (tool->curves->points[tool->channel][i][0] != -1)
{
tool->rightmost = tool->curves->points[tool->channel][i][0];
break;
}
tool->grab_point = closest_point;
tool->curves->points[tool->channel][tool->grab_point][0] = x;
tool->curves->points[tool->channel][tool->grab_point][1] = 255 - y;
break;
case GIMP_CURVE_FREE:
tool->curves->curve[tool->channel][x] = 255 - y;
tool->grab_point = x;
tool->last = y;
break;
}
curves_calculate_curve (tool->curves, tool->channel);
curves_update (tool, XRANGE | GRAPH);
return TRUE;
1997-11-25 06:05:25 +08:00
case GDK_BUTTON_RELEASE:
bevent = (GdkEventButton *) event;
if (bevent->button != 1)
return TRUE;
new_cursor = GDK_FLEUR;
tool->grab_point = -1;
1997-11-25 06:05:25 +08:00
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
return TRUE;
1997-11-25 06:05:25 +08:00
case GDK_MOTION_NOTIFY:
mevent = (GdkEventMotion *) event;
switch (tool->curves->curve_type[tool->channel])
{
case GIMP_CURVE_SMOOTH:
/* If no point is grabbed... */
if (tool->grab_point == -1)
{
if (tool->curves->points[tool->channel][closest_point][0] != -1)
new_cursor = GDK_FLEUR;
else
new_cursor = GDK_TCROSS;
}
/* Else, drag the grabbed point */
else
{
new_cursor = GDK_TCROSS;
tool->curves->points[tool->channel][tool->grab_point][0] = -1;
if (x > tool->leftmost && x < tool->rightmost)
{
closest_point = (x + 8) / 16;
if (tool->curves->points[tool->channel][closest_point][0] == -1)
tool->grab_point = closest_point;
tool->curves->points[tool->channel][tool->grab_point][0] = x;
tool->curves->points[tool->channel][tool->grab_point][1] = 255 - y;
}
curves_calculate_curve (tool->curves, tool->channel);
}
break;
case GIMP_CURVE_FREE:
if (tool->grab_point != -1)
{
if (tool->grab_point > x)
{
x1 = x;
x2 = tool->grab_point;
y1 = y;
y2 = tool->last;
}
else
{
x1 = tool->grab_point;
x2 = x;
y1 = tool->last;
y2 = y;
}
if (x2 != x1)
for (i = x1; i <= x2; i++)
tool->curves->curve[tool->channel][i] = 255 - (y1 + ((y2 - y1) * (i - x1)) / (x2 - x1));
else
tool->curves->curve[tool->channel][x] = 255 - y;
tool->grab_point = x;
tool->last = y;
}
if (mevent->state & GDK_BUTTON1_MASK)
new_cursor = GDK_TCROSS;
else
new_cursor = GDK_PENCIL;
break;
}
1997-11-25 06:05:25 +08:00
if (new_cursor != cursor_type)
{
cursor_type = new_cursor;
gimp_cursor_set (tool->graph,
GIMP_GUI_CONFIG (GIMP_TOOL (tool)->tool_info->gimp->config)->cursor_format,
cursor_type,
GIMP_TOOL_CURSOR_NONE,
GIMP_CURSOR_MODIFIER_NONE);
}
tool->cursor_x = x;
tool->cursor_y = y;
curves_update (tool, XRANGE | GRAPH);
return TRUE;
1997-11-25 06:05:25 +08:00
case GDK_LEAVE_NOTIFY:
tool->cursor_x = -1;
tool->cursor_y = -1;
curves_update (tool, GRAPH);
return TRUE;
1997-11-25 06:05:25 +08:00
default:
break;
}
return FALSE;
1997-11-25 06:05:25 +08:00
}
static void
curve_print_loc (GimpCurvesTool *tool)
{
gchar buf[32];
gint x, y;
gint w, h;
if (tool->cursor_x < 0 || tool->cursor_x > 255 ||
tool->cursor_y < 0 || tool->cursor_y > 255)
return;
if (! tool->cursor_layout)
{
tool->cursor_layout = gtk_widget_create_pango_layout (tool->graph,
"x:888 y:888");
pango_layout_get_pixel_extents (tool->cursor_layout,
NULL, &tool->cursor_rect);
}
x = RADIUS * 2 + 2;
y = RADIUS * 2 + 2;
w = tool->cursor_rect.width + 4;
h = tool->cursor_rect.height + 4;
gdk_draw_rectangle (tool->graph->window,
tool->graph->style->base_gc[GTK_STATE_ACTIVE],
TRUE,
x, y, w + 1, h + 1);
gdk_draw_rectangle (tool->graph->window,
tool->graph->style->text_gc[GTK_STATE_NORMAL],
FALSE,
x, y, w, h);
g_snprintf (buf, sizeof (buf), "x:%3d y:%3d",
tool->cursor_x, 255 - tool->cursor_y);
pango_layout_set_text (tool->cursor_layout, buf, 11);
gdk_draw_layout (tool->graph->window,
tool->graph->style->text_gc[GTK_STATE_ACTIVE],
x + 2, y + 2,
tool->cursor_layout);
}
static gboolean
curves_graph_expose (GtkWidget *widget,
GdkEventExpose *eevent,
GimpCurvesTool *tool)
{
GimpHistogramChannel channel;
gint width;
gint height;
gint x, y, i;
GdkPoint points[256];
GdkGC *graph_gc;
width = widget->allocation.width - 2 * RADIUS;
height = widget->allocation.height - 2 * RADIUS;
if (width < 1 || height < 1)
return FALSE;
if (tool->color)
{
channel = tool->channel;
}
else
{
if (tool->channel == 2)
channel = GIMP_HISTOGRAM_ALPHA;
else
channel = GIMP_HISTOGRAM_VALUE;
}
/* Draw the grid lines */
for (i = 1; i < 4; i++)
{
gdk_draw_line (widget->window,
tool->graph->style->dark_gc[GTK_STATE_NORMAL],
RADIUS,
RADIUS + i * (height / 4),
RADIUS + width - 1,
RADIUS + i * (height / 4));
gdk_draw_line (widget->window,
tool->graph->style->dark_gc[GTK_STATE_NORMAL],
RADIUS + i * (width / 4),
RADIUS,
RADIUS + i * (width / 4),
RADIUS + height - 1);
}
/* Draw the curve */
graph_gc = tool->graph->style->text_gc[GTK_STATE_NORMAL];
for (i = 0; i < 256; i++)
{
x = i;
y = 255 - tool->curves->curve[tool->channel][x];
points[i].x = RADIUS + ROUND ((gdouble) width * x / 256.0);
points[i].y = RADIUS + ROUND ((gdouble) height * y / 256.0);
}
gdk_draw_lines (widget->window, graph_gc, points, 256);
if (tool->curves->curve_type[tool->channel] == GIMP_CURVE_SMOOTH)
{
/* Draw the points */
for (i = 0; i < 17; i++)
{
x = tool->curves->points[tool->channel][i][0];
if (x < 0)
continue;
y = 255 - tool->curves->points[tool->channel][i][1];
gdk_draw_arc (widget->window,
graph_gc,
TRUE,
ROUND ((gdouble) width * x / 256.0),
ROUND ((gdouble) height * y / 256.0),
RADIUS * 2, RADIUS * 2, 0, 23040);
}
}
if (tool->col_value[channel] >= 0)
{
gchar buf[32];
/* draw the color line */
gdk_draw_line (widget->window,
graph_gc,
RADIUS +
ROUND ((gdouble) width * (tool->col_value[channel]) / 256.0),
RADIUS,
RADIUS +
ROUND ((gdouble) width * (tool->col_value[channel]) / 256.0),
height + RADIUS - 1);
/* and xpos indicator */
g_snprintf (buf, sizeof (buf), "x:%d",
tool->col_value[channel]);
if (! tool->xpos_layout)
tool->xpos_layout = gtk_widget_create_pango_layout (tool->graph, buf);
else
pango_layout_set_text (tool->xpos_layout, buf, -1);
pango_layout_get_pixel_size (tool->xpos_layout, &x, &y);
if ((tool->col_value[channel] + RADIUS) < 127)
x = RADIUS + 4;
else
x = -(x + 2);
gdk_draw_layout (widget->window,
graph_gc,
RADIUS +
ROUND (((gdouble) width * (tool->col_value[channel])) / 256.0 + x),
height - y - 2,
tool->xpos_layout);
}
curve_print_loc (tool);
return FALSE;
}