gimp/app/tools/gimppaintoptions-gui.c

566 lines
21 KiB
C
Raw Normal View History

/* GIMP - The GNU 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 3 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, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.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"
#include "core/gimptoolinfo.h"
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
#include "paint/gimppaintoptions.h"
#include "widgets/gimplayermodebox.h"
Added object properties for almost all tool_options values and registered 2003-02-07 Michael Natterer <mitch@gimp.org> Added object properties for almost all tool_options values and registered lots of enums with the type system: Part I (enum and type cleanup): * app/core/core-enums.[ch] * app/core/core-types.h: removed InternalOrientaionType and register GimpOrientationType. Register GimpChannelOps. Removed GimpToolOptionsGUIFunc. * app/xcf/xcf-private.h: added XcfOrientationType with the same values as the old InternalOrientationType * app/xcf/xcf-load.c * app/xcf/xcf-save.c: translate between GimpOrientationType and XcfOrientationType. * app/core/gimpdrawable-transform-utils.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.h * app/display/gimpdisplayshell.c * tools/pdbgen/stddefs.pdb * tools/pdbgen/pdb/transform_tools.pdb: changed accordingly. * app/pdb/guides_cmds.c * app/pdb/transform_tools_cmds.c * libgimp/gimpenums.h * libgimpproxy/gimpproxytypes.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimptool/gimptoolenums.[ch]: added GimpTransformGridType. * libgimptool/gimptooltypes.h: removed GimpToolOptionsResetFunc, added GimpToolOptionsGUIFunc. Part II (tool options changes): * app/config/gimpconfig-utils.c (gimp_config_reset_properties): don't reset object properties because they have NULL as default value. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_[enum|boolean]_radio_frame_new(), gimp_prop_paint_mode_menu_new() and gimp_prop_scale_entry_new(), which are all needed by the new tool options GUI code. * app/tools/tool_options.[ch]: removed the "reset_func" since the virtual reset() method is used now. * app/paint/gimpairbrushoptions.[ch] * app/paint/gimpcloneoptions.[ch] * app/paint/gimpconvolveoptions.[ch] * app/paint/gimpdodgeburnoptions.[ch] * app/paint/gimperaseroptions.[ch] * app/paint/gimppaintoptions.[ch] * app/paint/gimpsmudgeoptions.[ch]: added properties all over the place and removed the widget and default_value members from the structs. Renamed some values (e.g. s/type/clone_type/). Don't #include <gtk/gtk.h>. * 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/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: changed accordingly. Don't #include <gtk/gtk.h>. * tools/pdbgen/pdb/paint_tools.pdb: changed accordingly. * app/pdb/paint_tools_cmds.c: regenerated. * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpcropoptions.[ch] * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.c * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimptextoptions.c * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/transform_options.[ch]: ditto: added properties and removed widget and default_value stuff. Removed most reset functions. Use gimp_prop widgets all over the place, renamed some values as above. * app/tools/Makefile.am * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmovetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptransformtool.c * app/tools/gimpvectoroptions.c: changed accordingly. Ported the paint_options GUI constructors to gimp_prop widgets. * app/widgets/gimpselectioneditor.c * app/gui/tool-options-dialog.c: changed accordingly.
2003-02-08 01:12:21 +08:00
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpviewablebox.h"
#include "widgets/gimpwidgets-constructors.h"
#include "widgets/gimpwidgets-utils.h"
2001-04-11 09:13:53 +08:00
#include "gimpairbrushtool.h"
#include "gimpclonetool.h"
#include "gimpconvolvetool.h"
#include "gimpdodgeburntool.h"
#include "gimperasertool.h"
Merged the "soc-2006-healing-brush" branch. That branch is now officially 2006-09-02 Michael Natterer <mitch@gimp.org> Merged the "soc-2006-healing-brush" branch. That branch is now officially closed and all further fixes and changes have to be applied to HEAD. Did some minor adjustments, mostly small indentation and spacing fixes. Derive the tool from the newly introduced GimpBrushTool which did not exist when the branch was created. Thanks a lot to Kevin Sookocheff for this nice contribution! * app/paint/paint-enums.[ch]: new enum GimpHealAlignMode. * app/paint/Makefile.am * app/paint/makefile.msc * app/paint/gimpheal.[ch] * app/paint/gimphealoptions.[ch]: the heal core and its options. * app/paint/gimp-paint.c: register the heal core. * app/tools/Makefile.am * app/tools/makefile.msc * app/tools/gimphealtool.[ch]: the heal tool. * app/tools/gimp-tools.c: register the heal tool. * app/tools/gimppaintoptions-gui.c: show the widgets that are used by heal. * app/widgets/gimphelp-ids.h: the heal help ID. * tools/pdbgen/stddefs.pdb * tools/pdbgen/pdb/paint_tools.pdb: the heal PDB wrappers. * app/widgets/widgets-enums.h * app/widgets/gimpcursor.c * cursors/Makefile.am * cursors/makefile.msc * cursors/tool-heal.png * cursors/xbm/tool-heal.xbm * cursors/xbm/tool-heal-mask.xbm: a new cursor for the heal tool. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/makefile.msc * themes/Default/images/tools/stock-tool-heal-16.png * themes/Default/images/tools/stock-tool-heal-22.png: new stock icons for the heal tool. * app/pdb/internal_procs.c * app/pdb/paint_tools_cmds.c * libgimp/gimppainttools_pdb.[ch]: regenerated.
2006-09-03 02:54:35 +08:00
#include "gimphealtool.h"
#include "gimpinktool.h"
#include "gimpmybrushtool.h"
#include "gimppaintoptions-gui.h"
#include "gimppenciltool.h"
#include "gimpperspectiveclonetool.h"
#include "gimpsmudgetool.h"
#include "gimptooloptions-gui.h"
#include "gimp-intl.h"
static void gimp_paint_options_gui_reset_size (GtkWidget *button,
GimpPaintOptions *paint_options);
static void gimp_paint_options_gui_reset_aspect_ratio
(GtkWidget *button,
GimpPaintOptions *paint_options);
static void gimp_paint_options_gui_reset_angle (GtkWidget *button,
GimpPaintOptions *paint_options);
static void gimp_paint_options_gui_reset_spacing
(GtkWidget *button,
GimpPaintOptions *paint_options);
static void gimp_paint_options_gui_reset_hardness
(GtkWidget *button,
GimpPaintOptions *paint_options);
static void gimp_paint_options_gui_reset_force (GtkWidget *button,
GimpPaintOptions *paint_options);
static GtkWidget * dynamics_options_gui (GimpPaintOptions *paint_options,
GType tool_type);
static GtkWidget * jitter_options_gui (GimpPaintOptions *paint_options,
GType tool_type);
static GtkWidget * smoothing_options_gui (GimpPaintOptions *paint_options,
GType tool_type);
2014-11-16 05:23:14 +08:00
static GtkWidget * gimp_paint_options_gui_scale_with_buttons
(GObject *config,
gchar *prop_name,
gchar *link_prop_name,
gchar *reset_tooltip,
gdouble step_increment,
gdouble page_increment,
gint digits,
gdouble scale_min,
gdouble scale_max,
gdouble factor,
gdouble gamma,
GCallback reset_callback,
GtkSizeGroup *link_group);
Applied modified patch from Alexia Death which adds velocity support to 2008-05-10 Michael Natterer <mitch@gimp.org> Applied modified patch from Alexia Death which adds velocity support to paint tools in the spirit of the pressure support we already have. Fixes bug #529431. * app/display/gimpdisplayshell-coords.c (gimp_display_shell_eval_event): tweak velocity calculation to work in screen coordinates. * app/paint/gimppaintoptions.[ch]: add velocity options in the same way as there are pressure options. Add utility functions which return dynamic opatity and dynamic rate according to the the option's settings and some GimpCoords' pressure and velocity. * app/tools/gimppaintoptions-gui.c: add GUI for the velocity options. * app/paint/gimpbrushcore.h: remove PRESSURE_SCALE define, it's now in gimppaintoptions.h. * app/paint/gimpbrushcore.c (gimp_brush_core_interpolate): inerpolate velocity too. (gimp_brush_core_calc_brush_scale): take velocity into account. (gimp_brush_core_get_brush_mask): always pressurize the mask in the GIMP_BRUSH_PRESSURE because there always is velocity (unlike pressure which is only there on tablets). * app/paint/gimpairbrush.c * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimpheal.c * app/paint/gimppaintbrush.c * app/paint/gimpsmudge.c: get opacity and rate from the new paint options utility functions which take both pressure and velocity into account. * app/paint/gimppaintbrush.c: take velocity into account when calculating the gradient color offset. * app/paint/gimpairbrush.c: do some additional fiddling with velocity in the asynchronous airbrush timeout. * app/paint/gimpairbrushoptions.c: override the velocity-size property and have it default to FALSE. svn path=/trunk/; revision=25604
2008-05-10 18:03:21 +08:00
/* public functions */
simplified everything a lot by merging the public GimpContextPropType enum 2003-02-09 Michael Natterer <mitch@gimp.org> * app/core/gimpcontext.[ch]: simplified everything a lot by merging the public GimpContextPropType enum with the internal anonymous object property id enum. Removed the internal copy_prop functions and handle property copying in a big switch() in gimp_context_copy_property(). Removed the separate signal connections for each property of the parent context and do the same using a single "notify" handler. Emit "notify" signals all over the place. Removed internal arrays which are no longer needed due to enum merge and copy_property simplification. Removed the array of signal names and use g_signal_name(). Removed gimp_context_unset_parent() and allow "parent" being NULL in gimp_context_set_parent(). * app/tools/tool_manager.c * app/widgets/gimpdevices.c: changed accordingly. * libgimptool/gimptooltypes.h: changed GimpToolOptionsGUIFunc to return a GtkWidget (the created tool options widget). * libgimptool/gimptoolmodule.c: #include <gtk/gtk.h> * app/tools/tool_options.[ch]: removed the "main_vbox" from the GimpToolOptions struct. Changed gimp_tool_options_gui() to create and return the main_vbox. * app/tools/tool_manager.c: create the "This Tool has no Options" label here if NULL was passed as "options_gui_func". Attach the options widget to the tool_options object using g_object_set_data(). * app/gui/tool-options-dialog.c: changed accordingly. * app/tools/gimpairbrushtool.c * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpconvolvetool.c * app/tools/gimpcropoptions.[ch] * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.[ch] * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimpselectionoptions.[ch] * app/tools/gimpsmudgetool.c * app/tools/gimptextoptions.[ch] * app/tools/gimptransformoptions.[ch] * app/tools/gimpvectoroptions.[ch] * app/tools/paint_options.[ch]: return the options vbox from all tool_options_gui functions.
2003-02-10 01:32:52 +08:00
GtkWidget *
Made GimpToolOptions a GimpContext subclass and objectified all tool 2003-02-05 Michael Natterer <mitch@gimp.org> Made GimpToolOptions a GimpContext subclass and objectified all tool options types. * app/core/core-types.h: replaced GimpToolOptionsNewFunc by GimpToolOptionsGUIFunc. * libgimpproxy/gimpproxytypes.h: regenerated. * app/core/gimppaintinfo.[ch]: added "GType paint_options_type". * app/core/gimptoolinfo.[ch]: added "GType tool_options_type", removed tool_info->context since GimpToolOptions are a GimpContext now. Added "gboolean use_context" as a temp_hack. * libgimptool/gimptooltypes.h: added the tool_options_type to the tool registering callback. * app/tools/tool_options.[ch]: is a real GimpContext subclass now. * app/paint/paint-types.h * app/paint/paint.c: added the paint_options_type to the paint registering stuff. * app/paint/gimppaintoptions.[ch]: is a real GimpToolOptions subclass now. * app/paint/Makefile.am * app/paint/gimpairbrushoptions.[ch] * app/paint/gimpcloneoptions.[ch] * app/paint/gimpconvolveoptions.[ch] * app/paint/gimpdodgeburnoptions.[ch] * app/paint/gimperaseroptions.[ch] * app/paint/gimpsmudgeoptions.[ch]: new files holding GimpPaintOptions subclasses. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.c * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: removed paint options stuff, lots of related changed & cleanups. * tools/pdbgen/pdb/paint_tools.pdb: changed accordingly. * app/pdb/paint_tools_cmds.c: regenerated. * app/tools/Makefile.am * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpcropoptions.[ch] * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.[ch] * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimptextoptions.[ch] * app/tools/gimpvectoroptions.[ch]: new files holding the various tool options classes. * app/tools/selection_options.[ch] * app/tools/transform_options.[ch]: made them objects. * app/tools/paint_options.[ch]: contains only the paint_options GUI and reset stuff. * app/tools/tools-types.h: removed SelectionOptions typedef for now. * app/tools/[all tools]: removed the tool options stuff except some GUI constructors. Tons of related changes. * app/tools/tool_manager.[ch]: changed tool registration / restore / switching accordingly. * app/widgets/gimpdrawablelistview.c * app/widgets/gimpselectioneditor.c: changed accordingly.
2003-02-05 22:39:40 +08:00
gimp_paint_options_gui (GimpToolOptions *tool_options)
{
GObject *config = G_OBJECT (tool_options);
GimpPaintOptions *options = GIMP_PAINT_OPTIONS (tool_options);
GtkWidget *vbox = gimp_tool_options_gui (tool_options);
GtkWidget *menu;
GtkWidget *scale;
GType tool_type;
tool_type = tool_options->tool_info->tool_type;
/* the paint mode menu */
menu = gimp_prop_layer_mode_box_new (config, "paint-mode",
GIMP_LAYER_MODE_CONTEXT_PAINT);
gimp_layer_mode_box_set_label (GIMP_LAYER_MODE_BOX (menu), _("Mode"));
gimp_layer_mode_box_set_ellipsize (GIMP_LAYER_MODE_BOX (menu),
PANGO_ELLIPSIZE_END);
gtk_box_pack_start (GTK_BOX (vbox), menu, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (vbox),
"gimp-paint-options-gui-paint-mode-box", menu);
if (tool_type == GIMP_TYPE_ERASER_TOOL ||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
tool_type == GIMP_TYPE_HEAL_TOOL ||
tool_type == GIMP_TYPE_MYBRUSH_TOOL ||
tool_type == GIMP_TYPE_SMUDGE_TOOL)
{
gtk_widget_set_sensitive (menu, FALSE);
}
/* the opacity scale */
scale = gimp_prop_spin_scale_new (config, "opacity", 0.01, 0.1, 0);
gimp_spin_scale_set_constrain_drag (GIMP_SPIN_SCALE (scale), TRUE);
gimp_prop_widget_set_factor (scale, 100.0, 1.0, 10.0, 1);
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
/* temp debug foo, disabled in stable */
if (FALSE &&
g_type_is_a (tool_type, GIMP_TYPE_PAINT_TOOL) &&
tool_type != GIMP_TYPE_MYBRUSH_TOOL)
{
GtkWidget *button;
button = gimp_prop_check_button_new (config, "use-applicator", NULL);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
}
/* the brush */
if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
Separated tool_options creation from tool registration so we don't 2002-06-17 Michael Natterer <mitch@gimp.org> Separated tool_options creation from tool registration so we don't implicitly create widgets before gui_init(): * libgimptool/gimptooltypes.h: removed GimpToolOptionsNewFunc typedef here... * app/core/core-types.h: ...and added it here. * libgimpproxy/gimpproxytypes.h: regenerated. * app/core/gimptoolinfo.[ch]: added a GimpToolOptionsNewFunc pointer to remember the constructor. Fixed the finalize() method (bug was never noticed because we leaked all tool infos) * app/tools/tool_manager.[ch]: moved tool_options creation to the new function tool_manager_restore(). Unref the tool infos after adding them to their container. Added "brush" and "gradient" to the context properties which are defined for tool contexts. * app/app_procs.c: call tool_manager_restore() after gui_init(). * app/gui/gui.c: removed the hack introduced recently and call render_setup() in gui_init() again, not in gui_themes_init(). Use the correct contexts now that they are properly initialized at the time of tool_options creation: * app/tools/gimpblendtool.c: use tool_info->context, not gimp_get_user_context() to get/set the tool's gradient. * app/paint/gimppaintcore.[ch] (gimp_paint_core_start): added a GimpPaintOptions paramater and get the brush to use from paint_options->context (instead of gimp_get_current_context()). * app/paint/gimppaintcore-stroke.c * app/tools/gimppainttool.c: changed accordingly. * app/tools/paint_options.c: added a brush preview to the paint options.
2002-06-17 18:34:28 +08:00
{
GtkSizeGroup *link_group;
GtkWidget *button;
GtkWidget *frame;
GtkWidget *hbox;
2009-04-26 01:53:09 +08:00
button = gimp_prop_brush_box_new (NULL, GIMP_CONTEXT (tool_options),
_("Brush"), 2,
"brush-view-type", "brush-view-size",
"gimp-brush-editor",
_("Edit this brush"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
link_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
hbox = gimp_paint_options_gui_scale_with_buttons
(config, "brush-size", "brush-link-size",
2014-11-16 05:23:14 +08:00
_("Reset size to brush's native size"),
1.0, 10.0, 2, 1.0, 1000.0, 1.0, 1.7,
G_CALLBACK (gimp_paint_options_gui_reset_size), link_group);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
hbox = gimp_paint_options_gui_scale_with_buttons
(config, "brush-aspect-ratio", "brush-link-aspect-ratio",
_("Reset aspect ratio to brush's native aspect ratio"),
0.1, 1.0, 2, -20.0, 20.0, 1.0, 1.0,
G_CALLBACK (gimp_paint_options_gui_reset_aspect_ratio), link_group);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
hbox = gimp_paint_options_gui_scale_with_buttons
(config, "brush-angle", "brush-link-angle",
_("Reset angle to brush's native angle"),
0.1, 1.0, 2, -180.0, 180.0, 1.0, 1.0,
G_CALLBACK (gimp_paint_options_gui_reset_angle), link_group);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
hbox = gimp_paint_options_gui_scale_with_buttons
(config, "brush-spacing", "brush-link-spacing",
2014-11-16 05:23:14 +08:00
_("Reset spacing to brush's native spacing"),
0.1, 1.0, 1, 1.0, 200.0, 100.0, 1.7,
G_CALLBACK (gimp_paint_options_gui_reset_spacing), link_group);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
hbox = gimp_paint_options_gui_scale_with_buttons
(config, "brush-hardness", "brush-link-hardness",
_("Reset hardness to brush's native hardness"),
0.1, 1.0, 1, 0.0, 100.0, 100.0, 1.0,
G_CALLBACK (gimp_paint_options_gui_reset_hardness), link_group);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
hbox = gimp_paint_options_gui_scale_with_buttons
(config, "brush-force", NULL,
_("Reset force to default"),
0.1, 1.0, 1, 0.0, 100.0, 100.0, 1.0,
G_CALLBACK (gimp_paint_options_gui_reset_force), link_group);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
if (tool_type == GIMP_TYPE_PENCIL_TOOL)
gtk_widget_set_sensitive (hbox, FALSE);
g_object_unref (link_group);
frame = dynamics_options_gui (options, tool_type);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
frame = jitter_options_gui (options, tool_type);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
}
/* the "smooth stroke" options */
if (g_type_is_a (tool_type, GIMP_TYPE_PAINT_TOOL))
{
GtkWidget *frame;
frame = smoothing_options_gui (options, tool_type);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
}
/* the "Lock brush to view" toggle */
2014-11-14 02:32:59 +08:00
if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
{
GtkWidget *button;
button = gimp_prop_check_button_new (config, "brush-lock-to-view", NULL);
2014-11-14 02:32:59 +08:00
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
}
/* the "incremental" toggle */
if (tool_type == GIMP_TYPE_PENCIL_TOOL ||
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
tool_type == GIMP_TYPE_ERASER_TOOL ||
tool_type == GIMP_TYPE_DODGE_BURN_TOOL)
{
GtkWidget *button;
button = gimp_prop_enum_check_button_new (config, "application-mode",
NULL,
GIMP_PAINT_CONSTANT,
GIMP_PAINT_INCREMENTAL);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
}
/* the "hard edge" toggle */
if (tool_type == GIMP_TYPE_ERASER_TOOL ||
tool_type == GIMP_TYPE_CLONE_TOOL ||
tool_type == GIMP_TYPE_HEAL_TOOL ||
tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
tool_type == GIMP_TYPE_SMUDGE_TOOL)
{
GtkWidget *button;
button = gimp_prop_check_button_new (config, "hard", NULL);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
}
simplified everything a lot by merging the public GimpContextPropType enum 2003-02-09 Michael Natterer <mitch@gimp.org> * app/core/gimpcontext.[ch]: simplified everything a lot by merging the public GimpContextPropType enum with the internal anonymous object property id enum. Removed the internal copy_prop functions and handle property copying in a big switch() in gimp_context_copy_property(). Removed the separate signal connections for each property of the parent context and do the same using a single "notify" handler. Emit "notify" signals all over the place. Removed internal arrays which are no longer needed due to enum merge and copy_property simplification. Removed the array of signal names and use g_signal_name(). Removed gimp_context_unset_parent() and allow "parent" being NULL in gimp_context_set_parent(). * app/tools/tool_manager.c * app/widgets/gimpdevices.c: changed accordingly. * libgimptool/gimptooltypes.h: changed GimpToolOptionsGUIFunc to return a GtkWidget (the created tool options widget). * libgimptool/gimptoolmodule.c: #include <gtk/gtk.h> * app/tools/tool_options.[ch]: removed the "main_vbox" from the GimpToolOptions struct. Changed gimp_tool_options_gui() to create and return the main_vbox. * app/tools/tool_manager.c: create the "This Tool has no Options" label here if NULL was passed as "options_gui_func". Attach the options widget to the tool_options object using g_object_set_data(). * app/gui/tool-options-dialog.c: changed accordingly. * app/tools/gimpairbrushtool.c * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpconvolvetool.c * app/tools/gimpcropoptions.[ch] * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.[ch] * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimpselectionoptions.[ch] * app/tools/gimpsmudgetool.c * app/tools/gimptextoptions.[ch] * app/tools/gimptransformoptions.[ch] * app/tools/gimpvectoroptions.[ch] * app/tools/paint_options.[ch]: return the options vbox from all tool_options_gui functions.
2003-02-10 01:32:52 +08:00
return vbox;
}
GtkWidget *
gimp_paint_options_gui_get_paint_mode_box (GtkWidget *options_gui)
{
return g_object_get_data (G_OBJECT (options_gui),
"gimp-paint-options-gui-paint-mode-box");
}
/* private functions */
Added object properties for almost all tool_options values and registered 2003-02-07 Michael Natterer <mitch@gimp.org> Added object properties for almost all tool_options values and registered lots of enums with the type system: Part I (enum and type cleanup): * app/core/core-enums.[ch] * app/core/core-types.h: removed InternalOrientaionType and register GimpOrientationType. Register GimpChannelOps. Removed GimpToolOptionsGUIFunc. * app/xcf/xcf-private.h: added XcfOrientationType with the same values as the old InternalOrientationType * app/xcf/xcf-load.c * app/xcf/xcf-save.c: translate between GimpOrientationType and XcfOrientationType. * app/core/gimpdrawable-transform-utils.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.h * app/display/gimpdisplayshell.c * tools/pdbgen/stddefs.pdb * tools/pdbgen/pdb/transform_tools.pdb: changed accordingly. * app/pdb/guides_cmds.c * app/pdb/transform_tools_cmds.c * libgimp/gimpenums.h * libgimpproxy/gimpproxytypes.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimptool/gimptoolenums.[ch]: added GimpTransformGridType. * libgimptool/gimptooltypes.h: removed GimpToolOptionsResetFunc, added GimpToolOptionsGUIFunc. Part II (tool options changes): * app/config/gimpconfig-utils.c (gimp_config_reset_properties): don't reset object properties because they have NULL as default value. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_[enum|boolean]_radio_frame_new(), gimp_prop_paint_mode_menu_new() and gimp_prop_scale_entry_new(), which are all needed by the new tool options GUI code. * app/tools/tool_options.[ch]: removed the "reset_func" since the virtual reset() method is used now. * app/paint/gimpairbrushoptions.[ch] * app/paint/gimpcloneoptions.[ch] * app/paint/gimpconvolveoptions.[ch] * app/paint/gimpdodgeburnoptions.[ch] * app/paint/gimperaseroptions.[ch] * app/paint/gimppaintoptions.[ch] * app/paint/gimpsmudgeoptions.[ch]: added properties all over the place and removed the widget and default_value members from the structs. Renamed some values (e.g. s/type/clone_type/). Don't #include <gtk/gtk.h>. * 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/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: changed accordingly. Don't #include <gtk/gtk.h>. * tools/pdbgen/pdb/paint_tools.pdb: changed accordingly. * app/pdb/paint_tools_cmds.c: regenerated. * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpcropoptions.[ch] * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.c * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimptextoptions.c * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/transform_options.[ch]: ditto: added properties and removed widget and default_value stuff. Removed most reset functions. Use gimp_prop widgets all over the place, renamed some values as above. * app/tools/Makefile.am * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmovetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptransformtool.c * app/tools/gimpvectoroptions.c: changed accordingly. Ported the paint_options GUI constructors to gimp_prop widgets. * app/widgets/gimpselectioneditor.c * app/gui/tool-options-dialog.c: changed accordingly.
2003-02-08 01:12:21 +08:00
static GtkWidget *
dynamics_options_gui (GimpPaintOptions *paint_options,
GType tool_type)
{
GObject *config = G_OBJECT (paint_options);
GtkWidget *frame;
GtkWidget *inner_frame;
2010-11-02 05:19:59 +08:00
GtkWidget *scale;
GtkWidget *menu;
GtkWidget *combo;
GtkWidget *checkbox;
GtkWidget *button;
GtkWidget *vbox;
GtkWidget *inner_vbox;
GtkWidget *hbox;
GtkWidget *box;
Added object properties for almost all tool_options values and registered 2003-02-07 Michael Natterer <mitch@gimp.org> Added object properties for almost all tool_options values and registered lots of enums with the type system: Part I (enum and type cleanup): * app/core/core-enums.[ch] * app/core/core-types.h: removed InternalOrientaionType and register GimpOrientationType. Register GimpChannelOps. Removed GimpToolOptionsGUIFunc. * app/xcf/xcf-private.h: added XcfOrientationType with the same values as the old InternalOrientationType * app/xcf/xcf-load.c * app/xcf/xcf-save.c: translate between GimpOrientationType and XcfOrientationType. * app/core/gimpdrawable-transform-utils.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.h * app/display/gimpdisplayshell.c * tools/pdbgen/stddefs.pdb * tools/pdbgen/pdb/transform_tools.pdb: changed accordingly. * app/pdb/guides_cmds.c * app/pdb/transform_tools_cmds.c * libgimp/gimpenums.h * libgimpproxy/gimpproxytypes.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimptool/gimptoolenums.[ch]: added GimpTransformGridType. * libgimptool/gimptooltypes.h: removed GimpToolOptionsResetFunc, added GimpToolOptionsGUIFunc. Part II (tool options changes): * app/config/gimpconfig-utils.c (gimp_config_reset_properties): don't reset object properties because they have NULL as default value. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_[enum|boolean]_radio_frame_new(), gimp_prop_paint_mode_menu_new() and gimp_prop_scale_entry_new(), which are all needed by the new tool options GUI code. * app/tools/tool_options.[ch]: removed the "reset_func" since the virtual reset() method is used now. * app/paint/gimpairbrushoptions.[ch] * app/paint/gimpcloneoptions.[ch] * app/paint/gimpconvolveoptions.[ch] * app/paint/gimpdodgeburnoptions.[ch] * app/paint/gimperaseroptions.[ch] * app/paint/gimppaintoptions.[ch] * app/paint/gimpsmudgeoptions.[ch]: added properties all over the place and removed the widget and default_value members from the structs. Renamed some values (e.g. s/type/clone_type/). Don't #include <gtk/gtk.h>. * 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/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: changed accordingly. Don't #include <gtk/gtk.h>. * tools/pdbgen/pdb/paint_tools.pdb: changed accordingly. * app/pdb/paint_tools_cmds.c: regenerated. * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpcropoptions.[ch] * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.c * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimptextoptions.c * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/transform_options.[ch]: ditto: added properties and removed widget and default_value stuff. Removed most reset functions. Use gimp_prop widgets all over the place, renamed some values as above. * app/tools/Makefile.am * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmovetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptransformtool.c * app/tools/gimpvectoroptions.c: changed accordingly. Ported the paint_options GUI constructors to gimp_prop widgets. * app/widgets/gimpselectioneditor.c * app/gui/tool-options-dialog.c: changed accordingly.
2003-02-08 01:12:21 +08:00
2011-09-30 17:29:11 +08:00
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
frame = gimp_prop_expanding_frame_new (config, "dynamics-enabled",
NULL, vbox, NULL);
button = gimp_prop_dynamics_box_new (NULL,
GIMP_CONTEXT (config),
_("Dynamics"), 2,
"dynamics-view-type",
"dynamics-view-size",
"gimp-dynamics-editor",
_("Edit this dynamics"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
inner_frame = gimp_frame_new (_("Fade Options"));
gtk_box_pack_start (GTK_BOX (vbox), inner_frame, FALSE, FALSE, 0);
gtk_widget_show (inner_frame);
2011-09-30 17:29:11 +08:00
inner_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_container_add (GTK_CONTAINER (inner_frame), inner_vbox);
gtk_widget_show (inner_vbox);
/* the fade-out scale & unitmenu */
2011-09-30 17:29:11 +08:00
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start (GTK_BOX (inner_vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
scale = gimp_prop_spin_scale_new (config, "fade-length",
1.0, 50.0, 0);
gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 1000.0);
gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
menu = gimp_prop_unit_combo_box_new (config, "fade-unit");
gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
#if 0
/* FIXME pixel digits */
g_object_set_data (G_OBJECT (menu), "set_digits", spinbutton);
gimp_unit_menu_set_pixel_digits (GIMP_UNIT_MENU (menu), 0);
#endif
/* the repeat type */
combo = gimp_prop_enum_combo_box_new (config, "fade-repeat", 0, 0);
gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Repeat"));
g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_box_pack_start (GTK_BOX (inner_vbox), combo, TRUE, TRUE, 0);
checkbox = gimp_prop_check_button_new (config, "fade-reverse", NULL);
gtk_box_pack_start (GTK_BOX (inner_vbox), checkbox, FALSE, FALSE, 0);
/* Color UI */
if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
tool_type == GIMP_TYPE_SMUDGE_TOOL)
{
inner_frame = gimp_frame_new (_("Color Options"));
gtk_box_pack_start (GTK_BOX (vbox), inner_frame, FALSE, FALSE, 0);
gtk_widget_show (inner_frame);
inner_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_container_add (GTK_CONTAINER (inner_frame), inner_vbox);
gtk_widget_show (inner_vbox);
box = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (config),
_("Gradient"), 2,
"gradient-view-type",
"gradient-view-size",
"gradient-reverse",
"gradient-blend-color-space",
"gimp-gradient-editor",
_("Edit this gradient"));
gtk_box_pack_start (GTK_BOX (inner_vbox), box, FALSE, FALSE, 0);
/* the blend color space */
combo = gimp_prop_enum_combo_box_new (config, "gradient-blend-color-space",
0, 0);
gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo),
_("Blend Color Space"));
g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_box_pack_start (GTK_BOX (inner_vbox), combo, TRUE, TRUE, 0);
}
Added object properties for almost all tool_options values and registered 2003-02-07 Michael Natterer <mitch@gimp.org> Added object properties for almost all tool_options values and registered lots of enums with the type system: Part I (enum and type cleanup): * app/core/core-enums.[ch] * app/core/core-types.h: removed InternalOrientaionType and register GimpOrientationType. Register GimpChannelOps. Removed GimpToolOptionsGUIFunc. * app/xcf/xcf-private.h: added XcfOrientationType with the same values as the old InternalOrientationType * app/xcf/xcf-load.c * app/xcf/xcf-save.c: translate between GimpOrientationType and XcfOrientationType. * app/core/gimpdrawable-transform-utils.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.h * app/display/gimpdisplayshell.c * tools/pdbgen/stddefs.pdb * tools/pdbgen/pdb/transform_tools.pdb: changed accordingly. * app/pdb/guides_cmds.c * app/pdb/transform_tools_cmds.c * libgimp/gimpenums.h * libgimpproxy/gimpproxytypes.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimptool/gimptoolenums.[ch]: added GimpTransformGridType. * libgimptool/gimptooltypes.h: removed GimpToolOptionsResetFunc, added GimpToolOptionsGUIFunc. Part II (tool options changes): * app/config/gimpconfig-utils.c (gimp_config_reset_properties): don't reset object properties because they have NULL as default value. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_[enum|boolean]_radio_frame_new(), gimp_prop_paint_mode_menu_new() and gimp_prop_scale_entry_new(), which are all needed by the new tool options GUI code. * app/tools/tool_options.[ch]: removed the "reset_func" since the virtual reset() method is used now. * app/paint/gimpairbrushoptions.[ch] * app/paint/gimpcloneoptions.[ch] * app/paint/gimpconvolveoptions.[ch] * app/paint/gimpdodgeburnoptions.[ch] * app/paint/gimperaseroptions.[ch] * app/paint/gimppaintoptions.[ch] * app/paint/gimpsmudgeoptions.[ch]: added properties all over the place and removed the widget and default_value members from the structs. Renamed some values (e.g. s/type/clone_type/). Don't #include <gtk/gtk.h>. * 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/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: changed accordingly. Don't #include <gtk/gtk.h>. * tools/pdbgen/pdb/paint_tools.pdb: changed accordingly. * app/pdb/paint_tools_cmds.c: regenerated. * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpcropoptions.[ch] * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.c * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimptextoptions.c * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/transform_options.[ch]: ditto: added properties and removed widget and default_value stuff. Removed most reset functions. Use gimp_prop widgets all over the place, renamed some values as above. * app/tools/Makefile.am * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmovetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptransformtool.c * app/tools/gimpvectoroptions.c: changed accordingly. Ported the paint_options GUI constructors to gimp_prop widgets. * app/widgets/gimpselectioneditor.c * app/gui/tool-options-dialog.c: changed accordingly.
2003-02-08 01:12:21 +08:00
return frame;
}
static GtkWidget *
jitter_options_gui (GimpPaintOptions *paint_options,
GType tool_type)
{
GObject *config = G_OBJECT (paint_options);
GtkWidget *frame;
GtkWidget *scale;
scale = gimp_prop_spin_scale_new (config, "jitter-amount",
0.01, 1.0, 2);
gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 0.0, 5.0);
frame = gimp_prop_expanding_frame_new (config, "use-jitter", NULL,
scale, NULL);
return frame;
}
static GtkWidget *
smoothing_options_gui (GimpPaintOptions *paint_options,
GType tool_type)
{
GObject *config = G_OBJECT (paint_options);
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *scale;
2011-09-30 17:29:11 +08:00
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
frame = gimp_prop_expanding_frame_new (config, "use-smoothing", NULL,
vbox, NULL);
scale = gimp_prop_spin_scale_new (config, "smoothing-quality",
1, 10, 1);
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
scale = gimp_prop_spin_scale_new (config, "smoothing-factor",
1, 10, 1);
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
return frame;
}
static void
gimp_paint_options_gui_reset_size (GtkWidget *button,
GimpPaintOptions *paint_options)
{
GimpBrush *brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
if (brush)
gimp_paint_options_set_default_brush_size (paint_options, brush);
}
static void
gimp_paint_options_gui_reset_aspect_ratio (GtkWidget *button,
GimpPaintOptions *paint_options)
{
GimpBrush *brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
if (brush)
gimp_paint_options_set_default_brush_aspect_ratio (paint_options, brush);
}
static void
gimp_paint_options_gui_reset_angle (GtkWidget *button,
GimpPaintOptions *paint_options)
{
GimpBrush *brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
if (brush)
gimp_paint_options_set_default_brush_angle (paint_options, brush);
}
static void
gimp_paint_options_gui_reset_spacing (GtkWidget *button,
GimpPaintOptions *paint_options)
{
GimpBrush *brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
if (brush)
gimp_paint_options_set_default_brush_spacing (paint_options, brush);
}
static void
gimp_paint_options_gui_reset_hardness (GtkWidget *button,
GimpPaintOptions *paint_options)
{
GimpBrush *brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
if (brush)
gimp_paint_options_set_default_brush_hardness (paint_options, brush);
}
static void
gimp_paint_options_gui_reset_force (GtkWidget *button,
GimpPaintOptions *paint_options)
{
g_object_set (paint_options,
"brush-force", 0.5,
NULL);
}
static GtkWidget *
gimp_paint_options_gui_scale_with_buttons (GObject *config,
gchar *prop_name,
gchar *link_prop_name,
gchar *reset_tooltip,
gdouble step_increment,
gdouble page_increment,
gint digits,
gdouble scale_min,
gdouble scale_max,
gdouble factor,
gdouble gamma,
GCallback reset_callback,
GtkSizeGroup *link_group)
{
2014-11-16 05:23:14 +08:00
GtkWidget *scale;
GtkWidget *hbox;
GtkWidget *button;
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
2014-11-16 05:23:14 +08:00
scale = gimp_prop_spin_scale_new (config, prop_name,
step_increment, page_increment, digits);
gimp_spin_scale_set_constrain_drag (GIMP_SPIN_SCALE (scale), TRUE);
gimp_prop_widget_set_factor (scale, factor,
step_increment, page_increment, digits);
2014-11-16 05:23:14 +08:00
gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale),
scale_min, scale_max);
gimp_spin_scale_set_gamma (GIMP_SPIN_SCALE (scale), gamma);
gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
gtk_widget_show (scale);
button = gimp_icon_button_new (GIMP_ICON_RESET, NULL);
2014-11-16 05:23:14 +08:00
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_image_set_from_icon_name (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))),
GIMP_ICON_RESET, GTK_ICON_SIZE_MENU);
2014-11-16 05:23:14 +08:00
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
2014-11-16 05:23:14 +08:00
g_signal_connect (button, "clicked",
reset_callback,
config);
2014-11-16 05:23:14 +08:00
gimp_help_set_help_data (button,
reset_tooltip, NULL);
if (link_prop_name)
{
GtkWidget *image;
button = gtk_toggle_button_new ();
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
image = gtk_image_new_from_icon_name (GIMP_ICON_LINKED,
GTK_ICON_SIZE_MENU);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
g_object_bind_property (config, link_prop_name,
button, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
}
else
{
button = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
}
gtk_size_group_add_widget (link_group, button);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
gimp_help_set_help_data (button,
_("Link to brush default"), NULL);
2014-11-16 05:23:14 +08:00
return hbox;
}