gimp/app/tools/gimppaintoptions-gui.c

827 lines
30 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
Makefile.am configure.in added new directory libgimpbase/ 2001-05-21 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool-1.4.in: added new directory libgimpbase/ * app/Makefile.am: link against the new lib. * app/appenums.h: removed the PDB enums which are in libgimpbase/gimpbasetypes.h now. They are all "Gimp" prefixed. * app/apptypes.h: #include "libgimpbase/gimpbasetypes.h" * app/[lots] * app/core/[of] * app/gui/[files] * app/tools/: changed includes and all PDB types. * app/pdb/*: regenerated. * libgimp/Makefile.am: don't build libgimpi.a uglyness any more. * libgimp/gimpenv.[ch] * libgimp/gimplimits.[hh] * libgimp/gimpparasite.[ch] * libgimp/gimpparasiteio.[ch] * libgimp/gimpprotocol.[ch] * libgimp/gimpsignal.[ch] * libgimp/gimpunit.h * libgimp/gimputils.[ch] * libgimp/gimpwire.[ch]: removed... * libgimpbase/*: ...and added here as new library. * libgimp/gimp.[ch] * libgimp/gimpdrawable.[ch] * libgimp/gimpenums.h * libgimp/gimpimage.[ch] * libgimp/gimptile.c * libgimp/gimptypes.h * libgimp/gimpunit.c: changed accordingly. Added the gimp_*_add_new_parasite to gimp.[ch], gimpdrawable.[ch] and gimpimage.[ch]. * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpsizeentry.c * libgimpwidgets/gimpunitmenu.c * libgimpwidgets/gimpwidgets.c * libgimpwidgets/gimpwidgetstypes.h: changed includes accordingly. * plug-ins/*/Makefile.am * plug-ins/common/mkgen.pl: link against libgimpbase. * tools/pdbgen/Makefile.am: scan libgimpbase/gimpbasetypes.h, so the enums are known to pdbgen... * tools/pdbgen/enumcode.pl: ...but don't write them out to libgimp/gimpenums.h * tools/pdbgen/app.pl: include libgimp/gimpbase.h in all *_cmds.c files. Added GIMP_ to the type names ganerated in app/. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/procedural_db.pdb * tools/pdbgen/pdb/unit.pdb: changed includes.
2001-05-21 21:58:46 +08:00
#include "libgimpbase/gimpbase.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"
#include "tools-types.h"
app/Makefile.am removed. 2001-07-07 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/context_manager.[ch]: removed. * app/app_procs.c: call tool_mananger instead of context_manager functions, pass "the_gimp" to some more functions. * app/drawable.[ch]: pass a GimpContext to drawable_fill(). * app/errors.c: behave according to "stack_trace_mode" when using the debugging signal handler. * app/gimprc.[ch]: removed the core/ config variables. * app/selection.c: set the selection's state to INVISIBLE in selection_pause(). * app/core/Makefile.am * app/core/gimpcoreconfig.[ch]: new files (the configuration variables used by core/). * app/core/gimpcontext.[ch]: removed the global contexts (user, default, ...) and their functions. It's no longer possible to pass NULL to the context functions to manipulate the current context (gimpcontext.c doesn't know the current context any more). * app/core/gimp.[ch]: added them here. The functions are now called gimp_[set|get]_*_context(). Added gimp_create_context() which is the only function to create contexts now. * app/gui/dialogs.[ch] * app/gui/gui.[ch]: pass "gimp" to all functions. * app/tools/tool_manager.[ch] * app/tools/tools.[ch]: pass "gimp" to lots of functions. Added the "global_tool_context" logic and the global/non-global paint options switching from the context_manager. Pass "gimp" to all tools' "register" functions. * app/tools/*: changed accordingly. * app/devices.c * app/disp_callbacks.c * app/file-open.[ch] * app/file-save.c * app/gdisplay.c * app/gimage.c * app/libgimp_glue.c * app/module_db.c * app/nav_window.c * app/plug_in.c * app/qmask.c * app/undo.c * app/base/base-config.c * app/core/gimpbrushpipe.c * app/core/gimpdrawable-offset.c * app/core/gimpgradient.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimppalette.c * app/core/gimptoolinfo.[ch] * app/core/gimpundo.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/dialogs-constructors.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/gui/test-commands.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdnd.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimpimagedock.c * app/widgets/gimplayerlistview.c * app/pdb/brushes_cmds.c * app/pdb/drawable_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/palette_cmds.c * app/pdb/patterns_cmds.c * app/pdb/procedural_db.c * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly: remove usage of gimp_context_[get|set]_*(NULL), create contexts with gimp_create_context(). Get the user/current context with gimp_get_[user|current]_context(). Added/removed access to the global "the_gimp" variable in some places. Get the core's config variables from "core_config".
2001-07-07 20:17:23 +08:00
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpwidgets-constructors.h"
2001-04-11 09:13:53 +08:00
#include "widgets/gtkhwrapbox.h"
#include "gimptool.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 "paint_options.h"
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
#include "tool_manager.h"
#include "gimpairbrushtool.h"
#include "gimpblendtool.h"
#include "gimpbucketfilltool.h"
#include "gimpdodgeburntool.h"
#include "gimperasertool.h"
#include "gimpinktool.h"
#include "gimppaintbrushtool.h"
#include "gimppenciltool.h"
#include "gimpdodgeburntool.h"
#include "gimpsmudgetool.h"
#include "gimpclonetool.h"
#include "gimpconvolvetool.h"
app/Makefile.am removed. 2001-07-07 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/context_manager.[ch]: removed. * app/app_procs.c: call tool_mananger instead of context_manager functions, pass "the_gimp" to some more functions. * app/drawable.[ch]: pass a GimpContext to drawable_fill(). * app/errors.c: behave according to "stack_trace_mode" when using the debugging signal handler. * app/gimprc.[ch]: removed the core/ config variables. * app/selection.c: set the selection's state to INVISIBLE in selection_pause(). * app/core/Makefile.am * app/core/gimpcoreconfig.[ch]: new files (the configuration variables used by core/). * app/core/gimpcontext.[ch]: removed the global contexts (user, default, ...) and their functions. It's no longer possible to pass NULL to the context functions to manipulate the current context (gimpcontext.c doesn't know the current context any more). * app/core/gimp.[ch]: added them here. The functions are now called gimp_[set|get]_*_context(). Added gimp_create_context() which is the only function to create contexts now. * app/gui/dialogs.[ch] * app/gui/gui.[ch]: pass "gimp" to all functions. * app/tools/tool_manager.[ch] * app/tools/tools.[ch]: pass "gimp" to lots of functions. Added the "global_tool_context" logic and the global/non-global paint options switching from the context_manager. Pass "gimp" to all tools' "register" functions. * app/tools/*: changed accordingly. * app/devices.c * app/disp_callbacks.c * app/file-open.[ch] * app/file-save.c * app/gdisplay.c * app/gimage.c * app/libgimp_glue.c * app/module_db.c * app/nav_window.c * app/plug_in.c * app/qmask.c * app/undo.c * app/base/base-config.c * app/core/gimpbrushpipe.c * app/core/gimpdrawable-offset.c * app/core/gimpgradient.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimppalette.c * app/core/gimptoolinfo.[ch] * app/core/gimpundo.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/dialogs-constructors.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/gui/test-commands.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdnd.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimpimagedock.c * app/widgets/gimplayerlistview.c * app/pdb/brushes_cmds.c * app/pdb/drawable_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/palette_cmds.c * app/pdb/patterns_cmds.c * app/pdb/procedural_db.c * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly: remove usage of gimp_context_[get|set]_*(NULL), create contexts with gimp_create_context(). Get the user/current context with gimp_get_[user|current]_context(). Added/removed access to the global "the_gimp" variable in some places. Get the core's config variables from "core_config".
2001-07-07 20:17:23 +08:00
#include "gimprc.h"
#include "libgimp/gimpintl.h"
#define DEFAULT_USE_FADE FALSE
#define DEFAULT_FADE_OUT 100.0
#define DEFAULT_FADE_UNIT GIMP_UNIT_PIXEL
#define DEFAULT_USE_GRADIENT FALSE
#define DEFAULT_GRADIENT_LENGTH 100.0
#define DEFAULT_GRADIENT_UNIT GIMP_UNIT_PIXEL
#define DEFAULT_GRADIENT_TYPE LOOP_TRIANGLE
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
static PaintPressureOptions * paint_pressure_options_new (GType tool_type,
PaintOptions *paint_options);
static void paint_pressure_options_reset (PaintPressureOptions *pressure_options,
PaintOptions *paint_options);
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
static PaintGradientOptions * paint_gradient_options_new (GType tool_type,
PaintOptions *paint_options);
static void paint_gradient_options_reset (PaintGradientOptions *gradient_options,
PaintOptions *paint_options);
static void paint_options_opacity_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
static void paint_options_opacity_changed (GimpContext *context,
gdouble opacity,
gpointer data);
static void paint_options_paint_mode_update (GtkWidget *widget,
gpointer data);
static void paint_options_paint_mode_changed (GimpContext *context,
LayerModeEffects paint_mode,
gpointer data);
static void paint_gradient_options_gradient_toggle_callback (GtkWidget *widget,
PaintOptions *options);
/* declared extern in paint_options.h */
PaintPressureOptions non_gui_pressure_options =
{
NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL
};
PaintGradientOptions non_gui_gradient_options =
{
NULL,
DEFAULT_USE_FADE, DEFAULT_USE_FADE, NULL,
DEFAULT_FADE_OUT, DEFAULT_FADE_OUT, NULL,
DEFAULT_FADE_UNIT, DEFAULT_FADE_UNIT, NULL,
DEFAULT_USE_GRADIENT, DEFAULT_USE_GRADIENT, NULL,
DEFAULT_GRADIENT_LENGTH, DEFAULT_GRADIENT_LENGTH, NULL,
DEFAULT_GRADIENT_UNIT, DEFAULT_GRADIENT_UNIT, NULL,
DEFAULT_GRADIENT_TYPE, DEFAULT_GRADIENT_TYPE, NULL
};
/* a list of all PaintOptions */
static GSList *paint_options_list = NULL;
void
paint_options_init (PaintOptions *options,
GimpToolInfo *tool_info)
{
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *scale;
/* initialize the tool options structure */
tool_options_init ((GimpToolOptions *) options, tool_info);
((GimpToolOptions *) options)->reset_func = paint_options_reset;
/* initialize the paint options structure */
options->global = NULL;
options->opacity_w = NULL;
options->paint_mode_w = NULL;
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
options->context = tool_info->context;
options->incremental_w = NULL;
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
options->incremental = options->incremental_d = FALSE;
options->incremental_save = FALSE;
options->pressure_options = NULL;
options->gradient_options = NULL;
/* the main vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox), vbox,
FALSE, FALSE, 0);
options->paint_vbox = vbox;
/* the main table */
table = gtk_table_new (2, 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
/* the opacity scale */
options->opacity_w =
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
gtk_adjustment_new (gimp_context_get_opacity (tool_info->context) * 100,
0.0, 100.0, 1.0, 1.0, 0.0);
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->opacity_w));
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
g_signal_connect (G_OBJECT (options->opacity_w), "value_changed",
G_CALLBACK (paint_options_opacity_adjustment_update),
tool_info->context);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Opacity:"), 1.0, 1.0,
scale, 1, FALSE);
g_signal_connect (G_OBJECT (tool_info->context), "opacity_changed",
G_CALLBACK (paint_options_opacity_changed),
options->opacity_w);
/* the paint mode menu */
if (tool_info->tool_type == GIMP_TYPE_BUCKET_FILL_TOOL ||
tool_info->tool_type == GIMP_TYPE_BLEND_TOOL ||
tool_info->tool_type == GIMP_TYPE_PENCIL_TOOL ||
tool_info->tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
tool_info->tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
tool_info->tool_type == GIMP_TYPE_CLONE_TOOL ||
tool_info->tool_type == GIMP_TYPE_INK_TOOL)
{
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
options->paint_mode_w =
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) 2001-07-24 Michael Natterer <mitch@gimp.org> Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) * configure.in: require glib/gtk+ >= 1.3.7, commented out the gtkxmhtml stuff. From now on, you will need glib, pango, atk and gtk+ HEAD from CVS to hack or use GIMP HEAD. Beware, it crashes randomly :) * app/core/Makefile.am * app/core/gimpmarshal.list: new file plus rules to generate gimpmarshal.[ch] from it. * app/core/* * app/tools/* * app/widgets/* * libgimpwidgets/*: started to use the glib object system. All core/ objects are still gtk objects however. All signals are created using g_signal_new(). There are many gtk+ artefacts left. Finally, we will _not_ use the gtk_signal_foo() wrappers and friends any more. * app/colormaps.c * app/devices.[ch] * app/disp_callbacks.c * app/errorconsole.c * app/file-save.[ch] * app/interface.c * app/module_db.c * app/nav_window.c * app/ops_buttons.c * app/scroll.c * app/user_install.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/brushes-commands.c * app/gui/color-notebook.c * app/gui/colormap-dialog.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradients-commands.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/layer-select.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.[ch] * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimp/gimpui.c * libgimpbase/gimpenv.c: tons and tons of changes like "const gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete and currently disables), lots of s/gtk_signal/g_signal/, removal/replacement of deprecated stuff, s/GtkSignalFunc/GCallback/ and lots of small changes and fixes while I was on it, zillions of warnings left... * modules/Makefile.am: disabled the water color selector temporarily (XInput issues). * plug-ins/Makefile.am * plug-ins/common/.cvsignore * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl: simply excluded all plug-ins which did not build (including Script-Fu). They are trivial to fix.
2001-07-25 05:27:11 +08:00
gimp_paint_mode_menu_new (G_CALLBACK (paint_options_paint_mode_update),
options,
TRUE,
gimp_context_get_paint_mode (tool_info->context));
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Mode:"), 1.0, 0.5,
options->paint_mode_w, 1, TRUE);
g_signal_connect (G_OBJECT (tool_info->context), "paint_mode_changed",
G_CALLBACK (paint_options_paint_mode_changed),
options->paint_mode_w);
}
/* show the main table */
gtk_widget_show (table);
/* a separator after the common paint options which can be global */
if (tool_info->tool_type == GIMP_TYPE_BUCKET_FILL_TOOL ||
tool_info->tool_type == GIMP_TYPE_BLEND_TOOL)
{
2001-11-10 22:17:01 +08:00
GtkWidget *separator;
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
gtk_widget_show (separator);
}
if (! gimprc.global_paint_options)
gtk_widget_show (vbox);
/* the "incremental" toggle */
if (tool_info->tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
tool_info->tool_type == GIMP_TYPE_ERASER_TOOL ||
tool_info->tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
tool_info->tool_type == GIMP_TYPE_PENCIL_TOOL)
{
options->incremental_w =
gtk_check_button_new_with_label (_("Incremental"));
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
options->incremental_w, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
gtk_widget_show (options->incremental_w);
g_signal_connect (G_OBJECT (options->incremental_w), "toggled",
G_CALLBACK (gimp_toggle_button_update),
&options->incremental);
}
options->pressure_options = paint_pressure_options_new (tool_info->tool_type,
options);
if (options->pressure_options->frame)
{
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
options->pressure_options->frame, FALSE, FALSE, 0);
gtk_widget_show (options->pressure_options->frame);
}
options->gradient_options = paint_gradient_options_new (tool_info->tool_type,
options);
if (options->gradient_options->frame)
{
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
options->gradient_options->frame, FALSE, FALSE, 0);
gtk_widget_show (options->gradient_options->frame);
}
/* register this Paintoptions structure */
paint_options_list = g_slist_prepend (paint_options_list, options);
}
GimpToolOptions *
paint_options_new (GimpToolInfo *tool_info)
{
PaintOptions *options;
options = g_new0 (PaintOptions, 1);
paint_options_init (options, tool_info);
if (gimprc.global_paint_options && options->global)
gtk_widget_show (options->global);
return (GimpToolOptions *) options;
}
void
paint_options_reset (GimpToolOptions *tool_options)
{
PaintOptions *options;
GimpContext *default_context;
options = (PaintOptions *) tool_options;
use the passed Gimp pointer instead of using "the_gimp". 2001-12-03 Michael Natterer <mitch@gimp.org> * app/devices.c: use the passed Gimp pointer instead of using "the_gimp". * app/base/temp-buf.c: indentation. * app/gui/preferences-dialog.c: prefs_toggle_callback(): fixed segfault when trying to find the prefs_dlg widget from a menu item callback (Fixes #65757). * app/gui/offset-dialog.[ch]: fixed public prototype, include the header in the .c file. * app/gui/menus.c: some menu cleanup: moved all functions which operate on the active layer/drawable to <Image>/Layer. Renamed "Layers" to "Layer". * app/display/gimpdisplayshell.c: changed menu update function accordingly. * app/gui/image-commands.[ch] * app/gui/layers-commands.[ch]: moved stuff from image-commands.* to layers-commads.*- * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/transform_options.c * plug-ins/common/align_layers.c * plug-ins/common/autocrop.c * plug-ins/common/autostretch_hsv.c * plug-ins/common/c_astretch.c * plug-ins/common/color_enhance.c * plug-ins/common/guillotine.c * plug-ins/common/normalize.c * plug-ins/common/rotate.c * plug-ins/common/threshold_alpha.c * plug-ins/common/zealouscrop.c * plug-ins/rcm/rcm.c * plug-ins/fp/fp.c: register under <Image>/Layer, some cosmetic fixes.
2001-12-04 01:59:48 +08:00
default_context = gimp_get_default_context (tool_options->tool_info->gimp);
if (options->opacity_w)
{
gimp_context_set_opacity (GIMP_CONTEXT (options->context),
gimp_context_get_opacity (default_context));
}
if (options->paint_mode_w)
{
gimp_context_set_paint_mode (GIMP_CONTEXT (options->context),
gimp_context_get_paint_mode (default_context));
}
if (options->incremental_w)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
}
paint_pressure_options_reset (options->pressure_options, options);
paint_gradient_options_reset (options->gradient_options, options);
}
void
paint_options_set_global (gboolean global)
{
PaintOptions *options;
GSList *list;
global = global ? TRUE : FALSE;
if (gimprc.global_paint_options == global)
return;
gimprc.global_paint_options = global;
for (list = paint_options_list; list; list = list->next)
{
options = (PaintOptions *) list->data;
if (global)
{
if (options->paint_vbox && GTK_WIDGET_VISIBLE (options->paint_vbox))
gtk_widget_hide (options->paint_vbox);
if (options->global && ! GTK_WIDGET_VISIBLE (options->global))
gtk_widget_show (options->global);
}
else
{
if (options->paint_vbox && ! GTK_WIDGET_VISIBLE (options->paint_vbox))
gtk_widget_show (options->paint_vbox);
if (options->global && GTK_WIDGET_VISIBLE (options->global))
gtk_widget_hide (options->global);
}
}
}
/* private functions */
static PaintPressureOptions *
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
paint_pressure_options_new (GType tool_type,
PaintOptions *paint_options)
{
PaintPressureOptions *pressure = NULL;
GtkWidget *frame = NULL;
GtkWidget *wbox = NULL;
pressure = g_new0 (PaintPressureOptions, 1);
pressure->opacity = pressure->opacity_d = TRUE;
pressure->pressure = pressure->pressure_d = TRUE;
pressure->rate = pressure->rate_d = FALSE;
pressure->size = pressure->size_d = FALSE;
pressure->color = pressure->color_d = FALSE;
pressure->opacity_w = NULL;
pressure->pressure_w = NULL;
pressure->rate_w = NULL;
pressure->size_w = NULL;
pressure->color_w = NULL;
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
tool_type == GIMP_TYPE_CLONE_TOOL ||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
tool_type == GIMP_TYPE_DODGEBURN_TOOL ||
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
tool_type == GIMP_TYPE_ERASER_TOOL ||
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
tool_type == GIMP_TYPE_PENCIL_TOOL ||
tool_type == GIMP_TYPE_SMUDGE_TOOL)
{
frame = gtk_frame_new (_("Pressure Sensitivity"));
wbox = gtk_hwrap_box_new (FALSE);
gtk_wrap_box_set_aspect_ratio (GTK_WRAP_BOX (wbox), 6);
gtk_container_add (GTK_CONTAINER (frame), wbox);
gtk_widget_show (wbox);
}
/* the opacity toggle */
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
if (tool_type == GIMP_TYPE_CLONE_TOOL ||
tool_type == GIMP_TYPE_DODGEBURN_TOOL ||
tool_type == GIMP_TYPE_ERASER_TOOL ||
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
tool_type == GIMP_TYPE_PENCIL_TOOL)
{
pressure->opacity_w =
gtk_check_button_new_with_label (_("Opacity"));
gtk_container_add (GTK_CONTAINER (wbox), pressure->opacity_w);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->opacity_w),
pressure->opacity_d);
gtk_widget_show (pressure->opacity_w);
g_signal_connect (G_OBJECT (pressure->opacity_w), "toggled",
G_CALLBACK (gimp_toggle_button_update),
&pressure->opacity);
}
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
/* the pressure toggle */
if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
tool_type == GIMP_TYPE_CLONE_TOOL ||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
tool_type == GIMP_TYPE_DODGEBURN_TOOL ||
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
tool_type == GIMP_TYPE_SMUDGE_TOOL)
{
pressure->pressure_w = gtk_check_button_new_with_label (_("Hardness"));
gtk_container_add (GTK_CONTAINER (wbox), pressure->pressure_w);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->pressure_w),
pressure->pressure_d);
gtk_widget_show (pressure->pressure_w);
g_signal_connect (G_OBJECT (pressure->pressure_w), "toggled",
G_CALLBACK (gimp_toggle_button_update),
&pressure->pressure);
}
/* the rate toggle */
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
tool_type == GIMP_TYPE_SMUDGE_TOOL)
{
pressure->rate_w =
gtk_check_button_new_with_label (_("Rate"));
gtk_container_add (GTK_CONTAINER (wbox), pressure->rate_w);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->rate_w),
pressure->rate_d);
gtk_widget_show (pressure->rate_w);
g_signal_connect (G_OBJECT (pressure->rate_w), "toggled",
G_CALLBACK (gimp_toggle_button_update),
&pressure->rate);
}
/* the size toggle */
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
tool_type == GIMP_TYPE_CLONE_TOOL ||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
tool_type == GIMP_TYPE_DODGEBURN_TOOL ||
tool_type == GIMP_TYPE_ERASER_TOOL ||
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
tool_type == GIMP_TYPE_PENCIL_TOOL)
{
pressure->size_w =
gtk_check_button_new_with_label (_("Size"));
gtk_container_add (GTK_CONTAINER (wbox), pressure->size_w);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->size_w),
pressure->size_d);
gtk_widget_show (pressure->size_w);
g_signal_connect (G_OBJECT (pressure->size_w), "toggled",
G_CALLBACK (gimp_toggle_button_update),
&pressure->size);
}
/* the color toggle */
removed crap from ancient times when tools used to be an enum. 2001-02-23 Michael Natterer <mitch@gimp.org> * app/app_procs.c: removed crap from ancient times when tools used to be an enum. * app/brush_select.[ch]: cleaned up the gui and made global paint mode toggling much simpler by expanding vertically instead of reparenting. * app/context_manager.c: removed hack by using a tool manager accessor function. * app/gimpcontext.c: use the new standard tool info object. Tools also _behave_ like all other data types now (can e.g. be refreshed). * app/tools/tool.[ch] * app/tools/gimptoolinfo.[ch]: added an "identifier" which is an untranslated string with a meaningful prefix and name, e.g. "gimp:color_picker_tool". Renamed "tool_name" and "tool_desc" to "blurb" and "help", changed the constructor accordingly. Added gimp_tool_info_get_standards() to make the context work with tool refresh. * app/tools/tool_manager.[ch] * app/tools/tools.c: removed the global list of tool class structures because the tool info list is in place. Added tool_manager_register_tool_options() which calls tool_options_dialog_add() and registers the options in the global_tool_info_list. * app/tools/Makefile.am * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/tool_options.[ch] * app/tools/tool_options_dialog.[ch]: build them all again. This is mostly the old tool options system with minor modifications to work with the new stuff. The tool options auto-update with the user context now, so there are no update functions any more. * app/gimpdnd.c * app/toolbox.c * app/tools/color_picker.c * app/tools/measure.c * app/tools/move.c: changed accordingly.
2001-02-24 05:32:47 +08:00
if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
tool_type == GIMP_TYPE_PENCIL_TOOL)
{
pressure->color_w =
gtk_check_button_new_with_label (_("Color"));
gtk_container_add (GTK_CONTAINER (wbox), pressure->color_w);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->color_w),
pressure->color_d);
gtk_widget_show (pressure->color_w);
g_signal_connect (G_OBJECT (pressure->color_w), "toggled",
G_CALLBACK (gimp_toggle_button_update),
&pressure->color);
}
pressure->frame = frame;
return pressure;
}
static void
paint_pressure_options_reset (PaintPressureOptions *pressure,
PaintOptions *paint_options)
{
if (pressure->opacity_w)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->opacity_w),
pressure->opacity_d);
}
if (pressure->pressure_w)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->pressure_w),
pressure->pressure_d);
}
if (pressure->rate_w)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->rate_w),
pressure->rate_d);
}
if (pressure->size_w)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->size_w),
pressure->size_d);
}
if (pressure->color_w)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->color_w),
pressure->color_d);
}
}
static PaintGradientOptions *
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
paint_gradient_options_new (GType tool_type,
PaintOptions *paint_options)
{
PaintGradientOptions *gradient = NULL;
GtkWidget *abox = NULL;
GtkWidget *table = NULL;
GtkWidget *type_label = NULL;
GtkWidget *spinbutton = NULL;
gradient = g_new0 (PaintGradientOptions, 1);
gradient->use_fade = gradient->use_fade_d = DEFAULT_USE_FADE;
gradient->fade_out = gradient->fade_out_d = DEFAULT_FADE_OUT;
gradient->fade_unit = gradient->fade_unit_d = DEFAULT_FADE_UNIT;
gradient->use_gradient = gradient->use_gradient_d = DEFAULT_USE_GRADIENT;
gradient->gradient_length = gradient->gradient_length_d = DEFAULT_GRADIENT_LENGTH;
gradient->gradient_unit = gradient->gradient_unit_d = DEFAULT_GRADIENT_UNIT;
gradient->gradient_type = gradient->gradient_type_d = DEFAULT_GRADIENT_TYPE;
gradient->use_fade_w = NULL;
gradient->fade_out_w = NULL;
gradient->fade_unit_w = NULL;
gradient->use_gradient_w = NULL;
gradient->gradient_length_w = NULL;
gradient->gradient_unit_w = NULL;
gradient->gradient_type_w = NULL;
if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
{
gradient->frame = gtk_frame_new (_("Gradient Options"));
table = gtk_table_new (3, 3, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 3);
gtk_container_add (GTK_CONTAINER (gradient->frame), table);
gtk_widget_show (table);
}
/* the fade options */
if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
{
abox = gtk_alignment_new (0.5, 1.0, 1.0, 0.0);
gtk_table_attach (GTK_TABLE (table), abox, 0, 1, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (abox);
/* the use fade toggle */
gradient->use_fade_w =
gtk_check_button_new_with_label (_("Fade Out"));
gtk_container_add (GTK_CONTAINER (abox), gradient->use_fade_w);
g_signal_connect (G_OBJECT (gradient->use_fade_w), "toggled",
G_CALLBACK (gimp_toggle_button_update),
&gradient->use_fade);
gtk_widget_show (gradient->use_fade_w);
/* the fade-out sizeentry */
gradient->fade_out_w =
gtk_adjustment_new (gradient->fade_out_d,
1e-5, 32767.0, 1.0, 50.0, 0.0);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (gradient->fade_out_w),
1.0, 0.0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_usize (spinbutton, 75, 0);
g_signal_connect (G_OBJECT (gradient->fade_out_w), "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&gradient->fade_out);
gtk_table_attach_defaults (GTK_TABLE (table), spinbutton, 1, 2, 0, 1);
gtk_widget_show (spinbutton);
/* the fade-out unitmenu */
gradient->fade_unit_w =
gimp_unit_menu_new ("%a", gradient->fade_unit_d, TRUE, TRUE, TRUE);
g_signal_connect (G_OBJECT (gradient->fade_unit_w), "unit_changed",
G_CALLBACK (gimp_unit_menu_update),
&gradient->fade_unit);
g_object_set_data (G_OBJECT (gradient->fade_unit_w), "set_digits",
spinbutton);
gtk_table_attach (GTK_TABLE (table), gradient->fade_unit_w, 2, 3, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (gradient->fade_unit_w);
/* automatically set the sensitive state of the fadeout stuff */
gtk_widget_set_sensitive (spinbutton, gradient->use_fade_d);
gtk_widget_set_sensitive (gradient->fade_unit_w, gradient->use_fade_d);
g_object_set_data (G_OBJECT (gradient->use_fade_w),
"set_sensitive", spinbutton);
g_object_set_data (G_OBJECT (spinbutton),
"set_sensitive", gradient->fade_unit_w);
}
/* the gradient options */
if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
{
abox = gtk_alignment_new (0.5, 1.0, 1.0, 0.0);
gtk_table_attach (GTK_TABLE (table), abox, 0, 1, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (abox);
/* the use gradient toggle */
gradient->use_gradient_w =
gtk_check_button_new_with_label (_("Gradient"));
gtk_container_add (GTK_CONTAINER (abox), gradient->use_gradient_w);
g_signal_connect (G_OBJECT (gradient->use_gradient_w), "toggled",
G_CALLBACK (paint_gradient_options_gradient_toggle_callback),
paint_options);
gtk_widget_show (gradient->use_gradient_w);
/* the gradient length scale */
gradient->gradient_length_w =
gtk_adjustment_new (gradient->gradient_length_d,
1e-5, 32767.0, 1.0, 50.0, 0.0);
spinbutton =
gtk_spin_button_new (GTK_ADJUSTMENT (gradient->gradient_length_w),
1.0, 0.0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_usize (spinbutton, 75, 0);
g_signal_connect (G_OBJECT (gradient->gradient_length_w), "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&gradient->gradient_length);
gtk_table_attach_defaults (GTK_TABLE (table), spinbutton, 1, 2, 1, 2);
gtk_widget_show (spinbutton);
/* the gradient unitmenu */
gradient->gradient_unit_w =
gimp_unit_menu_new ("%a", gradient->gradient_unit_d, TRUE, TRUE, TRUE);
g_signal_connect (G_OBJECT (gradient->gradient_unit_w), "unit_changed",
G_CALLBACK (gimp_unit_menu_update),
&gradient->gradient_unit);
g_object_set_data (G_OBJECT (gradient->gradient_unit_w), "set_digits",
spinbutton);
gtk_table_attach (GTK_TABLE (table), gradient->gradient_unit_w, 2, 3, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (gradient->gradient_unit_w);
/* the gradient type */
type_label = gtk_label_new (_("Type:"));
gtk_misc_set_alignment (GTK_MISC (type_label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (table), type_label, 0, 1, 2, 3,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (type_label);
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 3, 2, 3);
gtk_widget_show (abox);
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) 2001-07-24 Michael Natterer <mitch@gimp.org> Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) * configure.in: require glib/gtk+ >= 1.3.7, commented out the gtkxmhtml stuff. From now on, you will need glib, pango, atk and gtk+ HEAD from CVS to hack or use GIMP HEAD. Beware, it crashes randomly :) * app/core/Makefile.am * app/core/gimpmarshal.list: new file plus rules to generate gimpmarshal.[ch] from it. * app/core/* * app/tools/* * app/widgets/* * libgimpwidgets/*: started to use the glib object system. All core/ objects are still gtk objects however. All signals are created using g_signal_new(). There are many gtk+ artefacts left. Finally, we will _not_ use the gtk_signal_foo() wrappers and friends any more. * app/colormaps.c * app/devices.[ch] * app/disp_callbacks.c * app/errorconsole.c * app/file-save.[ch] * app/interface.c * app/module_db.c * app/nav_window.c * app/ops_buttons.c * app/scroll.c * app/user_install.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/brushes-commands.c * app/gui/color-notebook.c * app/gui/colormap-dialog.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradients-commands.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/layer-select.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.[ch] * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimp/gimpui.c * libgimpbase/gimpenv.c: tons and tons of changes like "const gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete and currently disables), lots of s/gtk_signal/g_signal/, removal/replacement of deprecated stuff, s/GtkSignalFunc/GCallback/ and lots of small changes and fixes while I was on it, zillions of warnings left... * modules/Makefile.am: disabled the water color selector temporarily (XInput issues). * plug-ins/Makefile.am * plug-ins/common/.cvsignore * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl: simply excluded all plug-ins which did not build (including Script-Fu). They are trivial to fix.
2001-07-25 05:27:11 +08:00
gradient->gradient_type_w =
gimp_option_menu_new2 (FALSE,
G_CALLBACK (gimp_menu_item_update),
&gradient->gradient_type,
(gpointer) gradient->gradient_type_d,
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) 2001-07-24 Michael Natterer <mitch@gimp.org> Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) * configure.in: require glib/gtk+ >= 1.3.7, commented out the gtkxmhtml stuff. From now on, you will need glib, pango, atk and gtk+ HEAD from CVS to hack or use GIMP HEAD. Beware, it crashes randomly :) * app/core/Makefile.am * app/core/gimpmarshal.list: new file plus rules to generate gimpmarshal.[ch] from it. * app/core/* * app/tools/* * app/widgets/* * libgimpwidgets/*: started to use the glib object system. All core/ objects are still gtk objects however. All signals are created using g_signal_new(). There are many gtk+ artefacts left. Finally, we will _not_ use the gtk_signal_foo() wrappers and friends any more. * app/colormaps.c * app/devices.[ch] * app/disp_callbacks.c * app/errorconsole.c * app/file-save.[ch] * app/interface.c * app/module_db.c * app/nav_window.c * app/ops_buttons.c * app/scroll.c * app/user_install.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/brushes-commands.c * app/gui/color-notebook.c * app/gui/colormap-dialog.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradients-commands.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/layer-select.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.[ch] * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimp/gimpui.c * libgimpbase/gimpenv.c: tons and tons of changes like "const gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete and currently disables), lots of s/gtk_signal/g_signal/, removal/replacement of deprecated stuff, s/GtkSignalFunc/GCallback/ and lots of small changes and fixes while I was on it, zillions of warnings left... * modules/Makefile.am: disabled the water color selector temporarily (XInput issues). * plug-ins/Makefile.am * plug-ins/common/.cvsignore * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl: simply excluded all plug-ins which did not build (including Script-Fu). They are trivial to fix.
2001-07-25 05:27:11 +08:00
_("Once Forward"),
GINT_TO_POINTER (ONCE_FORWARD), NULL,
_("Once Backward"),
GINT_TO_POINTER (ONCE_BACKWARDS), NULL,
_("Loop Sawtooth"),
GINT_TO_POINTER (LOOP_SAWTOOTH), NULL,
_("Loop Triangle"),
GINT_TO_POINTER (LOOP_TRIANGLE), NULL,
NULL);
gtk_container_add (GTK_CONTAINER (abox), gradient->gradient_type_w);
gtk_widget_show (gradient->gradient_type_w);
gtk_widget_show (table);
/* automatically set the sensitive state of the gradient stuff */
gtk_widget_set_sensitive (spinbutton, gradient->use_gradient_d);
gtk_widget_set_sensitive (spinbutton, gradient->use_gradient_d);
gtk_widget_set_sensitive (gradient->gradient_unit_w,
gradient->use_gradient_d);
gtk_widget_set_sensitive (gradient->gradient_type_w,
gradient->use_gradient_d);
gtk_widget_set_sensitive (type_label, gradient->use_gradient_d);
gtk_widget_set_sensitive (paint_options->incremental_w,
! gradient->use_gradient_d);
g_object_set_data (G_OBJECT (gradient->use_gradient_w),
"set_sensitive",
spinbutton);
g_object_set_data (G_OBJECT (spinbutton), "set_sensitive",
gradient->gradient_unit_w);
g_object_set_data (G_OBJECT (gradient->gradient_unit_w),
"set_sensitive",
gradient->gradient_type_w);
g_object_set_data (G_OBJECT (gradient->gradient_type_w),
"set_sensitive",
type_label);
g_object_set_data (G_OBJECT (gradient->use_gradient_w),
"inverse_sensitive",
paint_options->incremental_w);
}
return gradient;
}
static void
paint_gradient_options_reset (PaintGradientOptions *gradient,
PaintOptions *paint_options)
{
GtkWidget *spinbutton;
gint digits;
if (gradient->use_fade_w)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gradient->use_fade_w),
gradient->use_fade_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (gradient->fade_out_w),
gradient->fade_out_d);
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (gradient->fade_unit_w),
gradient->fade_unit_d);
digits = ((gradient->fade_unit_d == GIMP_UNIT_PIXEL) ? 0 :
((gradient->fade_unit_d == GIMP_UNIT_PERCENT) ? 2 :
(MIN (6, MAX (3, gimp_unit_get_digits (gradient->fade_unit_d))))));
spinbutton = g_object_get_data (G_OBJECT (gradient->fade_unit_w),
"set_digits");
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
}
if (gradient->use_gradient_w)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gradient->use_gradient_w),
gradient->use_gradient_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (gradient->gradient_length_w),
gradient->gradient_length_d);
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (gradient->gradient_unit_w),
gradient->gradient_unit_d);
digits = ((gradient->gradient_unit_d == GIMP_UNIT_PIXEL) ? 0 :
((gradient->gradient_unit_d == GIMP_UNIT_PERCENT) ? 2 :
(MIN (6, MAX (3, gimp_unit_get_digits (gradient->gradient_unit_d))))));
spinbutton = g_object_get_data (G_OBJECT (gradient->gradient_unit_w),
"set_digits");
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
gradient->gradient_type = gradient->gradient_type_d;
gtk_option_menu_set_history (GTK_OPTION_MENU (gradient->gradient_type_w),
gradient->gradient_type_d);
}
}
static void
paint_options_opacity_adjustment_update (GtkAdjustment *adjustment,
gpointer data)
{
g_signal_handlers_block_by_func (G_OBJECT (data),
paint_options_opacity_changed,
adjustment);
gimp_context_set_opacity (GIMP_CONTEXT (data),
adjustment->value / 100);
g_signal_handlers_unblock_by_func (G_OBJECT (data),
paint_options_opacity_changed,
adjustment);
}
static void
paint_options_opacity_changed (GimpContext *context,
gdouble opacity,
gpointer data)
{
g_signal_handlers_block_by_func (G_OBJECT (data),
paint_options_opacity_adjustment_update,
context);
gtk_adjustment_set_value (GTK_ADJUSTMENT (data), opacity * 100);
g_signal_handlers_unblock_by_func (G_OBJECT (data),
paint_options_opacity_adjustment_update,
context);
}
static void
paint_options_paint_mode_update (GtkWidget *widget,
gpointer data)
{
LayerModeEffects paint_mode;
PaintOptions *options;
paint_mode =
use "gimp-item-data" instead of "user_data" as data key when attaching 2001-11-22 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpwidgets.[ch]: use "gimp-item-data" instead of "user_data" as data key when attaching values to radio buttons or menu items. (For backward compat, attach "user_data" additionally, but don't use it to _get_data()). Added gimp_radio_group_set_active() which works like gimp_options_menu_set_history() and sets the active item by attached "gimp-item-data" value. * app/gui/brush-select.c * app/gui/file-new-dialog.c * app/gui/info-window.c * app/gui/preferences-dialog.c * app/gui/resolution-calibrate-dialog.c * app/tools/gimpbucketfilltool.c * app/tools/gimpselectiontool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimplayerlistview.c: removed all kinds of "user_data" stuff and evil hacks to find a radio button by the value it represents (simply call gimp_radio_group_set_active()). * app/tools/gimpdrawtool.c: added a g_return_if_fail(). * app/tools/gimpfliptool.c: don't set draw_tool_class->draw to NULL, * app/tools/gimptransformtool.[ch]: fixed some stuff i broke when removing the old "interactive" boolean (there is no non-interactive transform tool any more). Put the info_dialog pointer and the old_trans_info array into the GimpTransformTool instance. Added gimp_transform_tool_info_dialog_connect(). Don't include any subclasses any more. * app/tools/gimpperspectivetool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c: use gimp_transform_tool_info_dialog_connect() to create and connect the info dialogs' action_area.
2001-11-22 21:01:26 +08:00
(LayerModeEffects) g_object_get_data (G_OBJECT (widget), "gimp-item-data");
options = (PaintOptions *) data;
g_signal_handlers_block_by_func (G_OBJECT (options->context),
paint_options_paint_mode_changed,
options->paint_mode_w);
gimp_context_set_paint_mode (GIMP_CONTEXT (options->context), paint_mode);
g_signal_handlers_unblock_by_func (G_OBJECT (options->context),
paint_options_paint_mode_changed,
options->paint_mode_w);
}
static void
paint_options_paint_mode_changed (GimpContext *context,
LayerModeEffects paint_mode,
gpointer data)
{
gimp_option_menu_set_history (GTK_OPTION_MENU (data), (gpointer) paint_mode);
}
static void
paint_gradient_options_gradient_toggle_callback (GtkWidget *widget,
PaintOptions *options)
{
gimp_toggle_button_update (widget, &options->gradient_options->use_gradient);
if (options->gradient_options->use_gradient)
{
options->incremental_save = options->incremental;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
TRUE);
}
else
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_save);
}
}