gimp/app/tools/gimplevelstool.c

1237 lines
43 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
1997-11-25 06:05:25 +08:00
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
1997-11-25 06:05:25 +08:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
1997-11-25 06:05:25 +08:00
* (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, see <http://www.gnu.org/licenses/>.
1997-11-25 06:05:25 +08:00
*/
#include "config.h"
#include <errno.h>
#include <glib/gstdio.h>
#include <gegl.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
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpconfig/gimpconfig.h"
Makefile.am configure.in added the new library below. 2001-01-24 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added the new library below. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.[ch] * libgimpwidgets/gimpcolorbutton.[ch] * libgimpwidgets/gimpdialog.[ch] * libgimpwidgets/gimpfileselection.[ch] * libgimpwidgets/gimphelpui.[ch] * libgimpwidgets/gimppatheditor.[ch] * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpquerybox.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch] * libgimpwidgets/gimpwidgets.[ch] * libgimpwidgets/gimpwidgets.def * libgimpwidgets/gimpwidgetstypes.h: new shared library. Currently there are some ugly dependencies into libgimp. These will be removed and go to a "libgimpglue" library which will be a library for functions which share a common interface between plug-ins and the app but have different implementations. Include "libgimp/gimpunit.h" from "libgimpwidgets/gimpwidgetstypes.h" to simulate this upcoming separation. * libgimp/Makefile.am * libgimp/gimpchainbutton.[ch] * libgimp/gimpcolorarea.[ch] * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimpfileselection.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimppixmap.[ch] * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: removed from here. * libgimp/gimpui.h * libgimp/gimpuitypes.h * libgimp/makefile.mingw.in * libgimp/makefile.msc: changed accordingly. * app/[all ui files] * app/pdb/palette_cmds.c * app/pdb/tools_cmds.c * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/tools.pdb: #include "libgimpwidgets/gimpwidgets.h" and removed useless includes. * app/apptypes.h: #include "libgimpwidgets/gimpwidgetstypes.h" * app/Makefile.am * plug-ins/[all makefiles which link against libgimpui]: link against libgimpwidgets.la * po-libgimp/POTFILES.in: changed file locations.
2001-01-25 06:36:18 +08:00
#include "libgimpwidgets/gimpwidgets.h"
devel-docs/Makefile.am new file documenting the core's include policy. 2002-05-03 Michael Natterer <mitch@gimp.org> * devel-docs/Makefile.am * devel-docs/includes.txt: new file documenting the core's include policy. * HACKING: mention it here. * libgimptool/gimptooltypes.h: removed GimpToolOptions here. * app/core/core-types.h: and added it here. This is a temp hack needed because GimpToolInfo needs to know the GimpToolOptions type. * libgimpproxy/gimpproxytypes.h: regenerated. * libgimptool/gimptoolmodule.h: don't include gimptooltypes.h here... * libgimptool/gimptoolmodule.c: ...but here. * app/config/gimpconfig-params.c: include "libgimpbase/gimpbase.h" entirely, not single files from it. * app/core/gimp.c * app/core/gimpcontext.c * app/core/gimpcoreconfig.c * app/core/gimpdatafactory.c * app/core/gimpdocuments.c * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpdrawable-offset.c * app/core/gimpdrawable-transform.c * app/core/gimpdrawable.c * app/core/gimpedit.c * app/core/gimpimage-convert.c * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimpimage-new.c * app/core/gimpimage-projection.c * app/core/gimpimage-qmask.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.c * app/core/gimpitem.c * app/core/gimpmodules.c * app/core/gimppaintinfo.c * app/core/gimpparasite.c * app/core/gimppreviewcache.c * app/core/gimptoolinfo.c * app/core/gimpunit.c: include "core-types.h" and no other types file. * app/display/gimpdisplay.c * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.c: include "tools/tools-types.h" instead of "libgimptool/gimptooltypes.h", warn about inclusion on "gui/gui-types.h" * app/file/file-open.c * app/file/file-save.c: don't include "libgimptool/gimptooltypes.h". * app/gui/about-dialog.c * app/gui/brush-select.c * app/gui/brushes-commands.c * app/gui/color-select.c * app/gui/data-commands.c * app/gui/device-status-dialog.c * app/gui/dialogs.c * app/gui/gradients-commands.c * app/gui/help-commands.c * app/gui/info-window.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/resize-dialog.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c: include "gui-types.h" and no other types file. * app/paint/gimpairbrush.c * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/paint/gimppaintcore-stroke.c * app/paint/gimppaintcore.c * app/paint/gimppaintoptions.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint.c: include "paint-types.h" and no other types file. * app/pdb/pdb-types.h: don't include "libgimptool/gimptooltypes.h". * app/plug-in/plug-in-progress.c: warn about inclusion of "display/display-types.h" * app/tools/tools-types.h: include "libgimptool/gimptooltypes.h". * app/tools/gimpairbrushtool.c * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.c * app/tools/gimppenciltool.c * app/tools/gimpperspectivetool.c * app/tools/gimpposterizetool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/gimptoolcontrol.c * app/tools/gimptoolcontrol.h * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c * app/tools/tools.c: include "tools-types.h" and no other types file, warn about inclusion of "gui/gui-types.h". * app/widgets/gimpcolorpanel.c * app/widgets/gimptoolbox-color-area.c: warn about inclusion of "gui/gui-types.h". * app/xcf/xcf-load.c * app/xcf/xcf.c: don't include "libgimptool/gimptooltypes.h". Split tool-safe-mode up in two files, one including libgimpproxy, one libgimp. * plug-ins/tools/Makefile.am * plug-ins/tools/tool-safe-mode-plug-in.[ch]: new files including libgimp/ stuff only. * plug-ins/tools/tool-safe-mode.[ch]: include libgimpproxy/ and libgimptool/ but don't include libgimp/ because of conflicting declarations. Unrelated: * app/tools/gimpclonetool.c: create the clone core so we don't crash. * app/gui/file-open-dialog.c: changed the way we create previews so that only out-of-date previews are created on a click in the preview area. Unconditional creation can still be forced by <Ctrl>+click. Changed the tooltip to document this.
2002-05-03 20:45:22 +08:00
#include "tools-types.h"
#include "gegl/gimp-babl.h"
#include "operations/gimplevelsconfig.h"
#include "operations/gimpoperationlevels.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-histogram.h"
#include "core/gimperror.h"
#include "core/gimphistogram.h"
#include "core/gimpimage.h"
#include "widgets/gimpcolorbar.h"
#include "widgets/gimphandlebar.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimphistogramview.h"
#include "widgets/gimpwidgets-constructors.h"
#include "display/gimpdisplay.h"
#include "gimphistogramoptions.h"
#include "gimplevelstool.h"
#include "gimp-intl.h"
#define PICK_LOW_INPUT (1 << 0)
#define PICK_GAMMA (1 << 1)
#define PICK_HIGH_INPUT (1 << 2)
#define PICK_ALL_CHANNELS (1 << 8)
#define HISTOGRAM_WIDTH 256
#define GRADIENT_HEIGHT 12
#define CONTROL_HEIGHT 10
1997-11-25 06:05:25 +08:00
/* local function prototypes */
static void gimp_levels_tool_finalize (GObject *object);
static gboolean gimp_levels_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error);
static GeglNode * gimp_levels_tool_get_operation (GimpImageMapTool *im_tool,
GObject **config,
gchar **undo_desc);
static void gimp_levels_tool_dialog (GimpImageMapTool *im_tool);
static void gimp_levels_tool_reset (GimpImageMapTool *im_tool);
static gboolean gimp_levels_tool_settings_import(GimpImageMapTool *im_tool,
const gchar *filename,
GError **error);
static gboolean gimp_levels_tool_settings_export(GimpImageMapTool *im_tool,
const gchar *filename,
GError **error);
static void gimp_levels_tool_color_picked (GimpImageMapTool *im_tool,
gpointer identifier,
gdouble x,
gdouble y,
const Babl *sample_format,
const GimpRGB *color);
static void gimp_levels_tool_export_setup (GimpSettingsBox *settings_box,
GtkFileChooserDialog *dialog,
gboolean export,
GimpLevelsTool *tool);
static void gimp_levels_tool_config_notify (GObject *object,
GParamSpec *pspec,
GimpLevelsTool *tool);
static void levels_update_input_bar (GimpLevelsTool *tool);
static void levels_channel_callback (GtkWidget *widget,
GimpLevelsTool *tool);
static void levels_channel_reset_callback (GtkWidget *widget,
GimpLevelsTool *tool);
static gboolean levels_menu_sensitivity (gint value,
gpointer data);
static void levels_stretch_callback (GtkWidget *widget,
GimpLevelsTool *tool);
static void levels_low_input_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_gamma_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_linear_gamma_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_high_input_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_low_output_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_high_output_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_to_curves_callback (GtkWidget *widget,
GimpLevelsTool *tool);
G_DEFINE_TYPE (GimpLevelsTool, gimp_levels_tool, GIMP_TYPE_IMAGE_MAP_TOOL)
#define parent_class gimp_levels_tool_parent_class
1997-11-25 06:05:25 +08:00
void
2002-03-29 11:50:29 +08:00
gimp_levels_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)
1997-11-25 06:05:25 +08:00
{
2002-03-29 11:50:29 +08:00
(* callback) (GIMP_TYPE_LEVELS_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-levels-tool",
_("Levels"),
2006-09-19 02:00:22 +08:00
_("Levels Tool: Adjust color levels"),
N_("_Levels..."), NULL,
NULL, GIMP_HELP_TOOL_LEVELS,
2002-03-29 11:50:29 +08:00
GIMP_STOCK_TOOL_LEVELS,
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);
1997-11-25 06:05:25 +08:00
}
static void
gimp_levels_tool_class_init (GimpLevelsToolClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
object_class->finalize = gimp_levels_tool_finalize;
tool_class->initialize = gimp_levels_tool_initialize;
im_tool_class->dialog_desc = _("Adjust Color Levels");
im_tool_class->settings_name = "levels";
im_tool_class->import_dialog_title = _("Import Levels");
im_tool_class->export_dialog_title = _("Export Levels");
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
im_tool_class->get_operation = gimp_levels_tool_get_operation;
im_tool_class->dialog = gimp_levels_tool_dialog;
im_tool_class->reset = gimp_levels_tool_reset;
im_tool_class->settings_import = gimp_levels_tool_settings_import;
im_tool_class->settings_export = gimp_levels_tool_settings_export;
im_tool_class->color_picked = gimp_levels_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
}
static void
gimp_levels_tool_init (GimpLevelsTool *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
{
tool->histogram = gimp_histogram_new (TRUE);
}
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_levels_tool_finalize (GObject *object)
1997-11-25 06:05:25 +08:00
{
GimpLevelsTool *tool = GIMP_LEVELS_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->histogram)
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->histogram);
tool->histogram = 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
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
added GError** parameter to GimpPaintCore::start(). 2006-09-26 Michael Natterer <mitch@gimp.org> * app/paint/gimppaintcore.[ch]: added GError** parameter to GimpPaintCore::start(). * app/tools/gimppainttool.c (button_press): display the error in the statusbar. * app/paint/gimppaintcore-stroke.c: pass a NULL error, effectively swallowing mssages. Will fix that later. * app/paint/gimpbrushcore.c * app/paint/gimpclone.c * app/paint/gimpsourcecore.c: changed accordingly. Set the error instead of calling g_message(). * app/paint/gimpheal.c * app/paint/gimpperspectiveclone.c: implement start() and bail out early on indexed drawables instead of showing a g_message() in other functions that are called later. * app/tools/gimptool.[ch]: added GError** to GimpTool::initialize(). * app/tools/gimptool.c (gimp_tool_initialize): display the error in the statusbar. Keep the external API GError-free. * app/tools/gimprectangletool.[ch]: added GError** to gimp_rectangle_tool_initialize(). * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorizetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpimagemaptool.c * app/tools/gimplevelstool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c: changed accordingly. Set the errors in initialize() instead of using gimp_message(). * app/tools/gimpblendtool.c: implement initialize() and bail out early on indexed images instead of showing a gimp_message() in button_press().
2006-09-27 04:55:40 +08:00
gimp_levels_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
1997-11-25 06:05:25 +08:00
{
GimpLevelsTool *l_tool = GIMP_LEVELS_TOOL (tool);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GimpLevelsConfig *config = l_tool->config;
gdouble scale_factor;
gdouble step;
gint digits;
if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
{
return FALSE;
}
1997-11-25 06:05:25 +08:00
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (l_tool->channel_menu),
levels_menu_sensitivity, drawable, NULL);
1997-11-25 06:05:25 +08:00
gimp_drawable_calculate_histogram (drawable, l_tool->histogram);
gimp_histogram_view_set_histogram (GIMP_HISTOGRAM_VIEW (l_tool->histogram_view),
l_tool->histogram);
if (gimp_drawable_get_precision (drawable) == GIMP_PRECISION_U8)
{
scale_factor = 255.0;
step = 1.0;
digits = 0;
}
else
{
scale_factor = 100.0;
step = 0.1;
digits = 1;
}
l_tool->ui_scale_factor = scale_factor;
g_object_freeze_notify (G_OBJECT (l_tool->low_input));
g_object_freeze_notify (G_OBJECT (l_tool->high_input));
g_object_freeze_notify (G_OBJECT (l_tool->gamma_linear));
g_object_freeze_notify (G_OBJECT (l_tool->low_output));
g_object_freeze_notify (G_OBJECT (l_tool->high_output));
gtk_adjustment_configure (l_tool->low_input,
config->low_input[config->channel] * scale_factor,
0, scale_factor, step, 10, 0);
gtk_adjustment_configure (l_tool->high_input,
config->high_input[config->channel] * scale_factor,
0, scale_factor, step, 10, 0);
gtk_adjustment_configure (l_tool->gamma_linear,
scale_factor / 2.0,
0, scale_factor, 0.1, 1.0, 0);
gtk_adjustment_configure (l_tool->low_output,
config->low_output[config->channel] * scale_factor,
0, scale_factor, step, 10, 0);
gtk_adjustment_configure (l_tool->high_output,
config->high_output[config->channel] * scale_factor,
0, scale_factor, step, 10, 0);
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (l_tool->low_input_spinbutton),
digits);
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (l_tool->high_input_spinbutton),
digits);
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (l_tool->low_output_spinbutton),
digits);
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (l_tool->high_output_spinbutton),
digits);
g_object_thaw_notify (G_OBJECT (l_tool->low_input));
g_object_thaw_notify (G_OBJECT (l_tool->high_input));
g_object_thaw_notify (G_OBJECT (l_tool->gamma_linear));
g_object_thaw_notify (G_OBJECT (l_tool->low_output));
g_object_thaw_notify (G_OBJECT (l_tool->high_output));
return TRUE;
1997-11-25 06:05:25 +08:00
}
static GeglNode *
gimp_levels_tool_get_operation (GimpImageMapTool *im_tool,
GObject **config,
gchar **undo_desc)
{
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (im_tool);
tool->config = g_object_new (GIMP_TYPE_LEVELS_CONFIG, NULL);
g_signal_connect_object (tool->config, "notify",
G_CALLBACK (gimp_levels_tool_config_notify),
G_OBJECT (tool), 0);
*config = G_OBJECT (tool->config);
return gegl_node_new_child (NULL,
"operation", "gimp:levels",
"config", tool->config,
NULL);
}
1997-11-25 06:05:25 +08:00
/*******************/
/* Levels dialog */
/*******************/
1997-11-25 06:05:25 +08:00
static GtkWidget *
gimp_levels_tool_color_picker_new (GimpLevelsTool *tool,
guint value)
{
const gchar *stock_id;
const gchar *help;
switch (value & 0xF)
{
case PICK_LOW_INPUT:
stock_id = GIMP_STOCK_COLOR_PICKER_BLACK;
help = _("Pick black point");
break;
case PICK_GAMMA:
stock_id = GIMP_STOCK_COLOR_PICKER_GRAY;
help = _("Pick gray point");
break;
case PICK_HIGH_INPUT:
stock_id = GIMP_STOCK_COLOR_PICKER_WHITE;
help = _("Pick white point");
break;
default:
return NULL;
}
return gimp_image_map_tool_add_color_picker (GIMP_IMAGE_MAP_TOOL (tool),
GUINT_TO_POINTER (value),
stock_id,
help);
}
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_levels_tool_dialog (GimpImageMapTool *image_map_tool)
1997-11-25 06:05:25 +08:00
{
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
GimpToolOptions *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool);
GimpLevelsConfig *config = tool->config;
GtkListStore *store;
GtkSizeGroup *label_group;
GtkWidget *main_vbox;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *vbox3;
GtkWidget *hbox;
GtkWidget *hbox2;
GtkWidget *label;
GtkWidget *menu;
GtkWidget *frame;
GtkWidget *hbbox;
GtkWidget *button;
GtkWidget *spinbutton;
GtkWidget *bar;
GtkObject *data;
gint border;
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_signal_connect (image_map_tool->settings_box, "file-dialog-setup",
G_CALLBACK (gimp_levels_tool_export_setup),
image_map_tool);
main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool);
label_group = gimp_image_map_tool_dialog_get_label_group (image_map_tool);
1997-11-25 06:05:25 +08:00
/* The option menu for selecting channels */
2011-09-30 17:29:11 +08:00
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
1997-11-25 06:05:25 +08:00
label = gtk_label_new_with_mnemonic (_("Cha_nnel:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
1997-11-25 06:05:25 +08:00
gtk_size_group_add_widget (label_group, label);
store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL,
GIMP_HISTOGRAM_VALUE,
GIMP_HISTOGRAM_ALPHA);
menu = gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));
g_object_unref (store);
g_signal_connect (menu, "changed",
G_CALLBACK (levels_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;
gtk_label_set_mnemonic_widget (GTK_LABEL (label), menu);
button = gtk_button_new_with_mnemonic (_("R_eset Channel"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gtk_widget_show (button);
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 (levels_channel_reset_callback),
tool);
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);
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
/* Input levels frame */
frame = gimp_frame_new (_("Input Levels"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 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);
2011-09-30 17:29:11 +08:00
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
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 (vbox), frame, TRUE, TRUE, 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);
2011-09-30 17:29:11 +08:00
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
tool->histogram_view = gimp_histogram_view_new (FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), tool->histogram_view, TRUE, TRUE, 0);
gtk_widget_show (GTK_WIDGET (tool->histogram_view));
1997-11-25 06:05:25 +08:00
gimp_histogram_options_connect_view (GIMP_HISTOGRAM_OPTIONS (tool_options),
GIMP_HISTOGRAM_VIEW (tool->histogram_view));
g_object_get (tool->histogram_view, "border-width", &border, NULL);
2011-09-30 17:29:11 +08:00
vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox3), border);
gtk_box_pack_start (GTK_BOX (vbox2), vbox3, 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 (vbox3);
tool->input_bar = g_object_new (GIMP_TYPE_COLOR_BAR, NULL);
gtk_widget_set_size_request (tool->input_bar, -1, GRADIENT_HEIGHT / 2);
gtk_box_pack_start (GTK_BOX (vbox3), tool->input_bar, FALSE, FALSE, 0);
gtk_widget_show (tool->input_bar);
bar = g_object_new (GIMP_TYPE_COLOR_BAR, NULL);
gtk_widget_set_size_request (bar, -1, GRADIENT_HEIGHT / 2);
gtk_box_pack_start (GTK_BOX (vbox3), bar, FALSE, FALSE, 0);
gtk_widget_show (bar);
tool->input_sliders = g_object_new (GIMP_TYPE_HANDLE_BAR, NULL);
gtk_widget_set_size_request (tool->input_sliders, -1, CONTROL_HEIGHT);
gtk_box_pack_start (GTK_BOX (vbox3), tool->input_sliders, FALSE, FALSE, 0);
gtk_widget_show (tool->input_sliders);
g_signal_connect_swapped (tool->input_bar, "button-press-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (tool->input_sliders)->button_press_event),
tool->input_sliders);
g_signal_connect_swapped (tool->input_bar, "button-release-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (tool->input_sliders)->button_release_event),
tool->input_sliders);
g_signal_connect_swapped (tool->input_bar, "motion-notify-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (tool->input_sliders)->motion_notify_event),
tool->input_sliders);
g_signal_connect_swapped (bar, "button-press-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (tool->input_sliders)->button_press_event),
tool->input_sliders);
g_signal_connect_swapped (bar, "button-release-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (tool->input_sliders)->button_release_event),
tool->input_sliders);
g_signal_connect_swapped (bar, "motion-notify-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (tool->input_sliders)->motion_notify_event),
tool->input_sliders);
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
/* Horizontal box for input levels spinbuttons */
2011-09-30 17:29:11 +08:00
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (vbox), hbox, 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 (hbox);
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
/* low input spin */
2011-09-30 17:29:11 +08:00
hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
gtk_widget_show (hbox2);
button = gimp_levels_tool_color_picker_new (tool, PICK_LOW_INPUT);
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
spinbutton = gimp_spin_button_new (&data,
config->low_input[config->channel] * 255.0,
0, 255, 1, 10, 0, 0.5, 0);
gtk_box_pack_start (GTK_BOX (hbox2), spinbutton, 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 (spinbutton);
tool->low_input_spinbutton = spinbutton;
tool->low_input = GTK_ADJUSTMENT (data);
g_signal_connect (tool->low_input, "value-changed",
G_CALLBACK (levels_low_input_changed),
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_handle_bar_set_adjustment (GIMP_HANDLE_BAR (tool->input_sliders), 0,
tool->low_input);
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
/* input gamma spin */
spinbutton = gimp_spin_button_new (&data,
config->gamma[config->channel],
0.1, 10, 0.01, 0.1, 0, 0.5, 2);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, TRUE, 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
gimp_help_set_help_data (spinbutton, _("Gamma"), NULL);
gtk_widget_show (spinbutton);
tool->gamma = GTK_ADJUSTMENT (data);
g_signal_connect (tool->gamma, "value-changed",
G_CALLBACK (levels_gamma_changed),
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
tool->gamma_linear = GTK_ADJUSTMENT (gtk_adjustment_new (127, 0, 255,
0.1, 1.0, 0.0));
g_signal_connect (tool->gamma_linear, "value-changed",
G_CALLBACK (levels_linear_gamma_changed),
tool);
gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (tool->input_sliders), 1,
tool->gamma_linear);
g_object_unref (tool->gamma_linear);
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
/* high input spin */
2011-09-30 17:29:11 +08:00
hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
gtk_widget_show (hbox2);
button = gimp_levels_tool_color_picker_new (tool, PICK_HIGH_INPUT);
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
spinbutton = gimp_spin_button_new (&data,
config->high_input[config->channel] * 255.0,
0, 255, 1, 10, 0, 0.5, 0);
gtk_box_pack_start (GTK_BOX (hbox2), spinbutton, 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 (spinbutton);
tool->high_input_spinbutton = spinbutton;
tool->high_input = GTK_ADJUSTMENT (data);
g_signal_connect (tool->high_input, "value-changed",
G_CALLBACK (levels_high_input_changed),
tool);
gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (tool->input_sliders), 2,
tool->high_input);
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
/* Output levels frame */
frame = gimp_frame_new (_("Output Levels"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, 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 (frame);
2011-09-30 17:29:11 +08:00
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
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 (vbox), frame, 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 (frame);
2011-09-30 17:29:11 +08:00
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), border);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
tool->output_bar = g_object_new (GIMP_TYPE_COLOR_BAR, NULL);
gtk_widget_set_size_request (tool->output_bar, -1, GRADIENT_HEIGHT);
gtk_box_pack_start (GTK_BOX (vbox2), tool->output_bar, FALSE, FALSE, 0);
gtk_widget_show (tool->output_bar);
tool->output_sliders = g_object_new (GIMP_TYPE_HANDLE_BAR, NULL);
gtk_widget_set_size_request (tool->output_sliders, -1, CONTROL_HEIGHT);
gtk_box_pack_start (GTK_BOX (vbox2), tool->output_sliders, FALSE, FALSE, 0);
gtk_widget_show (tool->output_sliders);
g_signal_connect_swapped (tool->output_bar, "button-press-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (tool->output_sliders)->button_press_event),
tool->output_sliders);
g_signal_connect_swapped (tool->output_bar, "button-release-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (tool->output_sliders)->button_release_event),
tool->output_sliders);
g_signal_connect_swapped (tool->output_bar, "motion-notify-event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (tool->output_sliders)->motion_notify_event),
tool->output_sliders);
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
/* Horizontal box for levels spin widgets */
2011-09-30 17:29:11 +08:00
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
1997-11-25 06:05:25 +08:00
gtk_widget_show (hbox);
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
/* low output spin */
spinbutton = gimp_spin_button_new (&data,
config->low_output[config->channel] * 255.0,
0, 255, 1, 10, 0, 0.5, 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_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
tool->low_output_spinbutton = spinbutton;
tool->low_output = GTK_ADJUSTMENT (data);
g_signal_connect (tool->low_output, "value-changed",
G_CALLBACK (levels_low_output_changed),
tool);
gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (tool->output_sliders), 0,
tool->low_output);
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
/* high output spin */
spinbutton = gimp_spin_button_new (&data,
config->high_output[config->channel] * 255.0,
0, 255, 1, 10, 0, 0.5, 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_box_pack_end (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
tool->high_output_spinbutton = spinbutton;
tool->high_output = GTK_ADJUSTMENT (data);
g_signal_connect (tool->high_output, "value-changed",
G_CALLBACK (levels_high_output_changed),
tool);
gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (tool->output_sliders), 2,
tool->high_output);
/* all channels frame */
frame = gimp_frame_new (_("All Channels"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
2011-09-30 17:29:11 +08:00
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
2011-09-30 17:29:11 +08:00
hbbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_end (GTK_BOX (hbox), hbbox, FALSE, FALSE, 0);
gtk_widget_show (hbbox);
button = gtk_button_new_with_mnemonic (_("_Auto"));
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, _("Adjust levels automatically"), NULL);
gtk_widget_show (button);
g_signal_connect (button, "clicked",
G_CALLBACK (levels_stretch_callback),
tool);
button = gimp_levels_tool_color_picker_new (tool,
PICK_LOW_INPUT | PICK_ALL_CHANNELS);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = gimp_levels_tool_color_picker_new (tool,
PICK_GAMMA | PICK_ALL_CHANNELS);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = gimp_levels_tool_color_picker_new (tool,
PICK_HIGH_INPUT | PICK_ALL_CHANNELS);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = gimp_stock_button_new (GIMP_STOCK_TOOL_CURVES,
_("Edit these Settings as Curves"));
gtk_box_pack_start (GTK_BOX (main_vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_signal_connect (button, "clicked",
G_CALLBACK (levels_to_curves_callback),
tool);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
config->channel);
}
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_levels_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
{
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
GimpHistogramChannel channel = tool->config->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
g_object_freeze_notify (image_map_tool->config);
if (image_map_tool->default_config)
{
gimp_config_copy (GIMP_CONFIG (image_map_tool->default_config),
GIMP_CONFIG (image_map_tool->config),
0);
}
else
{
gimp_config_reset (GIMP_CONFIG (image_map_tool->config));
}
g_object_set (tool->config,
"channel", channel,
NULL);
g_object_thaw_notify (image_map_tool->config);
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_levels_tool_settings_import (GimpImageMapTool *image_map_tool,
const gchar *filename,
GError **error)
{
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
FILE *file;
gchar header[64];
file = g_fopen (filename, "rt");
if (! file)
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename),
g_strerror (errno));
return FALSE;
}
if (! fgets (header, sizeof (header), file))
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not read header from '%s': %s"),
gimp_filename_to_utf8 (filename),
g_strerror (errno));
fclose (file);
return FALSE;
}
if (g_str_has_prefix (header, "# GIMP Levels File\n"))
{
gboolean success;
rewind (file);
success = gimp_levels_config_load_cruft (tool->config, file, error);
fclose (file);
return success;
}
fclose (file);
return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_import (image_map_tool,
filename,
error);
}
static gboolean
gimp_levels_tool_settings_export (GimpImageMapTool *image_map_tool,
const gchar *filename,
GError **error)
{
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
if (tool->export_old_format)
{
FILE *file;
gboolean success;
file = g_fopen (filename, "wt");
if (! file)
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename),
g_strerror (errno));
return FALSE;
}
success = gimp_levels_config_save_cruft (tool->config, file, error);
fclose (file);
return success;
}
return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_export (image_map_tool,
filename,
error);
}
static void
gimp_levels_tool_export_setup (GimpSettingsBox *settings_box,
GtkFileChooserDialog *dialog,
gboolean export,
GimpLevelsTool *tool)
{
GtkWidget *button;
if (! export)
return;
button = gtk_check_button_new_with_mnemonic (_("Use _old levels file format"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
tool->export_old_format);
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), button);
gtk_widget_show (button);
g_signal_connect (button, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&tool->export_old_format);
}
1997-11-25 06:05:25 +08:00
static void
gimp_levels_tool_config_notify (GObject *object,
GParamSpec *pspec,
GimpLevelsTool *tool)
1997-11-25 06:05:25 +08:00
{
GimpLevelsConfig *config = GIMP_LEVELS_CONFIG (object);
gdouble scale_factor = tool->ui_scale_factor;
if (! tool->low_input)
return;
if (! strcmp (pspec->name, "channel"))
{
gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->histogram_view),
config->channel);
gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->output_bar),
config->channel);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
config->channel);
}
else if (! strcmp (pspec->name, "gamma") ||
! strcmp (pspec->name, "low-input") ||
! strcmp (pspec->name, "high-input"))
{
2009-10-18 01:33:46 +08:00
g_object_freeze_notify (G_OBJECT (tool->low_input));
g_object_freeze_notify (G_OBJECT (tool->high_input));
g_object_freeze_notify (G_OBJECT (tool->gamma_linear));
gtk_adjustment_set_upper (tool->low_input, scale_factor);
2009-10-18 01:33:46 +08:00
gtk_adjustment_set_lower (tool->high_input, 0);
gtk_adjustment_set_lower (tool->gamma_linear, 0);
gtk_adjustment_set_upper (tool->gamma_linear, scale_factor);
gtk_adjustment_set_value (tool->low_input,
config->low_input[config->channel] *
scale_factor);
gtk_adjustment_set_value (tool->gamma,
config->gamma[config->channel]);
gtk_adjustment_set_value (tool->high_input,
config->high_input[config->channel] *
scale_factor);
2009-10-18 01:33:46 +08:00
gtk_adjustment_set_upper (tool->low_input,
gtk_adjustment_get_value (tool->high_input));
gtk_adjustment_set_lower (tool->high_input,
gtk_adjustment_get_value (tool->low_input));
gtk_adjustment_set_lower (tool->gamma_linear,
gtk_adjustment_get_value (tool->low_input));
gtk_adjustment_set_upper (tool->gamma_linear,
gtk_adjustment_get_value (tool->high_input));
g_object_thaw_notify (G_OBJECT (tool->low_input));
g_object_thaw_notify (G_OBJECT (tool->high_input));
g_object_thaw_notify (G_OBJECT (tool->gamma_linear));
levels_update_input_bar (tool);
}
else if (! strcmp (pspec->name, "low-output"))
{
gtk_adjustment_set_value (tool->low_output,
config->low_output[config->channel] *
scale_factor);
}
else if (! strcmp (pspec->name, "high-output"))
{
gtk_adjustment_set_value (tool->high_output,
config->high_output[config->channel] *
scale_factor);
}
1997-11-25 06:05:25 +08:00
}
static void
levels_update_input_bar (GimpLevelsTool *tool)
1997-11-25 06:05:25 +08:00
{
GimpLevelsConfig *config = tool->config;
switch (config->channel)
1997-11-25 06:05:25 +08:00
{
gdouble value;
case GIMP_HISTOGRAM_VALUE:
case GIMP_HISTOGRAM_ALPHA:
case GIMP_HISTOGRAM_RGB:
{
guchar v[256];
gint i;
for (i = 0; i < 256; i++)
{
value = gimp_operation_levels_map_input (config,
config->channel,
i / 255.0);
v[i] = CLAMP (value, 0.0, 1.0) * 255.999;
}
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->input_bar),
v, v, v);
}
break;
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
case GIMP_HISTOGRAM_RED:
case GIMP_HISTOGRAM_GREEN:
case GIMP_HISTOGRAM_BLUE:
{
guchar r[256];
guchar g[256];
guchar b[256];
gint i;
for (i = 0; i < 256; i++)
{
value = gimp_operation_levels_map_input (config,
GIMP_HISTOGRAM_RED,
i / 255.0);
r[i] = CLAMP (value, 0.0, 1.0) * 255.999;
value = gimp_operation_levels_map_input (config,
GIMP_HISTOGRAM_GREEN,
i / 255.0);
g[i] = CLAMP (value, 0.0, 1.0) * 255.999;
value = gimp_operation_levels_map_input (config,
GIMP_HISTOGRAM_BLUE,
i / 255.0);
b[i] = CLAMP (value, 0.0, 1.0) * 255.999;
}
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->input_bar),
r, g, b);
}
break;
1997-11-25 06:05:25 +08:00
}
}
static void
levels_channel_callback (GtkWidget *widget,
GimpLevelsTool *tool)
1997-11-25 06:05:25 +08:00
{
gint value;
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value) &&
tool->config->channel != value)
{
g_object_set (tool->config,
"channel", value,
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
}
static void
levels_channel_reset_callback (GtkWidget *widget,
GimpLevelsTool *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_levels_config_reset_channel (tool->config);
1997-11-25 06:05:25 +08:00
}
static gboolean
levels_menu_sensitivity (gint value,
gpointer data)
{
GimpDrawable *drawable = GIMP_DRAWABLE (data);
GimpHistogramChannel channel = value;
switch (channel)
{
case GIMP_HISTOGRAM_VALUE:
return TRUE;
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
case GIMP_HISTOGRAM_RED:
case GIMP_HISTOGRAM_GREEN:
case GIMP_HISTOGRAM_BLUE:
return gimp_drawable_is_rgb (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
case GIMP_HISTOGRAM_ALPHA:
return gimp_drawable_has_alpha (drawable);
case GIMP_HISTOGRAM_RGB:
return FALSE;
}
return FALSE;
}
static void
levels_stretch_callback (GtkWidget *widget,
GimpLevelsTool *tool)
{
GimpDrawable *drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable;
gimp_levels_config_stretch (tool->config, tool->histogram,
gimp_drawable_is_rgb (drawable));
1997-11-25 06:05:25 +08:00
}
static void
levels_linear_gamma_update (GimpLevelsTool *tool)
{
gdouble low_input = gtk_adjustment_get_value (tool->low_input);
gdouble high_input = gtk_adjustment_get_value (tool->high_input);
gdouble delta, mid, tmp, value;
delta = (high_input - low_input) / 2.0;
mid = low_input + delta;
tmp = log10 (1.0 / tool->config->gamma[tool->config->channel]);
value = mid + delta * tmp;
gtk_adjustment_set_value (tool->gamma_linear, value);
}
static void
levels_linear_gamma_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
{
gdouble low_input = gtk_adjustment_get_value (tool->low_input);
gdouble high_input = gtk_adjustment_get_value (tool->high_input);
gdouble delta, mid, tmp, value;
delta = (high_input - low_input) / 2.0;
if (delta >= 0.5)
{
mid = low_input + delta;
tmp = (gtk_adjustment_get_value (adjustment) - mid) / delta;
value = 1.0 / pow (10, tmp);
/* round the gamma value to the nearest 1/100th */
value = floor (value * 100 + 0.5) / 100.0;
gtk_adjustment_set_value (tool->gamma, value);
}
}
1997-11-25 06:05:25 +08:00
static void
levels_low_input_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
1997-11-25 06:05:25 +08:00
{
GimpLevelsConfig *config = tool->config;
gdouble value = gtk_adjustment_get_value (adjustment);
if (tool->ui_scale_factor == 255.0)
value = ROUND (value);
2009-10-18 01:33:46 +08:00
gtk_adjustment_set_lower (tool->high_input, value);
gtk_adjustment_set_lower (tool->gamma_linear, value);
1997-11-25 06:05:25 +08:00
if (config->low_input[config->channel] != value / tool->ui_scale_factor)
1997-11-25 06:05:25 +08:00
{
g_object_set (config,
"low-input", value / tool->ui_scale_factor,
NULL);
1997-11-25 06:05:25 +08:00
}
levels_linear_gamma_update (tool);
1997-11-25 06:05:25 +08:00
}
static void
levels_gamma_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
1997-11-25 06:05:25 +08:00
{
GimpLevelsConfig *config = tool->config;
gdouble value = gtk_adjustment_get_value (adjustment);
if (config->gamma[config->channel] != value)
1997-11-25 06:05:25 +08:00
{
g_object_set (config,
"gamma", value,
NULL);
1997-11-25 06:05:25 +08:00
}
levels_linear_gamma_update (tool);
1997-11-25 06:05:25 +08:00
}
static void
levels_high_input_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
1997-11-25 06:05:25 +08:00
{
GimpLevelsConfig *config = tool->config;
gdouble value = gtk_adjustment_get_value (adjustment);
if (tool->ui_scale_factor == 255.0)
value = ROUND (value);
2009-10-18 01:33:46 +08:00
gtk_adjustment_set_upper (tool->low_input, value);
gtk_adjustment_set_upper (tool->gamma_linear, value);
1997-11-25 06:05:25 +08:00
if (config->high_input[config->channel] != value / tool->ui_scale_factor)
1997-11-25 06:05:25 +08:00
{
g_object_set (config,
"high-input", value / tool->ui_scale_factor,
NULL);
1997-11-25 06:05:25 +08:00
}
levels_linear_gamma_update (tool);
1997-11-25 06:05:25 +08:00
}
static void
levels_low_output_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
1997-11-25 06:05:25 +08:00
{
GimpLevelsConfig *config = tool->config;
gdouble value = gtk_adjustment_get_value (adjustment);
if (tool->ui_scale_factor == 255.0)
value = ROUND (value);
if (config->low_output[config->channel] != value / tool->ui_scale_factor)
1997-11-25 06:05:25 +08:00
{
g_object_set (config,
"low-output", value / tool->ui_scale_factor,
NULL);
1997-11-25 06:05:25 +08:00
}
}
static void
levels_high_output_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
1997-11-25 06:05:25 +08:00
{
GimpLevelsConfig *config = tool->config;
gdouble value = gtk_adjustment_get_value (adjustment);
if (tool->ui_scale_factor == 255.0)
value = ROUND (value);
if (config->high_output[config->channel] != value / tool->ui_scale_factor)
1997-11-25 06:05:25 +08:00
{
g_object_set (config,
"high-output", value / tool->ui_scale_factor,
NULL);
1997-11-25 06:05:25 +08:00
}
}
static void
levels_input_adjust_by_color (GimpLevelsConfig *config,
guint value,
GimpHistogramChannel channel,
const GimpRGB *color)
{
switch (value & 0xF)
{
case PICK_LOW_INPUT:
gimp_levels_config_adjust_by_colors (config, channel, color, NULL, NULL);
break;
case PICK_GAMMA:
gimp_levels_config_adjust_by_colors (config, channel, NULL, color, NULL);
break;
case PICK_HIGH_INPUT:
gimp_levels_config_adjust_by_colors (config, channel, NULL, NULL, color);
break;
default:
break;
}
}
static void
gimp_levels_tool_color_picked (GimpImageMapTool *color_tool,
gpointer identifier,
gdouble x,
gdouble y,
const Babl *sample_format,
const GimpRGB *color)
{
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (color_tool);
guint value = GPOINTER_TO_UINT (identifier);
if (value & PICK_ALL_CHANNELS &&
gimp_babl_format_get_base_type (sample_format) == GIMP_RGB)
{
GimpHistogramChannel channel;
/* first reset the value channel */
switch (value & 0xF)
{
case PICK_LOW_INPUT:
tool->config->low_input[GIMP_HISTOGRAM_VALUE] = 0.0;
break;
case PICK_GAMMA:
tool->config->gamma[GIMP_HISTOGRAM_VALUE] = 1.0;
break;
case PICK_HIGH_INPUT:
tool->config->high_input[GIMP_HISTOGRAM_VALUE] = 1.0;
break;
default:
break;
}
/* then adjust all color channels */
for (channel = GIMP_HISTOGRAM_RED;
channel <= GIMP_HISTOGRAM_BLUE;
channel++)
{
levels_input_adjust_by_color (tool->config,
value, channel, color);
}
}
else
{
levels_input_adjust_by_color (tool->config,
value, tool->config->channel, color);
}
}
static void
levels_to_curves_callback (GtkWidget *widget,
GimpLevelsTool *tool)
{
GimpCurvesConfig *curves;
curves = gimp_levels_config_to_curves_config (tool->config);
gimp_image_map_tool_edit_as (GIMP_IMAGE_MAP_TOOL (tool),
"gimp-curves-tool",
GIMP_CONFIG (curves));
g_object_unref (curves);
}