gimp/app/actions/layers-commands.c

2511 lines
84 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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 <string.h>
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "config/gimpdialogconfig.h"
#include "operations/layer-modes/gimp-layer-modes.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 12:17:23 +00:00
#include "core/gimp.h"
#include "core/gimpchannel.h"
2020-05-20 18:16:30 +02:00
#include "core/gimpchannel-combine.h"
#include "core/gimpcontainer.h"
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-03 17:59:48 +00:00
#include "core/gimpcontext.h"
#include "core/gimpdrawable-fill.h"
#include "core/gimpgrouplayer.h"
#include "core/gimpimage.h"
include the new "paint-funcs/paint-funcs-types.h". 2001-11-28 Michael Natterer <mitch@gimp.org> * app/base/base-types.h: include the new "paint-funcs/paint-funcs-types.h". * app/paint-funcs/Makefile.am * app/paint-funcs/paint-funcs-types.h: new file. Includes "base/base-types.h". * app/paint-funcs/paint-funcs.[ch]: removed the enums here, include "paint-funcs-types.h". * app/widgets/widgets-types.h: include "display/display-types.h" * app/display/display-types.h: include "widgets/widgets-types.h". * app/tools/tools-types.h: include "display/display-types.h" * app/gui/gui-types.h: include "tools/tools-types.h". The order of namespaces/dependencies should be (but is not): (base, paint-funcs) -> (core, file, xcf, pdb) -> (widgets, display) -> tools -> gui * app/path.c: include "tools/tools-types.h". * app/core/Makefile.am * app/core/gimpimage-guides.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-scale.[ch]: new files. * app/core/gimpimage.[ch]: removed the stuff which is in the new files. Reordered all functions in both the .h and .c files, commented the groups of functions. * app/core/gimpcontainer.c: create the handler_id using a counter, not the address of a pointer, because the address *may* be the same twice, added debugging output. * app/core/gimpviewable.[ch]: added primitive support for getting a preview GdkPixbuf. * app/nav_window.c * app/undo.c * app/undo_history.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.[ch] * app/display/gimpdisplay.c * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-dnd.c * app/display/gimpdisplayshell-render.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-scroll.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/palette-import-dialog.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/widgets/gimpcontainerview-utils.c * app/xcf/xcf-load.c: changed accordingly, some cleanup. * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions. * app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu items to the name of the last plug-in (Fixes #50986). * app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and "Redo" to the resp. undo names. Much simplified the WM icon stuff by removing most code and using gimp_viewable_get_new_preview_pixbuf(). * app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark returned by gimp_container_add_handler(). * app/pdb/guides_cmds.c * app/pdb/image_cmds.c * libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-28 17:51:06 +00:00
#include "core/gimpimage-merge.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage-undo-push.h"
#include "core/gimpitemundo.h"
#include "core/gimplayerpropundo.h"
#include "core/gimplayer-floating-selection.h"
#include "core/gimplayer-new.h"
#include "core/gimppickable.h"
#include "core/gimppickable-auto-shrink.h"
#include "core/gimptoolinfo.h"
#include "core/gimpundostack.h"
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-10 18:47:21 +00:00
#include "core/gimpprogress.h"
#include "text/gimptext.h"
#include "text/gimptext-vectors.h"
#include "text/gimptextlayer.h"
#include "vectors/gimpstroke.h"
#include "vectors/gimpvectors.h"
#include "vectors/gimpvectors-warp.h"
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
#include "widgets/gimpaction.h"
#include "widgets/gimpdock.h"
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 15:54:47 +00:00
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpprogressdialog.h"
The unbelievable happened: a menu bar per display (optionally) 2002-12-10 Michael Natterer <mitch@gimp.org> The unbelievable happened: a menu bar per display (optionally) * app/widgets/gimpitemfactory.[ch]: Added the possibility to have more than one item factory per <Prefix>. Added gimp_item_factories_set_foobar() variants of all functions which set menu item properties (label, sensitive, ...). Removed the #ifndef ENABLE_NLS code since that's no longer possible. * app/widgets/gimptoolbox.c: made it robust againt the <Image> factory not existing at the time of toolbox creation. * app/config/gimpconfig-blurbs.h * app/config/gimpdisplayconfig.[ch]: added boolean "menu_bar_per_display" property. * app/gui/preferences-dialog.c: added a toggle for the new option. * app/gui/menus.[ch]: added menus_get_new_image_factory() as temporary solution. Will add a GimpMenuFactory which creates the item factories soon. * app/display/gimpdisplayshell.c: add the menu bar if requested. Changed widget packing slightly for the menu bar case. * app/display/gimpdisplayshell-callbacks.c: changed accordingly. Currently there is no right-click popup menu when we have a menu bar. This will change soon. * app/gui/file-dialog-utils.c * app/gui/gui.c: use gimp_item_factories_set_foo(). * app/gui/channels-commands.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/plug-in-commands.c * app/gui/select-commands.c * app/gui/tools-commands.c * app/gui/vectors-commands.c * app/gui/view-commands.c: per-display item factories pass the GimpDisplay as user_data to callbacks, not a Gimp. Changed all return_if_no_foo() macros to handle both cases. Cleaned up the plug-in menu stuff: * app/plug-in/plug-in-types.h: removed PlugInMenuEntry type. * app/plug-in/plug-ins.[ch]: added plug_ins_proc_def_add() as counterpart to plug_ins_proc_def_remove(). Added plug_ins_locale_domain() as counterpart to plug_ins_help_path(). Remember the locale domains just as the help paths. Changed plug-in initialization so that their menus can be created multiple times. * app/plug-in/plug-in.[ch]: use plug_ins_proc_def_add() instead of doing it manually. * app/gui/plug-in-menus.[ch]: added plug_in_menus_init() which just registers the locale domains. Changed plug_in_make_menu() to take a list of proc_defs, not plug_ins_defs so it can be used after plug-in query.
2002-12-10 16:38:16 +00:00
#include "display/gimpdisplay.h"
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-01 22:04:20 +00:00
#include "display/gimpdisplayshell.h"
#include "display/gimpimagewindow.h"
The unbelievable happened: a menu bar per display (optionally) 2002-12-10 Michael Natterer <mitch@gimp.org> The unbelievable happened: a menu bar per display (optionally) * app/widgets/gimpitemfactory.[ch]: Added the possibility to have more than one item factory per <Prefix>. Added gimp_item_factories_set_foobar() variants of all functions which set menu item properties (label, sensitive, ...). Removed the #ifndef ENABLE_NLS code since that's no longer possible. * app/widgets/gimptoolbox.c: made it robust againt the <Image> factory not existing at the time of toolbox creation. * app/config/gimpconfig-blurbs.h * app/config/gimpdisplayconfig.[ch]: added boolean "menu_bar_per_display" property. * app/gui/preferences-dialog.c: added a toggle for the new option. * app/gui/menus.[ch]: added menus_get_new_image_factory() as temporary solution. Will add a GimpMenuFactory which creates the item factories soon. * app/display/gimpdisplayshell.c: add the menu bar if requested. Changed widget packing slightly for the menu bar case. * app/display/gimpdisplayshell-callbacks.c: changed accordingly. Currently there is no right-click popup menu when we have a menu bar. This will change soon. * app/gui/file-dialog-utils.c * app/gui/gui.c: use gimp_item_factories_set_foo(). * app/gui/channels-commands.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/plug-in-commands.c * app/gui/select-commands.c * app/gui/tools-commands.c * app/gui/vectors-commands.c * app/gui/view-commands.c: per-display item factories pass the GimpDisplay as user_data to callbacks, not a Gimp. Changed all return_if_no_foo() macros to handle both cases. Cleaned up the plug-in menu stuff: * app/plug-in/plug-in-types.h: removed PlugInMenuEntry type. * app/plug-in/plug-ins.[ch]: added plug_ins_proc_def_add() as counterpart to plug_ins_proc_def_remove(). Added plug_ins_locale_domain() as counterpart to plug_ins_help_path(). Remember the locale domains just as the help paths. Changed plug-in initialization so that their menus can be created multiple times. * app/plug-in/plug-in.[ch]: use plug_ins_proc_def_add() instead of doing it manually. * app/gui/plug-in-menus.[ch]: added plug_in_menus_init() which just registers the locale domains. Changed plug_in_make_menu() to take a list of proc_defs, not plug_ins_defs so it can be used after plug-in query.
2002-12-10 16:38:16 +00:00
#include "tools/gimptexttool.h"
#include "tools/tool_manager.h"
#include "dialogs/dialogs.h"
#include "dialogs/layer-add-mask-dialog.h"
#include "dialogs/layer-options-dialog.h"
configure.in added new directory app/dialogs and link libappdialogs.c into 2004-09-13 Michael Natterer <mitch@gimp.org> * configure.in * app/Makefile.am: added new directory app/dialogs and link libappdialogs.c into the gimp binary. * app/gui/Makefile.am * app/gui/gui-types.h * app/gui/gui-vtable.c * app/gui/gui.c * app/gui/about-dialog.[ch] * app/gui/authors.h * app/gui/color-notebook.[ch] * app/gui/convert-dialog.[ch] * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.[ch] * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.[ch] * app/gui/file-open-dialog.[ch] * app/gui/file-open-location-dialog.[ch] * app/gui/file-save-dialog.[ch] * app/gui/grid-dialog.[ch] * app/gui/info-dialog.[ch] * app/gui/info-window.[ch] * app/gui/module-browser.[ch] * app/gui/offset-dialog.[ch] * app/gui/palette-import-dialog.[ch] * app/gui/preferences-dialog.[ch] * app/gui/quit-dialog.[ch] * app/gui/resize-dialog.[ch] * app/gui/resolution-calibrate-dialog.[ch] * app/gui/stroke-dialog.[ch] * app/gui/tips-dialog.[ch] * app/gui/tips-parser.[ch] * app/gui/user-install-dialog.[ch]: removed these files... * app/dialogs/Makefile.am * app/dialogs/dialogs-types.h * app/dialogs/*.[ch]: ...and added them here. Changed some filenames like module-browser -> module-dialog. * app/app_procs.c * app/actions/actions-types.h * app/actions/actions.c * app/actions/dialogs-actions.c * app/actions/dialogs-commands.c * app/actions/dockable-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/file-commands.c * app/actions/gradient-editor-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/templates-commands.c * app/actions/templates-commands.h * app/actions/vectors-commands.c * app/actions/view-commands.c * app/display/gimpdisplayshell-cursor.c * app/display/gimpdisplayshell-title.c * app/display/gimpdisplayshell.[ch] * app/tools/gimpcroptool.c * app/tools/gimpperspectivetool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimptransformtool.[ch] * app/tools/gimpvectortool.c * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcolorpanel.c * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimppaletteeditor.[ch] * app/widgets/gimptoolbox-color-area.c * menus/toolbox-menu.xml.in * tools/authorsgen/authorsgen.pl: changed accordingly.
2004-09-13 15:15:23 +00:00
#include "dialogs/resize-dialog.h"
#include "dialogs/scale-dialog.h"
#include "actions.h"
#include "items-commands.h"
#include "layers-commands.h"
#include "gimp-intl.h"
app/core/Makefile.am new files: the QMask stuff stripped from GUI code. 2001-11-30 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/gimpimage-qmask.[ch]: new files: the QMask stuff stripped from GUI code. Added gimp_image_qmask_invert(). * app/core/gimpimage.[ch]: removed the QMask functions. * app/display/Makefile.am * app/display/gimpdisplayshell-qmask.[ch]: removed. * app/gui/Makefile.am * app/gui/qmask-commands.[ch]: new files for the new QMask item factory callbacks and the qmask query dialog. * app/gui/menus.c: added a context menu for the QMask button. * app/display/gimpdisplayshell.c * app/display/gimpdisplayshell-handlers.c: don't include the qmask stuff. * app/display/gimpdisplayshell-callbacks.[ch]: Moved the 2 qmask callbacks here. Don't popup the dialog on double_click. Show the contect menu on right-click. * app/display/gimpdisplayshell-callbacks.[ch]: gimp_display_shell_canvas_events(): removed the hack of conntecting "key_press_event" to gtk_true() while a tool is active. Instead, check for (event & GDK_BUTTON1_MASK) in the key_press and key_release handlers and stop signal emission. Save the modifier state on "button_press" and restore it after "button_release". Changed the way context menus are updated/shown: - removed GimpContainerContextFunc. - pass around item factory identifiers (e.g. "<Brushes>") - added voodoo to update the menus before showing them. * app/widgets/gimpitemfactory.[ch]: gimp_item_factory_new(): take a GimpItemFactoryUpdateFunc parameter, attach it as data to the factory and use it to update the menu in gimp_item_factory_popup_with_date(). * app/widgets/gimpwidgets-utils.[ch]: removed gimp_item_factory_popup_with_data() here. * app/widgets/gimpbrushfactoryview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpdrawablelistview.[ch]: use item_factory identifier strings all over the place. * app/widgets/gimpdockbook.c: removed the menu update code, it's now in gui/dialogs-commands.c. * app/gui/brushes-commands.[ch] * app/gui/buffers-commands.[c] * app/gui/channels-commands.[ch] * app/gui/dialogs-commands.[ch] * app/gui/documents-commands.[ch] * app/gui/gradient-editor-commands.[ch] * app/gui/gradients-commands.[ch] * app/gui/layers-commands.[ch] * app/gui/palettes-commands.[ch] * app/gui/patterns-commands.[ch]: removed all show_context_menu() functions and made the update functions public. Changed all update functions to use the gimp_item_factory_set_foo() methods instead of gimp_menu_item_set_foo(). * app/gui/menus.c: pass the update functions to the gimp_item_factory_new(). * app/gui/dialogs-constructors.c: pass item factory identifiers to all view constructors. * app/gui/gradient-editor.c: show the context menu using the new method. * app/gui/toolbox.c: no need to include "dialogs-commands.h".
2001-11-30 14:41:56 +00:00
/* local function prototypes */
static void layers_new_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
GimpLayerColorSpace layer_blend_space,
GimpLayerColorSpace layer_composite_space,
GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
gint layer_height,
gint layer_offset_x,
gint layer_offset_y,
gboolean layer_visible,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
gboolean rename_text_layer,
gpointer user_data);
static void layers_edit_attributes_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
GimpLayerColorSpace layer_blend_space,
GimpLayerColorSpace layer_composite_space,
GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
gint layer_height,
gint layer_offset_x,
gint layer_offset_y,
gboolean layer_visible,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
gboolean rename_text_layer,
gpointer user_data);
static void layers_add_mask_callback (GtkWidget *dialog,
GList *layers,
GimpAddMaskType add_mask_type,
GimpChannel *channel,
gboolean invert,
gpointer user_data);
static void layers_scale_callback (GtkWidget *dialog,
GimpViewable *viewable,
gint width,
gint height,
GimpUnit unit,
GimpInterpolationType interpolation,
gdouble xresolution,
gdouble yresolution,
GimpUnit resolution_unit,
gpointer user_data);
static void layers_resize_callback (GtkWidget *dialog,
GimpViewable *viewable,
GimpContext *context,
gint width,
gint height,
GimpUnit unit,
gint offset_x,
gint offset_y,
gdouble unused0,
gdouble unused1,
GimpUnit unused2,
GimpFillType fill_type,
GimpItemSet unused3,
gboolean unused4,
gpointer data);
static gint layers_mode_index (GimpLayerMode layer_mode,
const GimpLayerMode *modes,
gint n_modes);
/* private variables */
static GimpUnit layer_resize_unit = GIMP_UNIT_PIXEL;
static GimpUnit layer_scale_unit = GIMP_UNIT_PIXEL;
static GimpInterpolationType layer_scale_interp = -1;
app/core/Makefile.am new files: the QMask stuff stripped from GUI code. 2001-11-30 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/gimpimage-qmask.[ch]: new files: the QMask stuff stripped from GUI code. Added gimp_image_qmask_invert(). * app/core/gimpimage.[ch]: removed the QMask functions. * app/display/Makefile.am * app/display/gimpdisplayshell-qmask.[ch]: removed. * app/gui/Makefile.am * app/gui/qmask-commands.[ch]: new files for the new QMask item factory callbacks and the qmask query dialog. * app/gui/menus.c: added a context menu for the QMask button. * app/display/gimpdisplayshell.c * app/display/gimpdisplayshell-handlers.c: don't include the qmask stuff. * app/display/gimpdisplayshell-callbacks.[ch]: Moved the 2 qmask callbacks here. Don't popup the dialog on double_click. Show the contect menu on right-click. * app/display/gimpdisplayshell-callbacks.[ch]: gimp_display_shell_canvas_events(): removed the hack of conntecting "key_press_event" to gtk_true() while a tool is active. Instead, check for (event & GDK_BUTTON1_MASK) in the key_press and key_release handlers and stop signal emission. Save the modifier state on "button_press" and restore it after "button_release". Changed the way context menus are updated/shown: - removed GimpContainerContextFunc. - pass around item factory identifiers (e.g. "<Brushes>") - added voodoo to update the menus before showing them. * app/widgets/gimpitemfactory.[ch]: gimp_item_factory_new(): take a GimpItemFactoryUpdateFunc parameter, attach it as data to the factory and use it to update the menu in gimp_item_factory_popup_with_date(). * app/widgets/gimpwidgets-utils.[ch]: removed gimp_item_factory_popup_with_data() here. * app/widgets/gimpbrushfactoryview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpdrawablelistview.[ch]: use item_factory identifier strings all over the place. * app/widgets/gimpdockbook.c: removed the menu update code, it's now in gui/dialogs-commands.c. * app/gui/brushes-commands.[ch] * app/gui/buffers-commands.[c] * app/gui/channels-commands.[ch] * app/gui/dialogs-commands.[ch] * app/gui/documents-commands.[ch] * app/gui/gradient-editor-commands.[ch] * app/gui/gradients-commands.[ch] * app/gui/layers-commands.[ch] * app/gui/palettes-commands.[ch] * app/gui/patterns-commands.[ch]: removed all show_context_menu() functions and made the update functions public. Changed all update functions to use the gimp_item_factory_set_foo() methods instead of gimp_menu_item_set_foo(). * app/gui/menus.c: pass the update functions to the gimp_item_factory_new(). * app/gui/dialogs-constructors.c: pass item factory identifiers to all view constructors. * app/gui/gradient-editor.c: show the context menu using the new method. * app/gui/toolbox.c: no need to include "dialogs-commands.h".
2001-11-30 14:41:56 +00:00
/* public functions */
void
layers_edit_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
if (gimp_item_is_text_layer (GIMP_ITEM (layer)))
{
layers_edit_text_cmd_callback (action, value, data);
}
else
{
layers_edit_attributes_cmd_callback (action, value, data);
}
}
void
layers_edit_text_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
GimpTool *active_tool;
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
g_return_if_fail (gimp_item_is_text_layer (GIMP_ITEM (layer)));
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
active_tool = tool_manager_get_active (image->gimp);
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
if (! GIMP_IS_TEXT_TOOL (active_tool))
{
GimpToolInfo *tool_info = gimp_get_tool_info (image->gimp,
"gimp-text-tool");
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
if (GIMP_IS_TOOL_INFO (tool_info))
{
gimp_context_set_tool (action_data_get_context (data), tool_info);
active_tool = tool_manager_get_active (image->gimp);
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
}
}
if (GIMP_IS_TEXT_TOOL (active_tool))
{
if (gimp_text_tool_set_layer (GIMP_TEXT_TOOL (active_tool), layer))
{
GimpDisplayShell *shell;
shell = gimp_display_get_shell (active_tool->display);
gtk_widget_grab_focus (shell->canvas);
}
}
}
void
layers_edit_attributes_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
#define EDIT_DIALOG_KEY "gimp-layer-edit-attributes-dialog"
dialog = dialogs_get_dialog (G_OBJECT (layer), EDIT_DIALOG_KEY);
if (! dialog)
{
GimpItem *item = GIMP_ITEM (layer);
dialog = layer_options_dialog_new (gimp_item_get_image (GIMP_ITEM (layer)),
layer,
action_data_get_context (data),
widget,
_("Layer Attributes"),
"gimp-layer-edit",
GIMP_ICON_EDIT,
_("Edit Layer Attributes"),
GIMP_HELP_LAYER_EDIT,
gimp_object_get_name (layer),
gimp_layer_get_mode (layer),
gimp_layer_get_blend_space (layer),
gimp_layer_get_composite_space (layer),
gimp_layer_get_composite_mode (layer),
gimp_layer_get_opacity (layer),
0 /* unused */,
gimp_item_get_visible (item),
gimp_item_get_color_tag (item),
gimp_item_get_lock_content (item),
gimp_item_get_lock_position (item),
gimp_layer_get_lock_alpha (layer),
layers_edit_attributes_callback,
NULL);
dialogs_attach_dialog (G_OBJECT (layer), EDIT_DIALOG_KEY, dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
}
void
layers_new_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GtkWidget *widget;
GimpLayer *floating_sel;
GtkWidget *dialog;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
/* If there is a floating selection, the new command transforms
* the current fs into a new layer
*/
if ((floating_sel = gimp_image_get_floating_selection (image)))
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
{
GError *error = NULL;
if (! floating_sel_to_layer (floating_sel, &error))
{
bumped minimum required version of GLib to 2.18.0. 2008-11-04 Sven Neumann <sven@sven> * configure.in: bumped minimum required version of GLib to 2.18.0. * INSTALL: document the updated dependency. * app/core/gimp.[ch]: introduced gimp_message_literal(), a variant of gimp_message() that takes a literal string. * app/errors.[ch]: removed format arguments from gimp_fatal_error() and gimp_terminate() and let them take a literal string instead. * app/tools/gimptool.[ch]: introduced gimp_tool_message_literal(), a variant of gimp_tool_message() that takes a literal string. * app/actions/documents-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/gradients-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/plug-in-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c * app/config/gimprc.c * app/core/gimp-modules.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp-units.c * app/core/gimpchannel.c * app/core/gimpcontainer-filter.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpimage-convert.c * app/core/gimpimage-merge.c * app/core/gimpimage.c * app/core/gimpimagefile.c * app/core/gimplayer-floating-sel.c * app/core/gimplayer.c * app/core/gimpselection.c * app/dialogs/convert-dialog.c * app/dialogs/dialogs.c * app/dialogs/palette-import-dialog.c * app/dialogs/preferences-dialog.c * app/dialogs/quit-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/file/file-open.c * app/file/file-procedure.c * app/file/file-save.c * app/file/file-utils.c * app/gegl/gimpcurvesconfig.c * app/gegl/gimplevelsconfig.c * app/gui/gui-message.c * app/gui/gui.c * app/gui/session.c * app/paint/gimpbrushcore.c * app/paint/gimpclone.c * app/paint/gimpheal.c * app/paint/gimpperspectiveclone.c * app/paint/gimpsourcecore.c * app/pdb/gimppdb-utils.c * app/pdb/gimpprocedure.c * app/plug-in/gimpplugin-message.c * app/plug-in/gimpplugin.c * app/plug-in/gimppluginmanager-restore.c * app/plug-in/gimppluginprocedure.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcurvestool.c * app/tools/gimpdesaturatetool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpforegroundselecttool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpgegltool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpimagemaptool-settings.c * app/tools/gimpiscissorstool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimpposterizetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsourcetool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimpcontrollers.c * app/widgets/gimpdataeditor.c * app/widgets/gimpdevices.c * app/widgets/gimpdnd-xds.c * app/widgets/gimperrordialog.c * app/widgets/gimphelp.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppdbdialog.c * app/widgets/gimpsettingsbox.c * app/widgets/gimpvectorstreeview.c * app/widgets/gimpwidgets-utils.c * app/xcf/xcf-load.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/floating_sel.pdb * tools/pdbgen/pdb/image.pdb: use the _literal variants for g_set_error(), gimp_message() and gimp_tool_message(). * app/pdb/convert-cmds.c * app/pdb/edit-cmds.c * app/pdb/floating-sel-cmds.c * app/pdb/image-cmds.c: regenerated. svn path=/trunk/; revision=27548
2008-11-04 12:33:09 +00:00
gimp_message_literal (image->gimp,
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
error->message);
g_clear_error (&error);
return;
}
gimp_image_flush (image);
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
return;
}
#define NEW_DIALOG_KEY "gimp-layer-new-dialog"
dialog = dialogs_get_dialog (G_OBJECT (image), NEW_DIALOG_KEY);
if (! dialog)
{
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
const gchar *title;
gchar *desc;
gint n_layers;
GimpLayerMode layer_mode = config->layer_new_mode;
n_layers = g_list_length (gimp_image_get_selected_layers (image));
title = ngettext ("New Layer", "New Layers", n_layers > 0 ? n_layers : 1);
desc = ngettext ("Create a New Layer", "Create %d New Layers", n_layers > 0 ? n_layers : 1);
desc = g_strdup_printf (desc, n_layers > 0 ? n_layers : 1);
if (layer_mode == GIMP_LAYER_MODE_NORMAL ||
layer_mode == GIMP_LAYER_MODE_NORMAL_LEGACY)
{
layer_mode = gimp_image_get_default_new_layer_mode (image);
}
dialog = layer_options_dialog_new (image, NULL,
action_data_get_context (data),
widget,
title,
"gimp-layer-new",
GIMP_ICON_LAYER,
desc,
GIMP_HELP_LAYER_NEW,
config->layer_new_name,
layer_mode,
config->layer_new_blend_space,
config->layer_new_composite_space,
config->layer_new_composite_mode,
config->layer_new_opacity,
config->layer_new_fill_type,
TRUE,
GIMP_COLOR_TAG_NONE,
FALSE,
FALSE,
FALSE,
layers_new_callback,
NULL);
g_free (desc);
dialogs_attach_dialog (G_OBJECT (image), NEW_DIALOG_KEY, dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
}
void
layers_new_last_vals_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
{
GimpImage *image;
GtkWidget *widget;
GimpLayer *layer;
GimpDialogConfig *config;
GList *layers;
GList *new_layers = NULL;
GList *iter;
GimpLayerMode layer_mode;
gint n_layers;
gboolean run_once;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
config = GIMP_DIALOG_CONFIG (image->gimp->config);
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
/* If there is a floating selection, the new command transforms
* the current fs into a new layer
*/
if (gimp_image_get_floating_selection (image))
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
{
layers_new_cmd_callback (action, value, data);
Ported the layers, channels and paths dialogs from 2004-10-16 Michael Natterer <mitch@gimp.org> Ported the layers, channels and paths dialogs from gimp_editor_add_button() to gimp_editor_add_action_button(), removing a massive amount of duplicated code, sensitivity logic and confusing utility functions. * app/actions/channels-actions.c * app/actions/channels-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added "foo-new-default" actions and callbacks which create items without a dialog, optionally using default values from a passed template. Removed all public utility function that were passed as function pointers to widget construtors. Added tooltips to all actions which are now used for dialog buttons. * app/widgets/gimpeditor.c (gimp_editor_add_action_button): automatically create multi-line tooltips showing the modifiers for extended action buttons. Removes the need for lots of insane format strings that need to be translated correctly. * app/widgets/gimpitemtreeview.[ch] (struct GimpItemTreeViewClass): replaced tooltip and help_id strings by action names. (struct GimpItemTreeView) (gimp_item_tree_view_new): removed "edit", "new" and "activate" function pointers. (gimp_item_tree_view_constructor): create all buttons with gimp_editor_add_action_button(), using the action names from GimpItemTreeViewClass. Removed tons of "clicked" callbacks and all code which sets the buttons' sensitivity. They are not needed any longer. Require all subclasses to implement GimpItemTreeView::new_item(), a new virtual function which creates a plain new item without showing a dialog. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: fill in the action names and implement GimpItemTreeView::new_item(). Removed all button sensitivity logic. * app/dialogs/dialogs-constructors.c: changed accordingly. Doesn't include anything from actions/ any more.
2004-10-16 15:48:23 +00:00
return;
}
layer_mode = config->layer_new_mode;
if (layer_mode == GIMP_LAYER_MODE_NORMAL ||
layer_mode == GIMP_LAYER_MODE_NORMAL_LEGACY)
{
layer_mode = gimp_image_get_default_new_layer_mode (image);
}
layers = gimp_image_get_selected_layers (image);
layers = g_list_copy (layers);
n_layers = g_list_length (layers);
run_once = (n_layers == 0);
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_LAYER_ADD,
ngettext ("New layer",
"New layers",
n_layers > 0 ? n_layers : 1));
for (iter = layers; iter || run_once ; iter = iter ? iter->next : NULL)
{
GimpLayer *parent;
gint position;
run_once = FALSE;
if (iter)
{
if (gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)))
{
parent = iter->data;
position = 0;
}
else
{
parent = GIMP_LAYER (gimp_item_get_parent (iter->data));
position = gimp_item_get_index (iter->data);
}
}
else /* run_once */
{
parent = NULL;
position = -1;
}
layer = gimp_layer_new (image,
gimp_image_get_width (image),
gimp_image_get_height (image),
gimp_image_get_layer_format (image, TRUE),
config->layer_new_name,
config->layer_new_opacity,
layer_mode);
gimp_drawable_fill (GIMP_DRAWABLE (layer),
action_data_get_context (data),
config->layer_new_fill_type);
gimp_layer_set_blend_space (layer,
config->layer_new_blend_space, FALSE);
gimp_layer_set_composite_space (layer,
config->layer_new_composite_space, FALSE);
gimp_layer_set_composite_mode (layer,
config->layer_new_composite_mode, FALSE);
gimp_image_add_layer (image, layer, parent, position, TRUE);
new_layers = g_list_prepend (new_layers, layer);
}
gimp_image_set_selected_layers (image, new_layers);
gimp_image_undo_group_end (image);
g_list_free (layers);
g_list_free (new_layers);
gimp_image_flush (image);
}
void
layers_new_from_visible_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GimpDisplayShell *shell;
GimpLayer *layer;
GimpPickable *pickable;
GimpColorProfile *profile;
return_if_no_image (image, data);
return_if_no_shell (shell, data);
pickable = gimp_display_shell_get_canvas_pickable (shell);
gimp_pickable_flush (pickable);
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
layer = gimp_layer_new_from_gegl_buffer (gimp_pickable_get_buffer (pickable),
image,
gimp_image_get_layer_format (image,
TRUE),
_("Visible"),
GIMP_OPACITY_OPAQUE,
gimp_image_get_default_new_layer_mode (image),
profile);
gimp_image_add_layer (image, layer, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_flush (image);
}
void
layers_new_group_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *new_layers = NULL;
GList *layers;
GList *iter;
gint n_layers;
gboolean run_once;
return_if_no_image (image, data);
layers = gimp_image_get_selected_layers (image);
layers = g_list_copy (layers);
n_layers = g_list_length (layers);
run_once = (n_layers == 0);
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_LAYER_ADD,
ngettext ("New layer group",
"New layer groups",
n_layers > 0 ? n_layers : 1));
for (iter = layers; iter || run_once ; iter = iter ? iter->next : NULL)
{
GimpLayer *layer;
GimpLayer *parent;
gint position;
run_once = FALSE;
if (iter)
{
if (gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)))
{
parent = iter->data;
position = 0;
}
else
{
parent = GIMP_LAYER (gimp_item_get_parent (iter->data));
position = gimp_item_get_index (iter->data);
}
}
else /* run_once */
{
parent = NULL;
position = -1;
}
layer = gimp_group_layer_new (image);
gimp_image_add_layer (image, layer, parent, position, TRUE);
new_layers = g_list_prepend (new_layers, layer);
}
gimp_image_set_selected_layers (image, new_layers);
gimp_image_undo_group_end (image);
gimp_image_flush (image);
g_list_free (layers);
g_list_free (new_layers);
}
void
layers_select_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *new_layers = NULL;
GList *layers;
GList *iter;
GimpActionSelectType select_type;
gboolean run_once;
return_if_no_image (image, data);
select_type = (GimpActionSelectType) g_variant_get_int32 (value);
layers = gimp_image_get_selected_layers (image);
run_once = (g_list_length (layers) == 0);
for (iter = layers; iter || run_once; iter = iter ? iter->next : NULL)
{
GimpLayer *new_layer;
GimpContainer *container;
if (iter)
{
container = gimp_item_get_container (GIMP_ITEM (iter->data));
}
else /* run_once */
{
container = gimp_image_get_layers (image);
run_once = FALSE;
}
new_layer = (GimpLayer *) action_select_object (select_type,
container,
iter ? iter->data : NULL);
if (new_layer)
new_layers = g_list_prepend (new_layers, new_layer);
}
if (new_layers)
{
gimp_image_set_selected_layers (image, new_layers);
gimp_image_flush (image);
}
g_list_free (new_layers);
}
void
layers_raise_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
GList *raised_layers = NULL;
return_if_no_layers (image, layers, data);
for (iter = layers; iter; iter = iter->next)
{
gint index;
index = gimp_item_get_index (iter->data);
if (index > 0)
raised_layers = g_list_prepend (raised_layers, iter->data);
}
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_ITEM_DISPLACE,
ngettext ("Raise Layer",
"Raise Layers",
g_list_length (raised_layers)));
for (iter = raised_layers; iter; iter = iter->next)
gimp_image_raise_item (image, iter->data, NULL);
gimp_image_flush (image);
gimp_image_undo_group_end (image);
g_list_free (raised_layers);
}
void
layers_raise_to_top_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
GList *raised_layers = NULL;
return_if_no_layers (image, layers, data);
for (iter = layers; iter; iter = iter->next)
{
gint index;
index = gimp_item_get_index (iter->data);
if (index > 0)
raised_layers = g_list_prepend (raised_layers, iter->data);
}
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_ITEM_DISPLACE,
ngettext ("Raise Layer to Top",
"Raise Layers to Top",
g_list_length (raised_layers)));
for (iter = raised_layers; iter; iter = iter->next)
gimp_image_raise_item_to_top (image, iter->data);
gimp_image_flush (image);
gimp_image_undo_group_end (image);
g_list_free (raised_layers);
}
void
layers_lower_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
GList *lowered_layers = NULL;
return_if_no_layers (image, layers, data);
for (iter = layers; iter; iter = iter->next)
{
GList *layer_list;
gint index;
layer_list = gimp_item_get_container_iter (GIMP_ITEM (iter->data));
index = gimp_item_get_index (iter->data);
if (index < g_list_length (layer_list) - 1)
lowered_layers = g_list_prepend (lowered_layers, iter->data);
}
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_ITEM_DISPLACE,
ngettext ("Lower Layer",
"Lower Layers",
g_list_length (lowered_layers)));
for (iter = lowered_layers; iter; iter = iter->next)
gimp_image_lower_item (image, iter->data, NULL);
gimp_image_flush (image);
gimp_image_undo_group_end (image);
g_list_free (lowered_layers);
}
void
layers_lower_to_bottom_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
GList *lowered_layers = NULL;
return_if_no_layers (image, layers, data);
for (iter = layers; iter; iter = iter->next)
{
GList *layer_list;
gint index;
layer_list = gimp_item_get_container_iter (GIMP_ITEM (iter->data));
index = gimp_item_get_index (iter->data);
if (index < g_list_length (layer_list) - 1)
lowered_layers = g_list_prepend (lowered_layers, iter->data);
}
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_ITEM_DISPLACE,
ngettext ("Lower Layer to Bottom",
"Lower Layers to Bottom",
g_list_length (lowered_layers)));
for (iter = lowered_layers; iter; iter = iter->next)
gimp_image_lower_item_to_bottom (image, iter->data);
gimp_image_flush (image);
gimp_image_undo_group_end (image);
g_list_free (lowered_layers);
}
void
layers_duplicate_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *new_layers = NULL;
GList *iter;
return_if_no_layers (image, layers, data);
layers = g_list_copy (layers);
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_LAYER_ADD,
_("Duplicate layers"));
for (iter = layers; iter; iter = iter->next)
{
GimpLayer *new_layer;
new_layer = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (iter->data),
G_TYPE_FROM_INSTANCE (iter->data)));
/* use the actual parent here, not GIMP_IMAGE_ACTIVE_PARENT because
* the latter would add a duplicated group inside itself instead of
* above it
*/
gimp_image_add_layer (image, new_layer,
gimp_layer_get_parent (iter->data),
gimp_item_get_index (iter->data),
TRUE);
new_layers = g_list_prepend (new_layers, new_layer);
}
gimp_image_set_selected_layers (image, new_layers);
g_list_free (layers);
g_list_free (new_layers);
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
void
layers_anchor_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
return_if_no_layers (image, layers, data);
if (g_list_length (layers) == 1 &&
gimp_layer_is_floating_sel (layers->data))
{
floating_sel_anchor (layers->data);
gimp_image_flush (image);
}
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-03 17:59:48 +00:00
}
void
layers_merge_down_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GimpDisplay *display;
GError *error = NULL;
return_if_no_layers (image, layers, data);
return_if_no_display (display, data);
layers = gimp_image_merge_down (image, layers, action_data_get_context (data),
GIMP_EXPAND_AS_NECESSARY,
GIMP_PROGRESS (display), &error);
if (error)
{
gimp_message_literal (image->gimp,
G_OBJECT (display), GIMP_MESSAGE_WARNING,
error->message);
g_clear_error (&error);
return;
}
gimp_image_set_selected_layers (image, layers);
g_list_free (layers);
gimp_image_flush (image);
}
void
layers_merge_group_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *merge_layers = NULL;
GList *iter;
return_if_no_layers (image, layers, data);
for (iter = layers; iter; iter = iter->next)
{
if (gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)))
{
GList *iter2;
for (iter2 = layers; iter2; iter2 = iter2->next)
{
/* Do not merge a layer when we already merge one of its
* ancestors.
*/
if (gimp_viewable_is_ancestor (iter2->data, iter->data))
break;
}
if (iter2 == NULL)
merge_layers = g_list_prepend (merge_layers, iter->data);
}
}
if (g_list_length (merge_layers) > 1)
{
gchar *undo_name;
undo_name = g_strdup_printf (C_("undo-type", "Merge %d Layer Groups"),
g_list_length (merge_layers));
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE,
undo_name);
g_free (undo_name);
}
for (iter = merge_layers; iter; iter = iter->next)
gimp_image_merge_group_layer (image, GIMP_GROUP_LAYER (iter->data));
if (g_list_length (merge_layers) > 1)
gimp_image_undo_group_end (image);
g_list_free (merge_layers);
gimp_image_flush (image);
}
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-03 17:59:48 +00:00
void
layers_delete_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
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-03 17:59:48 +00:00
{
GimpImage *image;
GList *layers;
GList *removed_layers;
GList *iter;
GList *iter2;
return_if_no_image (image, data);
layers = gimp_image_get_selected_layers (image);
/*TODO: we should have a failsafe to determine when we are going to
* delete all layers (i.e. all layers of first level at least) and
* forbid it. */
/* Copy of the original selection. */
removed_layers = g_list_copy (layers);
/* Removing children layers (they will be removed anyway by removing
* the parent.
*/
for (iter = removed_layers; iter; iter = iter->next)
{
for (iter2 = removed_layers; iter2; iter2 = iter2->next)
{
if (iter->data != iter2->data &&
gimp_viewable_is_ancestor (iter2->data, iter->data))
{
removed_layers = g_list_delete_link (removed_layers, iter);
iter = removed_layers;
break;
}
}
}
if (g_list_length (removed_layers) > 1)
{
gchar *undo_name;
undo_name = g_strdup_printf (C_("undo-type", "Remove %d Layers"),
g_list_length (removed_layers));
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE,
undo_name);
}
for (iter = removed_layers; iter; iter = iter->next)
gimp_image_remove_layer (image, iter->data, TRUE, NULL);
if (g_list_length (removed_layers) > 1)
gimp_image_undo_group_end (image);
g_list_free (removed_layers);
gimp_image_flush (image);
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-03 17:59:48 +00:00
}
void
layers_text_discard_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
app/actions/documents-actions.c app/actions/documents-commands.c 2004-05-12 Michael Natterer <mitch@gimp.org> * app/actions/documents-actions.c * app/actions/documents-commands.c * app/actions/edit-actions.c * app/actions/edit-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.c * app/actions/select-actions.c * app/actions/select-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added tooltips for actions which are now used for dialog buttons, added callback implementations which formerly lived in various widgets, moved some actions around and did some general cleanups. * menus/image-menu.xml.in: s/edit-stroke/select-stroke/ * menus/Makefile.am * menus/selection-editor-menu.xml: new popup menu. * app/menus/menus.c: register <SelectionEditor> and <UndoEditor> UI managers. * app/widgets/gimpeditor.[ch]: added construct properties "menu-factory", "menu-identifier", "ui-path" and "popup-data". Implement GObject::constructor() and create the UI manager if all needed properties were set. Enables creating action buttons at widget construction time because they need a UI manager. (gimp_editor_add_action_button): changed to take a va_list of "extended" actions which are invoked if the resp. button emits "extended_clicked". Store the actions and their modifier masks in a list attached to the button. * app/widgets/gimpcontainerview.c (gimp_container_view_item_selected): if the view has container *and* context, simply change the context and return. (gimp_container_view_context_changed): don't emit "select_item" manually but simply call gimp_container_view_select_item(). (gimp_container_view_viewable_dropped): use gimp_container_view_item_selected() instead of changing the context directly. * app/widgets/gimpcontainereditor.c (gimp_container_editor_select_item): update the UI manager. * app/widgets/gimpdockable.c: don't try to fiddle with the dialog's menu if it doesn't have a ui_path (happens if the UI manager is just a collection of actions for the dialog buttons and has no menu registered). * app/widgets/gimpimageeditor.c: connect to the image's "flush" signal and update the UI manager in the callback. * app/widgets/gimpitemtreeview.c: use GimpEditor's construct properties to create the UI manager so GimpItemTreeView subclasses can have action buttons. Update the UI manager in gimp_item_tree_view_select_item(). * app/widgets/gimpbufferview.c * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpfontview.c * app/widgets/gimpimageview.c * app/widgets/gimptemplateview.c * app/widgets/gimptoolview.c: changed calls to gimp_editor_add_action_button() accordingly and removed some unneeded select_item() implementations. * app/widgets/gimpchanneltreeview.c * app/widgets/gimpvectorstreeview.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimplayertreeview.c * app/widgets/gimpselectioneditor.[ch] * app/widgets/gimpundoeditor.[ch]: use action buttons and removed lots of callbacks which went to the resp. action callbacks. * app/widgets/widgets-types.h: removed some now unneeded function prototypes. * app/gui/dialogs-constructors.c: changed (simplified) many dialog constructors accordingly.
2004-05-12 18:36:33 +00:00
GimpLayer *layer;
return_if_no_layer (image, layer, data);
app/actions/documents-actions.c app/actions/documents-commands.c 2004-05-12 Michael Natterer <mitch@gimp.org> * app/actions/documents-actions.c * app/actions/documents-commands.c * app/actions/edit-actions.c * app/actions/edit-commands.[ch] * app/actions/layers-actions.c * app/actions/layers-commands.c * app/actions/select-actions.c * app/actions/select-commands.[ch] * app/actions/vectors-actions.c * app/actions/vectors-commands.[ch]: added tooltips for actions which are now used for dialog buttons, added callback implementations which formerly lived in various widgets, moved some actions around and did some general cleanups. * menus/image-menu.xml.in: s/edit-stroke/select-stroke/ * menus/Makefile.am * menus/selection-editor-menu.xml: new popup menu. * app/menus/menus.c: register <SelectionEditor> and <UndoEditor> UI managers. * app/widgets/gimpeditor.[ch]: added construct properties "menu-factory", "menu-identifier", "ui-path" and "popup-data". Implement GObject::constructor() and create the UI manager if all needed properties were set. Enables creating action buttons at widget construction time because they need a UI manager. (gimp_editor_add_action_button): changed to take a va_list of "extended" actions which are invoked if the resp. button emits "extended_clicked". Store the actions and their modifier masks in a list attached to the button. * app/widgets/gimpcontainerview.c (gimp_container_view_item_selected): if the view has container *and* context, simply change the context and return. (gimp_container_view_context_changed): don't emit "select_item" manually but simply call gimp_container_view_select_item(). (gimp_container_view_viewable_dropped): use gimp_container_view_item_selected() instead of changing the context directly. * app/widgets/gimpcontainereditor.c (gimp_container_editor_select_item): update the UI manager. * app/widgets/gimpdockable.c: don't try to fiddle with the dialog's menu if it doesn't have a ui_path (happens if the UI manager is just a collection of actions for the dialog buttons and has no menu registered). * app/widgets/gimpimageeditor.c: connect to the image's "flush" signal and update the UI manager in the callback. * app/widgets/gimpitemtreeview.c: use GimpEditor's construct properties to create the UI manager so GimpItemTreeView subclasses can have action buttons. Update the UI manager in gimp_item_tree_view_select_item(). * app/widgets/gimpbufferview.c * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpfontview.c * app/widgets/gimpimageview.c * app/widgets/gimptemplateview.c * app/widgets/gimptoolview.c: changed calls to gimp_editor_add_action_button() accordingly and removed some unneeded select_item() implementations. * app/widgets/gimpchanneltreeview.c * app/widgets/gimpvectorstreeview.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimplayertreeview.c * app/widgets/gimpselectioneditor.[ch] * app/widgets/gimpundoeditor.[ch]: use action buttons and removed lots of callbacks which went to the resp. action callbacks. * app/widgets/widgets-types.h: removed some now unneeded function prototypes. * app/gui/dialogs-constructors.c: changed (simplified) many dialog constructors accordingly.
2004-05-12 18:36:33 +00:00
if (GIMP_IS_TEXT_LAYER (layer))
gimp_text_layer_discard (GIMP_TEXT_LAYER (layer));
}
void
layers_text_to_vectors_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
return_if_no_layer (image, layer, data);
if (GIMP_IS_TEXT_LAYER (layer))
{
GimpVectors *vectors;
gint x, y;
vectors = gimp_text_vectors_new (image, GIMP_TEXT_LAYER (layer)->text);
gimp_item_get_offset (GIMP_ITEM (layer), &x, &y);
gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
gimp_image_add_vectors (image, vectors,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_flush (image);
}
}
void
layers_text_along_vectors_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
GimpVectors *vectors;
return_if_no_layer (image, layer, data);
return_if_no_vectors (image, vectors, data);
if (GIMP_IS_TEXT_LAYER (layer))
{
gdouble box_width;
gdouble box_height;
GimpVectors *new_vectors;
gdouble offset;
box_width = gimp_item_get_width (GIMP_ITEM (layer));
box_height = gimp_item_get_height (GIMP_ITEM (layer));
new_vectors = gimp_text_vectors_new (image, GIMP_TEXT_LAYER (layer)->text);
offset = 0;
switch (GIMP_TEXT_LAYER (layer)->text->base_dir)
{
case GIMP_TEXT_DIRECTION_LTR:
case GIMP_TEXT_DIRECTION_RTL:
offset = 0.5 * box_height;
break;
case GIMP_TEXT_DIRECTION_TTB_RTL:
case GIMP_TEXT_DIRECTION_TTB_RTL_UPRIGHT:
case GIMP_TEXT_DIRECTION_TTB_LTR:
case GIMP_TEXT_DIRECTION_TTB_LTR_UPRIGHT:
{
GimpStroke *stroke = NULL;
while ((stroke = gimp_vectors_stroke_get_next (new_vectors, stroke)))
{
gimp_stroke_rotate (stroke, 0, 0, 270);
gimp_stroke_translate (stroke, 0, box_width);
}
}
offset = 0.5 * box_width;
break;
}
gimp_vectors_warp_vectors (vectors, new_vectors, offset);
gimp_item_set_visible (GIMP_ITEM (new_vectors), TRUE, FALSE);
gimp_image_add_vectors (image, new_vectors,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_flush (image);
}
}
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-03 17:59:48 +00:00
void
layers_resize_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
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-03 17:59:48 +00:00
{
GimpImage *image;
GimpLayer *layer;
GList *layers;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_layers (image, layers, data);
Switch from GtkItemFactory to GtkUIManager. The migration is almost 2004-04-29 Michael Natterer <mitch@gimp.org> Switch from GtkItemFactory to GtkUIManager. The migration is almost complete, still stuff missing/incomplete, definitely added a bunch of new bugs... * app/actions/*-commands.[ch]: converted all callback from GtkItemFactory callbacks to GtkAction callbacks. * app/actions/debug-actions.c * app/actions/gradient-editor-actions.c * app/actions/help-actions.c * app/actions/plug-in-actions.c * app/actions/qmask-actions.c * app/actions/tool-options-actions.c: various fixes. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell-appearance.[ch] * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.[ch]: move everything from GtkItemFactory to GtkUIManager. * app/gui/dialogs.[ch]: added new function dialogs_get_toolbox(). Needed because the action callbacks don't have a widget parameter and sometimes we need a parent window for showing dialogs. * app/gui/Makefile.am * app/gui/brushes-menu.[ch] * app/gui/buffers-menu.[ch] * app/gui/channels-menu.[ch] * app/gui/colormap-editor-menu.[ch] * app/gui/dialogs-menu.[ch] * app/gui/documents-menu.[ch] * app/gui/error-console-menu.[ch] * app/gui/fonts-menu.[ch] * app/gui/gradient-editor-menu.[ch] * app/gui/gradients-menu.[ch] * app/gui/images-menu.[ch] * app/gui/layers-menu.[ch] * app/gui/palette-editor-menu.[ch] * app/gui/palettes-menu.[ch] * app/gui/patterns-menu.[ch] * app/gui/qmask-menu.[ch] * app/gui/templates-menu.[ch] * app/gui/vectors-menu.[ch]: removed these files. * app/gui/gui.c: create a global UI manager for the image popup menu and the toolbox menubar. * app/gui/menus.[ch]: removed all GtkItemFactory code. * app/gui/image-menu.[ch] * app/gui/toolbox-menu.[ch]: removed everything except the trivial setup_funcs. * app/gui/file-open-menu.c * app/gui/file-save-menu.c * app/gui/tool-options-menu.c: don't use the macros from menus.h any more, they are gone. * app/gui/gui-vtable.c * app/gui/plug-in-menus.[ch]: create/destroy the dynamic plug-in menu entries. * app/tools/gimpimagemaptool.c: s/gimp_item_factory_update/ gimp_ui_manager_update/g * app/widgets/gimpuimanager.[ch]: added API to get an action group by name. * app/widgets/gimpmenufactory.c: don't choke on the item_factory entries being NULL. * app/widgets/gimpactiongroup.c: make sure booleans set using g_object_set() only have TRUE or FALSE values. * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdockable.[ch] * app/widgets/gimpdocked.[ch] * app/widgets/gimpeditor.[ch] * app/widgets/gimperrorconsole.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c: removed all GtkItemFactory code and enable the #if 0'ed UI manager stuff. * menus/gradient-editor-menu.xml: fixed typos. * menus/image-menu.xml: duplicate everything so we have both an image menubar and an image popup menu. Badly cries for an XSL processor. * menus/toolbox-menu.xml: added an "Extensions" placeholder.
2004-04-29 12:52:29 +00:00
return_if_no_widget (widget, data);
#define RESIZE_DIALOG_KEY "gimp-resize-dialog"
g_return_if_fail (g_list_length (layers) == 1);
layer = layers->data;
dialog = dialogs_get_dialog (G_OBJECT (layer), RESIZE_DIALOG_KEY);
if (! dialog)
{
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
GimpDisplay *display = NULL;
if (GIMP_IS_IMAGE_WINDOW (data))
display = action_data_get_display (data);
if (layer_resize_unit != GIMP_UNIT_PERCENT && display)
layer_resize_unit = gimp_display_get_shell (display)->unit;
dialog = resize_dialog_new (GIMP_VIEWABLE (layer),
action_data_get_context (data),
_("Set Layer Boundary Size"),
"gimp-layer-resize",
widget,
gimp_standard_help_func,
GIMP_HELP_LAYER_RESIZE,
layer_resize_unit,
config->layer_resize_fill_type,
GIMP_ITEM_SET_NONE,
FALSE,
layers_resize_callback,
NULL);
dialogs_attach_dialog (G_OBJECT (layer), RESIZE_DIALOG_KEY, dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
}
void
layers_resize_to_image_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
return_if_no_layers (image, layers, data);
if (g_list_length (layers) > 1)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_RESIZE,
_("Layers to Image Size"));
for (iter = layers; iter; iter = iter->next)
gimp_layer_resize_to_image (iter->data,
action_data_get_context (data),
GIMP_FILL_TRANSPARENT);
if (g_list_length (layers) > 1)
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
void
layers_scale_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GimpLayer *layer;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_layers (image, layers, data);
Switch from GtkItemFactory to GtkUIManager. The migration is almost 2004-04-29 Michael Natterer <mitch@gimp.org> Switch from GtkItemFactory to GtkUIManager. The migration is almost complete, still stuff missing/incomplete, definitely added a bunch of new bugs... * app/actions/*-commands.[ch]: converted all callback from GtkItemFactory callbacks to GtkAction callbacks. * app/actions/debug-actions.c * app/actions/gradient-editor-actions.c * app/actions/help-actions.c * app/actions/plug-in-actions.c * app/actions/qmask-actions.c * app/actions/tool-options-actions.c: various fixes. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell-appearance.[ch] * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.[ch]: move everything from GtkItemFactory to GtkUIManager. * app/gui/dialogs.[ch]: added new function dialogs_get_toolbox(). Needed because the action callbacks don't have a widget parameter and sometimes we need a parent window for showing dialogs. * app/gui/Makefile.am * app/gui/brushes-menu.[ch] * app/gui/buffers-menu.[ch] * app/gui/channels-menu.[ch] * app/gui/colormap-editor-menu.[ch] * app/gui/dialogs-menu.[ch] * app/gui/documents-menu.[ch] * app/gui/error-console-menu.[ch] * app/gui/fonts-menu.[ch] * app/gui/gradient-editor-menu.[ch] * app/gui/gradients-menu.[ch] * app/gui/images-menu.[ch] * app/gui/layers-menu.[ch] * app/gui/palette-editor-menu.[ch] * app/gui/palettes-menu.[ch] * app/gui/patterns-menu.[ch] * app/gui/qmask-menu.[ch] * app/gui/templates-menu.[ch] * app/gui/vectors-menu.[ch]: removed these files. * app/gui/gui.c: create a global UI manager for the image popup menu and the toolbox menubar. * app/gui/menus.[ch]: removed all GtkItemFactory code. * app/gui/image-menu.[ch] * app/gui/toolbox-menu.[ch]: removed everything except the trivial setup_funcs. * app/gui/file-open-menu.c * app/gui/file-save-menu.c * app/gui/tool-options-menu.c: don't use the macros from menus.h any more, they are gone. * app/gui/gui-vtable.c * app/gui/plug-in-menus.[ch]: create/destroy the dynamic plug-in menu entries. * app/tools/gimpimagemaptool.c: s/gimp_item_factory_update/ gimp_ui_manager_update/g * app/widgets/gimpuimanager.[ch]: added API to get an action group by name. * app/widgets/gimpmenufactory.c: don't choke on the item_factory entries being NULL. * app/widgets/gimpactiongroup.c: make sure booleans set using g_object_set() only have TRUE or FALSE values. * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdockable.[ch] * app/widgets/gimpdocked.[ch] * app/widgets/gimpeditor.[ch] * app/widgets/gimperrorconsole.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c: removed all GtkItemFactory code and enable the #if 0'ed UI manager stuff. * menus/gradient-editor-menu.xml: fixed typos. * menus/image-menu.xml: duplicate everything so we have both an image menubar and an image popup menu. Badly cries for an XSL processor. * menus/toolbox-menu.xml: added an "Extensions" placeholder.
2004-04-29 12:52:29 +00:00
return_if_no_widget (widget, data);
#define SCALE_DIALOG_KEY "gimp-scale-dialog"
g_return_if_fail (g_list_length (layers) == 1);
layer = layers->data;
dialog = dialogs_get_dialog (G_OBJECT (layer), SCALE_DIALOG_KEY);
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
if (! dialog)
{
GimpDisplay *display = NULL;
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
if (GIMP_IS_IMAGE_WINDOW (data))
display = action_data_get_display (data);
if (layer_scale_unit != GIMP_UNIT_PERCENT && display)
layer_scale_unit = gimp_display_get_shell (display)->unit;
if (layer_scale_interp == -1)
layer_scale_interp = image->gimp->config->interpolation_type;
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
dialog = scale_dialog_new (GIMP_VIEWABLE (layer),
action_data_get_context (data),
_("Scale Layer"), "gimp-layer-scale",
widget,
gimp_standard_help_func, GIMP_HELP_LAYER_SCALE,
layer_scale_unit,
layer_scale_interp,
layers_scale_callback,
display);
dialogs_attach_dialog (G_OBJECT (layer), SCALE_DIALOG_KEY, dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
}
void
layers_crop_to_selection_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
app/actions/data-commands.c app/actions/documents-commands.c 2006-10-09 Michael Natterer <mitch@gimp.org> * app/actions/data-commands.c * app/actions/documents-commands.c * app/actions/drawable-commands.c * app/actions/gradients-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c * app/core/gimp-contexts.c * app/core/gimp-documents.c * app/core/gimp-edit.c * app/core/gimp-modules.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp-units.c * app/core/gimpchannel.c * app/core/gimpdatafactory.[ch] * app/core/gimpdrawable-bucket-fill.c * app/core/gimpimage-merge.c * app/core/gimpimagefile.c * app/core/gimplayer-floating-sel.c * app/core/gimppdbprogress.c * app/core/gimpselection.c * app/dialogs/palette-import-dialog.c * app/display/gimpdisplayshell-dnd.c * app/gui/session.c * app/gui/themes.c * app/pdb/gimpprocedure.c * app/plug-in/gimpplugin-message.c * app/plug-in/gimpplugin.c * app/plug-in/gimppluginmanager-file.c * app/plug-in/gimppluginmanager.c * app/text/gimptextlayer-xcf.c * app/text/gimptextlayer.c * app/widgets/gimpcontrollers.c * app/widgets/gimpdataeditor.c * app/widgets/gimpdevices.c * app/widgets/gimpdnd-xds.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c * app/widgets/gimptoolbox.c * app/widgets/gimpuimanager.c * app/widgets/gimpvectorstreeview.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/palette.pdb: convert lots of g_message() to gimp_message(). Make sure we never pass unknown strings (like error->message) to printf-like functions directly; run them thorugh "%s" instead. Don't translate some messages which should never happen. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 18:49:15 +00:00
GtkWidget *widget;
gchar *desc;
gint x, y;
gint width, height;
return_if_no_layers (image, layers, data);
app/actions/data-commands.c app/actions/documents-commands.c 2006-10-09 Michael Natterer <mitch@gimp.org> * app/actions/data-commands.c * app/actions/documents-commands.c * app/actions/drawable-commands.c * app/actions/gradients-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c * app/core/gimp-contexts.c * app/core/gimp-documents.c * app/core/gimp-edit.c * app/core/gimp-modules.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp-units.c * app/core/gimpchannel.c * app/core/gimpdatafactory.[ch] * app/core/gimpdrawable-bucket-fill.c * app/core/gimpimage-merge.c * app/core/gimpimagefile.c * app/core/gimplayer-floating-sel.c * app/core/gimppdbprogress.c * app/core/gimpselection.c * app/dialogs/palette-import-dialog.c * app/display/gimpdisplayshell-dnd.c * app/gui/session.c * app/gui/themes.c * app/pdb/gimpprocedure.c * app/plug-in/gimpplugin-message.c * app/plug-in/gimpplugin.c * app/plug-in/gimppluginmanager-file.c * app/plug-in/gimppluginmanager.c * app/text/gimptextlayer-xcf.c * app/text/gimptextlayer.c * app/widgets/gimpcontrollers.c * app/widgets/gimpdataeditor.c * app/widgets/gimpdevices.c * app/widgets/gimpdnd-xds.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c * app/widgets/gimptoolbox.c * app/widgets/gimpuimanager.c * app/widgets/gimpvectorstreeview.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/palette.pdb: convert lots of g_message() to gimp_message(). Make sure we never pass unknown strings (like error->message) to printf-like functions directly; run them thorugh "%s" instead. Don't translate some messages which should never happen. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 18:49:15 +00:00
return_if_no_widget (widget, data);
if (! gimp_item_bounds (GIMP_ITEM (gimp_image_get_mask (image)),
&x, &y, &width, &height))
{
bumped minimum required version of GLib to 2.18.0. 2008-11-04 Sven Neumann <sven@sven> * configure.in: bumped minimum required version of GLib to 2.18.0. * INSTALL: document the updated dependency. * app/core/gimp.[ch]: introduced gimp_message_literal(), a variant of gimp_message() that takes a literal string. * app/errors.[ch]: removed format arguments from gimp_fatal_error() and gimp_terminate() and let them take a literal string instead. * app/tools/gimptool.[ch]: introduced gimp_tool_message_literal(), a variant of gimp_tool_message() that takes a literal string. * app/actions/documents-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/gradients-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/plug-in-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c * app/config/gimprc.c * app/core/gimp-modules.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp-units.c * app/core/gimpchannel.c * app/core/gimpcontainer-filter.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpimage-convert.c * app/core/gimpimage-merge.c * app/core/gimpimage.c * app/core/gimpimagefile.c * app/core/gimplayer-floating-sel.c * app/core/gimplayer.c * app/core/gimpselection.c * app/dialogs/convert-dialog.c * app/dialogs/dialogs.c * app/dialogs/palette-import-dialog.c * app/dialogs/preferences-dialog.c * app/dialogs/quit-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/file/file-open.c * app/file/file-procedure.c * app/file/file-save.c * app/file/file-utils.c * app/gegl/gimpcurvesconfig.c * app/gegl/gimplevelsconfig.c * app/gui/gui-message.c * app/gui/gui.c * app/gui/session.c * app/paint/gimpbrushcore.c * app/paint/gimpclone.c * app/paint/gimpheal.c * app/paint/gimpperspectiveclone.c * app/paint/gimpsourcecore.c * app/pdb/gimppdb-utils.c * app/pdb/gimpprocedure.c * app/plug-in/gimpplugin-message.c * app/plug-in/gimpplugin.c * app/plug-in/gimppluginmanager-restore.c * app/plug-in/gimppluginprocedure.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcurvestool.c * app/tools/gimpdesaturatetool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpforegroundselecttool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpgegltool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpimagemaptool-settings.c * app/tools/gimpiscissorstool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimpposterizetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsourcetool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimpcontrollers.c * app/widgets/gimpdataeditor.c * app/widgets/gimpdevices.c * app/widgets/gimpdnd-xds.c * app/widgets/gimperrordialog.c * app/widgets/gimphelp.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppdbdialog.c * app/widgets/gimpsettingsbox.c * app/widgets/gimpvectorstreeview.c * app/widgets/gimpwidgets-utils.c * app/xcf/xcf-load.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/floating_sel.pdb * tools/pdbgen/pdb/image.pdb: use the _literal variants for g_set_error(), gimp_message() and gimp_tool_message(). * app/pdb/convert-cmds.c * app/pdb/edit-cmds.c * app/pdb/floating-sel-cmds.c * app/pdb/image-cmds.c: regenerated. svn path=/trunk/; revision=27548
2008-11-04 12:33:09 +00:00
gimp_message_literal (image->gimp,
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("Cannot crop because the current selection "
"is empty."));
return;
}
desc = g_strdup_printf (ngettext ("Crop Layer to Selection",
"Crop %d Layers to Selection",
g_list_length (layers)),
g_list_length (layers));
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_RESIZE, desc);
g_free (desc);
for (iter = layers; iter; iter = iter->next)
{
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (iter->data), &off_x, &off_y);
off_x -= x;
off_y -= y;
gimp_item_resize (GIMP_ITEM (iter->data),
action_data_get_context (data), GIMP_FILL_TRANSPARENT,
width, height, off_x, off_y);
}
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
void
layers_crop_to_content_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
GtkWidget *widget;
gchar *desc;
gint x, y;
gint width, height;
gint n_croppable = 0;
return_if_no_layers (image, layers, data);
return_if_no_widget (widget, data);
for (iter = layers; iter; iter = iter->next)
{
switch (gimp_pickable_auto_shrink (GIMP_PICKABLE (iter->data),
0, 0,
gimp_item_get_width (iter->data),
gimp_item_get_height (iter->data),
&x, &y, &width, &height))
{
case GIMP_AUTO_SHRINK_SHRINK:
n_croppable++;
break;
case GIMP_AUTO_SHRINK_EMPTY:
/* Cannot crop because the layer has no content. */
case GIMP_AUTO_SHRINK_UNSHRINKABLE:
/* Cannot crop because the active layer is already cropped to
* its content. */
break;
}
}
if (n_croppable == 0)
{
gimp_message_literal (image->gimp,
G_OBJECT (widget), GIMP_MESSAGE_INFO,
_("Cannot crop because none of the selected"
" layers have content or they are already"
" cropped to their content."));
return;
}
desc = g_strdup_printf (ngettext ("Crop Layer to Content",
"Crop %d Layers to Content",
n_croppable),
n_croppable);
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_RESIZE, desc);
g_free (desc);
for (iter = layers; iter; iter = iter->next)
{
switch (gimp_pickable_auto_shrink (GIMP_PICKABLE (iter->data),
0, 0,
gimp_item_get_width (iter->data),
gimp_item_get_height (iter->data),
&x, &y, &width, &height))
{
case GIMP_AUTO_SHRINK_SHRINK:
gimp_item_resize (iter->data,
action_data_get_context (data), GIMP_FILL_TRANSPARENT,
width, height, -x, -y);
break;
default:
break;
}
}
gimp_image_flush (image);
gimp_image_undo_group_end (image);
}
void
layers_mask_add_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
GtkWidget *widget;
GtkWidget *dialog;
GList *update_layers = NULL;
gint n_channels = 0;
return_if_no_layers (image, layers, data);
Switch from GtkItemFactory to GtkUIManager. The migration is almost 2004-04-29 Michael Natterer <mitch@gimp.org> Switch from GtkItemFactory to GtkUIManager. The migration is almost complete, still stuff missing/incomplete, definitely added a bunch of new bugs... * app/actions/*-commands.[ch]: converted all callback from GtkItemFactory callbacks to GtkAction callbacks. * app/actions/debug-actions.c * app/actions/gradient-editor-actions.c * app/actions/help-actions.c * app/actions/plug-in-actions.c * app/actions/qmask-actions.c * app/actions/tool-options-actions.c: various fixes. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell-appearance.[ch] * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.[ch]: move everything from GtkItemFactory to GtkUIManager. * app/gui/dialogs.[ch]: added new function dialogs_get_toolbox(). Needed because the action callbacks don't have a widget parameter and sometimes we need a parent window for showing dialogs. * app/gui/Makefile.am * app/gui/brushes-menu.[ch] * app/gui/buffers-menu.[ch] * app/gui/channels-menu.[ch] * app/gui/colormap-editor-menu.[ch] * app/gui/dialogs-menu.[ch] * app/gui/documents-menu.[ch] * app/gui/error-console-menu.[ch] * app/gui/fonts-menu.[ch] * app/gui/gradient-editor-menu.[ch] * app/gui/gradients-menu.[ch] * app/gui/images-menu.[ch] * app/gui/layers-menu.[ch] * app/gui/palette-editor-menu.[ch] * app/gui/palettes-menu.[ch] * app/gui/patterns-menu.[ch] * app/gui/qmask-menu.[ch] * app/gui/templates-menu.[ch] * app/gui/vectors-menu.[ch]: removed these files. * app/gui/gui.c: create a global UI manager for the image popup menu and the toolbox menubar. * app/gui/menus.[ch]: removed all GtkItemFactory code. * app/gui/image-menu.[ch] * app/gui/toolbox-menu.[ch]: removed everything except the trivial setup_funcs. * app/gui/file-open-menu.c * app/gui/file-save-menu.c * app/gui/tool-options-menu.c: don't use the macros from menus.h any more, they are gone. * app/gui/gui-vtable.c * app/gui/plug-in-menus.[ch]: create/destroy the dynamic plug-in menu entries. * app/tools/gimpimagemaptool.c: s/gimp_item_factory_update/ gimp_ui_manager_update/g * app/widgets/gimpuimanager.[ch]: added API to get an action group by name. * app/widgets/gimpmenufactory.c: don't choke on the item_factory entries being NULL. * app/widgets/gimpactiongroup.c: make sure booleans set using g_object_set() only have TRUE or FALSE values. * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdockable.[ch] * app/widgets/gimpdocked.[ch] * app/widgets/gimpeditor.[ch] * app/widgets/gimperrorconsole.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c: removed all GtkItemFactory code and enable the #if 0'ed UI manager stuff. * menus/gradient-editor-menu.xml: fixed typos. * menus/image-menu.xml: duplicate everything so we have both an image menubar and an image popup menu. Badly cries for an XSL processor. * menus/toolbox-menu.xml: added an "Extensions" placeholder.
2004-04-29 12:52:29 +00:00
return_if_no_widget (widget, data);
for (iter = layers; iter; iter = iter->next)
{
g_return_if_fail (GIMP_IS_LAYER (iter->data));
if (! gimp_layer_get_mask (iter->data))
{
update_layers = g_list_prepend (update_layers, iter->data);
n_channels++;
}
}
if (n_channels == 0)
/* No layers or they all have masks already. */
return;
#define ADD_MASK_DIALOG_KEY "gimp-add-mask-dialog"
for (iter = update_layers; iter; iter = iter->next)
{
dialog = dialogs_get_dialog (G_OBJECT (iter->data), ADD_MASK_DIALOG_KEY);
if (dialog)
break;
}
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
if (! dialog)
{
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
dialog = layer_add_mask_dialog_new (update_layers, action_data_get_context (data),
widget,
config->layer_add_mask_type,
config->layer_add_mask_invert,
layers_add_mask_callback,
NULL);
for (iter = update_layers; iter; iter = iter->next)
dialogs_attach_dialog (G_OBJECT (iter->data), ADD_MASK_DIALOG_KEY, dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
}
void
layers_mask_add_last_vals_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
GtkWidget *widget;
GimpDialogConfig *config;
GimpChannel *channel = NULL;
GimpLayerMask *mask;
return_if_no_layers (image, layers, data);
return_if_no_widget (widget, data);
config = GIMP_DIALOG_CONFIG (image->gimp->config);
if (config->layer_add_mask_type == GIMP_ADD_MASK_CHANNEL)
{
GList *selected_channels;
selected_channels = gimp_image_get_selected_channels (image);
if (selected_channels)
{
channel = selected_channels->data;
}
else
{
GimpContainer *channels = gimp_image_get_channels (image);
channel = GIMP_CHANNEL (gimp_container_get_first_child (channels));
}
if (! channel)
{
layers_mask_add_cmd_callback (action, value, data);
return;
}
}
for (iter = layers; iter; iter = iter->next)
{
if (! gimp_layer_get_mask (iter->data))
break;
}
if (iter == NULL)
/* No layers or they all have masks already. */
return;
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_LAYER_ADD,
_("Add Layer Masks"));
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_get_mask (iter->data))
continue;
mask = gimp_layer_create_mask (iter->data,
config->layer_add_mask_type,
channel);
if (config->layer_add_mask_invert)
gimp_channel_invert (GIMP_CHANNEL (mask), FALSE);
gimp_layer_add_mask (iter->data, mask, TRUE, NULL);
}
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
void
layers_mask_apply_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpMaskApplyMode mode;
GimpImage *image;
GList *layers;
GList *iter;
gchar *undo_text = NULL;
GimpUndoType undo_type = GIMP_UNDO_GROUP_NONE;
return_if_no_layers (image, layers, data);
mode = (GimpMaskApplyMode) g_variant_get_int32 (value);
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_get_mask (iter->data) &&
(mode != GIMP_MASK_APPLY ||
(! gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)) &&
! gimp_item_is_content_locked (GIMP_ITEM (iter->data), NULL))))
break;
}
if (iter == NULL)
2020-08-08 05:58:47 +00:00
/* No layers or none have applicable masks. */
return;
switch (mode)
{
case GIMP_MASK_APPLY:
undo_type = GIMP_UNDO_GROUP_MASK;
undo_text = _("Apply Layer Masks");
break;
case GIMP_MASK_DISCARD:
undo_type = GIMP_UNDO_GROUP_MASK;
undo_text = _("Delete Layer Masks");
break;
default:
g_warning ("%s: unhandled GimpMaskApplyMode %d\n",
G_STRFUNC, mode);
break;
}
if (undo_type != GIMP_UNDO_GROUP_NONE)
gimp_image_undo_group_start (image, undo_type, undo_text);
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_get_mask (iter->data))
{
if (mode == GIMP_MASK_APPLY &&
(gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)) ||
gimp_item_is_content_locked (GIMP_ITEM (iter->data), NULL)))
/* Layer groups cannot apply masks. Neither can
* content-locked layers.
*/
continue;
gimp_layer_apply_mask (iter->data, mode, TRUE);
}
}
if (undo_type != GIMP_UNDO_GROUP_NONE)
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
void
layers_mask_edit_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
gboolean active = g_variant_get_boolean (value);
return_if_no_layers (image, layers, data);
/* Multiple-layer selection cannot edit masks. */
active = active && (g_list_length (layers) == 1);
for (iter = layers; iter; iter = iter->next)
if (gimp_layer_get_mask (iter->data))
gimp_layer_set_edit_mask (iter->data, active);
gimp_image_flush (image);
}
void
layers_mask_show_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
gboolean active = g_variant_get_boolean (value);
gboolean have_masks = FALSE;
return_if_no_layers (image, layers, data);
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_get_mask (iter->data))
{
have_masks = TRUE;
/* A bit of tricky to handle multiple and diverse layers with
* a toggle action (with only binary state).
* In non-active state, we will consider sets of both shown
* and hidden masks as ok and exits. This allows us to switch
* the action "active" state without actually changing
* individual masks state without explicit user request.
*/
if (! active && ! gimp_layer_get_show_mask (iter->data))
return;
}
}
if (! have_masks)
return;
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_LAYER_ADD,
_("Show Layer Masks"));
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_get_mask (iter->data))
{
gimp_layer_set_show_mask (iter->data, active, TRUE);
}
}
gimp_image_flush (image);
gimp_image_undo_group_end (image);
}
void
layers_mask_disable_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
gboolean active = g_variant_get_boolean (value);
gboolean have_masks = FALSE;
return_if_no_layers (image, layers, data);
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_get_mask (iter->data))
{
have_masks = TRUE;
/* A bit of tricky to handle multiple and diverse layers with
* a toggle action (with only binary state).
* In non-active state, we will consider sets of both enabled
* and disabled masks as ok and exits. This allows us to
* switch the action "active" state without actually changing
* individual masks state without explicit user request.
*/
if (! active && gimp_layer_get_apply_mask (iter->data))
return;
}
}
if (! have_masks)
return;
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_LAYER_ADD,
_("Disable Layer Masks"));
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_get_mask (iter->data))
{
gimp_layer_set_apply_mask (iter->data, ! active, TRUE);
}
}
gimp_image_flush (image);
gimp_image_undo_group_end (image);
}
void
layers_mask_to_selection_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
GList *masks = NULL;
return_if_no_layers (image, layers, data);
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_get_mask (iter->data))
masks = g_list_prepend (masks, gimp_layer_get_mask (iter->data));
}
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 15:54:47 +00:00
if (masks)
{
GimpChannelOps operation = (GimpChannelOps) g_variant_get_int32 (value);
switch (operation)
{
case GIMP_CHANNEL_OP_REPLACE:
gimp_channel_push_undo (gimp_image_get_mask (image),
C_("undo-type", "Masks to Selection"));
break;
case GIMP_CHANNEL_OP_ADD:
gimp_channel_push_undo (gimp_image_get_mask (image),
C_("undo-type", "Add Masks to Selection"));
break;
case GIMP_CHANNEL_OP_SUBTRACT:
gimp_channel_push_undo (gimp_image_get_mask (image),
C_("undo-type", "Subtract Masks from Selection"));
break;
case GIMP_CHANNEL_OP_INTERSECT:
gimp_channel_push_undo (gimp_image_get_mask (image),
C_("undo-type", "Intersect Masks with Selection"));
break;
}
gimp_channel_combine_items (gimp_image_get_mask (image),
masks, operation);
gimp_image_flush (image);
g_list_free (masks);
}
}
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 15:54:47 +00:00
void
layers_alpha_add_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
return_if_no_layers (image, layers, data);
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_LAYER_ADD_ALPHA,
_("Add Alpha Channel"));
for (iter = layers; iter; iter = iter->next)
if (! gimp_drawable_has_alpha (iter->data))
gimp_layer_add_alpha (iter->data);
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
void
layers_alpha_remove_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
return_if_no_layers (image, layers, data);
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_LAYER_ADD_ALPHA,
_("Remove Alpha Channel"));
for (iter = layers; iter; iter = iter->next)
if (gimp_drawable_has_alpha (iter->data))
gimp_layer_remove_alpha (iter->data, action_data_get_context (data));
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
void
layers_alpha_to_selection_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 15:54:47 +00:00
{
GimpImage *image;
GimpDisplay *display;
GList *layers;
GimpChannelOps operation;
return_if_no_layers (image, layers, data);
return_if_no_display (display, data);
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 15:54:47 +00:00
operation = (GimpChannelOps) g_variant_get_int32 (value);
switch (operation)
{
case GIMP_CHANNEL_OP_REPLACE:
gimp_channel_push_undo (gimp_image_get_mask (image),
C_("undo-type", "Alpha to Selection"));
break;
case GIMP_CHANNEL_OP_ADD:
gimp_channel_push_undo (gimp_image_get_mask (image),
C_("undo-type", "Add Alpha to Selection"));
break;
case GIMP_CHANNEL_OP_SUBTRACT:
gimp_channel_push_undo (gimp_image_get_mask (image),
C_("undo-type", "Subtract Alpha from Selection"));
break;
case GIMP_CHANNEL_OP_INTERSECT:
gimp_channel_push_undo (gimp_image_get_mask (image),
C_("undo-type", "Intersect Alpha with Selection"));
break;
}
2020-05-20 18:16:30 +02:00
gimp_channel_combine_items (gimp_image_get_mask (image),
layers, operation);
gimp_image_flush (image);
if (gimp_channel_is_empty (gimp_image_get_mask (image)))
{
gimp_message_literal (image->gimp, G_OBJECT (display),
GIMP_MESSAGE_WARNING,
_("Empty Selection"));
}
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 15:54:47 +00:00
}
void
layers_opacity_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
gdouble opacity;
GimpUndo *undo;
GimpActionSelectType select_type;
gboolean push_undo = TRUE;
return_if_no_layers (image, layers, data);
select_type = (GimpActionSelectType) g_variant_get_int32 (value);
if (g_list_length (layers) == 1)
{
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_LAYER_OPACITY);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (layers->data))
push_undo = FALSE;
}
if (g_list_length (layers) > 1)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_LAYER_OPACITY,
_("Set layers opacity"));
for (iter = layers; iter; iter = iter->next)
{
opacity = action_select_value (select_type,
gimp_layer_get_opacity (iter->data),
0.0, 1.0, 1.0,
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
gimp_layer_set_opacity (iter->data, opacity, push_undo);
}
if (g_list_length (layers) > 1)
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
void
layers_mode_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
GimpActionSelectType select_type;
gboolean push_undo = TRUE;
return_if_no_layers (image, layers, data);
select_type = (GimpActionSelectType) g_variant_get_int32 (value);
if (g_list_length (layers) == 1)
{
GimpUndo *undo;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_LAYER_MODE);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (layers->data))
push_undo = FALSE;
}
if (g_list_length (layers) > 1)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_LAYER_OPACITY,
_("Set layers opacity"));
for (iter = layers; iter; iter = iter->next)
{
GimpLayerMode *modes;
gint n_modes;
GimpLayerMode layer_mode;
gint index;
layer_mode = gimp_layer_get_mode (iter->data);
modes = gimp_layer_mode_get_context_array (layer_mode,
GIMP_LAYER_MODE_CONTEXT_LAYER,
&n_modes);
index = layers_mode_index (layer_mode, modes, n_modes);
index = action_select_value (select_type,
index, 0, n_modes - 1, 0,
0.0, 1.0, 1.0, 0.0, FALSE);
layer_mode = modes[index];
g_free (modes);
gimp_layer_set_mode (iter->data, layer_mode, push_undo);
}
if (g_list_length (layers) > 1)
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
void
layers_blend_space_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *update_layers = NULL;
GList *iter;
GimpLayerColorSpace blend_space;
gboolean push_undo = TRUE;
return_if_no_layers (image, layers, data);
blend_space = (GimpLayerColorSpace) g_variant_get_int32 (value);
for (iter = layers; iter; iter = iter->next)
{
GimpLayerMode mode;
mode = gimp_layer_get_mode (iter->data);
if (gimp_layer_mode_is_blend_space_mutable (mode) &&
blend_space != gimp_layer_get_blend_space (iter->data))
update_layers = g_list_prepend (update_layers, iter->data);
}
if (g_list_length (update_layers) == 1)
{
GimpUndo *undo;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_LAYER_PROP_UNDO,
GIMP_UNDO_LAYER_MODE);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (update_layers->data))
push_undo = FALSE;
}
if (update_layers)
{
if (g_list_length (update_layers) > 1)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_LAYER_MODE,
_("Set layers' blend space"));
for (iter = update_layers; iter; iter = iter->next)
gimp_layer_set_blend_space (iter->data, blend_space, push_undo);
if (g_list_length (update_layers) > 1)
gimp_image_undo_group_end (image);
g_list_free (update_layers);
gimp_image_flush (image);
}
}
void
layers_composite_space_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *update_layers = NULL;
GList *iter;
GimpLayerColorSpace composite_space;
gboolean push_undo = TRUE;
return_if_no_layers (image, layers, data);
composite_space = (GimpLayerColorSpace) g_variant_get_int32 (value);
for (iter = layers; iter; iter = iter->next)
{
GimpLayerMode mode;
mode = gimp_layer_get_mode (iter->data);
if (gimp_layer_mode_is_composite_space_mutable (mode) &&
composite_space != gimp_layer_get_composite_space (iter->data))
update_layers = g_list_prepend (update_layers, iter->data);
}
if (g_list_length (update_layers) == 1)
{
GimpUndo *undo;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_LAYER_PROP_UNDO,
GIMP_UNDO_LAYER_MODE);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (update_layers->data))
push_undo = FALSE;
}
if (update_layers)
{
if (g_list_length (update_layers) > 1)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_LAYER_MODE,
_("Set layers' composite space"));
for (iter = update_layers; iter; iter = iter->next)
gimp_layer_set_composite_space (iter->data, composite_space, push_undo);
if (g_list_length (update_layers) > 1)
gimp_image_undo_group_end (image);
g_list_free (update_layers);
gimp_image_flush (image);
}
}
void
layers_composite_mode_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *update_layers = NULL;
GList *iter;
GimpLayerCompositeMode composite_mode;
gboolean push_undo = TRUE;
return_if_no_layers (image, layers, data);
composite_mode = (GimpLayerCompositeMode) g_variant_get_int32 (value);
for (iter = layers; iter; iter = iter->next)
{
GimpLayerMode mode;
mode = gimp_layer_get_mode (iter->data);
if (gimp_layer_mode_is_composite_mode_mutable (mode) &&
composite_mode != gimp_layer_get_composite_mode (iter->data))
update_layers = g_list_prepend (update_layers, iter->data);
}
if (g_list_length (update_layers) == 1)
{
GimpUndo *undo;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_LAYER_PROP_UNDO,
GIMP_UNDO_LAYER_MODE);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (update_layers->data))
push_undo = FALSE;
}
if (update_layers)
{
if (g_list_length (update_layers) > 1)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_LAYER_MODE,
_("Set layers' composite mode"));
for (iter = update_layers; iter; iter = iter->next)
gimp_layer_set_composite_mode (iter->data, composite_mode, push_undo);
if (g_list_length (update_layers) > 1)
gimp_image_undo_group_end (image);
g_list_free (update_layers);
gimp_image_flush (image);
}
}
void
layers_visible_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
return_if_no_layers (image, layers, data);
items_visible_cmd_callback (action, value, image, layers);
}
void
layers_lock_content_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
return_if_no_layers (image, layers, data);
items_lock_content_cmd_callback (action, value, image, layers);
}
void
layers_lock_position_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
return_if_no_layers (image, layers, data);
items_lock_position_cmd_callback (action, value, image, layers);
}
void
layers_lock_alpha_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
app/actions/layers-actions.c app/actions/layers-commands.[ch] 2005-07-10 Michael Natterer <mitch@gimp.org> * app/actions/layers-actions.c * app/actions/layers-commands.[ch] * app/core/core-enums.[ch] * app/core/gimpimage-undo-push.[ch] * app/core/gimplayer-floating-sel.c * app/core/gimplayer.[ch] * app/text/gimptextlayer-xcf.c * app/widgets/gimphelp-ids.h * app/widgets/gimplayertreeview.[ch] * app/xcf/xcf-load.c * app/xcf/xcf-private.h * app/xcf/xcf-save.c * tools/pdbgen/pdb/layer.pdb * menus/image-menu.xml.in * libgimp/gimp.def: did a global s/preserve_trans/lock_alpha/ in preparation for more layer locking flags. * app/pdb/procedural_db.c * libgimp/gimplayer.[ch]: added compat stuff for preserve_trans. * app/pdb/layer_cmds.c * libgimp/gimplayer_pdb.[ch]: regenerated. * plug-ins/common/colortoalpha.c * plug-ins/common/iwarp.c * plug-ins/common/psd.c * plug-ins/common/psd_save.c * plug-ins/common/psp.c * plug-ins/common/rotate.c * plug-ins/common/threshold_alpha.c * plug-ins/common/vpropagate.c * plug-ins/script-fu/scripts/3d-outline.scm * plug-ins/script-fu/scripts/alien-glow-bar.scm * plug-ins/script-fu/scripts/alien-glow-bullet.scm * plug-ins/script-fu/scripts/alien-glow-logo.scm * plug-ins/script-fu/scripts/basic1-logo.scm * plug-ins/script-fu/scripts/basic2-logo.scm * plug-ins/script-fu/scripts/beveled-pattern-button.scm * plug-ins/script-fu/scripts/blend-anim.scm * plug-ins/script-fu/scripts/blended-logo.scm * plug-ins/script-fu/scripts/bovinated-logo.scm * plug-ins/script-fu/scripts/burn-in-anim.scm * plug-ins/script-fu/scripts/carved-logo.scm * plug-ins/script-fu/scripts/chalk.scm * plug-ins/script-fu/scripts/chip-away.scm * plug-ins/script-fu/scripts/comic-logo.scm * plug-ins/script-fu/scripts/coolmetal-logo.scm * plug-ins/script-fu/scripts/crystal-logo.scm * plug-ins/script-fu/scripts/drop-shadow.scm * plug-ins/script-fu/scripts/gimp-headers.scm * plug-ins/script-fu/scripts/gimp-labels.scm * plug-ins/script-fu/scripts/glowing-logo.scm * plug-ins/script-fu/scripts/gradient-bevel-logo.scm * plug-ins/script-fu/scripts/image-structure.scm * plug-ins/script-fu/scripts/neon-logo.scm * plug-ins/script-fu/scripts/perspective-shadow.scm * plug-ins/script-fu/scripts/starburst-logo.scm * plug-ins/script-fu/scripts/starscape-logo.scm * plug-ins/script-fu/scripts/textured-logo.scm * plug-ins/script-fu/scripts/title-header.scm * plug-ins/script-fu/scripts/waves-anim.scm * plug-ins/xjt/xjt.c: changed accordingly.
2005-07-10 21:17:22 +00:00
gboolean lock_alpha;
gboolean lock_change = FALSE;
return_if_no_layers (image, layers, data);
lock_alpha = g_variant_get_boolean (value);
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_can_lock_alpha (iter->data))
{
/* Similar trick as in layers_mask_show_cmd_callback().
* When unlocking, we expect all selected layers to be locked,
2020-08-08 05:58:47 +00:00
* otherwise SET_ACTIVE() calls in layers-actions.c will
* trigger lock updates.
*/
if (! lock_alpha && ! gimp_layer_get_lock_alpha (iter->data))
return;
if (lock_alpha != gimp_layer_get_lock_alpha (iter->data))
lock_change = TRUE;
}
}
if (! lock_change)
/* No layer locks would be changed. */
return;
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_LAYER_LOCK_ALPHA,
lock_alpha ? _("Lock alpha channels") : _("Unlock alpha channels"));
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_can_lock_alpha (iter->data))
{
if (lock_alpha != gimp_layer_get_lock_alpha (iter->data))
gimp_layer_set_lock_alpha (iter->data, lock_alpha, TRUE);
}
}
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
void
layers_color_tag_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpImage *image;
GList *layers;
GList *iter;
GimpColorTag color_tag;
return_if_no_layers (image, layers, data);
color_tag = (GimpColorTag) g_variant_get_int32 (value);
for (iter = layers; iter; iter = iter->next)
items_color_tag_cmd_callback (action, image, GIMP_ITEM (iter->data),
color_tag);
}
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
/* private functions */
static void
layers_new_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
GimpLayerColorSpace layer_blend_space,
GimpLayerColorSpace layer_composite_space,
GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
gint layer_height,
gint layer_offset_x,
gint layer_offset_y,
gboolean layer_visible,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
gboolean rename_text_layer, /* unused */
gpointer user_data)
{
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
GList *layers = gimp_image_get_selected_layers (image);
GList *new_layers = NULL;
GList *iter;
gint n_layers = g_list_length (layers);
gboolean run_once = (n_layers == 0);
g_object_set (config,
"layer-new-name", layer_name,
"layer-new-mode", layer_mode,
"layer-new-blend-space", layer_blend_space,
"layer-new-composite-space", layer_composite_space,
"layer-new-composite-mode", layer_composite_mode,
"layer-new-opacity", layer_opacity,
"layer-new-fill-type", layer_fill_type,
NULL);
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
layers = g_list_copy (layers);
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_LAYER_ADD,
ngettext ("New layer",
"New layers",
n_layers > 0 ? n_layers : 1));
for (iter = layers; iter || run_once; iter = iter ? iter->next : NULL)
{
GimpLayer *parent;
gint position;
run_once = FALSE;
if (iter)
{
if (gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)))
{
parent = iter->data;
position = 0;
}
else
{
parent = GIMP_LAYER (gimp_item_get_parent (iter->data));
position = gimp_item_get_index (iter->data);
}
}
else /* run_once */
{
parent = NULL;
position = 0;
}
layer = gimp_layer_new (image, layer_width, layer_height,
gimp_image_get_layer_format (image, TRUE),
config->layer_new_name,
config->layer_new_opacity,
config->layer_new_mode);
if (layer)
{
gimp_item_set_offset (GIMP_ITEM (layer), layer_offset_x, layer_offset_y);
gimp_drawable_fill (GIMP_DRAWABLE (layer), context,
config->layer_new_fill_type);
gimp_item_set_visible (GIMP_ITEM (layer), layer_visible, FALSE);
gimp_item_set_color_tag (GIMP_ITEM (layer), layer_color_tag, FALSE);
gimp_item_set_lock_content (GIMP_ITEM (layer), layer_lock_pixels,
FALSE);
gimp_item_set_lock_position (GIMP_ITEM (layer), layer_lock_position,
FALSE);
gimp_layer_set_lock_alpha (layer, layer_lock_alpha, FALSE);
gimp_layer_set_blend_space (layer, layer_blend_space, FALSE);
gimp_layer_set_composite_space (layer, layer_composite_space, FALSE);
gimp_layer_set_composite_mode (layer, layer_composite_mode, FALSE);
gimp_image_add_layer (image, layer, parent, position, TRUE);
gimp_image_flush (image);
new_layers = g_list_prepend (new_layers, layer);
}
else
{
g_warning ("%s: could not allocate new layer", G_STRFUNC);
}
}
gimp_image_undo_group_end (image);
gimp_image_set_selected_layers (image, new_layers);
g_list_free (layers);
g_list_free (new_layers);
gtk_widget_destroy (dialog);
}
static void
layers_edit_attributes_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
GimpLayerColorSpace layer_blend_space,
GimpLayerColorSpace layer_composite_space,
GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType unused1,
gint unused2,
gint unused3,
gint layer_offset_x,
gint layer_offset_y,
gboolean layer_visible,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
gboolean rename_text_layer,
gpointer user_data)
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
{
GimpItem *item = GIMP_ITEM (layer);
if (strcmp (layer_name, gimp_object_get_name (layer)) ||
layer_mode != gimp_layer_get_mode (layer) ||
layer_blend_space != gimp_layer_get_blend_space (layer) ||
layer_composite_space != gimp_layer_get_composite_space (layer) ||
layer_composite_mode != gimp_layer_get_composite_mode (layer) ||
layer_opacity != gimp_layer_get_opacity (layer) ||
layer_offset_x != gimp_item_get_offset_x (item) ||
layer_offset_y != gimp_item_get_offset_y (item) ||
layer_visible != gimp_item_get_visible (item) ||
layer_color_tag != gimp_item_get_color_tag (item) ||
layer_lock_pixels != gimp_item_get_lock_content (item) ||
layer_lock_position != gimp_item_get_lock_position (item) ||
layer_lock_alpha != gimp_layer_get_lock_alpha (layer))
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
{
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
_("Layer Attributes"));
if (strcmp (layer_name, gimp_object_get_name (layer)))
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
{
GError *error = NULL;
if (! gimp_item_rename (GIMP_ITEM (layer), layer_name, &error))
{
gimp_message_literal (image->gimp,
G_OBJECT (dialog), GIMP_MESSAGE_WARNING,
error->message);
g_clear_error (&error);
}
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
}
if (layer_mode != gimp_layer_get_mode (layer))
gimp_layer_set_mode (layer, layer_mode, TRUE);
if (layer_blend_space != gimp_layer_get_blend_space (layer))
gimp_layer_set_blend_space (layer, layer_blend_space, TRUE);
if (layer_composite_space != gimp_layer_get_composite_space (layer))
gimp_layer_set_composite_space (layer, layer_composite_space, TRUE);
if (layer_composite_mode != gimp_layer_get_composite_mode (layer))
gimp_layer_set_composite_mode (layer, layer_composite_mode, TRUE);
if (layer_opacity != gimp_layer_get_opacity (layer))
gimp_layer_set_opacity (layer, layer_opacity, TRUE);
if (layer_offset_x != gimp_item_get_offset_x (item) ||
layer_offset_y != gimp_item_get_offset_y (item))
{
gimp_item_translate (item,
layer_offset_x - gimp_item_get_offset_x (item),
layer_offset_y - gimp_item_get_offset_y (item),
TRUE);
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
}
if (layer_visible != gimp_item_get_visible (item))
gimp_item_set_visible (item, layer_visible, TRUE);
if (layer_color_tag != gimp_item_get_color_tag (item))
gimp_item_set_color_tag (item, layer_color_tag, TRUE);
if (layer_lock_pixels != gimp_item_get_lock_content (item))
gimp_item_set_lock_content (item, layer_lock_pixels, TRUE);
if (layer_lock_position != gimp_item_get_lock_position (item))
gimp_item_set_lock_position (item, layer_lock_position, TRUE);
if (layer_lock_alpha != gimp_layer_get_lock_alpha (layer))
gimp_layer_set_lock_alpha (layer, layer_lock_alpha, TRUE);
gimp_image_undo_group_end (image);
gimp_image_flush (image);
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
}
if (gimp_item_is_text_layer (GIMP_ITEM (layer)))
{
g_object_set (layer,
"auto-rename", rename_text_layer,
NULL);
}
gtk_widget_destroy (dialog);
Action code review and pre-release consistency cleanup: 2004-10-18 Michael Natterer <mitch@gimp.org> Action code review and pre-release consistency cleanup: * app/actions/*-actions.c: added some missing and resolved conflicting mnemonics, added missing help IDs. Cleaned up the *_actions_update() functions. * app/actions/channels-actions.c * app/actions/layers-actions.c * app/actions/vectors-actions.c (*_actions_update): simplified the code that figures the prev and next channel,layer,vectors. * app/actions/qmask-actions.c: use the same accelerator for "qmask-active" and "qmask-toggle". Fixed action sensitivity. * app/actions/channels-commands.c * app/actions/dockable-commands.c * app/actions/documents-commands.c * app/actions/gradients-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/image-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c: folded tons of private utility functions into their only callers (they used to be public and called from outside before the switch to action based menus). Renamed functions and variables saying "query" or "qbox" to "dialog". Moved static functions to the end of the files. Misc minor cleanups. * app/actions/drawable-actions.c * app/actions/drawable-commands.c: made the "drawable-visible" and "drawable-linked" actions affect the layer if the active drawable is a layer mask. * app/actions/select-commands.c: added action to stroke with the last values used in an attempt to address bug #135746 but #if 0'ed it because the approach is too ugly. * app/tools/gimpiscissorstool.c: changed mnemonic from I to S. * menus/image-menu-xml.in: added more stuff to the (commented out) "context" menu.
2004-10-18 11:29:58 +00:00
}
static void
layers_add_mask_callback (GtkWidget *dialog,
GList *layers,
GimpAddMaskType add_mask_type,
GimpChannel *channel,
gboolean invert,
gpointer user_data)
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (layers->data));
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
GimpLayerMask *mask;
GList *iter;
GError *error = NULL;
g_object_set (config,
"layer-add-mask-type", add_mask_type,
"layer-add-mask-invert", invert,
NULL);
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_LAYER_ADD,
_("Add Layer Masks"));
for (iter = layers; iter; iter = iter->next)
{
mask = gimp_layer_create_mask (iter->data,
config->layer_add_mask_type,
channel);
if (config->layer_add_mask_invert)
gimp_channel_invert (GIMP_CHANNEL (mask), FALSE);
if (! gimp_layer_add_mask (iter->data, mask, TRUE, &error))
{
gimp_message_literal (image->gimp,
G_OBJECT (dialog), GIMP_MESSAGE_WARNING,
error->message);
g_object_unref (mask);
g_clear_error (&error);
return;
}
}
gimp_image_undo_group_end (image);
gimp_image_flush (image);
gtk_widget_destroy (dialog);
}
static void
layers_scale_callback (GtkWidget *dialog,
GimpViewable *viewable,
gint width,
gint height,
GimpUnit unit,
GimpInterpolationType interpolation,
gdouble xresolution, /* unused */
gdouble yresolution, /* unused */
GimpUnit resolution_unit,/* unused */
gpointer user_data)
{
GimpDisplay *display = GIMP_DISPLAY (user_data);
layer_scale_unit = unit;
layer_scale_interp = interpolation;
if (width > 0 && height > 0)
{
GimpItem *item = GIMP_ITEM (viewable);
GimpProgress *progress;
GtkWidget *progress_dialog = NULL;
gtk_widget_destroy (dialog);
if (width == gimp_item_get_width (item) &&
height == gimp_item_get_height (item))
return;
app/core/Makefile.am app/core/core-types.h new base class for something 2002-02-25 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/core-types.h * app/core/gimpitem.[ch]: new base class for something which is a child of an image, has a PDB ID, a tattoo, parasites and emits a "removed" signal. * app/core/gimpdrawable.[ch] * app/vectors/gimpvectors.[ch]: derive from GimpItem. Removed lots of stuff from GimpDrawable. * app/core/gimp.[ch]: changed gimp->drawable_table and gimp->next_drawable_ID to gimp->item_table and gimp->next_item_id. * app/undo.[ch]: s/undo_push_drawable_parasite/undo_push_item_parasite/, minor cleanups. * app/core/gimplayer.[ch]: changed gimp_layer_new_from_tiles() and gimp_layer_new_from_drawable() to take the "dest_gimage" as second, not first parameter. * app/image_map.c * app/core/gimpchannel.c * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpdrawable-histogram.c * app/core/gimpdrawable-offset.c * app/core/gimpdrawable-preview.c * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimpimage-pick-color.c * app/core/gimpimage.c * app/core/gimplayer-floating-sel.c * app/display/gimpdisplayshell-dnd.c * app/file/file-save.c * app/gui/channels-commands.c * app/gui/file-save-dialog.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/paths-dialog.c * app/gui/toolbox.c * 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.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/plug-in/plug-in.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpinktool.c * app/tools/gimppainttool.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/widgets/gimpdrawablepreview.c: changed accordingly. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpitemlistview.[ch]: new widget implementing most of the stuff formerly done by GimpDrawableListView. * app/widgets/gimpchannellistview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimplayerlistview.c: changed accordingly. * app/widgets/gimpdnd.[ch]: added a vectors DND type. * app/gui/menus.c * app/gui/dialogs.c * app/gui/dialogs-constructors.[ch]: added a vectors dialog and a vectors item_factory. * app/gui/Makefile.am * app/gui/vectors-commands.[ch]: new files implementing the callbacks for the new vectors dialog and item_factory. * app/pdb/pdb_glue.h: some more ugly hacks to keep intermediate perl code working... * tools/pdbgen/pdb.pl: added a vectors type, use GimpItem for all ID lookups. * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/misc_tools.pdb * tools/pdbgen/pdb/parasite.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/selection_tools.pdb: misc changes according to stuff above. * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/misc_tools_cmds.c * app/pdb/paint_tools_cmds.c * app/pdb/parasite_cmds.c * app/pdb/selection_cmds.c * app/pdb/selection_tools_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/transform_tools_cmds.c: regenerated.
2002-02-25 17:58:50 +00:00
if (display)
{
progress = GIMP_PROGRESS (display);
}
else
{
progress_dialog = gimp_progress_dialog_new ();
progress = GIMP_PROGRESS (progress_dialog);
}
progress = gimp_progress_start (progress, FALSE, _("Scaling"));
app/core/Makefile.am app/core/core-types.h new base class for something 2002-02-25 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/core-types.h * app/core/gimpitem.[ch]: new base class for something which is a child of an image, has a PDB ID, a tattoo, parasites and emits a "removed" signal. * app/core/gimpdrawable.[ch] * app/vectors/gimpvectors.[ch]: derive from GimpItem. Removed lots of stuff from GimpDrawable. * app/core/gimp.[ch]: changed gimp->drawable_table and gimp->next_drawable_ID to gimp->item_table and gimp->next_item_id. * app/undo.[ch]: s/undo_push_drawable_parasite/undo_push_item_parasite/, minor cleanups. * app/core/gimplayer.[ch]: changed gimp_layer_new_from_tiles() and gimp_layer_new_from_drawable() to take the "dest_gimage" as second, not first parameter. * app/image_map.c * app/core/gimpchannel.c * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpdrawable-histogram.c * app/core/gimpdrawable-offset.c * app/core/gimpdrawable-preview.c * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimpimage-pick-color.c * app/core/gimpimage.c * app/core/gimplayer-floating-sel.c * app/display/gimpdisplayshell-dnd.c * app/file/file-save.c * app/gui/channels-commands.c * app/gui/file-save-dialog.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/paths-dialog.c * app/gui/toolbox.c * 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.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/plug-in/plug-in.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpinktool.c * app/tools/gimppainttool.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/widgets/gimpdrawablepreview.c: changed accordingly. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpitemlistview.[ch]: new widget implementing most of the stuff formerly done by GimpDrawableListView. * app/widgets/gimpchannellistview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimplayerlistview.c: changed accordingly. * app/widgets/gimpdnd.[ch]: added a vectors DND type. * app/gui/menus.c * app/gui/dialogs.c * app/gui/dialogs-constructors.[ch]: added a vectors dialog and a vectors item_factory. * app/gui/Makefile.am * app/gui/vectors-commands.[ch]: new files implementing the callbacks for the new vectors dialog and item_factory. * app/pdb/pdb_glue.h: some more ugly hacks to keep intermediate perl code working... * tools/pdbgen/pdb.pl: added a vectors type, use GimpItem for all ID lookups. * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/misc_tools.pdb * tools/pdbgen/pdb/parasite.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/selection_tools.pdb: misc changes according to stuff above. * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/misc_tools_cmds.c * app/pdb/paint_tools_cmds.c * app/pdb/parasite_cmds.c * app/pdb/selection_cmds.c * app/pdb/selection_tools_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/transform_tools_cmds.c: regenerated.
2002-02-25 17:58:50 +00:00
gimp_item_scale_by_origin (item,
width, height, interpolation,
progress, TRUE);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-10 18:47:21 +00:00
if (progress)
gimp_progress_end (progress);
if (progress_dialog)
gtk_widget_destroy (progress_dialog);
gimp_image_flush (gimp_item_get_image (item));
}
else
{
g_warning ("Scale Error: "
"Both width and height must be greater than zero.");
}
}
static void
layers_resize_callback (GtkWidget *dialog,
GimpViewable *viewable,
GimpContext *context,
gint width,
gint height,
GimpUnit unit,
gint offset_x,
gint offset_y,
gdouble unused0,
gdouble unused1,
GimpUnit unused2,
GimpFillType fill_type,
GimpItemSet unused3,
gboolean unused4,
gpointer user_data)
{
layer_resize_unit = unit;
if (width > 0 && height > 0)
{
GimpItem *item = GIMP_ITEM (viewable);
GimpImage *image = gimp_item_get_image (item);
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
g_object_set (config,
"layer-resize-fill-type", fill_type,
NULL);
app/core/Makefile.am app/core/core-types.h new base class for something 2002-02-25 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/core-types.h * app/core/gimpitem.[ch]: new base class for something which is a child of an image, has a PDB ID, a tattoo, parasites and emits a "removed" signal. * app/core/gimpdrawable.[ch] * app/vectors/gimpvectors.[ch]: derive from GimpItem. Removed lots of stuff from GimpDrawable. * app/core/gimp.[ch]: changed gimp->drawable_table and gimp->next_drawable_ID to gimp->item_table and gimp->next_item_id. * app/undo.[ch]: s/undo_push_drawable_parasite/undo_push_item_parasite/, minor cleanups. * app/core/gimplayer.[ch]: changed gimp_layer_new_from_tiles() and gimp_layer_new_from_drawable() to take the "dest_gimage" as second, not first parameter. * app/image_map.c * app/core/gimpchannel.c * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpdrawable-histogram.c * app/core/gimpdrawable-offset.c * app/core/gimpdrawable-preview.c * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimpimage-pick-color.c * app/core/gimpimage.c * app/core/gimplayer-floating-sel.c * app/display/gimpdisplayshell-dnd.c * app/file/file-save.c * app/gui/channels-commands.c * app/gui/file-save-dialog.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/paths-dialog.c * app/gui/toolbox.c * 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.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/plug-in/plug-in.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpinktool.c * app/tools/gimppainttool.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/widgets/gimpdrawablepreview.c: changed accordingly. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpitemlistview.[ch]: new widget implementing most of the stuff formerly done by GimpDrawableListView. * app/widgets/gimpchannellistview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimplayerlistview.c: changed accordingly. * app/widgets/gimpdnd.[ch]: added a vectors DND type. * app/gui/menus.c * app/gui/dialogs.c * app/gui/dialogs-constructors.[ch]: added a vectors dialog and a vectors item_factory. * app/gui/Makefile.am * app/gui/vectors-commands.[ch]: new files implementing the callbacks for the new vectors dialog and item_factory. * app/pdb/pdb_glue.h: some more ugly hacks to keep intermediate perl code working... * tools/pdbgen/pdb.pl: added a vectors type, use GimpItem for all ID lookups. * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/misc_tools.pdb * tools/pdbgen/pdb/parasite.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/selection_tools.pdb: misc changes according to stuff above. * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/misc_tools_cmds.c * app/pdb/paint_tools_cmds.c * app/pdb/parasite_cmds.c * app/pdb/selection_cmds.c * app/pdb/selection_tools_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/transform_tools_cmds.c: regenerated.
2002-02-25 17:58:50 +00:00
gtk_widget_destroy (dialog);
if (width == gimp_item_get_width (item) &&
height == gimp_item_get_height (item))
return;
gimp_item_resize (item, context, fill_type,
width, height, offset_x, offset_y);
gimp_image_flush (gimp_item_get_image (item));
}
else
{
g_warning ("Resize Error: "
"Both width and height must be greater than zero.");
}
}
static gint
layers_mode_index (GimpLayerMode layer_mode,
const GimpLayerMode *modes,
gint n_modes)
{
gint i = 0;
while (i < (n_modes - 1) && modes[i] != layer_mode)
i++;
return i;
}