1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 05:22:40 +02:00

Compare commits

...

16 Commits

Author SHA1 Message Date
Hendrik Boom
684050b309 Added some files that were forgotten in the last commit.
2006-12-09  Hendrik Boom  <hboom@cvs.gnome.org>

	* Added some files that were forgotten in the last commit.
2006-12-09 20:50:25 +00:00
Hendrik Boom
7acbd12bc1 Merged in HEAD from 2006-12-07.
2006-12-09  Hendrik Boom  <hboom@cvs.gnome.org>

	* Merged in HEAD from 2006-12-07.
2006-12-09 20:36:46 +00:00
Hendrik Boom
2acd8c124d added gimp_stroke_desc_(de)serialize_property functions with the effect
2006-09-08  Hendrik Boom  <hboom@cvs.gnome.org>

	* app/core/gimpstrokedesc.c: added
	gimp_stroke_desc_(de)serialize_property functions with the effect that
	the GimpPaintInfo property of GimpStrokeDesc is now serialized by name
	rather than by value. Images with vector layers can now be saved and
	re-loaded without the previously mentionned error message.
2006-09-08 21:16:05 +00:00
Hendrik Boom
bf957dfe6b Note: an error message is shown when loading images with vector layers
2006-08-20  Hendrik Boom  <hboom@cvs.gnome.org>
	Note: an error message is shown when loading images with vector layers
	produced by recent versions of this code. This is caused by improper
	(de)serialization of the currently unused paint-info property of a
	GimpVectorLayerOptions' stroke-desc. However, as this is the last thing
	to be deserialized, it does not currently interfere with loading.

	* app/vectors/gimpvectorlayer.c
	* app/vectors/gimpvectorlayeroptions.c: fixed signal disconnections for
	some properties.

	* app/vectors/gimpvectorlayeroptions.c: the vector layer is now
	notified when its vectors object is removed from the image.

	* app/vectors/gimpvectorlayer.[ch]: added the gimp_vector_layer_discard
	function. This function sets the vector-layer-options property to null,
	which causes this layer to act like a regular layer. This is called
	either from the GUI or when it is noticed that the associated path has
	been removed from the image.

	* app/actions/layers-actions.c
	* app/actions/layers-commands.[ch]
	* menus/image-menu.xml.in
	* menus/layers-menu.xml: changed the name of the layers-fill-stroke to
	layers-vector-fill-stroke, and changed the name of the callback
	accordingly. Added the layers-vector-discard action and callback to
	convert a vector layer into an ordinary layer.
2006-08-21 03:35:50 +00:00
Hendrik Boom
b69c9e15bc app/actions/layers-actions.c rearranged a couple of actions, and added the
2006-08-20  Hendrik Boom  <hboom@cvs.gnome.org>

	* app/actions/layers-actions.c
	* app/actions/layers-commands.[ch]: rearranged a couple of actions, and
	added the layers-vector-tool action / callback / menu entries. This new
	action acts similarly to the existing one for text layers; It selects
	the Path tool as well as the vector associated with the vector layer

	* app/core/gimpstrokedesc.c: fixed a bug in gimp_stroke_desc_new which
	would cause the paint_info property of a GimpStrokeDesc to be NULL
	when no context was passed to it.

	* app/actions/vectors-actions.c: corrected capitalization in the name
	of the vectors-to-vector-layer action.

	* app/vectors/gimpvectorlayer.c: the layer bounds are now re-set every
	time the layer is rendered, to prevent the path from falling outside the
	layer.

	* app/vectors/gimpvectorlayer.c
	* app/vectors/gimpvectorlayeroptions.c: added signal disconnects when
	certain parameters are set.

	* app/vectors/gimpvectorlayer.c: vector layers now duplicate properly
	with the path being shared between the original and new layers.

	* app/vectors/gimpvectorlayer.c: vector layers whose vector-layer-options
	property is NULL are no longer considered to be vector layers by
	gimp_drawable_is_vector_layer.
2006-08-21 01:08:02 +00:00
Hendrik Boom
2ab196bbeb app/vectors/gimpvectorlayer.[ch] vector layer stroke and fill colors are
2006-08-14  Hendrik Boom  <hboom@cvs.gnome.org>

	* app/vectors/gimpvectorlayer.[ch]
	* app/vectors/gimpvectorlayeroptions.[ch]: vector layer stroke and fill
	colors are now initialized from a context which is newly passed in
	through gimp_vector_layer_new, instead of being hardcoded to black and
	blue.

	* app/actions/vectors-commands.c: changed accordingly.
2006-08-14 20:05:57 +00:00
Hendrik Boom
b1f0e69c27 Saving and loading of vector layers into the gimp's XCF file format is now
2006-08-13  Hendrik Boom  <hboom@cvs.gnome.org>

	Saving and loading of vector layers into the gimp's XCF file format is
	now working:

	* app/vectors/gimpvectorlayeroptions.[ch]: added a constructor and a
	mandatory construct-only "gimp" property for use in the initialization
	of the "fill-options" and "stroke_desc" properties, which now have the
	GIMP_CONFIG_PARAM_AGGREGATE flags set for proper deserialization.

	* app/vectors/gimpvectorlayer-xcf.c
	* app/vectors/gimpvectorlayeroptions-parasite.[ch]: changed accordingly

	* app/vectors/gimpvectorlayer-xcf.c: fixed a missing dereference symbol
2006-08-13 23:56:56 +00:00
Hendrik Boom
b05a94c979 fixed a typo in a property name.
2006-08-12  Hendrik Boom  <hboom@cvs.gnome.org>

	* app/vectors/gimpvectorlayer-xcf.c: fixed a typo in a property name.

	* app/vectors/gimpvectorlayeroptions-parasite.c: it now prints some
	output on loading which may help debugging.

	*  /cvs/gnome/gimp/app/vectors/Attic/gimpvectorlayeroptions.c: fixed a
	segfault which would occur if the vectors propery of a
	gimpvectorlayeroptions was set to NULL (i.e. at construction).
2006-08-13 00:45:50 +00:00
Hendrik Boom
8c68bbe6a2 fixed the linking error by adding the proper symbols to
2006-08-12  Hendrik Boom  <hboom@cvs.gnome.org>

	* app/Makefile.am: fixed the linking error by adding the proper symbols
	to gimp_console_2_3_LDFLAGS.
2006-08-13 00:05:36 +00:00
Hendrik Boom
327513185a this version still does not link properly! Please see the previous
2006-08-12  Hendrik Boom  <hboom@cvs.gnome.org>

	* NOTE: this version still does not link properly! Please see the
	previous Changelog entry for details.

	* app/vectors/gimpvectorlayeroptions.[ch]: actually added these files
	this time, I forgot to add them in the last commit.
2006-08-12 21:19:15 +00:00
Hendrik Boom
65b729e4c8 this version does not link properly! I am committing it to my own branch
2006-08-11  Hendrik Boom  <hboom@cvs.gnome.org>

	* NOTE: this version does not link properly! I am committing it to my
	own branch so that others can help in figuring out how to fix the
	problem. Note also that as I have not been able to build it
	successfully, it is also untested. If you manage to build it, it may
	not behave well at runtime.

	* app/vectors/Makefile.am
	* app/vectors/gimpvectorlayeroptions.[ch]
	* app/vectors/gimpvectorlayeroptions-parasite.[ch]: added new files
	implementing a container object for vector layer settings. This object
	is serialized when saving to an XCF file.

	* app/dialogs/vectorlayer-options-dialog.[ch]
	* app/vectors/gimpvectorlayer.[ch]: changed accordingly.

	* app/vectors/Makefile.am
	* app/vectors/gimpvectorlayer-xcf.[ch]: added new files containing
	functions related to saving and loading vector layers to/from XCF files.

	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c: added support for loading and saving vector
	layers. NOTE: this is where the linking problems occur.

	* app/Makefile.am: attempted to fix the linking problems by adding
	"-u gimp_vector_layer_xcf_load_hack" and
	"-u gimp_vector_layer_xcf_save_prepare" to gimp_2_3_LDFLAGS. These
	functions are in app/vectors/gimpvectorlayer-xcf.[ch].
2006-08-11 20:23:23 +00:00
Hendrik Boom
3dd4ef9565 clean-up, merged gimp_vector_layer_init_stroke_fill into
2006-08-01  Hendrik Boom  <hboom@cvs.gnome.org>

	* app/vectors/gimpvectorlayer.c: clean-up,
	merged gimp_vector_layer_init_stroke_fill into gimp_vector_layer_new.
2006-08-02 04:00:36 +00:00
Hendrik Boom
518445940b fixed a typo/memory leak related to releasing stroke_desc during
2006-07-31  Hendrik Boom  <hboom@cvs.gnome.org>

	* app/vectors/gimpvectorlayer.c: fixed a typo/memory leak related to
	releasing stroke_desc during finalization. Removed some unused code in
	gimp_vector_layer_refresh.
2006-07-31 23:20:42 +00:00
Hendrik Boom
ad22961695 app/dialogs/vectorlayer-options-dialog.c app/tools/gimpvectortool.c moved
2006-07-25  Hendrik Boom  <hboom@cvs.gnome.org>

	* app/dialogs/vectorlayer-options-dialog.c
	* app/tools/gimpvectortool.c
	* app/vectors/gimpvectorlayer.c: moved the gimp_image_flush call from
	the vector layer code itself to where it is needed in the vector tool
	and in the vector layer dialog, since it should only be called from
	GUI code.
2006-07-25 18:18:07 +00:00
Hendrik Boom
54d4017c6a added a gimp_image_flush in the right place so that vector layer updates
2006-07-25  Hendrik Boom  <hboom@cvs.gnome.org>

	* app/vectors/gimpvectorlayer.c: added a gimp_image_flush in the right
	place so that vector layer updates are now shown properly.
2006-07-25 17:05:55 +00:00
Hendrik Boom
e0ddc3d44c app/vectors/Makefile.am app/vectors/vectors-types.h new files implementing
2006-07-22  Hendrik Boom  <hboom@cvs.gnome.org>

	* app/vectors/Makefile.am
	* app/vectors/vectors-types.h
	* app/vectors/gimpvectorlayer.[ch]: new files implementing vector layers.

	* app/dialogs/Makefile.am
	* app/dialogs/vectorlayer-options-dialog.[ch]: new files implementing
	the fill / stroke dialog for vector layers.

	* menus/layers-menu.xml
	* app/actions/layers-actions.c
	* app/actions/layers-commands.[ch]: added "layers-fill-stroke" menu
	item, action, and respective callback for opening the fill / stroke
	dialog for vector layers.

	* menus/vectors-menu.xml
	* app/actions/vectors-actions.c
	* app/actions/vectors-commands.[ch]: added "vectors-to-vector-layer"
	menu item, action, and respective callback, which create a new vector
	layer from the chosen vectors object.

	* app/core/Makefile.am
	* app/core/core-types.h
	* app/core/gimpfilloptions.[ch]: new files, implementing GimpFillOptions
	as a parent of GimpStrokeOptions, factoring out generic functionality.

	* app/core/gimpstrokeoptions.[ch]: changed accordingly.

	* app/core/gimpdrawable-stroke.[ch]: added gimp_drawable_fill_vectors,
	factoring common functionality into the new static function
	gimp_drawable_stroke_scan_convert which can either do a stroke or
	a fill, depending on its arguments.

	* app/core/gimpitem.[ch]: added a push_undo boolean argument to the
	end of gimp_item_stroke, as well as the item's stroke virtual
	function. Changed implementations of stroke and the paint functions
	used by gimp_item_stroke as necessary. Also changed calls to
	gimp_item_stroke accordingly.

	* app/actions/select-commands.c
	* app/actions/vectors-commands.c
	* app/core/gimpchannel.c
	* app/core/gimpdrawable-stroke.[ch]
	* app/core/gimpselection.c
	* app/dialogs/stroke-dialog.c
	* app/paint/gimppaintcore-stroke.[ch]
	* app/paint/gimppaintcore.[ch]
	* app/tools/gimppainttool.c
	* app/vectors/gimpvectors.c
	* tools/pdbgen/pdb/edit.pdb
	* tools/pdbgen/pdb/paint_tools.pdb
	* tools/pdbgen/pdb/paths.pdb: changed accordingly.

	* app/pdb/edit_cmds.c
	* app/pdb/paint_tools_cmds.c
	* app/pdb/paths_cmds.c: regenerated.
2006-07-22 20:26:21 +00:00
1578 changed files with 277150 additions and 170785 deletions

236
ChangeLog
View File

@@ -1,3 +1,239 @@
2006-12-09 Hendrik Boom <hboom@cvs.gnome.org>
* Added some files that were forgotten in the last commit.
2006-12-09 Hendrik Boom <hboom@cvs.gnome.org>
* Merged in HEAD from 2006-12-07.
2006-09-08 Hendrik Boom <hboom@cvs.gnome.org>
* app/core/gimpstrokedesc.c: added
gimp_stroke_desc_(de)serialize_property functions with the effect that
the GimpPaintInfo property of GimpStrokeDesc is now serialized by name
rather than by value. Images with vector layers can now be saved and
re-loaded without the previously mentionned error message.
2006-08-20 Hendrik Boom <hboom@cvs.gnome.org>
Note: an error message is shown when loading images with vector layers
produced by recent versions of this code. This is caused by improper
(de)serialization of the currently unused paint-info property of a
GimpVectorLayerOptions' stroke-desc. However, as this is the last thing
to be deserialized, it does not currently interfere with loading.
* app/vectors/gimpvectorlayer.c
* app/vectors/gimpvectorlayeroptions.c: fixed signal disconnections for
some properties.
* app/vectors/gimpvectorlayeroptions.c: the vector layer is now
notified when its vectors object is removed from the image.
* app/vectors/gimpvectorlayer.[ch]: added the gimp_vector_layer_discard
function. This function sets the vector-layer-options property to null,
which causes this layer to act like a regular layer. This is called
either from the GUI or when it is noticed that the associated path has
been removed from the image.
* app/actions/layers-actions.c
* app/actions/layers-commands.[ch]
* menus/image-menu.xml.in
* menus/layers-menu.xml: changed the name of the layers-fill-stroke to
layers-vector-fill-stroke, and changed the name of the callback
accordingly. Added the layers-vector-discard action and callback to
convert a vector layer into an ordinary layer.
2006-08-20 Hendrik Boom <hboom@cvs.gnome.org>
* app/actions/layers-actions.c
* app/actions/layers-commands.[ch]: rearranged a couple of actions, and
added the layers-vector-tool action / callback / menu entries. This new
action acts similarly to the existing one for text layers; It selects
the Path tool as well as the vector associated with the vector layer
* app/core/gimpstrokedesc.c: fixed a bug in gimp_stroke_desc_new which
would cause the paint_info property of a GimpStrokeDesc to be NULL
when no context was passed to it.
* app/actions/vectors-actions.c: corrected capitalization in the name
of the vectors-to-vector-layer action.
* app/vectors/gimpvectorlayer.c: the layer bounds are now re-set every
time the layer is rendered, to prevent the path from falling outside the
layer.
* app/vectors/gimpvectorlayer.c
* app/vectors/gimpvectorlayeroptions.c: added signal disconnects when
certain parameters are set.
* app/vectors/gimpvectorlayer.c: vector layers now duplicate properly
with the path being shared between the original and new layers.
* app/vectors/gimpvectorlayer.c: vector layers whose vector-layer-options
property is NULL are no longer considered to be vector layers by
gimp_drawable_is_vector_layer.
2006-08-14 Hendrik Boom <hboom@cvs.gnome.org>
* app/vectors/gimpvectorlayer.[ch]
* app/vectors/gimpvectorlayeroptions.[ch]: vector layer stroke and fill
colors are now initialized from a context which is newly passed in
through gimp_vector_layer_new, instead of being hardcoded to black and
blue.
* app/actions/vectors-commands.c: changed accordingly.
2006-08-13 Hendrik Boom <hboom@cvs.gnome.org>
Saving and loading of vector layers into the gimp's XCF file format is
now working:
* app/vectors/gimpvectorlayeroptions.[ch]: added a constructor and a
mandatory construct-only "gimp" property for use in the initialization
of the "fill-options" and "stroke_desc" properties, which now have the
GIMP_CONFIG_PARAM_AGGREGATE flags set for proper deserialization.
* app/vectors/gimpvectorlayer-xcf.c
* app/vectors/gimpvectorlayeroptions-parasite.[ch]: changed accordingly
* app/vectors/gimpvectorlayer-xcf.c: fixed a missing dereference symbol
2006-08-12 Hendrik Boom <hboom@cvs.gnome.org>
* app/vectors/gimpvectorlayer-xcf.c: fixed a typo in a property name.
* app/vectors/gimpvectorlayeroptions-parasite.c: it now prints some
output on loading which may help debugging.
* /cvs/gnome/gimp/app/vectors/Attic/gimpvectorlayeroptions.c: fixed a
segfault which would occur if the vectors propery of a
gimpvectorlayeroptions was set to NULL (i.e. at construction).
2006-08-12 Hendrik Boom <hboom@cvs.gnome.org>
* app/Makefile.am: fixed the linking error by adding the proper symbols
to gimp_console_2_3_LDFLAGS.
2006-08-12 Hendrik Boom <hboom@cvs.gnome.org>
* NOTE: this version still does not link properly! Please see the
previous Changelog entry for details.
* app/vectors/gimpvectorlayeroptions.[ch]: actually added these files
this time, I forgot to add them in the last commit.
2006-08-11 Hendrik Boom <hboom@cvs.gnome.org>
* NOTE: this version does not link properly! I am committing it to my
own branch so that others can help in figuring out how to fix the
problem. Note also that as I have not been able to build it
successfully, it is also untested. If you manage to build it, it may
not behave well at runtime.
* app/vectors/Makefile.am
* app/vectors/gimpvectorlayeroptions.[ch]
* app/vectors/gimpvectorlayeroptions-parasite.[ch]: added new files
implementing a container object for vector layer settings. This object
is serialized when saving to an XCF file.
* app/dialogs/vectorlayer-options-dialog.[ch]
* app/vectors/gimpvectorlayer.[ch]: changed accordingly.
* app/vectors/Makefile.am
* app/vectors/gimpvectorlayer-xcf.[ch]: added new files containing
functions related to saving and loading vector layers to/from XCF files.
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c: added support for loading and saving vector
layers. NOTE: this is where the linking problems occur.
* app/Makefile.am: attempted to fix the linking problems by adding
"-u gimp_vector_layer_xcf_load_hack" and
"-u gimp_vector_layer_xcf_save_prepare" to gimp_2_3_LDFLAGS. These
functions are in app/vectors/gimpvectorlayer-xcf.[ch].
2006-08-01 Hendrik Boom <hboom@cvs.gnome.org>
* app/vectors/gimpvectorlayer.c: clean-up,
merged gimp_vector_layer_init_stroke_fill into gimp_vector_layer_new.
2006-07-31 Hendrik Boom <hboom@cvs.gnome.org>
* app/vectors/gimpvectorlayer.c: fixed a typo/memory leak related to
releasing stroke_desc during finalization. Removed some unused code in
gimp_vector_layer_refresh.
2006-07-25 Hendrik Boom <hboom@cvs.gnome.org>
* app/dialogs/vectorlayer-options-dialog.c
* app/tools/gimpvectortool.c
* app/vectors/gimpvectorlayer.c: moved the gimp_image_flush call from
the vector layer code itself to where it is needed in the vector tool
and in the vector layer dialog, since it should only be called from
GUI code.
2006-07-25 Hendrik Boom <hboom@cvs.gnome.org>
* app/vectors/gimpvectorlayer.c: added a gimp_image_flush in the right
place so that vector layer updates are now shown properly.
2006-07-22 Hendrik Boom <hboom@cvs.gnome.org>
* app/vectors/Makefile.am
* app/vectors/vectors-types.h
* app/vectors/gimpvectorlayer.[ch]: new files implementing vector layers.
* app/dialogs/Makefile.am
* app/dialogs/vectorlayer-options-dialog.[ch]: new files implementing
the fill / stroke dialog for vector layers.
* menus/layers-menu.xml
* app/actions/layers-actions.c
* app/actions/layers-commands.[ch]: added "layers-fill-stroke" menu
item, action, and respective callback for opening the fill / stroke
dialog for vector layers.
* menus/vectors-menu.xml
* app/actions/vectors-actions.c
* app/actions/vectors-commands.[ch]: added "vectors-to-vector-layer"
menu item, action, and respective callback, which create a new vector
layer from the chosen vectors object.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpfilloptions.[ch]: new files, implementing GimpFillOptions
as a parent of GimpStrokeOptions, factoring out generic functionality.
* app/core/gimpstrokeoptions.[ch]: changed accordingly.
* app/core/gimpdrawable-stroke.[ch]: added gimp_drawable_fill_vectors,
factoring common functionality into the new static function
gimp_drawable_stroke_scan_convert which can either do a stroke or
a fill, depending on its arguments.
* app/core/gimpitem.[ch]: added a push_undo boolean argument to the
end of gimp_item_stroke, as well as the item's stroke virtual
function. Changed implementations of stroke and the paint functions
used by gimp_item_stroke as necessary. Also changed calls to
gimp_item_stroke accordingly.
* app/actions/select-commands.c
* app/actions/vectors-commands.c
* app/core/gimpchannel.c
* app/core/gimpdrawable-stroke.[ch]
* app/core/gimpselection.c
* app/dialogs/stroke-dialog.c
* app/paint/gimppaintcore-stroke.[ch]
* app/paint/gimppaintcore.[ch]
* app/tools/gimppainttool.c
* app/vectors/gimpvectors.c
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/paint_tools.pdb
* tools/pdbgen/pdb/paths.pdb: changed accordingly.
* app/pdb/edit_cmds.c
* app/pdb/paint_tools_cmds.c
* app/pdb/paths_cmds.c: regenerated.
2006-07-20 Sven Neumann <sven@gimp.org>
* app/core/gimp-edit.c: formatting.

15
HACKING
View File

@@ -96,10 +96,17 @@ The interesting modules and the suggested stable branches to use are:
Patches
-------
Please submit patches to the gimp-developer@lists.xcf.berkeley.edu
mailing list. It's also a good idea to file a bug-report at
http://bugzilla.gnome.org/ and attach your patch to it. All kinds
of contributions are appreciated.
The best way to submit patches is to file a bug report at
http://bugzilla.gnome.org/ and attach your patch to it as a plain text
file, not compressed. If your patch is reasonably small you can submit
it to the gimp-developer@lists.xcf.berkeley.edu mailing list. If the
patch needs to be discussed, you should also consider using the
mailing list instead of Bugzilla because bug reports tend to be hard
to read if they contain too many comments. For the code, please try to
follow the guidelines given in Hackordnung, below. You can create the
patch file with "cvs diff", preferably with a ~/.cvsrc containing
"diff -up". All kinds of contributions are appreciated.
Autogenerated Files

24
INSTALL
View File

@@ -51,14 +51,18 @@ header files installed.
to check that the following libraries are installed: libpng,
libjpeg, libpoppler, libtiff, gtkhtml-2, libmng, librsvg, libwmf.
6. Configure GIMP by running the `configure' script. You may want
6. The Python extension requires Python development headers to be
present. You will also need PyGTK and the respective development
headers.
7. Configure GIMP by running the `configure' script. You may want
to pass some options to it, see below.
7. Build GIMP by running `make'. The use of GNU make is recommened.
8. Build GIMP by running `make'. The use of GNU make is recommended.
If you need to tweak the build to make it work with other flavours
of make, we'd appreciate if you'd send us a patch with the changes.
8. Install GIMP by running `make install'. In order to avoid clashes
9. Install GIMP by running `make install'. In order to avoid clashes
with other versions of GIMP, we install a binary called gimp-2.3.
By default there's also a link created so that you can type 'gimp'
to start gimp-2.3.
@@ -168,12 +172,8 @@ These are:
their API references so that the libgimp reference can link to
them.
--enable-mp. This options control whether to build GIMP with or without
support for multiple processors. This option is off by default. If
you do have multiply processors and run GIMP with an OS supporting
them you will like to enable this features to use all of your
horsepower. Enabling it on singleprocessor systems won't harm but
cause a bit processing overhead.
--disable-mp. This option allows you to disable support for multiple
processors. It is enabled by default.
--with-sendmail=[PATH]. This option is used to tell GIMP where to find
the sendmail command. Normally this options don't have to be used
@@ -197,8 +197,8 @@ These are:
--disable-python. If for some reason you don't want to build the
Python based pygimp plug-in, you can use --disable-python.
--disable-script-fu. If for some reason you don't want to build the
Script-Fu plug-in, you can use --disable-script-fu.
--without-script-fu. If for some reason you don't want to build the
Script-Fu plug-in, you can use --without-script-fu.
The `make' command builds several things:
- A bunch of public libraries in the directories starting with 'libgimp'.
@@ -271,7 +271,7 @@ There are some GIMP plug-ins that need additional third-party libraries
installed on your system. For example to compile the plug-ins that load
and save JPEG, PNG or TIFF files you need the related libraries and header
files installed, otherwise you'll get a message that plugin xyz will not
be build.
be built.
If you are sure that those libraries are correctly installed, but configure
fails to detect them, the following might help:

View File

@@ -9,6 +9,7 @@ SUBDIRS = \
po \
po-libgimp \
po-plug-ins \
po-python \
po-script-fu \
po-tips \
data \
@@ -72,10 +73,7 @@ EXTRA_DIST = \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
makefile.msc \
po-libgimp/update.sh \
po-plug-ins/update.sh \
po-script-fu/update.sh
makefile.msc
DISTCHECK_CONFIGURE_FLAGS = --enable-gimp-console
@@ -89,6 +87,9 @@ DISTCLEANFILES = \
gimpinstall-@GIMP_TOOL_VERSION@:
$(LN_S) $(srcdir)/install-sh $(srcdir)/gimpinstall-@GIMP_TOOL_VERSION@
check-defs:
@$(PYTHON) tools/defcheck.py || \
( echo "* .def files inconsistent *"; exit 1; )
validate-authors:
if HAVE_XMLLINT
@@ -98,4 +99,4 @@ endif
all-local: AUTHORS
dist-hook: validate-authors
dist-hook: check-defs validate-authors

70
NEWS
View File

@@ -7,14 +7,80 @@ This is the development branch of GIMP. Here's where all the shiny
new stuff is being done that will one day be released as GIMP 2.4.
Changes in GIMP 2.3.13
======================
- show information about embedded color profiles in Image Properties dialog
- allow to apply color profiles on load (still work in progress)
- new vectors PDB API to replace the old path API
- added "Auntie Alias" plug-in for antialiasing on lineart
- added Edit->Fade operation
- added Rounded Corners option to Rectangle Select tool
- improved WinIcon plug-in (now loads and saves 24 bit and Vista icons)
- merged gimp-tiny-fu; replaces Script-Fu Scheme interpreter with TinyScheme
- remember unit and interpolation type in scale and resize dialogs
- changed default interpolation type to Cubic
- show comment in Image Properties dialog
- when loading in image as layers, don't merge the layers
- added experimental palette color selector module
- don't save thumbnails that don't match the image
- increased tool handle sizes for better usability
- implemented brush scaling from the tool options (only downscaling yet)
- import paths embedded into TIFF files
- support vectors in the Script-Fu and Python-Fu user interfaces
- added PDB functions to retrieve position of layers/channels/vectors
- added side pane with table of contents to the Help Browser
- bug fixes and code cleanup
Changes in GIMP 2.3.12
======================
- merged the Perspective Clone tool
- allow to pan the image view using the Space bar
- show a thumbnail in the "Rotate JPEG?" query dialog
- added file information to the Image Properties dialog
- more work on the new selection tools
- give immidiate feedback when tool modifier keys are pressed
- added Lens Distortion plug-in
- internationalize Python binding and Python plug-ins
- improved internal message infrastructure, use the statusbar for warnings
- added an URL loader backend based on libcurl
- build a color-managed CMYK color selector if lcms is available
- localize Script-Fu procedure descriptions
- lots of user interface polishing
- bug fixes and code cleanup
Changes in GIMP 2.3.11
======================
- depend on newer versions of glib, gtk+ and pango and use some of the
new features in these libraries
- depend on newer versions of glib, gtk+ and pango and use some of the new
features in these libraries
- made Ctrl-P the default shortcut for Print
- show progress when loading/saving XCF files
- added support for 16/32 bit bitmaps and alpha channel to the BMP plug-in
- if possible, detect the number of CPUs
- allow to disable the build of the Script-Fu extension
- many improvements to the Python bindings and the pygimp user interface
- made message dialogs transient for the progress window
- added PDB API for creating a selection from vectors
- further improved status bar messages for tools
- derive ByColorSelect and FuzzySelect tools from a common base class
- finer control over select-by-color functionality
- minor optimizations in the drawing code
- abstract brush outline drawing into the common base class GimpBrushTool
- store sample points in XCF files
- added extended PDB API for selection procedures
- added convenience API to libgimp that creates a layer from a GdkPixbuf
- added midpoint handles to Scale tool for scaling with fixed width or height
- let color picker tools select a matching color in the Palette Editor
- allow to use foreground and background color in gradients
- added first draft of a new Healing Brush tool
- abstract clone tool functionality into the common base class GimpSourceTool
- improvements to the new selection tools
- don't wake up the gimp every so often
- added GimpHintBox widget to libgimpwidgets
- bug fixes and code cleanup

View File

@@ -163,20 +163,14 @@ this one may not necessarily fit.
po/gimp20.po -- the core
po-libgimp/gimp20-libgimp.pot -- the libgimp library
po-plugins/gimp20-std-plugins.pot -- most of the plug-ins
po-python/gimp20-python.pot -- the pygimp plug-ins
po-plugins/gimp20-std-plugins.pot -- the C plug-ins
po-script-fu/gimp20-script-fu.pot -- the script-fu scripts
po-tips/gimp20-tips.pot -- the startup tips
If you are looking for the translations of gimp-perl, please note that
gimp-perl has been moved into it's own CVS module called gimp-perl.
When translating menu paths in Script-Fu, please do not translate the
name of the item factory (that is the one in brackets at the front),
e.g. <Image>/Script-Fu/Selection should _not_ be translated to
<Bild>/Skript-Fu/Kopieren, but to <Image>/Skript-Fu/Kopieren. If you
get this wrong, Gimp will warn you at startup about bad translations.
So do always test your translations and watch the console for output.
The version of GIMP you are holding in your hand uses GTK+-2.0.
GTK+-2.0 requires that all strings are UTF-8 encoded. Therefore to make
internationalisation work, po files need to be UTF-8 encoded. If your

View File

@@ -18,8 +18,8 @@ SUBDIRS = \
paint \
text \
vectors \
file \
plug-in \
file \
xcf \
pdb \
widgets \
@@ -71,6 +71,7 @@ endif
if OS_WIN32
mwindows = -mwindows
endif
if USE_BINRELOC
munix = -Wl,-rpath '-Wl,$$ORIGIN/../lib'
endif
@@ -90,7 +91,7 @@ INCLUDES = \
$(PANGOFT2_CFLAGS) \
-I$(includedir)
gimp_2_3_LDFLAGS = $(mwindows) $(munix)
gimp_2_3_LDFLAGS = $(mwindows) $(munix) -u $(SYMPREFIX)xcf_init -u $(SYMPREFIX)internal_procs_init
gimp_2_3_LDADD = \
gui/libappgui.a \
@@ -100,14 +101,15 @@ gimp_2_3_LDADD = \
display/libappdisplay.a \
tools/libapptools.a \
widgets/libappwidgets.a \
pdb/libappinternal-procs.a \
xcf/libappxcf.a \
file/libappfile.a \
plug-in/libappplug-in.a \
pdb/libapppdb.a \
vectors/libappvectors.a \
plug-in/libappplug-in.a \
core/libappcore.a \
paint/libapppaint.a \
xcf/libappxcf.a \
text/libapptext.a \
file/libappfile.a \
config/libappconfig.a \
paint-funcs/libapppaint-funcs.a \
composite/libappcomposite.a \
@@ -139,18 +141,21 @@ gimp_console_2_3_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DGIMP_CONSOLE_COMPILATION
gimp_console_2_3_LDFLAGS = $(mwindows) $(munix) -u $(SYMPREFIX)xcf_init -u $(SYMPREFIX)internal_procs_init
gimp_console_2_3_LDADD = \
widgets/widgets-enums.o \
display/display-enums.o \
display/gimpdisplayoptions.o \
pdb/libappinternal-procs.a \
xcf/libappxcf.a \
file/libappfile.a \
plug-in/libappplug-in.a \
pdb/libapppdb.a \
vectors/libappvectors.a \
plug-in/libappplug-in.a \
core/libappcore.a \
paint/libapppaint.a \
xcf/libappxcf.a \
text/libapptext.a \
file/libappfile.a \
config/libappconfig.a \
paint-funcs/libapppaint-funcs.a \
composite/libappcomposite.a \

View File

@@ -19,10 +19,10 @@ libappactions_a_SOURCES = \
channels-actions.h \
channels-commands.c \
channels-commands.h \
colormap-editor-actions.c \
colormap-editor-actions.h \
colormap-editor-commands.c \
colormap-editor-commands.h \
colormap-actions.c \
colormap-actions.h \
colormap-commands.c \
colormap-commands.h \
context-actions.c \
context-actions.h \
context-commands.c \
@@ -117,10 +117,10 @@ libappactions_a_SOURCES = \
quick-mask-actions.h \
quick-mask-commands.c \
quick-mask-commands.h \
sample-point-editor-actions.c \
sample-point-editor-actions.h \
sample-point-editor-commands.c \
sample-point-editor-commands.h \
sample-points-actions.c \
sample-points-actions.h \
sample-points-commands.c \
sample-points-commands.h \
select-actions.c \
select-actions.h \
select-commands.c \

View File

@@ -20,6 +20,7 @@
#define __ACTIONS_TYPES_H__
#include "dialogs/dialogs-types.h"
#include "tools/tools-types.h"
@@ -28,10 +29,14 @@ typedef enum
GIMP_ACTION_SELECT_SET = 0,
GIMP_ACTION_SELECT_FIRST = -1,
GIMP_ACTION_SELECT_LAST = -2,
GIMP_ACTION_SELECT_PREVIOUS = -3,
GIMP_ACTION_SELECT_NEXT = -4,
GIMP_ACTION_SELECT_SKIP_PREVIOUS = -5,
GIMP_ACTION_SELECT_SKIP_NEXT = -6
GIMP_ACTION_SELECT_SMALL_PREVIOUS = -3,
GIMP_ACTION_SELECT_SMALL_NEXT = -4,
GIMP_ACTION_SELECT_PREVIOUS = -5,
GIMP_ACTION_SELECT_NEXT = -6,
GIMP_ACTION_SELECT_SKIP_PREVIOUS = -7,
GIMP_ACTION_SELECT_SKIP_NEXT = -8,
GIMP_ACTION_SELECT_PERCENT_PREVIOUS = -9,
GIMP_ACTION_SELECT_PERCENT_NEXT = -10
} GimpActionSelectType;

View File

@@ -46,11 +46,12 @@
#include "dialogs/dialogs.h"
#include "actions.h"
#include "brush-editor-actions.h"
#include "brushes-actions.h"
#include "buffers-actions.h"
#include "channels-actions.h"
#include "colormap-editor-actions.h"
#include "colormap-actions.h"
#include "context-actions.h"
#include "cursor-info-actions.h"
#include "debug-actions.h"
@@ -74,7 +75,7 @@
#include "patterns-actions.h"
#include "plug-in-actions.h"
#include "quick-mask-actions.h"
#include "sample-point-editor-actions.h"
#include "sample-points-actions.h"
#include "select-actions.h"
#include "templates-actions.h"
#include "text-editor-actions.h"
@@ -107,9 +108,9 @@ static GimpActionFactoryEntry action_groups[] =
{ "channels", N_("Channels"), GIMP_STOCK_CHANNEL,
channels_actions_setup,
channels_actions_update },
{ "colormap-editor", N_("Colormap Editor"), GIMP_STOCK_COLORMAP,
colormap_editor_actions_setup,
colormap_editor_actions_update },
{ "colormap", N_("Colormap"), GIMP_STOCK_COLORMAP,
colormap_actions_setup,
colormap_actions_update },
{ "context", N_("Context"), NULL,
context_actions_setup,
context_actions_update },
@@ -179,9 +180,9 @@ static GimpActionFactoryEntry action_groups[] =
{ "quick-mask", N_("Quick Mask"), GIMP_STOCK_QUICK_MASK_ON,
quick_mask_actions_setup,
quick_mask_actions_update },
{ "sample-point-editor", N_("Sample Points"), GIMP_STOCK_SAMPLE_POINT,
sample_point_editor_actions_setup,
sample_point_editor_actions_update },
{ "sample-points", N_("Sample Points"), GIMP_STOCK_SAMPLE_POINT,
sample_points_actions_setup,
sample_points_actions_update },
{ "select", N_("Select"), GIMP_STOCK_SELECTION,
select_actions_setup,
select_actions_update },
@@ -256,8 +257,6 @@ action_data_get_gimp (gpointer data)
return data;
else if (GIMP_IS_DOCK (data))
context = ((GimpDock *) data)->context;
else if (GIMP_IS_ITEM_TREE_VIEW (data))
context = ((GimpItemTreeView *) data)->context;
else if (GIMP_IS_CONTAINER_VIEW (data))
context = gimp_container_view_get_context ((GimpContainerView *) data);
else if (GIMP_IS_CONTAINER_EDITOR (data))
@@ -285,8 +284,6 @@ action_data_get_context (gpointer data)
return gimp_get_user_context (data);
else if (GIMP_IS_DOCK (data))
return ((GimpDock *) data)->context;
else if (GIMP_IS_ITEM_TREE_VIEW (data))
return ((GimpItemTreeView *) data)->context;
else if (GIMP_IS_CONTAINER_VIEW (data))
return gimp_container_view_get_context ((GimpContainerView *) data);
else if (GIMP_IS_CONTAINER_EDITOR (data))
@@ -375,8 +372,10 @@ action_select_value (GimpActionSelectType select_type,
gdouble value,
gdouble min,
gdouble max,
gdouble small_inc,
gdouble inc,
gdouble skip_inc,
gdouble delta_factor,
gboolean wrap)
{
switch (select_type)
@@ -389,6 +388,14 @@ action_select_value (GimpActionSelectType select_type,
value = max;
break;
case GIMP_ACTION_SELECT_SMALL_PREVIOUS:
value -= small_inc;
break;
case GIMP_ACTION_SELECT_SMALL_NEXT:
value += small_inc;
break;
case GIMP_ACTION_SELECT_PREVIOUS:
value -= inc;
break;
@@ -405,6 +412,16 @@ action_select_value (GimpActionSelectType select_type,
value += skip_inc;
break;
case GIMP_ACTION_SELECT_PERCENT_PREVIOUS:
g_return_val_if_fail (delta_factor >= 0.0, value);
value /= (1.0 + delta_factor);
break;
case GIMP_ACTION_SELECT_PERCENT_NEXT:
g_return_val_if_fail (delta_factor >= 0.0, value);
value *= (1.0 + delta_factor);
break;
default:
if ((gint) select_type >= 0)
value = (gdouble) select_type * (max - min) / 1000.0 + min;
@@ -433,12 +450,12 @@ void
action_select_property (GimpActionSelectType select_type,
GObject *object,
const gchar *property_name,
gdouble small_inc,
gdouble inc,
gdouble skip_inc,
gboolean wrap)
{
GParamSpec *pspec;
gdouble value;
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (property_name != NULL);
@@ -446,7 +463,9 @@ action_select_property (GimpActionSelectType select_type,
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object),
property_name);
g_return_if_fail (G_IS_PARAM_SPEC_DOUBLE (pspec));
if (G_IS_PARAM_SPEC_DOUBLE (pspec))
{
gdouble value;
g_object_get (object, property_name, &value, NULL);
@@ -454,9 +473,28 @@ action_select_property (GimpActionSelectType select_type,
value,
G_PARAM_SPEC_DOUBLE (pspec)->minimum,
G_PARAM_SPEC_DOUBLE (pspec)->maximum,
inc, skip_inc, wrap);
small_inc, inc, skip_inc, 0, wrap);
g_object_set (object, property_name, value, NULL);
}
else if (G_IS_PARAM_SPEC_INT (pspec))
{
gint value;
g_object_get (object, property_name, &value, NULL);
value = action_select_value (select_type,
value,
G_PARAM_SPEC_INT (pspec)->minimum,
G_PARAM_SPEC_INT (pspec)->maximum,
small_inc, inc, skip_inc, 0, wrap);
g_object_set (object, property_name, value, NULL);
}
else
{
g_return_if_reached ();
}
}
GimpObject *

View File

@@ -36,12 +36,15 @@ gdouble action_select_value (GimpActionSelectType select_type,
gdouble value,
gdouble min,
gdouble max,
gdouble small_inc,
gdouble inc,
gdouble skip_inc,
gdouble delta_factor,
gboolean wrap);
void action_select_property (GimpActionSelectType select_type,
GObject *object,
const gchar *property_name,
gdouble small_inc,
gdouble inc,
gdouble skip_inc,
gboolean wrap);

View File

@@ -31,6 +31,7 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpbrusheditor.h"
#include "brush-editor-actions.h"
#include "data-editor-commands.h"
#include "gimp-intl.h"
@@ -70,13 +71,10 @@ brush_editor_actions_update (GimpActionGroup *group,
gpointer user_data)
{
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (user_data);
GimpContext *context;
GimpData *data;
gboolean editable = FALSE;
gboolean edit_active = FALSE;
context = gimp_get_user_context (group->gimp);
data = data_editor->data;
if (data)

View File

@@ -77,9 +77,8 @@ channels_edit_attributes_cmd_callback (GtkAction *action,
return_if_no_channel (image, channel, data);
return_if_no_widget (widget, data);
options = channel_options_dialog_new (image,
options = channel_options_dialog_new (image, channel,
action_data_get_context (data),
channel,
widget,
&channel->color,
gimp_object_get_name (GIMP_OBJECT (channel)),
@@ -109,9 +108,8 @@ channels_new_cmd_callback (GtkAction *action,
return_if_no_image (image, data);
return_if_no_widget (widget, data);
options = channel_options_dialog_new (image,
options = channel_options_dialog_new (image, NULL,
action_data_get_context (data),
NULL,
widget,
&channel_color,
channel_name ? channel_name :

View File

@@ -31,34 +31,34 @@
#include "widgets/gimphelp-ids.h"
#include "actions.h"
#include "colormap-editor-actions.h"
#include "colormap-editor-commands.h"
#include "colormap-actions.h"
#include "colormap-commands.h"
#include "gimp-intl.h"
static const GimpActionEntry colormap_editor_actions[] =
static const GimpActionEntry colormap_actions[] =
{
{ "colormap-editor-popup", GIMP_STOCK_COLORMAP,
{ "colormap-popup", GIMP_STOCK_COLORMAP,
N_("Colormap Menu"), NULL, NULL, NULL,
GIMP_HELP_INDEXED_PALETTE_DIALOG },
{ "colormap-editor-edit-color", GTK_STOCK_EDIT,
{ "colormap-edit-color", GTK_STOCK_EDIT,
N_("_Edit Color..."), NULL,
N_("Edit color"),
G_CALLBACK (colormap_editor_edit_color_cmd_callback),
G_CALLBACK (colormap_edit_color_cmd_callback),
GIMP_HELP_INDEXED_PALETTE_EDIT }
};
static const GimpEnumActionEntry colormap_editor_add_color_actions[] =
static const GimpEnumActionEntry colormap_add_color_actions[] =
{
{ "colormap-editor-add-color-from-fg", GTK_STOCK_ADD,
{ "colormap-add-color-from-fg", GTK_STOCK_ADD,
N_("_Add Color from FG"), "",
N_("Add current foreground color"),
FALSE, FALSE,
GIMP_HELP_INDEXED_PALETTE_ADD },
{ "colormap-editor-add-color-from-bg", GTK_STOCK_ADD,
{ "colormap-add-color-from-bg", GTK_STOCK_ADD,
N_("_Add Color from BG"), "",
N_("Add current background color"),
TRUE, FALSE,
@@ -67,20 +67,20 @@ static const GimpEnumActionEntry colormap_editor_add_color_actions[] =
void
colormap_editor_actions_setup (GimpActionGroup *group)
colormap_actions_setup (GimpActionGroup *group)
{
gimp_action_group_add_actions (group,
colormap_editor_actions,
G_N_ELEMENTS (colormap_editor_actions));
colormap_actions,
G_N_ELEMENTS (colormap_actions));
gimp_action_group_add_enum_actions (group,
colormap_editor_add_color_actions,
G_N_ELEMENTS (colormap_editor_add_color_actions),
G_CALLBACK (colormap_editor_add_color_cmd_callback));
colormap_add_color_actions,
G_N_ELEMENTS (colormap_add_color_actions),
G_CALLBACK (colormap_add_color_cmd_callback));
}
void
colormap_editor_actions_update (GimpActionGroup *group,
colormap_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *image = action_data_get_image (data);
@@ -107,15 +107,15 @@ colormap_editor_actions_update (GimpActionGroup *group,
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, color, FALSE);
SET_SENSITIVE ("colormap-editor-edit-color",
SET_SENSITIVE ("colormap-edit-color",
image && indexed);
SET_SENSITIVE ("colormap-editor-add-color-from-fg",
SET_SENSITIVE ("colormap-add-color-from-fg",
image && indexed && num_colors < 256);
SET_SENSITIVE ("colormap-editor-add-color-from-bg",
SET_SENSITIVE ("colormap-add-color-from-bg",
image && indexed && num_colors < 256);
SET_COLOR ("colormap-editor-add-color-from-fg", context ? &fg : NULL);
SET_COLOR ("colormap-editor-add-color-from-bg", context ? &bg : NULL);
SET_COLOR ("colormap-add-color-from-fg", context ? &fg : NULL);
SET_COLOR ("colormap-add-color-from-bg", context ? &bg : NULL);
#undef SET_SENSITIVE
#undef SET_COLOR

View File

@@ -16,13 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __COLORMAP_EDITOR_ACTIONS_H__
#define __COLORMAP_EDITOR_ACTIONS_H__
#ifndef __COLORMAP_ACTIONS_H__
#define __COLORMAP_ACTIONS_H__
void colormap_editor_actions_setup (GimpActionGroup *group);
void colormap_editor_actions_update (GimpActionGroup *group,
void colormap_actions_setup (GimpActionGroup *group);
void colormap_actions_update (GimpActionGroup *group,
gpointer data);
#endif /* __COLORMAP_EDITOR_ACTIONS_H__ */
#endif /* __COLORMAP_ACTIONS_H__ */

View File

@@ -34,14 +34,14 @@
#include "widgets/gimpdialogfactory.h"
#include "actions.h"
#include "colormap-editor-commands.h"
#include "colormap-commands.h"
#include "gimp-intl.h"
/* local function prototypes */
static void colormap_editor_edit_color_update (GimpColorDialog *dialog,
static void colormap_edit_color_update (GimpColorDialog *dialog,
const GimpRGB *color,
GimpColorDialogState state,
GimpColormapEditor *editor);
@@ -50,7 +50,7 @@ static void colormap_editor_edit_color_update (GimpColorDialog *dialog,
/* public functions */
void
colormap_editor_edit_color_cmd_callback (GtkAction *action,
colormap_edit_color_cmd_callback (GtkAction *action,
gpointer data)
{
GimpColormapEditor *editor;
@@ -73,6 +73,7 @@ colormap_editor_edit_color_cmd_callback (GtkAction *action,
{
editor->color_dialog =
gimp_color_dialog_new (GIMP_VIEWABLE (image),
action_data_get_context (data),
_("Edit Colormap Entry"),
GIMP_STOCK_COLORMAP,
desc,
@@ -87,13 +88,14 @@ colormap_editor_edit_color_cmd_callback (GtkAction *action,
&editor->color_dialog);
g_signal_connect (editor->color_dialog, "update",
G_CALLBACK (colormap_editor_edit_color_update),
G_CALLBACK (colormap_edit_color_update),
editor);
}
else
{
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (editor->color_dialog),
GIMP_VIEWABLE (image));
GIMP_VIEWABLE (image),
action_data_get_context (data));
g_object_set (editor->color_dialog, "description", desc, NULL);
gimp_color_dialog_set_color (GIMP_COLOR_DIALOG (editor->color_dialog),
&color);
@@ -105,7 +107,7 @@ colormap_editor_edit_color_cmd_callback (GtkAction *action,
}
void
colormap_editor_add_color_cmd_callback (GtkAction *action,
colormap_add_color_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
@@ -132,7 +134,7 @@ colormap_editor_add_color_cmd_callback (GtkAction *action,
/* private functions */
static void
colormap_editor_edit_color_update (GimpColorDialog *dialog,
colormap_edit_color_update (GimpColorDialog *dialog,
const GimpRGB *color,
GimpColorDialogState state,
GimpColormapEditor *editor)

View File

@@ -16,15 +16,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __COLORMAP_EDITOR_COMMANDS_H__
#define __COLORMAP_EDITOR_COMMANDS_H__
#ifndef __COLORMAP_COMMANDS_H__
#define __COLORMAP_COMMANDS_H__
void colormap_editor_edit_color_cmd_callback (GtkAction *action,
void colormap_edit_color_cmd_callback (GtkAction *action,
gpointer data);
void colormap_editor_add_color_cmd_callback (GtkAction *action,
void colormap_add_color_cmd_callback (GtkAction *action,
gint value,
gpointer data);
#endif /* __COLORMAP_EDITOR_COMMANDS_H__ */
#endif /* __COLORMAP_COMMANDS_H__ */

View File

@@ -1,122 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
#include "actions.h"
#include "colormap-editor-actions.h"
#include "colormap-editor-commands.h"
#include "gimp-intl.h"
static const GimpActionEntry colormap_editor_actions[] =
{
{ "colormap-editor-popup", GIMP_STOCK_COLORMAP,
N_("Colormap Menu"), NULL, NULL, NULL,
GIMP_HELP_INDEXED_PALETTE_DIALOG },
{ "colormap-editor-edit-color", GTK_STOCK_EDIT,
N_("_Edit Color..."), NULL,
N_("Edit color"),
G_CALLBACK (colormap_editor_edit_color_cmd_callback),
GIMP_HELP_INDEXED_PALETTE_EDIT }
};
static const GimpEnumActionEntry colormap_editor_add_color_actions[] =
{
{ "colormap-editor-add-color-from-fg", GTK_STOCK_ADD,
N_("_Add Color from FG"), "",
N_("Add current foreground color"),
FALSE, FALSE,
GIMP_HELP_INDEXED_PALETTE_ADD },
{ "colormap-editor-add-color-from-bg", GTK_STOCK_ADD,
N_("_Add Color from BG"), "",
N_("Add current background color"),
TRUE, FALSE,
GIMP_HELP_INDEXED_PALETTE_ADD }
};
void
colormap_editor_actions_setup (GimpActionGroup *group)
{
gimp_action_group_add_actions (group,
colormap_editor_actions,
G_N_ELEMENTS (colormap_editor_actions));
gimp_action_group_add_enum_actions (group,
colormap_editor_add_color_actions,
G_N_ELEMENTS (colormap_editor_add_color_actions),
G_CALLBACK (colormap_editor_add_color_cmd_callback));
}
void
colormap_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *image = action_data_get_image (data);
GimpContext *context = action_data_get_context (data);
gboolean indexed = FALSE;
gint num_colors = 0;
GimpRGB fg;
GimpRGB bg;
if (image)
{
indexed = gimp_image_base_type (image) == GIMP_INDEXED;
num_colors = image->num_cols;
}
if (context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, color, FALSE);
SET_SENSITIVE ("colormap-editor-edit-color",
image && indexed);
SET_SENSITIVE ("colormap-editor-add-color-from-fg",
image && indexed && num_colors < 256);
SET_SENSITIVE ("colormap-editor-add-color-from-bg",
image && indexed && num_colors < 256);
SET_COLOR ("colormap-editor-add-color-from-fg", context ? &fg : NULL);
SET_COLOR ("colormap-editor-add-color-from-bg", context ? &bg : NULL);
#undef SET_SENSITIVE
#undef SET_COLOR
}

View File

@@ -1,156 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-colormap.h"
#include "widgets/gimpcolordialog.h"
#include "widgets/gimpcolormapeditor.h"
#include "widgets/gimpdialogfactory.h"
#include "actions.h"
#include "colormap-editor-commands.h"
#include "gimp-intl.h"
/* local function prototypes */
static void colormap_editor_edit_color_update (GimpColorDialog *dialog,
const GimpRGB *color,
GimpColorDialogState state,
GimpColormapEditor *editor);
/* public functions */
void
colormap_editor_edit_color_cmd_callback (GtkAction *action,
gpointer data)
{
GimpColormapEditor *editor;
GimpImage *image;
GimpRGB color;
gchar *desc;
return_if_no_image (image, data);
editor = GIMP_COLORMAP_EDITOR (data);
gimp_rgba_set_uchar (&color,
image->cmap[editor->col_index * 3],
image->cmap[editor->col_index * 3 + 1],
image->cmap[editor->col_index * 3 + 2],
OPAQUE_OPACITY);
desc = g_strdup_printf (_("Edit colormap entry #%d"), editor->col_index);
if (! editor->color_dialog)
{
editor->color_dialog =
gimp_color_dialog_new (GIMP_VIEWABLE (image),
_("Edit Colormap Entry"),
GIMP_STOCK_COLORMAP,
desc,
GTK_WIDGET (editor),
gimp_dialog_factory_from_name ("toplevel"),
"gimp-colormap-editor-color-dialog",
(const GimpRGB *) &color,
FALSE, FALSE);
g_signal_connect (editor->color_dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&editor->color_dialog);
g_signal_connect (editor->color_dialog, "update",
G_CALLBACK (colormap_editor_edit_color_update),
editor);
}
else
{
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (editor->color_dialog),
GIMP_VIEWABLE (image));
g_object_set (editor->color_dialog, "description", desc, NULL);
gimp_color_dialog_set_color (GIMP_COLOR_DIALOG (editor->color_dialog),
&color);
}
g_free (desc);
gtk_window_present (GTK_WINDOW (editor->color_dialog));
}
void
colormap_editor_add_color_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpImage *image;
return_if_no_context (context, data);
return_if_no_image (image, data);
if (image->num_cols < 256)
{
GimpRGB color;
if (value)
gimp_context_get_background (context, &color);
else
gimp_context_get_foreground (context, &color);
gimp_image_add_colormap_entry (image, &color);
gimp_image_flush (image);
}
}
/* private functions */
static void
colormap_editor_edit_color_update (GimpColorDialog *dialog,
const GimpRGB *color,
GimpColorDialogState state,
GimpColormapEditor *editor)
{
GimpImage *image = GIMP_IMAGE_EDITOR (editor)->image;
switch (state)
{
case GIMP_COLOR_DIALOG_UPDATE:
break;
case GIMP_COLOR_DIALOG_OK:
gimp_image_set_colormap_entry (image, editor->col_index, color, TRUE);
gimp_image_flush (image);
/* Fall through */
case GIMP_COLOR_DIALOG_CANCEL:
gtk_widget_hide (editor->color_dialog);
break;
}
}

View File

@@ -876,22 +876,38 @@ static const GimpEnumActionEntry context_brush_radius_actions[] =
"Maximum Radius", NULL, NULL,
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "context-brush-radius-decrease-less", GIMP_STOCK_BRUSH,
"Decrease Radius Less", NULL, NULL,
GIMP_ACTION_SELECT_SMALL_PREVIOUS, FALSE,
NULL },
{ "context-brush-radius-increase-less", GIMP_STOCK_BRUSH,
"Increase Radius Less", NULL, NULL,
GIMP_ACTION_SELECT_SMALL_NEXT, FALSE,
NULL },
{ "context-brush-radius-decrease", GIMP_STOCK_BRUSH,
"Decrease Radius", "bracketleft", NULL,
"Decrease Radius", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "context-brush-radius-increase", GIMP_STOCK_BRUSH,
"Increase Radius", "bracketright", NULL,
"Increase Radius", NULL, NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "context-brush-radius-decrease-skip", GIMP_STOCK_BRUSH,
"Decrease Radius More", "<shift>bracketleft", NULL,
"Decrease Radius More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "context-brush-radius-increase-skip", GIMP_STOCK_BRUSH,
"Increase Radius More", "<shift>bracketright", NULL,
"Increase Radius More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
{ "context-brush-radius-decrease-percent", GIMP_STOCK_BRUSH,
"Decrease Radius Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
NULL },
{ "context-brush-radius-increase-percent", GIMP_STOCK_BRUSH,
"Increase Radius Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
NULL }
};
static const GimpEnumActionEntry context_brush_spikes_actions[] =
@@ -923,7 +939,7 @@ static const GimpEnumActionEntry context_brush_spikes_actions[] =
{ "context-brush-spikes-increase-skip", GIMP_STOCK_BRUSH,
"Increase Spikes More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
NULL }
};
static const GimpEnumActionEntry context_brush_hardness_actions[] =
@@ -955,7 +971,7 @@ static const GimpEnumActionEntry context_brush_hardness_actions[] =
{ "context-brush-hardness-increase-skip", GIMP_STOCK_BRUSH,
"Increase Hardness More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
NULL }
};
static const GimpEnumActionEntry context_brush_aspect_actions[] =
@@ -987,7 +1003,7 @@ static const GimpEnumActionEntry context_brush_aspect_actions[] =
{ "context-brush-aspect-increase-skip", GIMP_STOCK_BRUSH,
"Increase Aspect More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
NULL }
};
static const GimpEnumActionEntry context_brush_angle_actions[] =
@@ -1019,7 +1035,7 @@ static const GimpEnumActionEntry context_brush_angle_actions[] =
{ "context-brush-angle-increase-skip", GIMP_STOCK_BRUSH,
"Rotate Left 15 degrees", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
NULL }
};
@@ -1208,9 +1224,9 @@ context_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("brush-radius-decrease", generated && radius > 1.0);
SET_SENSITIVE ("brush-radius-decrease-skip", generated && radius > 1.0);
SET_SENSITIVE ("brush-radius-maximum", generated && radius < 4096.0);
SET_SENSITIVE ("brush-radius-increase", generated && radius < 4096.0);
SET_SENSITIVE ("brush-radius-increase-skip", generated && radius < 4096.0);
SET_SENSITIVE ("brush-radius-maximum", generated && radius < 4000.0);
SET_SENSITIVE ("brush-radius-increase", generated && radius < 4000.0);
SET_SENSITIVE ("brush-radius-increase-skip", generated && radius < 4000.0);
SET_SENSITIVE ("brush-angle-minimum", generated);
SET_SENSITIVE ("brush-angle-decrease", generated);

View File

@@ -153,7 +153,7 @@ context_foreground_red_cmd_callback (GtkAction *action,
color.r = action_select_value ((GimpActionSelectType) value,
color.r,
0.0, 1.0,
0.01, 0.1, FALSE);
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
gimp_context_set_foreground (context, &color);
}
@@ -170,7 +170,7 @@ context_foreground_green_cmd_callback (GtkAction *action,
color.g = action_select_value ((GimpActionSelectType) value,
color.g,
0.0, 1.0,
0.01, 0.1, FALSE);
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
gimp_context_set_foreground (context, &color);
}
@@ -187,7 +187,7 @@ context_foreground_blue_cmd_callback (GtkAction *action,
color.b = action_select_value ((GimpActionSelectType) value,
color.b,
0.0, 1.0,
0.01, 0.1, FALSE);
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
gimp_context_set_foreground (context, &color);
}
@@ -204,7 +204,7 @@ context_background_red_cmd_callback (GtkAction *action,
color.r = action_select_value ((GimpActionSelectType) value,
color.r,
0.0, 1.0,
0.01, 0.1, FALSE);
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
gimp_context_set_background (context, &color);
}
@@ -221,7 +221,7 @@ context_background_green_cmd_callback (GtkAction *action,
color.g = action_select_value ((GimpActionSelectType) value,
color.g,
0.0, 1.0,
0.01, 0.1, FALSE);
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
gimp_context_set_background (context, &color);
}
@@ -238,7 +238,7 @@ context_background_blue_cmd_callback (GtkAction *action,
color.b = action_select_value ((GimpActionSelectType) value,
color.b,
0.0, 1.0,
0.01, 0.1, FALSE);
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
gimp_context_set_background (context, &color);
}
@@ -257,7 +257,7 @@ context_foreground_hue_cmd_callback (GtkAction *action,
hsv.h = action_select_value ((GimpActionSelectType) value,
hsv.h,
0.0, 1.0,
0.01, 0.1, FALSE);
1.0 / 360.0, 0.01, 0.1, 0.0, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_foreground (context, &color);
}
@@ -277,7 +277,7 @@ context_foreground_saturation_cmd_callback (GtkAction *action,
hsv.s = action_select_value ((GimpActionSelectType) value,
hsv.s,
0.0, 1.0,
0.01, 0.1, FALSE);
0.01, 0.01, 0.1, 0.0, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_foreground (context, &color);
}
@@ -297,7 +297,7 @@ context_foreground_value_cmd_callback (GtkAction *action,
hsv.v = action_select_value ((GimpActionSelectType) value,
hsv.v,
0.0, 1.0,
0.01, 0.1, FALSE);
0.01, 0.01, 0.1, 0.0, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_foreground (context, &color);
}
@@ -317,7 +317,7 @@ context_background_hue_cmd_callback (GtkAction *action,
hsv.h = action_select_value ((GimpActionSelectType) value,
hsv.h,
0.0, 1.0,
0.01, 0.1, FALSE);
1.0 / 360.0, 0.01, 0.1, 0.0, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_background (context, &color);
}
@@ -337,7 +337,7 @@ context_background_saturation_cmd_callback (GtkAction *action,
hsv.s = action_select_value ((GimpActionSelectType) value,
hsv.s,
0.0, 1.0,
0.01, 0.1, FALSE);
0.01, 0.01, 0.1, 0.0, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_background (context, &color);
}
@@ -357,7 +357,7 @@ context_background_value_cmd_callback (GtkAction *action,
hsv.v = action_select_value ((GimpActionSelectType) value,
hsv.v,
0.0, 1.0,
0.01, 0.1, FALSE);
0.01, 0.01, 0.1, 0.0, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_background (context, &color);
}
@@ -375,7 +375,7 @@ context_opacity_cmd_callback (GtkAction *action,
gimp_context_get_opacity (context),
GIMP_OPACITY_TRANSPARENT,
GIMP_OPACITY_OPAQUE,
0.01, 0.1, FALSE);
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
gimp_context_set_opacity (context, opacity);
}
@@ -394,7 +394,7 @@ context_paint_mode_cmd_callback (GtkAction *action,
index = action_select_value ((GimpActionSelectType) value,
context_paint_mode_index (paint_mode),
0, G_N_ELEMENTS (paint_modes) - 1,
1.0, 1.0, FALSE);
0.0, 1.0, 1.0, 0.0, FALSE);
gimp_context_set_paint_mode (context, paint_modes[index]);
}
@@ -481,7 +481,7 @@ context_brush_shape_cmd_callback (GtkAction *action,
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
{
GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
@@ -501,16 +501,41 @@ context_brush_radius_cmd_callback (GtkAction *action,
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
{
GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
gdouble radius;
gdouble min_radius;
radius = gimp_brush_generated_get_radius (generated);
/* If the user uses a high precision radius adjustment command
* then we allow a minimum radius of 0.1 px, otherwise we set the
* minimum radius to 1.0 px and adjust the radius to 1.0 px if it
* is less than 1.0 px. This prevents irritating 0.1, 1.1, 2.1 etc
* radius sequences when 1.0 px steps are used.
*/
switch ((GimpActionSelectType) value)
{
case GIMP_ACTION_SELECT_SMALL_PREVIOUS:
case GIMP_ACTION_SELECT_SMALL_NEXT:
case GIMP_ACTION_SELECT_PERCENT_PREVIOUS:
case GIMP_ACTION_SELECT_PERCENT_NEXT:
min_radius = 0.1;
break;
default:
min_radius = 1.0;
if (radius < 1.0)
radius = 1.0;
break;
}
radius = action_select_value ((GimpActionSelectType) value,
radius,
1.0, 256.0,
1.0, 10.0, FALSE);
min_radius, 4000.0,
0.1, 1.0, 10.0, 0.05, FALSE);
gimp_brush_generated_set_radius (generated, radius);
}
}
@@ -526,7 +551,7 @@ context_brush_spikes_cmd_callback (GtkAction *action,
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
{
GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
gint spikes;
@@ -535,7 +560,7 @@ context_brush_spikes_cmd_callback (GtkAction *action,
spikes = action_select_value ((GimpActionSelectType) value,
spikes,
2.0, 20.0,
1.0, 4.0, FALSE);
0.0, 1.0, 4.0, 0.0, FALSE);
gimp_brush_generated_set_spikes (generated, spikes);
}
}
@@ -551,7 +576,7 @@ context_brush_hardness_cmd_callback (GtkAction *action,
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
{
GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
gdouble hardness;
@@ -560,7 +585,7 @@ context_brush_hardness_cmd_callback (GtkAction *action,
hardness = action_select_value ((GimpActionSelectType) value,
hardness,
0.0, 1.0,
0.01, 0.1, FALSE);
0.001, 0.01, 0.1, 0.0, FALSE);
gimp_brush_generated_set_hardness (generated, hardness);
}
}
@@ -576,7 +601,7 @@ context_brush_aspect_cmd_callback (GtkAction *action,
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
{
GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
gdouble aspect;
@@ -585,7 +610,7 @@ context_brush_aspect_cmd_callback (GtkAction *action,
aspect = action_select_value ((GimpActionSelectType) value,
aspect,
1.0, 20.0,
1.0, 4.0, FALSE);
0.1, 1.0, 4.0, 0.0, FALSE);
gimp_brush_generated_set_aspect_ratio (generated, aspect);
}
}
@@ -601,7 +626,7 @@ context_brush_angle_cmd_callback (GtkAction *action,
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
{
GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
gdouble angle;
@@ -616,7 +641,7 @@ context_brush_angle_cmd_callback (GtkAction *action,
angle = action_select_value ((GimpActionSelectType) value,
angle,
0.0, 180.0,
1.0, 15.0, TRUE);
0.1, 1.0, 15.0, 0.0, TRUE);
gimp_brush_generated_set_angle (generated, angle);
}
@@ -666,7 +691,7 @@ context_select_color (GimpActionSelectType select_type,
index = action_select_value (select_type,
index,
0, max,
1, 4, FALSE);
0, 1, 4, 0, FALSE);
context_set_color_index (index, use_colormap, use_palette, color);
}

View File

@@ -53,7 +53,7 @@ typedef struct _GimpDataDeleteData GimpDataDeleteData;
struct _GimpDataDeleteData
{
GimpDataFactory *factory;
GimpDataFactoryView *view;
GimpData *data;
};
@@ -75,7 +75,8 @@ data_open_as_image_cmd_callback (GtkAction *action,
GimpContext *context;
GimpData *data;
context = gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view);
context =
gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view);
data = (GimpData *)
gimp_context_get_by_type (context,
@@ -96,10 +97,11 @@ data_open_as_image_cmd_callback (GtkAction *action,
if (! image && status != GIMP_PDB_CANCEL)
{
gchar *filename;
gchar *filename = file_utils_uri_display_name (uri);
filename = file_utils_uri_display_name (uri);
g_message (_("Opening '%s' failed:\n\n%s"),
gimp_message (context->gimp, G_OBJECT (view),
GIMP_MESSAGE_ERROR,
_("Opening '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
@@ -218,7 +220,7 @@ data_delete_cmd_callback (GtkAction *action,
delete_data = g_new0 (GimpDataDeleteData, 1);
delete_data->factory = view->factory;
delete_data->view = view;
delete_data->data = data;
dialog = gimp_message_dialog_new (_("Delete Object"), GIMP_STOCK_QUESTION,
@@ -307,11 +309,13 @@ data_delete_confirm_response (GtkWidget *dialog,
{
GError *error = NULL;
if (! gimp_data_factory_data_delete (delete_data->factory,
if (! gimp_data_factory_data_delete (delete_data->view->factory,
delete_data->data,
TRUE, &error))
{
g_message (error->message);
gimp_message (delete_data->view->factory->gimp,
G_OBJECT (delete_data->view), GIMP_MESSAGE_ERROR,
"%s", error->message);
g_clear_error (&error);
}
}

View File

@@ -49,6 +49,11 @@ static const GimpActionEntry debug_actions[] =
{ "debug-dump-managers", NULL,
"Dump _UI Managers", NULL, NULL,
G_CALLBACK (debug_dump_managers_cmd_callback),
NULL },
{ "debug-dump-attached-data", NULL,
"Dump Attached Data", NULL, NULL,
G_CALLBACK (debug_dump_attached_data_cmd_callback),
NULL }
};

View File

@@ -26,7 +26,8 @@
#include "actions-types.h"
#include "core/gimpobject.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "widgets/gimpmenufactory.h"
#include "widgets/gimpuimanager.h"
@@ -44,6 +45,10 @@
static void debug_dump_menus_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path);
static void debug_print_qdata (GimpObject *object);
static void debug_print_qdata_foreach (GQuark key_id,
gpointer data,
gpointer user_data);
/* public functions */
@@ -130,6 +135,17 @@ debug_dump_managers_cmd_callback (GtkAction *action,
}
}
void
debug_dump_attached_data_cmd_callback (GtkAction *action,
gpointer data)
{
Gimp *gimp = action_data_get_gimp (data);
GimpContext *user_context = gimp_get_user_context (gimp);
debug_print_qdata (GIMP_OBJECT (gimp));
debug_print_qdata (GIMP_OBJECT (user_context));
}
/* private functions */
@@ -173,4 +189,22 @@ debug_dump_menus_recurse_menu (GtkWidget *menu,
}
}
static void
debug_print_qdata (GimpObject *object)
{
g_print ("\nData attached to '%s':\n\n", gimp_object_get_name (object));
g_datalist_foreach (&G_OBJECT (object)->qdata,
debug_print_qdata_foreach,
NULL);
g_print ("\n");
}
static void
debug_print_qdata_foreach (GQuark key_id,
gpointer data,
gpointer user_data)
{
g_print ("%s: %p\n", g_quark_to_string (key_id), data);
}
#endif /* ENABLE_DEBUG_MENU */

View File

@@ -33,6 +33,8 @@ void debug_dump_menus_cmd_callback (GtkAction *action,
gpointer data);
void debug_dump_managers_cmd_callback (GtkAction *action,
gpointer data);
void debug_dump_attached_data_cmd_callback (GtkAction *action,
gpointer data);
#endif /* ENABLE_DEBUG_MENU */

View File

@@ -314,10 +314,11 @@ documents_open_image (GimpContext *context,
if (! image && status != GIMP_PDB_CANCEL)
{
gchar *filename;
gchar *filename = file_utils_uri_display_name (uri);
filename = file_utils_uri_display_name (uri);
g_message (_("Opening '%s' failed:\n\n%s"), filename, error->message);
gimp_message (context->gimp, NULL, GIMP_MESSAGE_ERROR,
_("Opening '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
g_free (filename);

View File

@@ -71,11 +71,14 @@ drawable_desaturate_cmd_callback (GtkAction *action,
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("Desaturate operates only on RGB color layers."));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("Desaturate operates only on RGB color layers."));
return;
}
dialog = desaturate_dialog_new (drawable, widget, desaturate_mode);
dialog = desaturate_dialog_new (drawable,
action_data_get_context (data),
widget, desaturate_mode);
g_signal_connect (dialog->dialog, "response",
G_CALLBACK (desaturate_response),
@@ -90,11 +93,14 @@ drawable_equalize_cmd_callback (GtkAction *action,
{
GimpImage *image;
GimpDrawable *drawable;
GtkWidget *widget;
return_if_no_drawable (image, drawable, data);
return_if_no_widget (widget, data);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Equalize does not operate on indexed layers."));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("Equalize does not operate on indexed layers."));
return;
}
@@ -108,11 +114,14 @@ drawable_invert_cmd_callback (GtkAction *action,
{
GimpImage *image;
GimpDrawable *drawable;
GtkWidget *widget;
return_if_no_drawable (image, drawable, data);
return_if_no_widget (widget, data);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Invert does not operate on indexed layers."));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("Invert does not operate on indexed layers."));
return;
}
@@ -127,12 +136,15 @@ drawable_levels_stretch_cmd_callback (GtkAction *action,
GimpImage *image;
GimpDrawable *drawable;
GimpContext *context;
GtkWidget *widget;
return_if_no_drawable (image, drawable, data);
return_if_no_context (context, data);
return_if_no_widget (widget, data);
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("White Balance operates only on RGB color layers."));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("White Balance operates only on RGB color layers."));
return;
}
@@ -151,7 +163,8 @@ drawable_offset_cmd_callback (GtkAction *action,
return_if_no_drawable (image, drawable, data);
return_if_no_widget (widget, data);
dialog = offset_dialog_new (drawable, widget);
dialog = offset_dialog_new (drawable, action_data_get_context (data),
widget);
gtk_widget_show (dialog);
}

View File

@@ -27,7 +27,9 @@
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawableundo.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "core/gimplayer.h"
#include "core/gimplist.h"
#include "core/gimptoolinfo.h"
@@ -96,6 +98,11 @@ static const GimpActionEntry edit_actions[] =
G_CALLBACK (edit_undo_clear_cmd_callback),
GIMP_HELP_EDIT_UNDO_CLEAR },
{ "edit-fade", GTK_STOCK_UNDO,
N_("_Fade..."), "", NULL,
G_CALLBACK (edit_fade_cmd_callback),
GIMP_HELP_EDIT_FADE },
{ "edit-cut", GTK_STOCK_CUT,
N_("Cu_t"), "<control>X",
N_("Move the selected pixels to the clipboard"),
@@ -208,6 +215,10 @@ edit_actions_setup (GimpActionGroup *group)
"edit-paste-as-new-short");
gtk_action_set_accel_path (action, "<Actions>/edit/edit-paste-as-new");
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
"edit-fill-pattern");
g_object_set (action, "context", context, NULL);
g_signal_connect_object (context, "foreground-changed",
G_CALLBACK (edit_actions_foreground_changed),
group, 0);
@@ -236,7 +247,9 @@ edit_actions_update (GimpActionGroup *group,
GimpDrawable *drawable = NULL;
gchar *undo_name = NULL;
gchar *redo_name = NULL;
gchar *fade_name = NULL;
gboolean undo_enabled = FALSE;
gboolean fade_enabled = FALSE;
if (image)
{
@@ -261,6 +274,17 @@ edit_actions_update (GimpActionGroup *group,
redo_name =
g_strdup_printf (_("_Redo %s"),
gimp_object_get_name (GIMP_OBJECT (redo)));
undo = gimp_image_undo_get_fadeable (image);
if (GIMP_IS_DRAWABLE_UNDO (undo) &&
GIMP_DRAWABLE_UNDO (undo)->src2_tiles)
fade_enabled = TRUE;
if (fade_enabled)
fade_name =
g_strdup_printf (_("_Fade %s..."),
gimp_object_get_name (GIMP_OBJECT (undo)));
}
}
@@ -272,12 +296,14 @@ edit_actions_update (GimpActionGroup *group,
SET_LABEL ("edit-undo", undo_name ? undo_name : _("_Undo"));
SET_LABEL ("edit-redo", redo_name ? redo_name : _("_Redo"));
SET_LABEL ("edit-fade", fade_name ? fade_name : _("_Fade..."));
SET_SENSITIVE ("edit-undo", undo_enabled && undo_name);
SET_SENSITIVE ("edit-redo", undo_enabled && redo_name);
SET_SENSITIVE ("edit-strong-undo", undo_enabled && undo_name);
SET_SENSITIVE ("edit-strong-redo", undo_enabled && redo_name);
SET_SENSITIVE ("edit-undo-clear", undo_enabled && (undo_name || redo_name));
SET_SENSITIVE ("edit-fade", fade_enabled && fade_name);
g_free (undo_name);
g_free (redo_name);

View File

@@ -48,6 +48,7 @@
#include "widgets/gimpmessagedialog.h"
#include "dialogs/dialogs.h"
#include "dialogs/fade-dialog.h"
#include "actions.h"
#include "edit-commands.h"
@@ -263,6 +264,11 @@ edit_paste_as_new_cmd_callback (GtkAction *action,
g_object_unref (buffer);
}
else
{
gimp_message (gimp, NULL, GIMP_MESSAGE_WARNING,
_("There is no image data in the clipboard to paste."));
}
}
void
@@ -285,6 +291,27 @@ edit_named_cut_cmd_callback (GtkAction *action,
gtk_widget_show (dialog);
}
void
edit_fade_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
dialog = fade_dialog_new (image, widget);
if (dialog)
{
g_signal_connect_object (image, "disconnect",
G_CALLBACK (gtk_widget_destroy),
dialog, G_CONNECT_SWAPPED);
gtk_widget_show (dialog);
}
}
void
edit_named_copy_cmd_callback (GtkAction *action,
gpointer data)
@@ -381,7 +408,7 @@ edit_paste (GimpDisplay *display,
if (svg)
{
if (gimp_vectors_import_buffer (display->image, svg, svg_size,
TRUE, TRUE, -1, NULL))
TRUE, TRUE, -1, NULL, NULL))
{
gimp_image_flush (display->image);
}
@@ -412,6 +439,12 @@ edit_paste (GimpDisplay *display,
g_object_unref (buffer);
}
else
{
gimp_message (display->image->gimp, G_OBJECT (display),
GIMP_MESSAGE_WARNING,
_("There is no image data in the clipboard to paste."));
}
}
}
@@ -427,7 +460,8 @@ cut_named_buffer_callback (GtkWidget *widget,
if (! drawable)
{
g_message (_("There is no active layer or channel to cut from."));
gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to cut from."));
return;
}
@@ -453,7 +487,8 @@ copy_named_buffer_callback (GtkWidget *widget,
if (! drawable)
{
g_message (_("There is no active layer or channel to copy from."));
gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to copy from."));
return;
}

View File

@@ -30,6 +30,8 @@ void edit_strong_redo_cmd_callback (GtkAction *action,
gpointer data);
void edit_undo_clear_cmd_callback (GtkAction *action,
gpointer data);
void edit_fade_cmd_callback (GtkAction *action,
gpointer data);
void edit_cut_cmd_callback (GtkAction *action,
gpointer data);
void edit_copy_cmd_callback (GtkAction *action,

View File

@@ -25,6 +25,8 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "widgets/gimperrorconsole.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
@@ -78,7 +80,8 @@ error_console_save_cmd_callback (GtkAction *action,
if (value && ! gtk_text_buffer_get_selection_bounds (console->text_buffer,
NULL, NULL))
{
g_message (_("Cannot save. Nothing is selected."));
gimp_message (console->gimp, G_OBJECT (console), GIMP_MESSAGE_WARNING,
_("Cannot save. Nothing is selected."));
return;
}
@@ -146,8 +149,10 @@ error_console_save_response (GtkWidget *dialog,
if (! gimp_text_buffer_save (console->text_buffer, filename,
console->save_selection, &error))
{
g_message (_("Error writing file '%s':\n%s"),
gimp_filename_to_utf8 (filename), error->message);
gimp_message (console->gimp, G_OBJECT (dialog), GIMP_MESSAGE_ERROR,
_("Error writing file '%s':\n%s"),
gimp_filename_to_utf8 (filename),
error->message);
g_clear_error (&error);
g_free (filename);
return;

View File

@@ -75,9 +75,9 @@ static const GimpActionEntry file_actions[] =
G_CALLBACK (file_open_from_image_cmd_callback),
GIMP_HELP_FILE_OPEN },
{ "file-open-as-layer", GIMP_STOCK_LAYER,
N_("Op_en as Layer..."), "<control><alt>O", NULL,
G_CALLBACK (file_open_as_layer_cmd_callback),
{ "file-open-as-layers", GIMP_STOCK_LAYER,
N_("Op_en as Layers..."), "<control><alt>O", NULL,
G_CALLBACK (file_open_as_layers_cmd_callback),
GIMP_HELP_FILE_OPEN_AS_LAYER },
{ "file-open-location", GIMP_STOCK_WEB,
@@ -151,7 +151,7 @@ file_actions_setup (GimpActionGroup *group)
entries[i].name = g_strdup_printf ("file-open-recent-%02d",
i + 1);
entries[i].stock_id = GTK_STOCK_OPEN;
entries[i].label = "";
entries[i].label = entries[i].name;
entries[i].tooltip = NULL;
entries[i].value = i;
entries[i].value_variable = FALSE;
@@ -170,10 +170,17 @@ file_actions_setup (GimpActionGroup *group)
for (i = 0; i < n_entries; i++)
{
GtkAction *action;
gimp_action_group_set_action_visible (group, entries[i].name, FALSE);
g_free ((gchar *) entries[i].name);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
entries[i].name);
g_object_set (action,
"context", gimp_get_user_context (group->gimp),
NULL);
g_free ((gchar *) entries[i].name);
if (i < 9)
g_free ((gchar *) entries[i].accelerator);
}
@@ -215,7 +222,7 @@ file_actions_update (GimpActionGroup *group,
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
SET_SENSITIVE ("file-open-as-layer", image);
SET_SENSITIVE ("file-open-as-layers", image);
SET_SENSITIVE ("file-save", image && drawable);
SET_SENSITIVE ("file-save-as", image && drawable);
SET_SENSITIVE ("file-save-a-copy", image && drawable);
@@ -281,6 +288,8 @@ file_actions_last_opened_update (GimpContainer *container,
else
{
g_object_set (action,
"label", name,
"tooltip", NULL,
"visible", FALSE,
"viewable", NULL,
NULL);

View File

@@ -66,7 +66,7 @@
static void file_open_dialog_show (GtkWidget *parent,
GimpImage *image,
const gchar *uri,
gboolean open_as_layer);
gboolean open_as_layers);
static void file_save_dialog_show (GimpImage *image,
GtkWidget *parent,
const gchar *title,
@@ -111,7 +111,7 @@ file_open_from_image_cmd_callback (GtkAction *action,
}
void
file_open_as_layer_cmd_callback (GtkAction *action,
file_open_as_layers_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
@@ -173,7 +173,8 @@ file_last_opened_cmd_callback (GtkAction *action,
gchar *filename =
file_utils_uri_display_name (GIMP_OBJECT (imagefile)->name);
g_message (_("Opening '%s' failed:\n\n%s"),
gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR,
_("Opening '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
@@ -206,8 +207,9 @@ file_save_cmd_callback (GtkAction *action,
save_proc = gimp_image_get_save_proc (image);
if (uri && ! save_proc)
save_proc = file_utils_find_proc (image->gimp->plug_in_manager->save_procs,
uri);
save_proc =
file_utils_find_proc (image->gimp->plug_in_manager->save_procs,
uri, NULL);
if (! (uri && save_proc))
{
@@ -218,6 +220,7 @@ file_save_cmd_callback (GtkAction *action,
GimpPDBStatusType status;
GError *error = NULL;
GList *list;
gchar *filename;
for (list = gimp_action_groups_from_name ("file");
list;
@@ -232,17 +235,30 @@ file_save_cmd_callback (GtkAction *action,
uri, save_proc,
GIMP_RUN_WITH_LAST_VALS, FALSE, &error);
if (status != GIMP_PDB_SUCCESS &&
status != GIMP_PDB_CANCEL)
{
gchar *filename = file_utils_uri_display_name (uri);
filename = file_utils_uri_display_name (uri);
g_message (_("Saving '%s' failed:\n\n%s"),
switch (status)
{
case GIMP_PDB_SUCCESS:
gimp_message (image->gimp, G_OBJECT (display), GIMP_MESSAGE_INFO,
_("Image saved to '%s'"),
filename);
break;
case GIMP_PDB_CANCEL:
gimp_message (image->gimp, G_OBJECT (display), GIMP_MESSAGE_INFO,
_("Saving canceled"));
break;
default:
gimp_message (image->gimp, G_OBJECT (display), GIMP_MESSAGE_ERROR,
_("Saving '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
break;
}
g_free (filename);
}
for (list = gimp_action_groups_from_name ("file");
list;
@@ -311,17 +327,22 @@ file_revert_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
GimpImage *image;
GtkWidget *dialog;
const gchar *uri;
return_if_no_display (display, data);
uri = gimp_object_get_name (GIMP_OBJECT (display->image));
image = display->image;
dialog = g_object_get_data (G_OBJECT (display->image), REVERT_DATA_KEY);
uri = gimp_object_get_name (GIMP_OBJECT (image));
dialog = g_object_get_data (G_OBJECT (image), REVERT_DATA_KEY);
if (! uri)
{
g_message (_("Revert failed. No file name associated with this image."));
gimp_message (image->gimp, G_OBJECT (display), GIMP_MESSAGE_ERROR,
_("Revert failed. "
"No file name associated with this image."));
}
else if (dialog)
{
@@ -369,7 +390,7 @@ file_revert_cmd_callback (GtkAction *action,
"on disk, you will lose all changes, "
"including all undo information."));
g_object_set_data (G_OBJECT (display->image), REVERT_DATA_KEY, dialog);
g_object_set_data (G_OBJECT (image), REVERT_DATA_KEY, dialog);
gtk_widget_show (dialog);
}
@@ -422,7 +443,7 @@ static void
file_open_dialog_show (GtkWidget *parent,
GimpImage *image,
const gchar *uri,
gboolean open_as_layer)
gboolean open_as_layers)
{
GtkWidget *dialog;
@@ -435,9 +456,9 @@ file_open_dialog_show (GtkWidget *parent,
if (uri)
gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dialog), uri);
if (open_as_layer)
if (open_as_layers)
{
gtk_window_set_title (GTK_WINDOW (dialog), _("Open Image as Layer"));
gtk_window_set_title (GTK_WINDOW (dialog), _("Open Image as Layers"));
GIMP_FILE_DIALOG (dialog)->image = image;
}
else
@@ -560,7 +581,8 @@ file_revert_confirm_response (GtkWidget *dialog,
{
gchar *filename = file_utils_uri_display_name (uri);
g_message (_("Reverting to '%s' failed:\n\n%s"),
gimp_message (gimp, G_OBJECT (display), GIMP_MESSAGE_ERROR,
_("Reverting to '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);

View File

@@ -24,7 +24,7 @@ void file_open_cmd_callback (GtkAction *action,
gpointer data);
void file_open_from_image_cmd_callback (GtkAction *action,
gpointer data);
void file_open_as_layer_cmd_callback (GtkAction *action,
void file_open_as_layers_cmd_callback (GtkAction *action,
gpointer data);
void file_open_location_cmd_callback (GtkAction *action,
gpointer data);

View File

@@ -46,11 +46,15 @@ static const GimpActionEntry gradient_editor_actions[] =
N_("Gradient Editor Menu"), NULL, NULL, NULL,
GIMP_HELP_GRADIENT_EDITOR_DIALOG },
{ "gradient-editor-left-color-type", NULL,
N_("Left Color Type") },
{ "gradient-editor-load-left-color", GTK_STOCK_REVERT_TO_SAVED,
N_("_Load Left Color From") },
{ "gradient-editor-save-left-color", GTK_STOCK_SAVE,
N_("_Save Left Color To") },
{ "gradient-editor-right-color-type", NULL,
N_("Right Color Type") },
{ "gradient-editor-load-right-color", GTK_STOCK_REVERT_TO_SAVED,
N_("Load Right Color Fr_om") },
{ "gradient-editor-save-right-color", GTK_STOCK_SAVE,
@@ -248,6 +252,62 @@ static const GimpEnumActionEntry gradient_editor_save_right_actions[] =
#undef SAVE_RIGHT_TO
static const GimpRadioActionEntry gradient_editor_left_color_type_actions[] =
{
{ "gradient-editor-left-color-fixed", NULL,
N_("_Fixed"), NULL, NULL,
GIMP_GRADIENT_COLOR_FIXED,
GIMP_HELP_GRADIENT_EDITOR_LEFT_COLOR },
{ "gradient-editor-left-color-foreground", NULL,
N_("F_oreground Color"), NULL, NULL,
GIMP_GRADIENT_COLOR_FOREGROUND,
GIMP_HELP_GRADIENT_EDITOR_LEFT_COLOR },
{ "gradient-editor-left-color-foreground-transparent", NULL,
N_("Fo_reground Color (Transparent)"), NULL, NULL,
GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT,
GIMP_HELP_GRADIENT_EDITOR_LEFT_COLOR },
{ "gradient-editor-left-color-background", NULL,
N_("_Background Color"), NULL, NULL,
GIMP_GRADIENT_COLOR_BACKGROUND,
GIMP_HELP_GRADIENT_EDITOR_LEFT_COLOR },
{ "gradient-editor-left-color-background-transparent", NULL,
N_("B_ackground Color (Transparent)"), NULL, NULL,
GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT,
GIMP_HELP_GRADIENT_EDITOR_LEFT_COLOR }
};
static const GimpRadioActionEntry gradient_editor_right_color_type_actions[] =
{
{ "gradient-editor-right-color-fixed", NULL,
N_("_Fixed"), NULL, NULL,
GIMP_GRADIENT_COLOR_FIXED,
GIMP_HELP_GRADIENT_EDITOR_RIGHT_COLOR },
{ "gradient-editor-right-color-foreground", NULL,
N_("F_oreground Color"), NULL, NULL,
GIMP_GRADIENT_COLOR_FOREGROUND,
GIMP_HELP_GRADIENT_EDITOR_RIGHT_COLOR },
{ "gradient-editor-right-color-foreground-transparent", NULL,
N_("Fo_reground Color (Transparent)"), NULL, NULL,
GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT,
GIMP_HELP_GRADIENT_EDITOR_RIGHT_COLOR },
{ "gradient-editor-right-color-background", NULL,
N_("_Background Color"), NULL, NULL,
GIMP_GRADIENT_COLOR_BACKGROUND,
GIMP_HELP_GRADIENT_EDITOR_RIGHT_COLOR },
{ "gradient-editor-right-color-background-transparent", NULL,
N_("B_ackground Color (Transparent)"), NULL, NULL,
GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT,
GIMP_HELP_GRADIENT_EDITOR_RIGHT_COLOR }
};
static const GimpRadioActionEntry gradient_editor_blending_actions[] =
{
{ "gradient-editor-blending-linear", NULL,
@@ -321,7 +381,7 @@ static const GimpEnumActionEntry gradient_editor_zoom_actions[] =
{ "gradient-editor-zoom-all", GTK_STOCK_ZOOM_FIT,
N_("Zoom All"), NULL,
N_("Zoom all"),
GIMP_ZOOM_TO /* abused */, FALSE,
GIMP_ZOOM_OUT_MAX, FALSE,
GIMP_HELP_GRADIENT_EDITOR_ZOOM_ALL }
};
@@ -358,6 +418,20 @@ gradient_editor_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (gradient_editor_save_right_actions),
G_CALLBACK (gradient_editor_save_right_cmd_callback));
gimp_action_group_add_radio_actions (group,
gradient_editor_left_color_type_actions,
G_N_ELEMENTS (gradient_editor_left_color_type_actions),
NULL,
0,
G_CALLBACK (gradient_editor_left_color_type_cmd_callback));
gimp_action_group_add_radio_actions (group,
gradient_editor_right_color_type_actions,
G_N_ELEMENTS (gradient_editor_right_color_type_actions),
NULL,
0,
G_CALLBACK (gradient_editor_right_color_type_cmd_callback));
gimp_action_group_add_radio_actions (group,
gradient_editor_blending_actions,
G_N_ELEMENTS (gradient_editor_blending_actions),
@@ -385,41 +459,67 @@ gradient_editor_actions_update (GimpActionGroup *group,
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
GimpGradient *gradient;
GimpContext *context;
gboolean editable = FALSE;
GimpGradientSegment *left_seg = NULL;
GimpGradientSegment *right_seg = NULL;
GimpRGB left_color;
GimpRGB right_color;
GimpRGB left_seg_color;
GimpRGB right_seg_color;
GimpRGB fg;
GimpRGB bg;
gboolean blending_equal = TRUE;
gboolean coloring_equal = TRUE;
gboolean left_editable = TRUE;
gboolean right_editable = TRUE;
gboolean selection = FALSE;
gboolean delete = FALSE;
gboolean edit_active = FALSE;
gradient = GIMP_GRADIENT (data_editor->data);
context = gimp_get_user_context (data_editor->data_factory->gimp);
if (gradient)
{
GimpGradientSegmentType type;
GimpGradientSegmentColor color;
GimpGradientSegment *left_seg;
GimpGradientSegment *right_seg;
GimpGradientSegment *seg, *aseg;
if (data_editor->data_editable)
editable = TRUE;
gimp_gradient_get_color_at (gradient, data_editor->context,
editor->control_sel_l,
editor->control_sel_l->left, FALSE,
&left_color);
if (editor->control_sel_l->prev)
left_seg = editor->control_sel_l->prev;
else
left_seg = gimp_gradient_segment_get_last (editor->control_sel_l);
gimp_gradient_get_color_at (gradient, data_editor->context,
left_seg, left_seg->right, FALSE,
&left_seg_color);
gimp_gradient_get_color_at (gradient, data_editor->context,
editor->control_sel_r,
editor->control_sel_r->right, FALSE,
&right_color);
if (editor->control_sel_r->next)
right_seg = editor->control_sel_r->next;
else
right_seg = gimp_gradient_segment_get_first (editor->control_sel_r);
gimp_gradient_get_color_at (gradient, data_editor->context,
right_seg, right_seg->left, FALSE,
&right_seg_color);
left_editable = (editor->control_sel_l->left_color_type ==
GIMP_GRADIENT_COLOR_FIXED);
right_editable = (editor->control_sel_r->right_color_type ==
GIMP_GRADIENT_COLOR_FIXED);
type = editor->control_sel_l->type;
color = editor->control_sel_l->color;
@@ -439,10 +539,10 @@ gradient_editor_actions_update (GimpActionGroup *group,
delete = (editor->control_sel_l->prev || editor->control_sel_r->next);
}
if (context)
if (data_editor->context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
gimp_context_get_foreground (data_editor->context, &fg);
gimp_context_get_background (data_editor->context, &bg);
}
/* pretend the gradient not being editable while the dialog is
@@ -452,6 +552,12 @@ gradient_editor_actions_update (GimpActionGroup *group,
if (! GTK_WIDGET_SENSITIVE (editor))
editable = FALSE;
if (! editable)
{
left_editable = FALSE;
right_editable = FALSE;
}
edit_active = gimp_data_editor_get_edit_active (data_editor);
#define SET_ACTIVE(action,condition) \
@@ -465,36 +571,66 @@ gradient_editor_actions_update (GimpActionGroup *group,
#define SET_VISIBLE(action,condition) \
gimp_action_group_set_action_visible (group, action, (condition) != 0)
SET_SENSITIVE ("gradient-editor-left-color", editable);
SET_SENSITIVE ("gradient-editor-left-color-fixed", editable);
SET_SENSITIVE ("gradient-editor-left-color-foreground", editable);
SET_SENSITIVE ("gradient-editor-left-color-foreground-transparent", editable);
SET_SENSITIVE ("gradient-editor-left-color-background", editable);
SET_SENSITIVE ("gradient-editor-left-color-background-transparent", editable);
if (gradient)
{
switch (editor->control_sel_l->left_color_type)
{
case GIMP_GRADIENT_COLOR_FIXED:
SET_ACTIVE ("gradient-editor-left-color-fixed", TRUE);
break;
case GIMP_GRADIENT_COLOR_FOREGROUND:
SET_ACTIVE ("gradient-editor-left-color-foreground", TRUE);
break;
case GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT:
SET_ACTIVE ("gradient-editor-left-color-foreground-transparent", TRUE);
break;
case GIMP_GRADIENT_COLOR_BACKGROUND:
SET_ACTIVE ("gradient-editor-left-color-background", TRUE);
break;
case GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT:
SET_ACTIVE ("gradient-editor-left-color-background-transparent", TRUE);
break;
}
}
SET_SENSITIVE ("gradient-editor-left-color", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-left-neighbor", editable);
SET_SENSITIVE ("gradient-editor-load-left-right-endpoint", editable);
if (gradient)
{
SET_COLOR ("gradient-editor-left-color",
&editor->control_sel_l->left_color, FALSE);
&left_color, FALSE);
SET_COLOR ("gradient-editor-load-left-left-neighbor",
&left_seg->right_color, FALSE);
&left_seg_color, FALSE);
SET_COLOR ("gradient-editor-load-left-right-endpoint",
&editor->control_sel_r->right_color, FALSE);
&right_color, FALSE);
}
SET_SENSITIVE ("gradient-editor-load-left-fg", editable);
SET_SENSITIVE ("gradient-editor-load-left-bg", editable);
SET_SENSITIVE ("gradient-editor-load-left-fg", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-bg", left_editable);
SET_COLOR ("gradient-editor-load-left-fg", context ? &fg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-left-bg", context ? &bg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-left-fg",
data_editor->context ? &fg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-left-bg",
data_editor->context ? &bg : NULL, FALSE);
SET_SENSITIVE ("gradient-editor-load-left-01", editable);
SET_SENSITIVE ("gradient-editor-load-left-02", editable);
SET_SENSITIVE ("gradient-editor-load-left-03", editable);
SET_SENSITIVE ("gradient-editor-load-left-04", editable);
SET_SENSITIVE ("gradient-editor-load-left-05", editable);
SET_SENSITIVE ("gradient-editor-load-left-06", editable);
SET_SENSITIVE ("gradient-editor-load-left-07", editable);
SET_SENSITIVE ("gradient-editor-load-left-08", editable);
SET_SENSITIVE ("gradient-editor-load-left-09", editable);
SET_SENSITIVE ("gradient-editor-load-left-10", editable);
SET_SENSITIVE ("gradient-editor-load-left-01", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-02", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-03", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-04", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-05", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-06", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-07", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-08", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-09", left_editable);
SET_SENSITIVE ("gradient-editor-load-left-10", left_editable);
SET_COLOR ("gradient-editor-load-left-01", &editor->saved_colors[0], TRUE);
SET_COLOR ("gradient-editor-load-left-02", &editor->saved_colors[1], TRUE);
@@ -529,36 +665,66 @@ gradient_editor_actions_update (GimpActionGroup *group,
SET_COLOR ("gradient-editor-save-left-09", &editor->saved_colors[8], TRUE);
SET_COLOR ("gradient-editor-save-left-10", &editor->saved_colors[9], TRUE);
SET_SENSITIVE ("gradient-editor-right-color", editable);
SET_SENSITIVE ("gradient-editor-right-color-fixed", editable);
SET_SENSITIVE ("gradient-editor-right-color-foreground", editable);
SET_SENSITIVE ("gradient-editor-right-color-foreground-transparent", editable);
SET_SENSITIVE ("gradient-editor-right-color-background", editable);
SET_SENSITIVE ("gradient-editor-right-color-background-transparent", editable);
if (gradient)
{
switch (editor->control_sel_r->right_color_type)
{
case GIMP_GRADIENT_COLOR_FIXED:
SET_ACTIVE ("gradient-editor-right-color-fixed", TRUE);
break;
case GIMP_GRADIENT_COLOR_FOREGROUND:
SET_ACTIVE ("gradient-editor-right-color-foreground", TRUE);
break;
case GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT:
SET_ACTIVE ("gradient-editor-right-color-foreground-transparent", TRUE);
break;
case GIMP_GRADIENT_COLOR_BACKGROUND:
SET_ACTIVE ("gradient-editor-right-color-background", TRUE);
break;
case GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT:
SET_ACTIVE ("gradient-editor-right-color-background-transparent", TRUE);
break;
}
}
SET_SENSITIVE ("gradient-editor-right-color", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-right-neighbor", editable);
SET_SENSITIVE ("gradient-editor-load-right-left-endpoint", editable);
if (gradient)
{
SET_COLOR ("gradient-editor-right-color",
&editor->control_sel_r->right_color, FALSE);
&right_color, FALSE);
SET_COLOR ("gradient-editor-load-right-right-neighbor",
&right_seg->left_color, FALSE);
&right_seg_color, FALSE);
SET_COLOR ("gradient-editor-load-right-left-endpoint",
&editor->control_sel_l->left_color, FALSE);
&left_color, FALSE);
}
SET_SENSITIVE ("gradient-editor-load-right-fg", editable);
SET_SENSITIVE ("gradient-editor-load-right-bg", editable);
SET_SENSITIVE ("gradient-editor-load-right-fg", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-bg", right_editable);
SET_COLOR ("gradient-editor-load-right-fg", context ? &fg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-right-bg", context ? &bg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-right-fg",
data_editor->context ? &fg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-right-bg",
data_editor->context ? &bg : NULL, FALSE);
SET_SENSITIVE ("gradient-editor-load-right-01", editable);
SET_SENSITIVE ("gradient-editor-load-right-02", editable);
SET_SENSITIVE ("gradient-editor-load-right-03", editable);
SET_SENSITIVE ("gradient-editor-load-right-04", editable);
SET_SENSITIVE ("gradient-editor-load-right-05", editable);
SET_SENSITIVE ("gradient-editor-load-right-06", editable);
SET_SENSITIVE ("gradient-editor-load-right-07", editable);
SET_SENSITIVE ("gradient-editor-load-right-08", editable);
SET_SENSITIVE ("gradient-editor-load-right-09", editable);
SET_SENSITIVE ("gradient-editor-load-right-10", editable);
SET_SENSITIVE ("gradient-editor-load-right-01", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-02", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-03", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-04", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-05", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-06", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-07", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-08", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-09", right_editable);
SET_SENSITIVE ("gradient-editor-load-right-10", right_editable);
SET_COLOR ("gradient-editor-load-right-01", &editor->saved_colors[0], TRUE);
SET_COLOR ("gradient-editor-load-right-02", &editor->saved_colors[1], TRUE);

View File

@@ -82,6 +82,7 @@ gradient_editor_left_color_cmd_callback (GtkAction *action,
editor->color_dialog =
gimp_color_dialog_new (GIMP_VIEWABLE (gradient),
GIMP_DATA_EDITOR (editor)->context,
_("Left Endpoint Color"),
GIMP_STOCK_GRADIENT,
_("Gradient Segment's Left Endpoint Color"),
@@ -106,21 +107,58 @@ gradient_editor_left_color_cmd_callback (GtkAction *action,
gtk_window_present (GTK_WINDOW (editor->color_dialog));
}
void
gradient_editor_left_color_type_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data)
{
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpGradient *gradient;
gint value;
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
if (gradient && value >= 0)
{
GimpGradientColor color_type = value;
GimpRGB color;
gimp_gradient_get_color_at (gradient,
GIMP_DATA_EDITOR (editor)->context,
editor->control_sel_l,
editor->control_sel_l->left, FALSE,
&color);
gimp_data_freeze (GIMP_DATA (gradient));
gimp_gradient_segment_set_left_color_type (gradient,
editor->control_sel_l,
color_type);
if (color_type == GIMP_GRADIENT_COLOR_FIXED)
gimp_gradient_segment_set_left_color (gradient,
editor->control_sel_l,
&color);
gimp_data_thaw (GIMP_DATA (gradient));
}
}
void
gradient_editor_load_left_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
GimpGradient *gradient;
GimpContext *context;
GimpGradientSegment *seg;
GimpRGB color;
GimpGradientColor color_type = GIMP_GRADIENT_COLOR_FIXED;
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
context =
gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp);
gradient = GIMP_GRADIENT (data_editor->data);
switch (value)
{
@@ -131,18 +169,20 @@ gradient_editor_load_left_cmd_callback (GtkAction *action,
seg = gimp_gradient_segment_get_last (editor->control_sel_l);
color = seg->right_color;
color_type = seg->right_color_type;
break;
case GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT:
color = editor->control_sel_r->right_color;
color_type = editor->control_sel_l->right_color_type;
break;
case GRADIENT_EDITOR_COLOR_FOREGROUND:
gimp_context_get_foreground (context, &color);
gimp_context_get_foreground (data_editor->context, &color);
break;
case GRADIENT_EDITOR_COLOR_BACKGROUND:
gimp_context_get_background (context, &color);
gimp_context_get_background (data_editor->context, &color);
break;
default: /* Load a color */
@@ -150,12 +190,19 @@ gradient_editor_load_left_cmd_callback (GtkAction *action,
break;
}
gimp_data_freeze (GIMP_DATA (gradient));
gimp_gradient_segment_range_blend (gradient,
editor->control_sel_l,
editor->control_sel_r,
&color,
&editor->control_sel_r->right_color,
TRUE, TRUE);
gimp_gradient_segment_set_left_color_type (gradient,
editor->control_sel_l,
color_type);
gimp_data_thaw (GIMP_DATA (gradient));
}
void
@@ -186,6 +233,7 @@ gradient_editor_right_color_cmd_callback (GtkAction *action,
editor->color_dialog =
gimp_color_dialog_new (GIMP_VIEWABLE (gradient),
GIMP_DATA_EDITOR (editor)->context,
_("Right Endpoint Color"),
GIMP_STOCK_GRADIENT,
_("Gradient Segment's Right Endpoint Color"),
@@ -210,21 +258,58 @@ gradient_editor_right_color_cmd_callback (GtkAction *action,
gtk_window_present (GTK_WINDOW (editor->color_dialog));
}
void
gradient_editor_right_color_type_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data)
{
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpGradient *gradient;
gint value;
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
if (gradient && value >= 0)
{
GimpGradientColor color_type = value;
GimpRGB color;
gimp_gradient_get_color_at (gradient,
GIMP_DATA_EDITOR (editor)->context,
editor->control_sel_r,
editor->control_sel_r->right, FALSE,
&color);
gimp_data_freeze (GIMP_DATA (gradient));
gimp_gradient_segment_set_right_color_type (gradient,
editor->control_sel_r,
color_type);
if (color_type == GIMP_GRADIENT_COLOR_FIXED)
gimp_gradient_segment_set_right_color (gradient,
editor->control_sel_r,
&color);
gimp_data_thaw (GIMP_DATA (gradient));
}
}
void
gradient_editor_load_right_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
GimpGradient *gradient;
GimpContext *context;
GimpGradientSegment *seg;
GimpRGB color;
GimpGradientColor color_type = GIMP_GRADIENT_COLOR_FIXED;
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
context =
gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp);
gradient = GIMP_GRADIENT (data_editor->data);
switch (value)
{
@@ -235,18 +320,20 @@ gradient_editor_load_right_cmd_callback (GtkAction *action,
seg = gimp_gradient_segment_get_first (editor->control_sel_r);
color = seg->left_color;
color_type = seg->left_color_type;
break;
case GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT:
color = editor->control_sel_l->left_color;
color_type = editor->control_sel_l->left_color_type;
break;
case GRADIENT_EDITOR_COLOR_FOREGROUND:
gimp_context_get_foreground (context, &color);
gimp_context_get_foreground (data_editor->context, &color);
break;
case GRADIENT_EDITOR_COLOR_BACKGROUND:
gimp_context_get_background (context, &color);
gimp_context_get_background (data_editor->context, &color);
break;
default: /* Load a color */
@@ -254,12 +341,19 @@ gradient_editor_load_right_cmd_callback (GtkAction *action,
break;
}
gimp_data_freeze (GIMP_DATA (gradient));
gimp_gradient_segment_range_blend (gradient,
editor->control_sel_l,
editor->control_sel_r,
&editor->control_sel_l->left_color,
&color,
TRUE, TRUE);
gimp_gradient_segment_set_right_color_type (gradient,
editor->control_sel_l,
color_type);
gimp_data_thaw (GIMP_DATA (gradient));
}
void
@@ -345,6 +439,7 @@ gradient_editor_replicate_cmd_callback (GtkAction *action,
gpointer data)
{
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
GtkWidget *dialog;
GtkWidget *vbox;
GtkWidget *label;
@@ -365,7 +460,8 @@ gradient_editor_replicate_cmd_callback (GtkAction *action,
}
dialog =
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
gimp_viewable_dialog_new (GIMP_VIEWABLE (data_editor->data),
data_editor->context,
title, "gimp-gradient-segment-replicate",
GIMP_STOCK_GRADIENT, desc,
GTK_WIDGET (editor),
@@ -428,11 +524,11 @@ gradient_editor_split_midpoint_cmd_callback (GtkAction *action,
gpointer data)
{
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpGradient *gradient;
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
GimpGradient *gradient = GIMP_GRADIENT (data_editor->data);
gimp_gradient_segment_range_split_midpoint (gradient,
data_editor->context,
editor->control_sel_l,
editor->control_sel_r,
&editor->control_sel_l,
@@ -444,6 +540,7 @@ gradient_editor_split_uniformly_cmd_callback (GtkAction *action,
gpointer data)
{
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
GtkWidget *dialog;
GtkWidget *vbox;
GtkWidget *label;
@@ -464,7 +561,8 @@ gradient_editor_split_uniformly_cmd_callback (GtkAction *action,
}
dialog =
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
gimp_viewable_dialog_new (GIMP_VIEWABLE (data_editor->data),
data_editor->context,
title, "gimp-gradient-segment-split-uniformly",
GIMP_STOCK_GRADIENT, desc,
GTK_WIDGET (editor),
@@ -794,9 +892,11 @@ gradient_editor_split_uniform_response (GtkWidget *widget,
if (response_id == GTK_RESPONSE_OK)
{
GimpGradient *gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
GimpGradient *gradient = GIMP_GRADIENT (data_editor->data);
gimp_gradient_segment_range_split_uniform (gradient,
data_editor->context,
editor->control_sel_l,
editor->control_sel_r,
editor->split_parts,

View File

@@ -32,6 +32,9 @@ enum
void gradient_editor_left_color_cmd_callback (GtkAction *action,
gpointer data);
void gradient_editor_left_color_type_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
void gradient_editor_load_left_cmd_callback (GtkAction *action,
gint value,
gpointer data);
@@ -41,6 +44,9 @@ void gradient_editor_save_left_cmd_callback (GtkAction *action,
void gradient_editor_right_color_cmd_callback (GtkAction *action,
gpointer data);
void gradient_editor_right_color_type_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
void gradient_editor_load_right_cmd_callback (GtkAction *action,
gint value,
gpointer data);

View File

@@ -24,6 +24,7 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpgradient-save.h"
#include "core/gimpcontext.h"
@@ -79,6 +80,8 @@ gradients_save_as_pov_ray_cmd_callback (GtkAction *action,
GTK_RESPONSE_CANCEL,
-1);
g_object_set_data (G_OBJECT (chooser), "gimp", context->gimp);
g_free (title);
gtk_window_set_screen (GTK_WINDOW (chooser),
@@ -122,10 +125,14 @@ gradients_save_as_pov_ray_response (GtkWidget *dialog,
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
if (! gimp_gradient_save_as_pov (gradient, filename, &error))
if (! gimp_gradient_save_pov (gradient, filename, &error))
{
g_message (error->message);
gimp_message (g_object_get_data (G_OBJECT (dialog), "gimp"),
G_OBJECT (dialog),
GIMP_MESSAGE_ERROR,
"%s", error->message);
g_clear_error (&error);
return;
}
}

View File

@@ -65,8 +65,8 @@ static const GimpActionEntry image_actions[] =
{ "colors-menu", NULL, N_("_Colors") },
{ "colors-info-menu", NULL, N_("I_nfo") },
{ "colors-auto-menu", NULL, N_("_Auto") },
{ "colors-map-menu", NULL, N_("Ma_p") },
{ "colors-components-menu", NULL, N_("_Components") },
{ "colors-map-menu", NULL, N_("_Map") },
{ "colors-components-menu", NULL, N_("C_omponents") },
{ "image-new", GTK_STOCK_NEW,
N_("_New..."), "<control>N",
@@ -135,7 +135,7 @@ static const GimpActionEntry image_actions[] =
GIMP_HELP_IMAGE_GRID },
{ "image-properties", GTK_STOCK_INFO,
N_("Image Properties"), NULL,
N_("Image Pr_operties"), NULL,
N_("Display information about this image"),
G_CALLBACK (image_properties_cmd_callback),
GIMP_HELP_IMAGE_PROPERTIES }

View File

@@ -24,6 +24,8 @@
#include "actions-types.h"
#include "config/gimpcoreconfig.h"
#include "core/core-enums.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
@@ -89,7 +91,16 @@ static void image_print_size_callback (GtkWidget *dialog,
gdouble yresolution,
GimpUnit resolution_unit,
gpointer data);
static void image_scale_callback (ImageScaleDialog *dialog);
static void image_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 image_merge_layers_response (GtkWidget *widget,
gint response_id,
@@ -100,6 +111,9 @@ static void image_merge_layers_response (GtkWidget *widget,
static GimpMergeType image_merge_layers_type = GIMP_EXPAND_AS_NECESSARY;
static gboolean image_merge_layers_discard_invisible = FALSE;
static GimpUnit image_resize_unit = GIMP_UNIT_PIXEL;
static GimpUnit image_scale_unit = GIMP_UNIT_PIXEL;
static GimpInterpolationType image_scale_interp = -1;
/* public functions */
@@ -185,7 +199,9 @@ image_convert_cmd_callback (GtkAction *action,
if (! dialog)
{
dialog = convert_dialog_new (image, widget,
dialog = convert_dialog_new (image,
action_data_get_context (data),
widget,
GIMP_PROGRESS (display));
g_object_set_data (G_OBJECT (widget),
@@ -213,7 +229,6 @@ image_resize_cmd_callback (GtkAction *action,
GtkWidget *widget;
GimpDisplay *display;
GtkWidget *dialog;
GimpUnit unit;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
return_if_no_display (display, data);
@@ -223,16 +238,15 @@ image_resize_cmd_callback (GtkAction *action,
options->display = display;
options->context = action_data_get_context (data);
unit = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (image),
"scale-dialog-unit"));
if (! unit)
unit = GIMP_DISPLAY_SHELL (display->shell)->unit;
if (image_resize_unit != GIMP_UNIT_PERCENT)
image_resize_unit = GIMP_DISPLAY_SHELL (display->shell)->unit;
dialog = resize_dialog_new (GIMP_VIEWABLE (image),
action_data_get_context (data),
_("Set Image Canvas Size"), "gimp-image-resize",
widget,
gimp_standard_help_func, GIMP_HELP_IMAGE_RESIZE,
unit,
image_resize_unit,
image_resize_callback,
options);
@@ -240,8 +254,7 @@ image_resize_cmd_callback (GtkAction *action,
G_CALLBACK (gtk_widget_destroy),
dialog, G_CONNECT_SWAPPED);
g_object_weak_ref (G_OBJECT (dialog),
(GWeakNotify) g_free, options);
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_free, options);
gtk_widget_show (dialog);
}
@@ -278,6 +291,7 @@ image_print_size_cmd_callback (GtkAction *action,
return_if_no_widget (widget, data);
dialog = print_size_dialog_new (display->image,
action_data_get_context (data),
_("Set Image Print Resolution"),
"gimp-image-print-size",
widget,
@@ -297,22 +311,31 @@ void
image_scale_cmd_callback (GtkAction *action,
gpointer data)
{
ImageScaleDialog *dialog;
GimpDisplay *display;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_display (display, data);
return_if_no_widget (widget, data);
dialog = image_scale_dialog_new (display->image, display,
if (image_scale_unit != GIMP_UNIT_PERCENT)
image_scale_unit = GIMP_DISPLAY_SHELL (display->shell)->unit;
if (image_scale_interp == -1)
image_scale_interp = display->image->gimp->config->interpolation_type;
dialog = image_scale_dialog_new (display->image,
action_data_get_context (data),
widget,
image_scale_callback);
image_scale_unit,
image_scale_interp,
image_scale_callback,
display);
g_signal_connect_object (display, "disconnect",
G_CALLBACK (gtk_widget_destroy),
dialog->dialog, G_CONNECT_SWAPPED);
dialog, G_CONNECT_SWAPPED);
gtk_widget_show (dialog->dialog);
gtk_widget_show (dialog);
}
void
@@ -362,13 +385,16 @@ image_crop_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GtkWidget *widget;
gint x1, y1, x2, y2;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
if (! gimp_channel_bounds (gimp_image_get_mask (image),
&x1, &y1, &x2, &y2))
{
g_message (_("Cannot crop because the current selection is empty."));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("Cannot crop because the current selection is empty."));
return;
}
@@ -446,7 +472,9 @@ image_configure_grid_cmd_callback (GtkAction *action,
if (! shell->grid_dialog)
{
shell->grid_dialog = grid_dialog_new (display->image, display->shell);
shell->grid_dialog = grid_dialog_new (display->image,
action_data_get_context (data),
display->shell);
gtk_window_set_transient_for (GTK_WINDOW (shell->grid_dialog),
GTK_WINDOW (display->shell));
@@ -473,7 +501,9 @@ image_properties_cmd_callback (GtkAction *action,
shell = GIMP_DISPLAY_SHELL (display->shell);
image = display->image;
dialog = image_properties_dialog_new (display->image, display->shell);
dialog = image_properties_dialog_new (display->image,
action_data_get_context (data),
display->shell);
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (display->shell));
@@ -499,6 +529,8 @@ image_resize_callback (GtkWidget *dialog,
{
ImageResizeOptions *options = data;
image_resize_unit = unit;
if (width > 0 && height > 0)
{
GimpImage *image = GIMP_IMAGE (viewable);
@@ -508,11 +540,8 @@ image_resize_callback (GtkWidget *dialog,
gtk_widget_destroy (dialog);
/* remember the last used unit */
g_object_set_data (G_OBJECT (image),
"scale-dialog-unit", GINT_TO_POINTER (unit));
if (width == image->width && height == image->height)
if (width == image->width &&
height == image->height)
return;
progress = gimp_progress_start (GIMP_PROGRESS (display),
@@ -562,54 +591,62 @@ image_print_size_callback (GtkWidget *dialog,
gimp_image_flush (image);
}
static void
image_scale_callback (ImageScaleDialog *dialog)
image_scale_callback (GtkWidget *dialog,
GimpViewable *viewable,
gint width,
gint height,
GimpUnit unit,
GimpInterpolationType interpolation,
gdouble xresolution,
gdouble yresolution,
GimpUnit resolution_unit,
gpointer user_data)
{
GimpImage *image = dialog->image;
GimpImage *image = GIMP_IMAGE (viewable);
if (dialog->width == image->width &&
dialog->height == image->height &&
dialog->xresolution == image->xresolution &&
dialog->yresolution == image->yresolution &&
dialog->resolution_unit == image->resolution_unit)
image_scale_unit = unit;
image_scale_interp = interpolation;
if (width > 0 && height > 0)
{
if (width == image->width &&
height == image->height &&
xresolution == image->xresolution &&
yresolution == image->yresolution &&
resolution_unit == image->resolution_unit)
return;
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_SCALE,
_("Scale Image"));
gimp_image_set_resolution (image,
dialog->xresolution, dialog->yresolution);
gimp_image_set_unit (image, dialog->resolution_unit);
gimp_image_set_resolution (image, xresolution, yresolution);
gimp_image_set_unit (image, resolution_unit);
if (dialog->width != image->width || dialog->height != image->height)
{
if (dialog->width > 0 && dialog->height > 0)
if (width != image->width ||
height != image->height)
{
GimpProgress *progress;
progress = gimp_progress_start (GIMP_PROGRESS (dialog->display),
progress = gimp_progress_start (GIMP_PROGRESS (user_data),
_("Scaling"), FALSE);
gimp_image_scale (image,
dialog->width,
dialog->height,
dialog->interpolation,
gimp_image_scale (image, width, height, interpolation,
progress);
if (progress)
gimp_progress_end (progress);
}
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
else
{
g_warning ("Scale Error: "
"Both width and height must be greater than zero.");
}
}
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
static void

View File

@@ -31,6 +31,8 @@
#include "text/gimptextlayer.h"
#include "vectors/gimpvectorlayer.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpactiongroup.h"
@@ -64,6 +66,12 @@ static const GimpActionEntry layers_actions[] =
G_CALLBACK (layers_text_tool_cmd_callback),
GIMP_HELP_TOOL_TEXT },
{ "layers-vector-tool", GIMP_STOCK_TOOL_PATH,
N_("Path Tool"), NULL,
N_("Activate the path tool on this vector layer's path"),
G_CALLBACK (layers_vector_tool_cmd_callback),
GIMP_HELP_TOOL_PATH },
{ "layers-edit-attributes", GTK_STOCK_EDIT,
N_("_Edit Layer Attributes..."), NULL,
N_("Edit the layer's name"),
@@ -160,6 +168,18 @@ static const GimpActionEntry layers_actions[] =
G_CALLBACK (layers_text_along_vectors_cmd_callback),
GIMP_HELP_LAYER_TEXT_ALONG_PATH },
{ "layers-vector-fill-stroke", NULL,
N_("Fill / Stroke"), NULL,
N_("Edit the fill and stroke of this vector layer"),
G_CALLBACK (layers_vector_fill_stroke_cmd_callback),
NULL },
{ "layers-vector-discard", NULL,
N_("Discard Vector Information"), NULL,
N_("Turn this vector layer into a normal layer"),
G_CALLBACK (layers_vector_discard_cmd_callback),
NULL },
{ "layers-resize", GIMP_STOCK_RESIZE,
N_("Layer B_oundary Size..."), NULL,
N_("Adjust the layer dimensions"),
@@ -179,7 +199,7 @@ static const GimpActionEntry layers_actions[] =
GIMP_HELP_LAYER_SCALE },
{ "layers-crop", GIMP_STOCK_TOOL_CROP,
N_("Cr_op Layer"), NULL,
N_("_Crop Layer"), NULL,
N_("Crop the layer to the extents of the selection"),
G_CALLBACK (layers_crop_cmd_callback),
GIMP_HELP_LAYER_CROP },
@@ -466,6 +486,7 @@ layers_actions_update (GimpActionGroup *group,
gboolean indexed = FALSE; /* is indexed */
gboolean lock_alpha = FALSE;
gboolean text_layer = FALSE;
gboolean vector_layer = FALSE;
GList *next = NULL;
GList *prev = NULL;
@@ -495,7 +516,10 @@ layers_actions_update (GimpActionGroup *group,
}
if (layer)
{
text_layer = gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer));
vector_layer = gimp_drawable_is_vector_layer (GIMP_DRAWABLE (layer));
}
}
}
@@ -507,6 +531,7 @@ layers_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_active (group, action, (condition) != 0)
SET_VISIBLE ("layers-text-tool", text_layer && !ac);
SET_VISIBLE ("layers-vector-tool", vector_layer && !ac);
SET_SENSITIVE ("layers-edit-attributes", layer && !fs && !ac);
SET_SENSITIVE ("layers-new", image);
@@ -537,6 +562,9 @@ layers_actions_update (GimpActionGroup *group,
SET_VISIBLE ("layers-text-selection-subtract", text_layer && !ac);
SET_VISIBLE ("layers-text-selection-intersect", text_layer && !ac);
SET_VISIBLE ("layers-vector-fill-stroke", vector_layer && !ac);
SET_VISIBLE ("layers-vector-discard", vector_layer && !ac);
SET_SENSITIVE ("layers-resize", layer && !ac);
SET_SENSITIVE ("layers-resize-to-image", layer && !ac);
SET_SENSITIVE ("layers-scale", layer && !ac);

View File

@@ -33,6 +33,7 @@
#include "core/gimp.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontext.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "core/gimpimage-merge.h"
#include "core/gimpimage-undo.h"
@@ -41,7 +42,6 @@
#include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayermask.h"
#include "core/gimplist.h"
#include "core/gimptoolinfo.h"
#include "core/gimpundostack.h"
#include "core/gimpprogress.h"
@@ -50,6 +50,8 @@
#include "text/gimptext-vectors.h"
#include "text/gimptextlayer.h"
#include "vectors/gimpvectorlayer.h"
#include "vectors/gimpvectorlayeroptions.h"
#include "vectors/gimpvectors-warp.h"
#include "widgets/gimpaction.h"
@@ -61,8 +63,10 @@
#include "display/gimpdisplayshell.h"
#include "tools/gimptexttool.h"
#include "tools/gimpvectortool.h"
#include "tools/tool_manager.h"
#include "dialogs/vectorlayer-options-dialog.h"
#include "dialogs/layer-add-mask-dialog.h"
#include "dialogs/layer-options-dialog.h"
#include "dialogs/resize-dialog.h"
@@ -139,6 +143,9 @@ static gint layers_mode_index (GimpLayerModeEffects layer_mode);
static GimpFillType layer_fill_type = GIMP_TRANSPARENT_FILL;
static gchar *layer_name = NULL;
static GimpUnit layer_resize_unit = GIMP_UNIT_PIXEL;
static GimpUnit layer_scale_unit = GIMP_UNIT_PIXEL;
static GimpInterpolationType layer_scale_interp = -1;
static GimpAddMaskType layer_add_mask_type = GIMP_ADD_WHITE_MASK;
static gboolean layer_mask_invert = FALSE;
@@ -166,10 +173,7 @@ layers_text_tool_cmd_callback (GtkAction *action,
if (! GIMP_IS_TEXT_TOOL (active_tool))
{
GimpToolInfo *tool_info;
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (image->gimp->tool_info_list,
GimpToolInfo *tool_info = gimp_get_tool_info (image->gimp,
"gimp-text-tool");
if (GIMP_IS_TOOL_INFO (tool_info))
@@ -183,6 +187,45 @@ layers_text_tool_cmd_callback (GtkAction *action,
gimp_text_tool_set_layer (GIMP_TEXT_TOOL (active_tool), layer);
}
void
layers_vector_tool_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
GimpTool *active_tool;
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
if (! gimp_drawable_is_vector_layer (GIMP_DRAWABLE (layer)))
{
layers_edit_attributes_cmd_callback (action, data);
return;
}
active_tool = tool_manager_get_active (image->gimp);
if (! GIMP_IS_VECTOR_TOOL (active_tool))
{
GimpToolInfo *tool_info;
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (image->gimp->tool_info_list,
"gimp-vector-tool");
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);
}
}
if (GIMP_IS_VECTOR_TOOL (active_tool))
gimp_vector_tool_set_vectors (GIMP_VECTOR_TOOL (active_tool),
GIMP_VECTOR_LAYER (layer)->options->vectors);
}
void
layers_edit_attributes_cmd_callback (GtkAction *action,
gpointer data)
@@ -195,8 +238,9 @@ layers_edit_attributes_cmd_callback (GtkAction *action,
return_if_no_widget (widget, data);
dialog = layer_options_dialog_new (gimp_item_get_image (GIMP_ITEM (layer)),
layer,
action_data_get_context (data),
layer, widget,
widget,
gimp_object_get_name (GIMP_OBJECT (layer)),
layer_fill_type,
_("Layer Attributes"),
@@ -233,8 +277,9 @@ layers_new_cmd_callback (GtkAction *action,
return;
}
dialog = layer_options_dialog_new (image, action_data_get_context (data),
NULL, widget,
dialog = layer_options_dialog_new (image, NULL,
action_data_get_context (data),
widget,
layer_name ? layer_name : _("New Layer"),
layer_fill_type,
_("New Layer"),
@@ -512,30 +557,57 @@ layers_text_along_vectors_cmd_callback (GtkAction *action,
}
void
layers_resize_cmd_callback (GtkAction *action,
layers_vector_fill_stroke_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
GtkWidget *dialog;
GimpUnit unit;
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
display = GIMP_IS_DISPLAY (data) ? data : NULL;
dialog = vectorlayer_options_dialog_new (GIMP_ITEM (layer),
action_data_get_context (data),
_("Fill / Stroke"),
GTK_STOCK_OK,
NULL,
widget);
gtk_widget_show (dialog);
}
unit = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (image),
"scale-dialog-unit"));
if (! unit)
unit = display ? GIMP_DISPLAY_SHELL (display->shell)->unit : GIMP_UNIT_PIXEL;
void
layers_vector_discard_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
return_if_no_layer (image, layer, data);
if (GIMP_IS_VECTOR_LAYER (layer))
gimp_vector_layer_discard (GIMP_VECTOR_LAYER (layer));
}
void
layers_resize_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
if (layer_resize_unit != GIMP_UNIT_PERCENT && GIMP_IS_DISPLAY (data))
layer_resize_unit = GIMP_DISPLAY_SHELL (GIMP_DISPLAY (data)->shell)->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,
unit,
layer_resize_unit,
layers_resize_layer_callback,
action_data_get_context (data));
@@ -561,26 +633,25 @@ layers_scale_cmd_callback (GtkAction *action,
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
GimpDisplay *display;
GtkWidget *dialog;
GimpUnit unit;
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
display = action_data_get_display (data);
if (layer_scale_unit != GIMP_UNIT_PERCENT && GIMP_IS_DISPLAY (data))
layer_scale_unit = GIMP_DISPLAY_SHELL (GIMP_DISPLAY (data)->shell)->unit;
unit = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (image),
"scale-dialog-unit"));
if (! unit)
unit = display ? GIMP_DISPLAY_SHELL (display->shell)->unit : GIMP_UNIT_PIXEL;
if (layer_scale_interp == -1)
layer_scale_interp = image->gimp->config->interpolation_type;
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,
unit, image->gimp->config->interpolation_type,
layer_scale_unit,
layer_scale_interp,
layers_scale_layer_callback,
display);
GIMP_IS_DISPLAY (data) ? data : NULL);
gtk_widget_show (dialog);
}
@@ -591,14 +662,17 @@ layers_crop_cmd_callback (GtkAction *action,
{
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
gint x1, y1, x2, y2;
gint off_x, off_y;
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
if (! gimp_channel_bounds (gimp_image_get_mask (image),
&x1, &y1, &x2, &y2))
{
g_message (_("Cannot crop because the current selection is empty."));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("Cannot crop because the current selection is empty."));
return;
}
@@ -629,7 +703,8 @@ layers_mask_add_cmd_callback (GtkAction *action,
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
dialog = layer_add_mask_dialog_new (layer, widget,
dialog = layer_add_mask_dialog_new (layer, action_data_get_context (data),
widget,
layer_add_mask_type, layer_mask_invert);
g_signal_connect (dialog->dialog, "response",
@@ -823,7 +898,7 @@ layers_opacity_cmd_callback (GtkAction *action,
opacity = action_select_value ((GimpActionSelectType) value,
gimp_layer_get_opacity (layer),
0.0, 1.0,
0.01, 0.1, FALSE);
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
gimp_layer_set_opacity (layer, opacity, push_undo);
gimp_image_flush (image);
}
@@ -852,7 +927,7 @@ layers_mode_cmd_callback (GtkAction *action,
index = action_select_value ((GimpActionSelectType) value,
layers_mode_index (layer_mode),
0, G_N_ELEMENTS (layer_modes) - 1,
1.0, 1.0, FALSE);
0.0, 1.0, 1.0, 0.0, FALSE);
gimp_layer_set_mode (layer, layer_modes[index], push_undo);
gimp_image_flush (image);
}
@@ -928,8 +1003,7 @@ layers_new_layer_response (GtkWidget *widget,
}
else
{
g_message ("new_layer_query_response: "
"could not allocate new layer");
g_warning ("%s: could not allocate new layer", G_STRFUNC);
}
}
@@ -981,7 +1055,8 @@ layers_add_mask_response (GtkWidget *widget,
if (dialog->add_mask_type == GIMP_ADD_CHANNEL_MASK &&
! dialog->channel)
{
g_message (_("Please select a channel first"));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("Please select a channel first"));
return;
}
@@ -1024,6 +1099,9 @@ layers_scale_layer_callback (GtkWidget *dialog,
{
GimpDisplay *display = GIMP_DISPLAY (data);
layer_scale_unit = unit;
layer_scale_interp = interpolation;
if (width > 0 && height > 0)
{
GimpItem *item = GIMP_ITEM (viewable);
@@ -1032,11 +1110,8 @@ layers_scale_layer_callback (GtkWidget *dialog,
gtk_widget_destroy (dialog);
/* remember the last used unit */
g_object_set_data (G_OBJECT (gimp_item_get_image (item)),
"scale-dialog-unit", GINT_TO_POINTER (unit));
if (width == gimp_item_width (item) && height == gimp_item_height (item))
if (width == gimp_item_width (item) &&
height == gimp_item_height (item))
return;
if (display)
@@ -1065,7 +1140,8 @@ layers_scale_layer_callback (GtkWidget *dialog,
}
else
{
g_message (_("Invalid width or height. Both must be positive."));
g_warning ("Scale Error: "
"Both width and height must be greater than zero.");
}
}
@@ -1082,28 +1158,27 @@ layers_resize_layer_callback (GtkWidget *dialog,
{
GimpContext *context = GIMP_CONTEXT (data);
layer_resize_unit = unit;
if (width > 0 && height > 0)
{
GimpItem *item = GIMP_ITEM (viewable);
gtk_widget_destroy (dialog);
/* remember the last used unit */
g_object_set_data (G_OBJECT (gimp_item_get_image (item)),
"scale-dialog-unit", GINT_TO_POINTER (unit));
if (width == gimp_item_width (item) && height == gimp_item_height (item))
if (width == gimp_item_width (item) &&
height == gimp_item_height (item))
return;
gimp_item_resize (item,
context,
gimp_item_resize (item, context,
width, height, offset_x, offset_y);
gimp_image_flush (gimp_item_get_image (item));
}
else
{
g_message (_("Invalid width or height. Both must be positive."));
g_warning ("Resize Error: "
"Both width and height must be greater than zero.");
}
}

View File

@@ -22,6 +22,8 @@
void layers_text_tool_cmd_callback (GtkAction *action,
gpointer data);
void layers_vector_tool_cmd_callback (GtkAction *action,
gpointer data);
void layers_edit_attributes_cmd_callback (GtkAction *action,
gpointer data);
void layers_new_cmd_callback (GtkAction *action,
@@ -57,6 +59,11 @@ void layers_text_to_vectors_cmd_callback (GtkAction *action,
void layers_text_along_vectors_cmd_callback (GtkAction *action,
gpointer data);
void layers_vector_fill_stroke_cmd_callback (GtkAction *action,
gpointer data);
void layers_vector_discard_cmd_callback (GtkAction *action,
gpointer data);
void layers_resize_cmd_callback (GtkAction *action,
gpointer data);
void layers_resize_to_image_cmd_callback (GtkAction *action,

View File

@@ -98,7 +98,7 @@ static const GimpEnumActionEntry palette_editor_zoom_actions[] =
{ "palette-editor-zoom-all", GTK_STOCK_ZOOM_FIT,
N_("Zoom _All"), "",
N_("Zoom all"),
GIMP_ZOOM_TO /* abused */, FALSE,
GIMP_ZOOM_OUT_MAX, FALSE,
GIMP_HELP_PALETTE_EDITOR_ZOOM_ALL }
};
@@ -131,15 +131,12 @@ palette_editor_actions_update (GimpActionGroup *group,
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (user_data);
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (user_data);
GimpContext *context;
GimpData *data;
gboolean editable = FALSE;
GimpRGB fg;
GimpRGB bg;
gboolean edit_active = FALSE;
context = gimp_get_user_context (group->gimp);
data = data_editor->data;
if (data)
@@ -148,10 +145,10 @@ palette_editor_actions_update (GimpActionGroup *group,
editable = TRUE;
}
if (context)
if (data_editor->context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
gimp_context_get_foreground (data_editor->context, &fg);
gimp_context_get_background (data_editor->context, &bg);
}
edit_active = gimp_data_editor_get_edit_active (data_editor);
@@ -169,8 +166,8 @@ palette_editor_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("palette-editor-new-color-fg", editable);
SET_SENSITIVE ("palette-editor-new-color-bg", editable);
SET_COLOR ("palette-editor-new-color-fg", context ? &fg : NULL);
SET_COLOR ("palette-editor-new-color-bg", context ? &bg : NULL);
SET_COLOR ("palette-editor-new-color-fg", data_editor->context ? &fg : NULL);
SET_COLOR ("palette-editor-new-color-bg", data_editor->context ? &bg : NULL);
SET_SENSITIVE ("palette-editor-zoom-out", data);
SET_SENSITIVE ("palette-editor-zoom-in", data);

View File

@@ -65,6 +65,7 @@ palette_editor_edit_color_cmd_callback (GtkAction *action,
{
editor->color_dialog =
gimp_color_dialog_new (GIMP_VIEWABLE (palette),
data_editor->context,
_("Edit Palette Color"),
GIMP_STOCK_PALETTE,
_("Edit Color Palette Entry"),
@@ -85,7 +86,8 @@ palette_editor_edit_color_cmd_callback (GtkAction *action,
else
{
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (editor->color_dialog),
GIMP_VIEWABLE (palette));
GIMP_VIEWABLE (palette),
data_editor->context);
gimp_color_dialog_set_color (GIMP_COLOR_DIALOG (editor->color_dialog),
&editor->color->color);
}
@@ -104,15 +106,12 @@ palette_editor_new_color_cmd_callback (GtkAction *action,
if (data_editor->data_editable)
{
GimpPalette *palette = GIMP_PALETTE (data_editor->data);
GimpContext *context;
GimpRGB color;
context = gimp_get_user_context (data_editor->data_factory->gimp);
if (value)
gimp_context_get_background (context, &color);
gimp_context_get_background (data_editor->context, &color);
else
gimp_context_get_foreground (context, &color);
gimp_context_get_foreground (data_editor->context, &color);
editor->color = gimp_palette_add_entry (palette, -1, NULL, &color);
}

View File

@@ -31,11 +31,13 @@
#include "widgets/gimpcontainertreeview.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpview.h"
#include "dialogs/palette-import-dialog.h"
#include "dialogs/dialogs.h"
#include "actions.h"
#include "palettes-commands.h"
#include "gimp-intl.h"
@@ -54,12 +56,12 @@ void
palettes_import_cmd_callback (GtkAction *action,
gpointer data)
{
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
GimpContext *context;
GtkWidget *widget;
return_if_no_widget (widget, data);
context = gimp_container_view_get_context (editor->view);
palette_import_dialog_show (context->gimp);
gimp_dialog_factory_dialog_new (global_dialog_factory,
gtk_widget_get_screen (widget),
"gimp-palette-import-dialog", -1, TRUE);
}
void
@@ -105,7 +107,9 @@ palettes_merge_callback (GtkWidget *widget,
if (! sel_list)
{
g_message ("Can't merge palettes because there are no palettes selected.");
gimp_message (gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
"Can't merge palettes because "
"there are no palettes selected.");
return;
}

View File

@@ -27,18 +27,16 @@
#include "actions-types.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "pdb/gimppluginprocedure.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/gimppluginmanager-help-domain.h"
#include "plug-in/gimppluginmanager-history.h"
#include "plug-in/gimppluginmanager-locale-domain.h"
#include "plug-in/gimppluginmanager-menu-branch.h"
#include "plug-in/gimppluginprocedure.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
@@ -69,7 +67,7 @@ static void plug_in_actions_menu_path_added (GimpPlugInProcedure *proc,
static void plug_in_actions_add_proc (GimpActionGroup *group,
GimpPlugInProcedure *proc);
static void plug_in_actions_last_changed (GimpPlugInManager *manager,
static void plug_in_actions_history_changed (GimpPlugInManager *manager,
GimpActionGroup *group);
static gboolean plug_in_actions_check_translation (const gchar *original,
const gchar *translated);
@@ -113,13 +111,13 @@ static const GimpEnumActionEntry plug_in_repeat_actions[] =
{ "plug-in-repeat", GTK_STOCK_EXECUTE,
N_("Re_peat Last"), "<control>F",
N_("Rerun the last used plug-in using the same settings"),
0, FALSE,
GIMP_RUN_WITH_LAST_VALS, FALSE,
GIMP_HELP_FILTER_REPEAT },
{ "plug-in-reshow", GIMP_STOCK_RESHOW_FILTER,
N_("R_e-Show Last"), "<control><shift>F",
N_("Show the last used plug-in dialog again"),
0, FALSE,
GIMP_RUN_INTERACTIVE, FALSE,
GIMP_HELP_FILTER_RESHOW }
};
@@ -129,7 +127,7 @@ static const GimpEnumActionEntry plug_in_repeat_actions[] =
void
plug_in_actions_setup (GimpActionGroup *group)
{
GimpEnumActionEntry *entries;
GimpPlugInActionEntry *entries;
GSList *list;
gint n_entries;
gint i;
@@ -193,25 +191,23 @@ plug_in_actions_setup (GimpActionGroup *group)
G_CALLBACK (plug_in_actions_unregister_procedure),
group, 0);
n_entries = group->gimp->config->plug_in_history_size;
n_entries = gimp_plug_in_manager_history_size (group->gimp->plug_in_manager);
entries = g_new0 (GimpEnumActionEntry, n_entries);
entries = g_new0 (GimpPlugInActionEntry, n_entries);
for (i = 0; i < n_entries; i++)
{
entries[i].name = g_strdup_printf ("plug-in-recent-%02d",
i + 1);
entries[i].stock_id = GIMP_STOCK_RESHOW_FILTER;
entries[i].name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
entries[i].stock_id = NULL;
entries[i].label = "";
entries[i].tooltip = NULL;
entries[i].value = i;
entries[i].value_variable = FALSE;
entries[i].help_id = GIMP_HELP_FILTER_RESHOW;
entries[i].accelerator = "";
entries[i].tooltip = NULL;
entries[i].procedure = NULL;
entries[i].help_id = GIMP_HELP_FILTER_RESHOW;
}
gimp_action_group_add_enum_actions (group, entries, n_entries,
G_CALLBACK (plug_in_repeat_cmd_callback));
gimp_action_group_add_plug_in_actions (group, entries, n_entries,
G_CALLBACK (plug_in_history_cmd_callback));
for (i = 0; i < n_entries; i++)
{
@@ -221,12 +217,11 @@ plug_in_actions_setup (GimpActionGroup *group)
g_free (entries);
g_signal_connect_object (group->gimp->plug_in_manager,
"last-plug-ins-changed",
G_CALLBACK (plug_in_actions_last_changed),
g_signal_connect_object (group->gimp->plug_in_manager, "history-changed",
G_CALLBACK (plug_in_actions_history_changed),
group, 0);
plug_in_actions_last_changed (group->gimp->plug_in_manager, group);
plug_in_actions_history_changed (group->gimp->plug_in_manager, group);
}
void
@@ -259,8 +254,7 @@ plug_in_actions_update (GimpActionGroup *group,
! proc->prefixes &&
! proc->magics)
{
gboolean sensitive = gimp_plug_in_procedure_get_sensitive (proc,
type);
gboolean sensitive = gimp_plug_in_procedure_get_sensitive (proc, type);
gimp_action_group_set_action_sensitive (group,
GIMP_OBJECT (proc)->name,
@@ -268,9 +262,8 @@ plug_in_actions_update (GimpActionGroup *group,
}
}
if (manager->last_plug_ins &&
gimp_plug_in_procedure_get_sensitive (manager->last_plug_ins->data,
type))
if (manager->history &&
gimp_plug_in_procedure_get_sensitive (manager->history->data, type))
{
gimp_action_group_set_action_sensitive (group, "plug-in-repeat", TRUE);
gimp_action_group_set_action_sensitive (group, "plug-in-reshow", TRUE);
@@ -281,7 +274,7 @@ plug_in_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_sensitive (group, "plug-in-reshow", FALSE);
}
for (list = manager->last_plug_ins, i = 0; list; list = list->next, i++)
for (list = manager->history, i = 0; list; list = list->next, i++)
{
GimpPlugInProcedure *proc = list->data;
gchar *name = g_strdup_printf ("plug-in-recent-%02d",
@@ -507,17 +500,18 @@ plug_in_actions_add_proc (GimpActionGroup *group,
}
static void
plug_in_actions_last_changed (GimpPlugInManager *manager,
plug_in_actions_history_changed (GimpPlugInManager *manager,
GimpActionGroup *group)
{
GSList *list;
GimpPlugInProcedure *proc;
const gchar *progname;
const gchar *domain;
gint i;
if (manager->last_plug_ins)
proc = gimp_plug_in_manager_history_nth (manager, 0);
if (proc)
{
GimpPlugInProcedure *proc = manager->last_plug_ins->data;
gchar *label;
gchar *repeat;
gchar *reshow;
@@ -547,33 +541,38 @@ plug_in_actions_last_changed (GimpPlugInManager *manager,
_("Re-Show Last"));
}
for (list = manager->last_plug_ins, i = 0; list; list = list->next, i++)
for (i = 0; i < gimp_plug_in_manager_history_length (manager); i++)
{
GtkAction *action;
GimpPlugInProcedure *proc = list->data;
gchar *name = g_strdup_printf ("plug-in-recent-%02d",
i + 1);
gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
gchar *label;
const gchar *tooltip = NULL;
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name);
g_free (name);
proc = gimp_plug_in_manager_history_nth (manager, i);
progname = gimp_plug_in_procedure_get_progname (proc);
domain = gimp_plug_in_manager_get_locale_domain (manager,
progname, NULL);
label = gimp_plug_in_procedure_get_label (proc, domain);
if (GIMP_PROCEDURE (proc)->blurb)
tooltip = dgettext (domain, GIMP_PROCEDURE (proc)->blurb);
g_object_set (action,
"label", label,
"visible", TRUE,
"procedure", proc,
"label", label,
"stock-id", gimp_plug_in_procedure_get_stock_id (proc),
"tooltip", tooltip,
NULL);
g_free (label);
}
for (; i < manager->gimp->config->plug_in_history_size; i++)
for (; i < gimp_plug_in_manager_history_size (manager); i++)
{
GtkAction *action;
gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
@@ -583,6 +582,7 @@ plug_in_actions_last_changed (GimpPlugInManager *manager,
g_object_set (action,
"visible", FALSE,
"procedure", NULL,
NULL);
}

View File

@@ -38,6 +38,7 @@
#include "plug-in/gimppluginmanager.h"
#include "plug-in/gimppluginmanager-data.h"
#include "plug-in/gimppluginmanager-history.h"
#include "pdb/gimpprocedure.h"
@@ -61,21 +62,31 @@
/* local function prototypes */
static void plug_in_procedure_execute (GimpPlugInProcedure *procedure,
Gimp *gimp,
GimpDisplay *display,
GValueArray *args,
gint n_args);
static gint plug_in_collect_data_args (GtkAction *action,
GimpObject *object,
GParamSpec **pspecs,
GValueArray *args,
gint n_args);
static gint plug_in_collect_image_args (GtkAction *action,
GimpImage *image,
GParamSpec **pspecs,
GValueArray *args,
gint n_args);
static gint plug_in_collect_item_args (GtkAction *action,
GimpImage *image,
GimpItem *item,
GParamSpec **pspecs,
GValueArray *args,
gint n_args);
static gint plug_in_collect_drawable_args (GtkAction *action,
GimpImage *image,
GParamSpec **pspecs,
GValueArray *args,
gint n_args);
static void plug_in_reset_all_response (GtkWidget *dialog,
@@ -126,6 +137,7 @@ plug_in_run_cmd_callback (GtkAction *action,
container->children_type);
n_args = plug_in_collect_data_args (action, object,
procedure->args,
args, n_args);
}
else if (GIMP_IS_IMAGE_EDITOR (data))
@@ -136,6 +148,7 @@ plug_in_run_cmd_callback (GtkAction *action,
image = gimp_image_editor_get_image (editor);
n_args = plug_in_collect_image_args (action, image,
procedure->args,
args, n_args);
}
else if (GIMP_IS_ITEM_TREE_VIEW (data))
@@ -152,48 +165,29 @@ plug_in_run_cmd_callback (GtkAction *action,
item = NULL;
n_args = plug_in_collect_item_args (action, image, item,
procedure->args,
args, n_args);
}
else
{
GimpImage *image;
display = action_data_get_display (data);
if (display)
image = display->image;
else
image = NULL;
n_args = plug_in_collect_drawable_args (action, image,
n_args = plug_in_collect_drawable_args (action,
display ?
display->image : NULL,
procedure->args,
args, n_args);
}
break;
default:
g_error ("Unknown procedure type.");
case GIMP_INTERNAL:
g_warning ("Unhandled procedure type.");
n_args = -1;
break;
}
if (n_args >= 1)
{
gimp_value_array_truncate (args, n_args);
/* run the plug-in procedure */
gimp_procedure_execute_async (procedure,
gimp, gimp_get_user_context (gimp),
GIMP_PROGRESS (display), args,
GIMP_OBJECT (display));
/* remember only "standard" plug-ins */
if (procedure->proc_type == GIMP_PLUGIN &&
procedure->num_args >= 3 &&
GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->args[1]) &&
GIMP_IS_PARAM_SPEC_DRAWABLE_ID (procedure->args[2]))
{
gimp_plug_in_manager_set_last_plug_in (gimp->plug_in_manager, proc);
}
}
plug_in_procedure_execute (proc, gimp, display, args, n_args);
g_value_array_free (args);
}
@@ -203,45 +197,61 @@ plug_in_repeat_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpProcedure *procedure;
GimpPlugInProcedure *procedure;
Gimp *gimp;
GimpDisplay *display;
GimpDrawable *drawable;
gboolean interactive = TRUE;
GimpRunMode run_mode;
return_if_no_gimp (gimp, data);
return_if_no_display (display, data);
drawable = gimp_image_active_drawable (display->image);
if (! drawable)
return;
run_mode = (GimpRunMode) value;
if (strcmp (gtk_action_get_name (action), "plug-in-repeat") == 0)
interactive = FALSE;
procedure = g_slist_nth_data (gimp->plug_in_manager->last_plug_ins, value);
procedure = gimp_plug_in_manager_history_nth (gimp->plug_in_manager, 0);
if (procedure)
{
GValueArray *args = gimp_procedure_get_arguments (procedure);
GValueArray *args;
gint n_args;
g_value_set_int (&args->values[0],
interactive ?
GIMP_RUN_INTERACTIVE : GIMP_RUN_WITH_LAST_VALS);
gimp_value_set_image (&args->values[1], display->image);
gimp_value_set_drawable (&args->values[2], drawable);
args = gimp_procedure_get_arguments (GIMP_PROCEDURE (procedure));
gimp_value_array_truncate (args, 3);
g_value_set_int (&args->values[0], run_mode);
/* run the plug-in procedure */
gimp_procedure_execute_async (procedure, gimp,
gimp_get_user_context (gimp),
GIMP_PROGRESS (display), args,
GIMP_OBJECT (display));
n_args = plug_in_collect_drawable_args (action, display->image,
GIMP_PROCEDURE (procedure)->args,
args, 1);
plug_in_procedure_execute (procedure, gimp, display, args, n_args);
g_value_array_free (args);
}
}
void
plug_in_history_cmd_callback (GtkAction *action,
GimpPlugInProcedure *procedure,
gpointer data)
{
Gimp *gimp;
GimpDisplay *display;
GValueArray *args;
gint n_args;
return_if_no_gimp (gimp, data);
return_if_no_display (display, data);
args = gimp_procedure_get_arguments (GIMP_PROCEDURE (procedure));
g_value_set_int (&args->values[0], GIMP_RUN_INTERACTIVE);
n_args = plug_in_collect_drawable_args (action, display->image,
GIMP_PROCEDURE (procedure)->args,
args, 1);
plug_in_procedure_execute (procedure, gimp, display, args, n_args);
g_value_array_free (args);
}
void
plug_in_reset_all_cmd_callback (GtkAction *action,
gpointer data)
@@ -278,14 +288,38 @@ plug_in_reset_all_cmd_callback (GtkAction *action,
/* private functions */
static void
plug_in_procedure_execute (GimpPlugInProcedure *procedure,
Gimp *gimp,
GimpDisplay *display,
GValueArray *args,
gint n_args)
{
gimp_value_array_truncate (args, n_args);
/* run the plug-in procedure */
gimp_procedure_execute_async (GIMP_PROCEDURE (procedure), gimp,
gimp_get_user_context (gimp),
GIMP_PROGRESS (display), args,
GIMP_OBJECT (display));
/* remember only image plug-ins */
if (GIMP_PROCEDURE (procedure)->num_args >= 2 &&
GIMP_IS_PARAM_SPEC_IMAGE_ID (GIMP_PROCEDURE (procedure)->args[1]))
{
gimp_plug_in_manager_history_add (gimp->plug_in_manager, procedure);
}
}
static gint
plug_in_collect_data_args (GtkAction *action,
GimpObject *object,
GParamSpec **pspecs,
GValueArray *args,
gint n_args)
{
if (args->n_values > n_args &&
G_VALUE_HOLDS_STRING (&args->values[n_args]))
GIMP_IS_PARAM_SPEC_STRING (pspecs[n_args]))
{
if (object)
{
@@ -306,11 +340,12 @@ plug_in_collect_data_args (GtkAction *action,
static gint
plug_in_collect_image_args (GtkAction *action,
GimpImage *image,
GParamSpec **pspecs,
GValueArray *args,
gint n_args)
{
if (args->n_values > n_args &&
GIMP_VALUE_HOLDS_IMAGE_ID (&args->values[n_args]))
GIMP_IS_PARAM_SPEC_IMAGE_ID (pspecs[n_args]))
{
if (image)
{
@@ -331,11 +366,12 @@ static gint
plug_in_collect_item_args (GtkAction *action,
GimpImage *image,
GimpItem *item,
GParamSpec **pspecs,
GValueArray *args,
gint n_args)
{
if (args->n_values > n_args &&
GIMP_VALUE_HOLDS_IMAGE_ID (&args->values[n_args]))
GIMP_IS_PARAM_SPEC_IMAGE_ID (pspecs[n_args]))
{
if (image)
{
@@ -343,9 +379,11 @@ plug_in_collect_item_args (GtkAction *action,
n_args++;
if (args->n_values > n_args &&
GIMP_VALUE_HOLDS_ITEM_ID (&args->values[n_args]))
GIMP_IS_PARAM_SPEC_ITEM_ID (pspecs[n_args]))
{
if (item)
if (item &&
g_type_is_a (G_TYPE_FROM_INSTANCE (item),
GIMP_PARAM_SPEC_ITEM_ID (pspecs[n_args])->item_type))
{
gimp_value_set_item (&args->values[n_args], item);
n_args++;
@@ -365,11 +403,12 @@ plug_in_collect_item_args (GtkAction *action,
static gint
plug_in_collect_drawable_args (GtkAction *action,
GimpImage *image,
GParamSpec **pspecs,
GValueArray *args,
gint n_args)
{
if (args->n_values > n_args &&
GIMP_VALUE_HOLDS_IMAGE_ID (&args->values[n_args]))
GIMP_IS_PARAM_SPEC_IMAGE_ID (pspecs[n_args]))
{
if (image)
{
@@ -377,7 +416,7 @@ plug_in_collect_drawable_args (GtkAction *action,
n_args++;
if (args->n_values > n_args &&
GIMP_VALUE_HOLDS_DRAWABLE_ID (&args->values[n_args]))
GIMP_IS_PARAM_SPEC_DRAWABLE_ID (pspecs[n_args]))
{
GimpDrawable *drawable = gimp_image_active_drawable (image);

View File

@@ -26,6 +26,9 @@ void plug_in_run_cmd_callback (GtkAction *action,
void plug_in_repeat_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void plug_in_history_cmd_callback (GtkAction *action,
GimpPlugInProcedure *proc,
gpointer data);
void plug_in_reset_all_cmd_callback (GtkAction *action,
gpointer data);

View File

@@ -97,9 +97,8 @@ quick_mask_configure_cmd_callback (GtkAction *action,
gimp_image_get_quick_mask_color (image, &color);
options = channel_options_dialog_new (image,
options = channel_options_dialog_new (image, NULL,
action_data_get_context (data),
NULL,
widget,
&color,
NULL,

View File

@@ -1,80 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpsamplepointeditor.h"
#include "sample-point-editor-actions.h"
#include "sample-point-editor-commands.h"
#include "gimp-intl.h"
static const GimpActionEntry sample_point_editor_actions[] =
{
{ "sample-point-editor-popup", GIMP_STOCK_SAMPLE_POINT,
N_("Sample Point Menu"), NULL, NULL, NULL,
GIMP_HELP_SAMPLE_POINT_DIALOG }
};
static const GimpToggleActionEntry sample_point_editor_toggle_actions[] =
{
{ "sample-point-editor-sample-merged", NULL,
N_("_Sample Merged"), "",
N_("Sample Merged"),
G_CALLBACK (sample_point_editor_sample_merged_cmd_callback),
TRUE,
GIMP_HELP_SAMPLE_POINT_SAMPLE_MERGED }
};
void
sample_point_editor_actions_setup (GimpActionGroup *group)
{
gimp_action_group_add_actions (group,
sample_point_editor_actions,
G_N_ELEMENTS (sample_point_editor_actions));
gimp_action_group_add_toggle_actions (group,
sample_point_editor_toggle_actions,
G_N_ELEMENTS (sample_point_editor_toggle_actions));
}
void
sample_point_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (data);
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
SET_ACTIVE ("sample-point-editor-sample-merged",
gimp_sample_point_editor_get_sample_merged (editor));
#undef SET_ACTIVE
}

View File

@@ -28,44 +28,44 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpsamplepointeditor.h"
#include "sample-point-editor-actions.h"
#include "sample-point-editor-commands.h"
#include "sample-points-actions.h"
#include "sample-points-commands.h"
#include "gimp-intl.h"
static const GimpActionEntry sample_point_editor_actions[] =
static const GimpActionEntry sample_points_actions[] =
{
{ "sample-point-editor-popup", GIMP_STOCK_SAMPLE_POINT,
{ "sample-points-popup", GIMP_STOCK_SAMPLE_POINT,
N_("Sample Point Menu"), NULL, NULL, NULL,
GIMP_HELP_SAMPLE_POINT_DIALOG }
};
static const GimpToggleActionEntry sample_point_editor_toggle_actions[] =
static const GimpToggleActionEntry sample_points_toggle_actions[] =
{
{ "sample-point-editor-sample-merged", NULL,
{ "sample-points-sample-merged", NULL,
N_("_Sample Merged"), "",
N_("Sample Merged"),
G_CALLBACK (sample_point_editor_sample_merged_cmd_callback),
G_CALLBACK (sample_points_sample_merged_cmd_callback),
TRUE,
GIMP_HELP_SAMPLE_POINT_SAMPLE_MERGED }
};
void
sample_point_editor_actions_setup (GimpActionGroup *group)
sample_points_actions_setup (GimpActionGroup *group)
{
gimp_action_group_add_actions (group,
sample_point_editor_actions,
G_N_ELEMENTS (sample_point_editor_actions));
sample_points_actions,
G_N_ELEMENTS (sample_points_actions));
gimp_action_group_add_toggle_actions (group,
sample_point_editor_toggle_actions,
G_N_ELEMENTS (sample_point_editor_toggle_actions));
sample_points_toggle_actions,
G_N_ELEMENTS (sample_points_toggle_actions));
}
void
sample_point_editor_actions_update (GimpActionGroup *group,
sample_points_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (data);
@@ -73,7 +73,7 @@ sample_point_editor_actions_update (GimpActionGroup *group,
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
SET_ACTIVE ("sample-point-editor-sample-merged",
SET_ACTIVE ("sample-points-sample-merged",
gimp_sample_point_editor_get_sample_merged (editor));
#undef SET_ACTIVE

View File

@@ -16,13 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __SAMPLE_POINT_EDITOR_ACIONS_H__
#define __SAMPLE_POINT_EDITOR_ACIONS_H__
#ifndef __SAMPLE_POINTS_ACIONS_H__
#define __SAMPLE_POINTS_ACIONS_H__
void sample_point_editor_actions_setup (GimpActionGroup *group);
void sample_point_editor_actions_update (GimpActionGroup *group,
void sample_points_actions_setup (GimpActionGroup *group);
void sample_points_actions_update (GimpActionGroup *group,
gpointer data);
#endif /* __SAMPLE_POINT_EDITOR_ACTIONS_H__ */
#endif /* __SAMPLE_POINTS_ACTIONS_H__ */

View File

@@ -28,7 +28,7 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpsamplepointeditor.h"
#include "sample-point-editor-commands.h"
#include "sample-points-commands.h"
#include "gimp-intl.h"
@@ -36,7 +36,7 @@
/* public functions */
void
sample_point_editor_sample_merged_cmd_callback (GtkAction *action,
sample_points_sample_merged_cmd_callback (GtkAction *action,
gpointer data)
{
GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (data);

View File

@@ -16,12 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __SAMPLE_POINT_EDITOR_COMMANDS_H__
#define __SAMPLE_POINT_EDITOR_COMMANDS_H__
#ifndef __SAMPLE_POINTS_COMMANDS_H__
#define __SAMPLE_POINTS_COMMANDS_H__
void sample_point_editor_sample_merged_cmd_callback (GtkAction *action,
void sample_points_sample_merged_cmd_callback (GtkAction *action,
gpointer data);
#endif /* __SAMPLE_POINT_EDITOR_COMMANDS_H__ */
#endif /* __SAMPLE_POINTS_COMMANDS_H__ */

View File

@@ -47,13 +47,13 @@ static const GimpActionEntry select_actions[] =
{ "select-menu", NULL, N_("_Select") },
{ "select-all", GIMP_STOCK_SELECTION_ALL,
N_("_All"), "<control>A",
N_("select|_All"), "<control>A",
N_("Select everything"),
G_CALLBACK (select_all_cmd_callback),
GIMP_HELP_SELECTION_ALL },
{ "select-none", GIMP_STOCK_SELECTION_NONE,
N_("_None"), "<control><shift>A",
N_("select|_None"), "<control><shift>A",
N_("Dismiss the selection"),
G_CALLBACK (select_none_cmd_callback),
GIMP_HELP_SELECTION_NONE },

View File

@@ -286,11 +286,13 @@ select_stroke_cmd_callback (GtkAction *action,
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to stroke to."));
return;
}
dialog = stroke_dialog_new (GIMP_ITEM (gimp_image_get_mask (image)),
action_data_get_context (data),
_("Stroke Selection"),
GIMP_STOCK_SELECTION_STROKE,
GIMP_HELP_SELECTION_STROKE,
@@ -305,20 +307,22 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
GimpImage *image;
GimpDrawable *drawable;
GimpContext *context;
GtkWidget *widget;
GimpStrokeDesc *desc;
return_if_no_image (image, data);
return_if_no_context (context, data);
return_if_no_widget (widget, data);
drawable = gimp_image_active_drawable (image);
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to stroke to."));
return;
}
context = gimp_get_user_context (image->gimp);
desc = g_object_get_data (G_OBJECT (context), "saved-stroke-desc");
desc = g_object_get_data (G_OBJECT (image->gimp), "saved-stroke-desc");
if (desc)
g_object_ref (desc);
@@ -326,7 +330,7 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
desc = gimp_stroke_desc_new (image->gimp, context);
gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
drawable, context, desc, FALSE);
drawable, context, desc, FALSE, TRUE);
g_object_unref (desc);
@@ -443,7 +447,7 @@ select_shrink_callback (GtkWidget *widget,
radius_x = radius_y = select_shrink_pixels = ROUND (size);
select_shrink_edge_lock =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
if (unit != GIMP_UNIT_PIXEL)
{

View File

@@ -117,7 +117,7 @@ templates_new_cmd_callback (GtkAction *action,
context = gimp_container_view_get_context (editor->view);
options = template_options_dialog_new (context->gimp, NULL,
options = template_options_dialog_new (NULL, context,
GTK_WIDGET (editor),
_("New Template"),
"gimp-template-new",
@@ -179,7 +179,7 @@ templates_edit_cmd_callback (GtkAction *action,
{
TemplateOptionsDialog *options;
options = template_options_dialog_new (context->gimp, template,
options = template_options_dialog_new (template, context,
GTK_WIDGET (editor),
_("Edit Template"),
"gimp-template-edit",

View File

@@ -25,8 +25,11 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "widgets/gimptexteditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpuimanager.h"
#include "widgets/gimpwidgets-utils.h"
#include "text-editor-commands.h"
@@ -134,8 +137,11 @@ text_editor_load_response (GtkWidget *dialog,
if (! gimp_text_buffer_load (buffer, filename, &error))
{
g_message (_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename), error->message);
gimp_message (editor->ui_manager->gimp, G_OBJECT (dialog),
GIMP_MESSAGE_ERROR,
_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename),
error->message);
g_clear_error (&error);
g_free (filename);
return;

View File

@@ -101,7 +101,7 @@ static const GimpStringActionEntry tools_alternative_actions[] =
GIMP_HELP_TOOL_BY_COLOR_SELECT },
{ "tools-rotate-arbitrary", GIMP_STOCK_TOOL_ROTATE,
N_("_Arbitrary Rotation..."), NULL, NULL,
N_("_Arbitrary Rotation..."), "", NULL,
"gimp-rotate-layer",
GIMP_HELP_TOOL_ROTATE }
};
@@ -140,6 +140,38 @@ static const GimpEnumActionEntry tools_color_average_radius_actions[] =
NULL },
};
static const GimpEnumActionEntry tools_paint_brush_scale_actions[] =
{
{ "tools-paint-brush-scale-set", GIMP_STOCK_TOOL_PAINTBRUSH,
"Set Brush Scale", NULL, NULL,
GIMP_ACTION_SELECT_SET, TRUE,
NULL },
{ "tools-paint-brush-scale-minimum", GIMP_STOCK_TOOL_PAINTBRUSH,
"Minumum Brush Scale", NULL, NULL,
GIMP_ACTION_SELECT_FIRST, FALSE,
NULL },
{ "tools-paint-brush-scale-maximum", GIMP_STOCK_TOOL_PAINTBRUSH,
"Maximum Brush Scale", NULL, NULL,
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "tools-paint-brush-scale-decrease", GIMP_STOCK_TOOL_PAINTBRUSH,
"Decrease Brush Scale", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "tools-paint-brush-scale-increase", GIMP_STOCK_TOOL_PAINTBRUSH,
"Increase Brush Scale", NULL, NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "tools-paint-brush-scale-decrease-skip", GIMP_STOCK_TOOL_PAINTBRUSH,
"Decrease Brush Scale More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "tools-paint-brush-scale-increase-skip", GIMP_STOCK_TOOL_PAINTBRUSH,
"Increase Brush Scale More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
};
static const GimpEnumActionEntry tools_ink_blob_size_actions[] =
{
{ "tools-ink-blob-size-set", GIMP_STOCK_TOOL_INK,
@@ -236,6 +268,59 @@ static const GimpEnumActionEntry tools_ink_blob_angle_actions[] =
NULL },
};
static const GimpEnumActionEntry tools_foreground_select_brush_size_actions[] =
{
{ "tools-foreground-select-brush-size-set",
GIMP_STOCK_TOOL_FOREGROUND_SELECT,
"Set Foreground Select Brush Size", NULL, NULL,
GIMP_ACTION_SELECT_SET, TRUE,
NULL },
{ "tools-foreground-select-brush-size-minimum",
GIMP_STOCK_TOOL_FOREGROUND_SELECT,
"Minumum Foreground Select Brush Size", NULL, NULL,
GIMP_ACTION_SELECT_FIRST, FALSE,
NULL },
{ "tools-foreground-select-brush-size-maximum",
GIMP_STOCK_TOOL_FOREGROUND_SELECT,
"Maximum Foreground Select Brush Size", NULL, NULL,
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "tools-foreground-select-brush-size-decrease",
GIMP_STOCK_TOOL_FOREGROUND_SELECT,
"Decrease Foreground Select Brush Size", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "tools-foreground-select-brush-size-increase",
GIMP_STOCK_TOOL_FOREGROUND_SELECT,
"Increase Foreground Select Brush Size", NULL, NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "tools-foreground-select-brush-size-decrease-skip",
GIMP_STOCK_TOOL_FOREGROUND_SELECT,
"Decrease Foreground Select Brush Size More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "tools-foreground-select-brush-size-increase-skip",
GIMP_STOCK_TOOL_FOREGROUND_SELECT,
"Increase Foreground Select Brush Size More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
};
static const GimpToggleActionEntry tools_rectangle_toggle_actions[] =
{
{ "tools-rectangle-toggle-fixed-aspect", GIMP_STOCK_TOOL_RECT_SELECT,
N_("Toggle Fixed-Aspect Option for Rectangle"), NULL, NULL,
G_CALLBACK (tools_rectangle_toggle_fixed_aspect),
TRUE,
NULL},
{ "tools-rectangle-toggle-fixed-center", GIMP_STOCK_TOOL_RECT_SELECT,
N_("Toggle Expand-From-Center Option for Rectangle"), NULL, NULL,
G_CALLBACK (tools_rectangle_toggle_fixed_center),
TRUE,
NULL}
};
static const GimpEnumActionEntry tools_value_1_actions[] =
{
{ "tools-value-1-set", GIMP_STOCK_TOOL_OPTIONS,
@@ -251,19 +336,19 @@ static const GimpEnumActionEntry tools_value_1_actions[] =
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "tools-value-1-decrease", GIMP_STOCK_TOOL_OPTIONS,
"Decrease Value 1", NULL, NULL,
"Decrease Value 1", "less", NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "tools-value-1-increase", GIMP_STOCK_TOOL_OPTIONS,
"Increase Value 1", NULL, NULL,
"Increase Value 1", "greater", NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "tools-value-1-decrease-skip", GIMP_STOCK_TOOL_OPTIONS,
"Decrease Value 1 More", NULL, NULL,
"Decrease Value 1 More", "<control>less", NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "tools-value-1-increase-skip", GIMP_STOCK_TOOL_OPTIONS,
"Increase Value 1 More", NULL, NULL,
"Increase Value 1 More", "<control>greater", NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
};
@@ -283,19 +368,19 @@ static const GimpEnumActionEntry tools_value_2_actions[] =
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "tools-value-2-decrease", GIMP_STOCK_TOOL_OPTIONS,
"Decrease Value 2", NULL, NULL,
"Decrease Value 2", "bracketleft", NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "tools-value-2-increase", GIMP_STOCK_TOOL_OPTIONS,
"Increase Value 2", NULL, NULL,
"Increase Value 2", "bracketright", NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "tools-value-2-decrease-skip", GIMP_STOCK_TOOL_OPTIONS,
"Decrease Value 2 More", NULL, NULL,
"Decrease Value 2 More", "<shift>bracketleft", NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "tools-value-2-increase-skip", GIMP_STOCK_TOOL_OPTIONS,
"Increase Value 2 More", NULL, NULL,
"Increase Value 2 More", "<shift>bracketright", NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
};
@@ -436,15 +521,16 @@ tools_actions_setup (GimpActionGroup *group)
"tools-by-color-select-short");
gtk_action_set_accel_path (action, "<Actions>/tools/tools-by-color-select");
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
"tools-rotate-arbitrary");
gtk_action_set_accel_path (action, "<Actions>/tools/tools-rotate");
gimp_action_group_add_enum_actions (group,
tools_color_average_radius_actions,
G_N_ELEMENTS (tools_color_average_radius_actions),
G_CALLBACK (tools_color_average_radius_cmd_callback));
gimp_action_group_add_enum_actions (group,
tools_paint_brush_scale_actions,
G_N_ELEMENTS (tools_paint_brush_scale_actions),
G_CALLBACK (tools_paint_brush_scale_cmd_callback));
gimp_action_group_add_enum_actions (group,
tools_ink_blob_size_actions,
G_N_ELEMENTS (tools_ink_blob_size_actions),
@@ -458,6 +544,15 @@ tools_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (tools_ink_blob_angle_actions),
G_CALLBACK (tools_ink_blob_angle_cmd_callback));
gimp_action_group_add_enum_actions (group,
tools_foreground_select_brush_size_actions,
G_N_ELEMENTS (tools_foreground_select_brush_size_actions),
G_CALLBACK (tools_fg_select_brush_size_cmd_callback));
gimp_action_group_add_toggle_actions (group,
tools_rectangle_toggle_actions,
G_N_ELEMENTS (tools_rectangle_toggle_actions));
gimp_action_group_add_enum_actions (group,
tools_value_1_actions,
G_N_ELEMENTS (tools_value_1_actions),

View File

@@ -36,6 +36,8 @@
#include "tools/gimp-tools.h"
#include "tools/gimpcoloroptions.h"
#include "tools/gimpforegroundselectoptions.h"
#include "tools/gimprectangleoptions.h"
#include "tools/gimpimagemaptool.h"
#include "tools/gimptoolcontrol.h"
#include "tools/tool_manager.h"
@@ -71,8 +73,7 @@ tools_select_cmd_callback (GtkAction *action,
value = "gimp-rotate-tool";
}
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (gimp->tool_info_list, value);
tool_info = gimp_get_tool_info (gimp, value);
context = gimp_get_user_context (gimp);
@@ -266,7 +267,27 @@ tools_color_average_radius_cmd_callback (GtkAction *action,
action_select_property ((GimpActionSelectType) value,
G_OBJECT (tool_info->tool_options),
"average-radius",
1.0, 10.0, FALSE);
1.0, 1.0, 10.0, FALSE);
}
}
void
tools_paint_brush_scale_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info && GIMP_IS_PAINT_OPTIONS (tool_info->tool_options))
{
action_select_property ((GimpActionSelectType) value,
G_OBJECT (tool_info->tool_options),
"brush-scale",
0.01, 0.1, 1.0, FALSE);
}
}
@@ -286,7 +307,7 @@ tools_ink_blob_size_cmd_callback (GtkAction *action,
action_select_property ((GimpActionSelectType) value,
G_OBJECT (tool_info->tool_options),
"size",
1.0, 10.0, FALSE);
1.0, 1.0, 10.0, FALSE);
}
}
@@ -306,7 +327,7 @@ tools_ink_blob_aspect_cmd_callback (GtkAction *action,
action_select_property ((GimpActionSelectType) value,
G_OBJECT (tool_info->tool_options),
"blob-aspect",
0.1, 1.0, FALSE);
1.0, 0.1, 1.0, FALSE);
}
}
@@ -326,7 +347,87 @@ tools_ink_blob_angle_cmd_callback (GtkAction *action,
action_select_property ((GimpActionSelectType) value,
G_OBJECT (tool_info->tool_options),
"blob-angle",
1.0, 15.0, TRUE);
1.0, 1.0, 15.0, TRUE);
}
}
void
tools_fg_select_brush_size_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info && GIMP_IS_FOREGROUND_SELECT_OPTIONS (tool_info->tool_options))
{
action_select_property ((GimpActionSelectType) value,
G_OBJECT (tool_info->tool_options),
"stroke-width",
1.0, 4.0, 16.0, FALSE);
}
}
void
tools_rectangle_toggle_fixed_aspect (GtkAction *action,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info)
{
GimpToolOptions *options = tool_info->tool_options;
if (GIMP_IS_RECTANGLE_OPTIONS (options))
{
GimpRectangleOptions *rectangle_options = GIMP_RECTANGLE_OPTIONS (options);
gboolean fixed_aspect;
g_object_get (rectangle_options,
"fixed-aspect", &fixed_aspect,
NULL);
g_object_set (rectangle_options,
"fixed-aspect", ! fixed_aspect,
NULL);
}
}
}
void
tools_rectangle_toggle_fixed_center (GtkAction *action,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info)
{
GimpToolOptions *options = tool_info->tool_options;
if (GIMP_IS_RECTANGLE_OPTIONS (options))
{
GimpRectangleOptions *rectangle_options = GIMP_RECTANGLE_OPTIONS (options);
gboolean fixed_center;
g_object_get (rectangle_options,
"fixed-center", &fixed_center,
NULL);
g_object_set (rectangle_options,
"fixed-center", ! fixed_center,
NULL);
}
}
}

View File

@@ -42,6 +42,10 @@ void tools_color_average_radius_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tools_paint_brush_scale_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tools_ink_blob_size_cmd_callback (GtkAction *action,
gint value,
gpointer data);
@@ -52,6 +56,15 @@ void tools_ink_blob_angle_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tools_fg_select_brush_size_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tools_rectangle_toggle_fixed_aspect (GtkAction *action,
gpointer data);
void tools_rectangle_toggle_fixed_center (GtkAction *action,
gpointer data);
void tools_value_1_cmd_callback (GtkAction *action,
gint value,
gpointer data);

View File

@@ -138,7 +138,12 @@ static const GimpActionEntry vectors_actions[] =
{ "vectors-import", GTK_STOCK_OPEN,
N_("I_mport Path..."), "", NULL,
G_CALLBACK (vectors_import_cmd_callback),
GIMP_HELP_PATH_IMPORT }
GIMP_HELP_PATH_IMPORT },
{ "vectors-to-vector-layer", NULL,
N_("Path to Vector Layer"), "", NULL,
G_CALLBACK (vectors_to_vector_layer_cmd_callback),
NULL }
};
static const GimpToggleActionEntry vectors_toggle_actions[] =
@@ -295,6 +300,8 @@ vectors_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("vectors-export", vectors);
SET_SENSITIVE ("vectors-import", image);
SET_SENSITIVE ("vectors-to-vector-layer", vectors);
SET_SENSITIVE ("vectors-visible", vectors);
SET_SENSITIVE ("vectors-linked", vectors);

View File

@@ -30,12 +30,12 @@
#include "core/gimp-utils.h"
#include "core/gimpchannel.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-merge.h"
#include "core/gimpimage-undo.h"
#include "core/gimpitemundo.h"
#include "core/gimplayer.h"
#include "core/gimpparamspecs.h"
#include "core/gimpprogress.h"
#include "core/gimpstrokedesc.h"
@@ -47,6 +47,7 @@
#include "vectors/gimpvectors.h"
#include "vectors/gimpvectors-export.h"
#include "vectors/gimpvectors-import.h"
#include "vectors/gimpvectorlayer.h"
#include "widgets/gimpaction.h"
#include "widgets/gimpclipboard.h"
@@ -107,10 +108,7 @@ vectors_vectors_tool_cmd_callback (GtkAction *action,
if (! GIMP_IS_VECTOR_TOOL (active_tool))
{
GimpToolInfo *tool_info;
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (image->gimp->tool_info_list,
GimpToolInfo *tool_info = gimp_get_tool_info (image->gimp,
"gimp-vector-tool");
if (GIMP_IS_TOOL_INFO (tool_info))
@@ -135,8 +133,8 @@ vectors_edit_attributes_cmd_callback (GtkAction *action,
return_if_no_vectors (image, vectors, data);
return_if_no_widget (widget, data);
options = vectors_options_dialog_new (image,
vectors,
options = vectors_options_dialog_new (image, vectors,
action_data_get_context (data),
widget,
gimp_object_get_name (GIMP_OBJECT (vectors)),
_("Path Attributes"),
@@ -162,8 +160,8 @@ vectors_new_cmd_callback (GtkAction *action,
return_if_no_image (image, data);
return_if_no_widget (widget, data);
options = vectors_options_dialog_new (image,
NULL,
options = vectors_options_dialog_new (image, NULL,
action_data_get_context (data),
widget,
vectors_name ? vectors_name :
_("New Path"),
@@ -285,6 +283,25 @@ vectors_merge_visible_cmd_callback (GtkAction *action,
gimp_image_flush (image);
}
void
vectors_to_vector_layer_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpVectors *vectors;
GimpVectorLayer *layer;
return_if_no_vectors (image, vectors, data);
layer = gimp_vector_layer_new (image,
vectors,
gimp_get_user_context (image->gimp));
gimp_image_add_layer(image, GIMP_LAYER(layer), -1);
gimp_vector_layer_refresh (layer);
gimp_image_flush (image);
}
void
vectors_to_selection_cmd_callback (GtkAction *action,
gint value,
@@ -300,7 +317,7 @@ vectors_to_selection_cmd_callback (GtkAction *action,
gimp_channel_select_vectors (gimp_image_get_mask (image),
_("Path to Selection"),
vectors,
op, TRUE, FALSE, 0, 0);
op, TRUE, FALSE, 0, 0, TRUE);
gimp_image_flush (image);
}
@@ -310,10 +327,12 @@ vectors_selection_to_vectors_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GtkWidget *widget;
GimpProcedure *procedure;
GValueArray *args;
GimpDisplay *display;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
if (value)
procedure = gimp_pdb_lookup_procedure (image->gimp->pdb,
@@ -324,7 +343,8 @@ vectors_selection_to_vectors_cmd_callback (GtkAction *action,
if (! procedure)
{
g_message ("Selection to path procedure lookup failed.");
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_ERROR,
"Selection to path procedure lookup failed.");
return;
}
@@ -360,11 +380,13 @@ vectors_stroke_cmd_callback (GtkAction *action,
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to stroke to."));
return;
}
dialog = stroke_dialog_new (GIMP_ITEM (vectors),
action_data_get_context (data),
_("Stroke Path"),
GIMP_STOCK_PATH_STROKE,
GIMP_HELP_PATH_STROKE,
@@ -380,27 +402,30 @@ vectors_stroke_last_vals_cmd_callback (GtkAction *action,
GimpVectors *vectors;
GimpDrawable *drawable;
GimpContext *context;
GtkWidget *widget;
GimpStrokeDesc *desc;
return_if_no_vectors (image, vectors, data);
return_if_no_context (context, data);
return_if_no_widget (widget, data);
drawable = gimp_image_active_drawable (image);
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to stroke to."));
return;
}
context = gimp_get_user_context (image->gimp);
desc = g_object_get_data (G_OBJECT (context), "saved-stroke-desc");
desc = g_object_get_data (G_OBJECT (image->gimp), "saved-stroke-desc");
if (desc)
g_object_ref (desc);
else
desc = gimp_stroke_desc_new (image->gimp, context);
gimp_item_stroke (GIMP_ITEM (vectors), drawable, context, desc, FALSE);
gimp_item_stroke (GIMP_ITEM (vectors), drawable, context, desc, FALSE, TRUE);
g_object_unref (desc);
@@ -430,9 +455,11 @@ vectors_paste_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GtkWidget *widget;
gchar *svg;
gsize svg_size;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
svg = gimp_clipboard_get_svg (image->gimp, &svg_size);
@@ -441,9 +468,10 @@ vectors_paste_cmd_callback (GtkAction *action,
GError *error = NULL;
if (! gimp_vectors_import_buffer (image, svg, svg_size,
TRUE, TRUE, -1, &error))
TRUE, TRUE, -1, NULL, &error))
{
g_message (error->message);
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_ERROR,
"%s", error->message);
g_clear_error (&error);
}
else
@@ -618,14 +646,17 @@ vectors_import_response (GtkWidget *widget,
if (gimp_vectors_import_file (dialog->image, filename,
vectors_import_merge, vectors_import_scale,
-1, &error))
-1, NULL, &error))
{
gimp_image_flush (dialog->image);
}
else
{
g_message (error->message);
gimp_message (dialog->image->gimp, G_OBJECT (widget),
GIMP_MESSAGE_ERROR,
"%s", error->message);
g_error_free (error);
return;
}
g_free (filename);
@@ -654,8 +685,11 @@ vectors_export_response (GtkWidget *widget,
if (! gimp_vectors_export_file (dialog->image, vectors, filename, &error))
{
g_message (error->message);
gimp_message (dialog->image->gimp, G_OBJECT (widget),
GIMP_MESSAGE_ERROR,
"%s", error->message);
g_error_free (error);
return;
}
g_free (filename);

View File

@@ -44,6 +44,8 @@ void vectors_delete_cmd_callback (GtkAction *action,
gpointer data);
void vectors_merge_visible_cmd_callback (GtkAction *action,
gpointer data);
void vectors_to_vector_layer_cmd_callback (GtkAction *action,
gpointer data);
void vectors_to_selection_cmd_callback (GtkAction *action,
gint value,
gpointer data);

View File

@@ -513,10 +513,6 @@ view_actions_update (GimpActionGroup *group,
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
#define SET_VISIBLE(action,condition) \
gimp_action_group_set_action_visible (group, action, (condition) != 0)
#define SET_LABEL(action,label) \
gimp_action_group_set_action_label (group, action, (label))
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
@@ -600,8 +596,6 @@ view_actions_update (GimpActionGroup *group,
}
#undef SET_ACTIVE
#undef SET_VISIBLE
#undef SET_LABEL
#undef SET_SENSITIVE
#undef SET_COLOR
}

View File

@@ -152,7 +152,7 @@ view_zoom_cmd_callback (GtkAction *action,
scale = action_select_value ((GimpActionSelectType) value,
scale,
0.0, 512.0,
1.0, 16.0,
1.0 / 8.0, 1.0, 16.0, 0.0,
FALSE);
/* min = 1.0 / 256, max = 256.0 */
@@ -249,8 +249,10 @@ view_scroll_horizontal_cmd_callback (GtkAction *action,
shell->hsbdata->lower,
shell->hsbdata->upper -
shell->hsbdata->page_size,
1,
shell->hsbdata->step_increment,
shell->hsbdata->page_increment,
0,
FALSE);
gtk_adjustment_set_value (shell->hsbdata, offset);
}
@@ -272,8 +274,10 @@ view_scroll_vertical_cmd_callback (GtkAction *action,
shell->vsbdata->lower,
shell->vsbdata->upper -
shell->vsbdata->page_size,
1,
shell->vsbdata->step_increment,
shell->vsbdata->page_increment,
0,
FALSE);
gtk_adjustment_set_value (shell->vsbdata, offset);
}
@@ -565,7 +569,9 @@ view_padding_color_cmd_callback (GtkAction *action,
if (! color_dialog)
{
color_dialog = gimp_color_dialog_new (GIMP_VIEWABLE (display->image),
color_dialog =
gimp_color_dialog_new (GIMP_VIEWABLE (display->image),
action_data_get_context (data),
_("Set Canvas Padding Color"),
GTK_STOCK_SELECT_COLOR,
_("Set Custom Canvas Padding Color"),

View File

@@ -159,6 +159,7 @@ app_run (const gchar *full_prog_name,
gboolean use_shm,
gboolean use_cpu_accel,
gboolean console_messages,
gboolean use_debug_handler,
GimpStackTraceMode stack_trace_mode,
GimpPDBCompatMode pdb_compat_mode)
{
@@ -169,30 +170,6 @@ app_run (const gchar *full_prog_name,
gboolean swap_is_ok;
gint i;
const gchar *log_domains[] =
{
"Gimp",
"Gimp-Actions",
"Gimp-Base",
"Gimp-Composite",
"Gimp-Config",
"Gimp-Core",
"Gimp-Dialogs",
"Gimp-Display",
"Gimp-File",
"Gimp-GUI",
"Gimp-Menus",
"Gimp-PDB",
"Gimp-Paint",
"Gimp-Paint-Funcs",
"Gimp-Plug-In",
"Gimp-Text",
"Gimp-Tools",
"Gimp-Vectors",
"Gimp-Widgets",
"Gimp-XCF"
};
/* Create an instance of the "Gimp" object which is the root of the
* core object system
*/
@@ -207,14 +184,7 @@ app_run (const gchar *full_prog_name,
stack_trace_mode,
pdb_compat_mode);
for (i = 0; i < G_N_ELEMENTS (log_domains); i++)
g_log_set_handler (log_domains[i],
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func, &gimp);
g_log_set_handler (NULL,
G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL,
gimp_error_log_func, &gimp);
errors_init (gimp, full_prog_name, use_debug_handler, stack_trace_mode);
units_init (gimp);

View File

@@ -46,6 +46,7 @@ void app_run (const gchar *full_prog_name,
gboolean use_shm,
gboolean use_cpu_accel,
gboolean console_messages,
gboolean use_debug_handler,
GimpStackTraceMode stack_trace_mode,
GimpPDBCompatMode pdb_compat_mode);

View File

@@ -100,6 +100,9 @@ gimp_layer_mode_effects_get_type (void)
{ GIMP_GRAIN_EXTRACT_MODE, "GIMP_GRAIN_EXTRACT_MODE", "grain-extract-mode" },
{ GIMP_GRAIN_MERGE_MODE, "GIMP_GRAIN_MERGE_MODE", "grain-merge-mode" },
{ GIMP_COLOR_ERASE_MODE, "GIMP_COLOR_ERASE_MODE", "color-erase-mode" },
{ GIMP_ERASE_MODE, "GIMP_ERASE_MODE", "erase-mode" },
{ GIMP_REPLACE_MODE, "GIMP_REPLACE_MODE", "replace-mode" },
{ GIMP_ANTI_ERASE_MODE, "GIMP_ANTI_ERASE_MODE", "anti-erase-mode" },
{ 0, NULL, NULL }
};
@@ -128,6 +131,9 @@ gimp_layer_mode_effects_get_type (void)
{ GIMP_GRAIN_EXTRACT_MODE, N_("Grain extract"), NULL },
{ GIMP_GRAIN_MERGE_MODE, N_("Grain merge"), NULL },
{ GIMP_COLOR_ERASE_MODE, N_("Color erase"), NULL },
{ GIMP_ERASE_MODE, N_("Erase"), NULL },
{ GIMP_REPLACE_MODE, N_("Replace"), NULL },
{ GIMP_ANTI_ERASE_MODE, N_("Anti erase"), NULL },
{ 0, NULL, NULL }
};

View File

@@ -90,9 +90,9 @@ typedef enum
GIMP_GRAIN_EXTRACT_MODE, /*< desc="Grain extract" >*/
GIMP_GRAIN_MERGE_MODE, /*< desc="Grain merge" >*/
GIMP_COLOR_ERASE_MODE, /*< desc="Color erase" >*/
GIMP_ERASE_MODE, /*< pdb-skip, skip >*/
GIMP_REPLACE_MODE, /*< pdb-skip, skip >*/
GIMP_ANTI_ERASE_MODE /*< pdb-skip, skip >*/
GIMP_ERASE_MODE, /*< pdb-skip, desc="Erase" >*/
GIMP_REPLACE_MODE, /*< pdb-skip, desc="Replace" >*/
GIMP_ANTI_ERASE_MODE /*< pdb-skip, desc="Anti erase" >*/
} GimpLayerModeEffects;

View File

@@ -163,7 +163,7 @@ base_toast_old_swap_files (const gchar *swap_path)
}
while ((entry = g_dir_read_name (dir)) != NULL)
if (! strncmp (entry, "gimpswap.", 9))
if (g_str_has_prefix (entry, "gimpswap."))
{
/* don't try to kill swap files of running processes
* yes, I know they might not all be gimp processes, and when you

View File

@@ -212,13 +212,16 @@ color_balance_transfer_init (void)
for (i = 0; i < 256; i++)
{
highlights_add[i] =
shadows_sub[255 - i] = (1.075 - 1 / ((gdouble) i / 16.0 + 1));
gdouble low = (1.075 - 1 / ((gdouble) i / 16.0 + 1));
gdouble mid = 0.667 * (1 - SQR (((gdouble) i - 127.0) / 127.0));
midtones_add[i] =
midtones_sub[i] = 0.667 * (1 - SQR (((gdouble) i - 127.0) / 127.0));
shadows_add[i] = low;
shadows_sub[255 - i] = low;
shadows_add[i] =
highlights_sub[i] = 0.667 * (1 - SQR (((gdouble) i - 127.0) / 127.0));
midtones_add[i] = mid;
midtones_sub[i] = mid;
highlights_add[255 - i] = low;
highlights_sub[i] = low;
}
}

View File

@@ -112,7 +112,7 @@ do_parallel_regions (PixelProcessor *processor)
g_mutex_unlock (processor->mutex);
switch(processor->num_regions)
switch (processor->num_regions)
{
case 1:
((p1_func) processor->func) (processor->data,

View File

@@ -135,24 +135,6 @@ pixel_region_resize (PixelRegion *PR,
PR->h = h;
}
/* request that tiles within a region be fetched asynchronously */
void
pixel_region_get_async (PixelRegion *PR,
gint ulx,
gint uly,
gint lrx,
gint lry)
{
gint x;
gint y;
for (y = uly; y < lry; y += TILE_HEIGHT)
for (x = ulx; x < lrx; x += TILE_WIDTH)
tile_manager_get_async (PR->tiles, x, y);
}
void
pixel_region_get_row (PixelRegion *PR,
gint x,
@@ -172,14 +154,12 @@ pixel_region_get_row (PixelRegion *PR,
end = x + w;
pixel_region_get_async (PR, x, y, end, y);
bpp = tile_manager_bpp (PR->tiles);
inc = subsample * bpp;
if (subsample == 1)
{
read_pixel_data (PR->tiles, x, y, end-1, y, data, bpp);
read_pixel_data (PR->tiles, x, y, end - 1, y, data, bpp);
}
else
{
@@ -212,15 +192,10 @@ pixel_region_set_row (PixelRegion *PR,
gint w,
const guchar *data)
{
gint end;
gint bpp;
gint end = x + w;
gint bpp = tile_manager_bpp (PR->tiles);
end = x + w;
bpp = tile_manager_bpp (PR->tiles);
pixel_region_get_async (PR, x, y, end, y);
write_pixel_data (PR->tiles, x, y, end-1, y, data, bpp);
write_pixel_data (PR->tiles, x, y, end - 1, y, data, bpp);
}
@@ -241,9 +216,6 @@ pixel_region_get_col (PixelRegion *PR,
gint b;
end = y + h;
pixel_region_get_async (PR, x, y, x, end);
bpp = tile_manager_bpp (PR->tiles);
while (y < end)
@@ -277,14 +249,8 @@ pixel_region_set_col (PixelRegion *PR,
gint h,
const guchar *data)
{
gint bpp;
gint end;
end = y + h;
pixel_region_get_async (PR, x, y, x, end);
bpp = tile_manager_bpp (PR->tiles);
gint end = y + h;
gint bpp = tile_manager_bpp (PR->tiles);
write_pixel_data (PR->tiles, x, y, x, end-1, data, bpp);
}
@@ -315,6 +281,7 @@ pixel_regions_register (gint num_regions,
va_start (ap, num_regions);
found = FALSE;
while (num_regions --)
{
PixelRegionHolder *PRH;
@@ -336,9 +303,10 @@ pixel_regions_register (gint num_regions,
PRH->starty = PR->y;
PRH->PR->process_count = 0;
if (!found)
if (! found)
{
found = TRUE;
PRI->region_width = PR->w;
PRI->region_height = PR->h;
}
@@ -536,8 +504,7 @@ pixel_regions_configure (PixelRegionIterator *PRI)
PRI->portion_width = get_portion_width (PRI);
PRI->portion_height = get_portion_height (PRI);
if (PRI->portion_width == 0 ||
PRI->portion_height == 0)
if (PRI->portion_width == 0 || PRI->portion_height == 0)
{
/* free the pixel regions list */
if (PRI->pixel_regions)

View File

@@ -86,11 +86,6 @@ void pixel_region_resize (PixelRegion *PR,
gint y,
gint w,
gint h);
void pixel_region_get_async (PixelRegion *PR,
gint ulx,
gint uly,
gint lrx,
gint lry);
void pixel_region_get_row (PixelRegion *PR,
gint x,
gint y,

View File

@@ -39,6 +39,7 @@
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmath/gimpmath.h"
#include "base-types.h"
@@ -1095,10 +1096,9 @@ siox_foreground_extract (SioxState *state,
siox_progress_update (progress_callback, progress_data, 0.5);
/* Reduce the working area to the region of interest */
x = x1;
y = y1;
width = x2 - x1;
height = y2 - y1;
gimp_rectangle_intersect (x1, y1, x2 - x1, y2 - y1,
x, y, width, height,
&x, &y, &width, &height);
/* Classify - the cached way....Better: Tree traversation? */

View File

@@ -28,22 +28,13 @@
#include "tile-private.h"
/* This is the percentage of the maximum cache size that should be cleared
* from the cache when an eviction is necessary
*/
#define FREE_QUANTUM 0.1
#define IDLE_SWAPPER_TIMEOUT 250
static gboolean tile_cache_zorch_next (void);
static void tile_cache_flush_internal (Tile *tile);
#ifdef ENABLE_THREADED_TILE_SWAPPER
static gpointer tile_idle_thread (gpointer data);
#else
static gboolean tile_idle_preswap (gpointer data);
#endif
static gboolean initialize = TRUE;
@@ -60,19 +51,21 @@ static gulong max_cache_size = 0;
static gulong cur_cache_dirty = 0;
static TileList clean_list = { NULL, NULL };
static TileList dirty_list = { NULL, NULL };
#ifdef ENABLE_THREADED_TILE_SWAPPER
static GThread *preswap_thread = NULL;
static GMutex *dirty_mutex = NULL;
static GCond *dirty_signal = NULL;
static GStaticMutex tile_mutex = G_STATIC_MUTEX_INIT;
#define CACHE_LOCK g_static_mutex_lock (&tile_mutex)
#define CACHE_UNLOCK g_static_mutex_unlock (&tile_mutex)
#else
static guint idle_swapper = 0;
#ifdef ENABLE_MP
static GStaticMutex tile_cache_mutex = G_STATIC_MUTEX_INIT;
#define CACHE_LOCK g_static_mutex_lock (&tile_cache_mutex)
#define CACHE_UNLOCK g_static_mutex_unlock (&tile_cache_mutex)
#else
#define CACHE_LOCK /* nothing */
#define CACHE_UNLOCK /* nothing */
#endif
@@ -87,23 +80,18 @@ tile_cache_init (gulong tile_cache_size)
dirty_list.first = dirty_list.last = NULL;
max_cache_size = tile_cache_size;
#ifdef ENABLE_THREADED_TILE_SWAPPER
dirty_mutex = g_mutex_new ();
dirty_signal = g_cond_new ();
preswap_thread = g_thread_create (&tile_idle_thread, NULL, FALSE, NULL);
#else
idle_swapper = g_timeout_add (IDLE_SWAPPER_TIMEOUT,
tile_idle_preswap,
NULL);
#endif
}
}
void
tile_cache_exit (void)
{
if (idle_swapper)
{
g_source_remove (idle_swapper);
idle_swapper = 0;
}
tile_cache_set_size (0);
}
@@ -193,11 +181,14 @@ tile_cache_insert (Tile *tile)
{
cur_cache_dirty += tile->size;
#ifdef ENABLE_THREADED_TILE_SWAPPER
g_mutex_lock (dirty_mutex);
g_cond_signal (dirty_signal);
g_mutex_unlock (dirty_mutex);
#endif
if (! idle_swapper &&
cur_cache_dirty * 2 > max_cache_size)
{
idle_swapper = g_timeout_add_full (G_PRIORITY_LOW,
IDLE_SWAPPER_TIMEOUT,
tile_idle_preswap,
NULL, NULL);
}
}
out:
@@ -255,7 +246,7 @@ tile_cache_set_size (gulong cache_size)
while (cur_cache_size > max_cache_size)
{
if (!tile_cache_zorch_next ())
if (! tile_cache_zorch_next ())
break;
}
@@ -275,10 +266,6 @@ tile_cache_zorch_next (void)
else
return FALSE;
CACHE_UNLOCK;
TILE_MUTEX_LOCK (tile);
CACHE_LOCK;
tile_cache_flush_internal (tile);
if (tile->dirty || tile->swap_offset == -1)
@@ -290,110 +277,26 @@ tile_cache_zorch_next (void)
{
g_free (tile->data);
tile->data = NULL;
TILE_MUTEX_UNLOCK (tile);
return TRUE;
}
/* unable to swap out tile for some reason */
TILE_MUTEX_UNLOCK (tile);
return FALSE;
}
#ifdef ENABLE_THREADED_TILE_SWAPPER
static gpointer
tile_idle_thread (gpointer data)
{
Tile *tile;
TileList *list;
gint count;
g_printerr ("starting tile preswapper thread\n");
count = 0;
while (TRUE)
{
CACHE_LOCK;
if (count > 5 || dirty_list.first == NULL)
{
CACHE_UNLOCK;
count = 0;
g_mutex_lock (dirty_mutex);
g_cond_wait (dirty_signal, dirty_mutex);
g_mutex_unlock (dirty_mutex);
CACHE_LOCK;
}
if ((tile = dirty_list.first))
{
CACHE_UNLOCK;
TILE_MUTEX_LOCK (tile);
CACHE_LOCK;
if (tile->dirty || tile->swap_offset == -1)
{
list = tile->listhead;
if (list == &dirty_list)
cur_cache_dirty -= tile->size;
if (tile->next)
tile->next->prev = tile->prev;
else
list->last = tile->prev;
if (tile->prev)
tile->prev->next = tile->next;
else
list->first = tile->next;
tile->next = NULL;
tile->prev = clean_list.last;
tile->listhead = &clean_list;
if (clean_list.last)
clean_list.last->next = tile;
else
clean_list.first = tile;
clean_list.last = tile;
CACHE_UNLOCK;
tile_swap_out (tile);
}
else
{
CACHE_UNLOCK;
}
TILE_MUTEX_UNLOCK (tile);
}
else
{
CACHE_UNLOCK;
}
count++;
}
}
#else /* !ENABLE_THREADED_TILE_SWAPPER */
static gboolean
tile_idle_preswap (gpointer data)
{
Tile *tile;
if (cur_cache_dirty * 2 < max_cache_size)
return TRUE;
{
idle_swapper = 0;
return FALSE;
}
CACHE_LOCK;
if ((tile = dirty_list.first))
{
@@ -419,7 +322,7 @@ tile_idle_preswap (gpointer data)
cur_cache_dirty -= tile->size;
}
CACHE_UNLOCK;
return TRUE;
}
#endif /* !ENABLE_THREADED_TILE_SWAPPER */

View File

@@ -22,10 +22,11 @@
#include "base-types.h"
#include "paint-funcs/paint-funcs.h"
#include "pixel-region.h"
#include "tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "tile-manager-crop.h"
/* Crop the buffer to the size of pixels with non-zero transparency */

View File

@@ -96,10 +96,7 @@ tile_manager_unref (TileManager *tm)
gint i;
for (i = 0; i < ntiles; i++)
{
TILE_MUTEX_LOCK (tm->tiles[i]);
tile_detach (tm->tiles[i], tm, i);
}
g_free (tm->tiles);
}
@@ -198,8 +195,6 @@ tile_manager_get (TileManager *tm,
if (wantread)
{
TILE_MUTEX_LOCK (*tile_ptr);
if (wantwrite)
{
if ((*tile_ptr)->share_count > 1)
@@ -234,8 +229,6 @@ tile_manager_get (TileManager *tm,
tile_detach (*tile_ptr, tm, tile_num);
TILE_MUTEX_LOCK (new);
tile_attach (new, tm, tile_num);
*tile_ptr = new;
}
@@ -252,30 +245,12 @@ tile_manager_get (TileManager *tm,
}
#endif
TILE_MUTEX_UNLOCK (*tile_ptr);
tile_lock (*tile_ptr);
}
return *tile_ptr;
}
void
tile_manager_get_async (TileManager *tm,
gint xpixel,
gint ypixel)
{
gint num;
g_return_if_fail (tm != NULL);
num = tile_manager_get_tile_num (tm, xpixel, ypixel);
if (num < 0)
return;
tile_swap_in_async (tm->tiles[num]);
}
void
tile_manager_validate (TileManager *tm,
Tile *tile)
@@ -350,10 +325,8 @@ tile_invalidate (Tile **tile_ptr,
g_return_if_fail (tile_ptr != NULL);
g_return_if_fail (tm != NULL);
TILE_MUTEX_LOCK (tile);
if (! tile->valid)
goto leave;
return;
if (G_UNLIKELY (tile->share_count > 1))
{
@@ -370,8 +343,6 @@ tile_invalidate (Tile **tile_ptr,
tile_detach (tile, tm, tile_num);
TILE_MUTEX_LOCK (new);
tile_attach (new, tm, tile_num);
tile = *tile_ptr = new;
}
@@ -394,9 +365,6 @@ tile_invalidate (Tile **tile_ptr,
*/
tile_swap_delete (tile);
}
leave:
TILE_MUTEX_UNLOCK (tile);
}
void
@@ -492,8 +460,6 @@ tile_manager_map (TileManager *tm,
if (G_UNLIKELY (! srctile->valid))
g_warning("%s: srctile not validated yet! please report", G_GNUC_FUNCTION);
TILE_MUTEX_LOCK (*tile_ptr);
if (G_UNLIKELY ((*tile_ptr)->ewidth != srctile->ewidth ||
(*tile_ptr)->eheight != srctile->eheight ||
(*tile_ptr)->bpp != srctile->bpp))
@@ -508,8 +474,6 @@ tile_manager_map (TileManager *tm,
g_printerr (">");
#endif
TILE_MUTEX_LOCK (srctile);
#ifdef DEBUG_TILE_MANAGER
g_printerr (" [src:%p tm:%p tn:%d] ", srctile, tm, tile_num);
#endif
@@ -517,8 +481,6 @@ tile_manager_map (TileManager *tm,
tile_attach (srctile, tm, tile_num);
*tile_ptr = srctile;
TILE_MUTEX_UNLOCK (srctile);
#ifdef DEBUG_TILE_MANAGER
g_printerr ("}\n");
#endif
@@ -866,9 +828,7 @@ read_pixel_data_1 (TileManager *tm,
switch (tm->bpp)
{
case 4:
*(guint32 *) buffer = *(const guint32 *) src;
break;
*buffer++ = *src++;
case 3:
*buffer++ = *src++;
case 2:
@@ -886,18 +846,13 @@ write_pixel_data_1 (TileManager *tm,
gint y,
const guchar *buffer)
{
Tile *tile;
guchar *dest;
tile = tile_manager_get_tile (tm, x, y, TRUE, TRUE);
dest = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
Tile *tile = tile_manager_get_tile (tm, x, y, TRUE, TRUE);
guchar *dest = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
switch (tm->bpp)
{
case 4:
*(guint32 *) dest = *(const guint32 *) buffer;
break;
*dest++ = *buffer++;
case 3:
*dest++ = *buffer++;
case 2:

View File

@@ -69,14 +69,6 @@ Tile * tile_manager_get (TileManager *tm,
gint wantread,
gint wantwrite);
/* Request that (if possible) the tile at x,y be swapped in. This is
* only a hint to improve performance; no guarantees. The tile may be
* swapped in or otherwise made more accessible if it is convenient...
*/
void tile_manager_get_async (TileManager *tm,
gint xpixel,
gint ypixel);
void tile_manager_map_tile (TileManager *tm,
gint xpixel,
gint ypixel,

View File

@@ -79,20 +79,7 @@ struct _Tile
Tile *next;
Tile *prev; /* List pointers for the tile cache lists */
gpointer listhead; /* Pointer to the head of the list this tile is on */
#ifdef ENABLE_THREADED_TILE_SWAPPER
GMutex *mutex;
#endif
};
#ifdef ENABLE_THREADED_TILE_SWAPPER
#define TILE_MUTEX_LOCK(tile) g_mutex_lock((tile)->mutex)
#define TILE_MUTEX_UNLOCK(tile) g_mutex_unlock((tile)->mutex)
#else
#define TILE_MUTEX_LOCK(tile) /* nothing */
#define TILE_MUTEX_UNLOCK(tile) /* nothing */
#endif
#endif /* __TILE_PRIVATE_H__ */

View File

@@ -99,14 +99,11 @@ static void tile_swap_open (SwapFile *swap_file);
static gint tile_swap_default (gint fd,
Tile *tile,
gint cmd,
SwapCommand cmd,
gpointer user_data);
static void tile_swap_default_in (DefSwapFile *def_swap_file,
gint fd,
Tile *tile);
static void tile_swap_default_in_async (DefSwapFile *def_swap_file,
gint fd,
Tile *tile);
static void tile_swap_default_out (DefSwapFile *def_swap_file,
gint fd,
Tile *tile);
@@ -122,9 +119,6 @@ static void tile_swap_resize (DefSwapFile *def_swap_file,
static Gap * tile_swap_gap_new (off_t start,
off_t end);
static void tile_swap_gap_destroy (Gap *gap);
#ifdef ENABLE_THREADED_TILE_SWAPPER
static gpointer tile_swap_in_thread (gpointer);
#endif
static gboolean initialized = FALSE;
@@ -134,17 +128,6 @@ static gint nopen_swap_files = 0;
static gint next_swap_num = 1;
static const off_t swap_file_grow = 1024 * TILE_WIDTH * TILE_HEIGHT * 4;
#ifdef ENABLE_THREADED_TILE_SWAPPER
static GStaticMutex swapfile_mutex = G_STATIC_MUTEX_INIT;
/* async_swapin_mutex protects only the list, not the tiles therein */
static GThread * swapin_thread = NULL;
static GMutex * async_swapin_mutex = NULL;
static GCond * async_swapin_signal = NULL;
static GSList * async_swapin_tiles = NULL;
static GSList * async_swapin_tiles_end = NULL;
#endif
static gboolean seek_err_msg = TRUE;
static gboolean read_err_msg = TRUE;
static gboolean write_err_msg = TRUE;
@@ -241,13 +224,6 @@ tile_swap_init (const gchar *path)
tile_swap_add (swappath, NULL, NULL);
g_free (swappath);
#ifdef ENABLE_THREADED_TILE_SWAPPER
async_swapin_signal = g_cond_new ();
async_swapin_mutex = g_mutex_new ();
swapin_thread = g_thread_create (tile_swap_in_thread, NULL, FALSE, NULL);
#endif
}
void
@@ -274,10 +250,6 @@ tile_swap_add (gchar *filename,
SwapFile *swap_file;
DefSwapFile *def_swap_file;
#ifdef ENABLE_THREADED_TILE_SWAPPER
g_static_mutex_lock (&swapfile_mutex);
#endif
g_return_val_if_fail (initialized, -1);
swap_file = g_new (SwapFile, 1);
@@ -302,10 +274,6 @@ tile_swap_add (gchar *filename,
g_hash_table_insert (swap_files, &swap_file->swap_num, swap_file);
#ifdef ENABLE_THREADED_TILE_SWAPPER
g_static_mutex_unlock (&swapfile_mutex);
#endif
return swap_file->swap_num;
}
@@ -314,15 +282,11 @@ tile_swap_remove (gint swap_num)
{
SwapFile *swap_file;
#ifdef ENABLE_THREADED_TILE_SWAPPER
g_static_mutex_lock (&swapfile_mutex);
#endif
g_return_if_fail (initialized);
swap_file = g_hash_table_lookup (swap_files, &swap_num);
if (!swap_file)
goto out;
return;
g_hash_table_remove (swap_files, &swap_num);
@@ -330,22 +294,6 @@ tile_swap_remove (gint swap_num)
close (swap_file->fd);
g_free (swap_file);
out:
#ifdef ENABLE_THREADED_TILE_SWAPPER
g_static_mutex_unlock (&swapfile_mutex);
#endif
return;
}
void
tile_swap_in_async (Tile *tile)
{
if (tile->swap_offset == -1)
return;
tile_swap_command (tile, SWAP_IN_ASYNC);
}
void
@@ -372,12 +320,6 @@ tile_swap_delete (Tile *tile)
tile_swap_command (tile, SWAP_DELETE);
}
void
tile_swap_compress (gint swap_num)
{
tile_swap_command (NULL, SWAP_COMPRESS);
}
/* check if we can open a swap file */
gboolean
tile_swap_test (void)
@@ -426,18 +368,15 @@ tile_swap_command (Tile *tile,
{
SwapFile *swap_file;
#ifdef ENABLE_THREADED_TILE_SWAPPER
g_static_mutex_lock (&swapfile_mutex);
#endif
g_return_if_fail (initialized);
do {
do
{
swap_file = g_hash_table_lookup (swap_files, &tile->swap_num);
if (!swap_file)
{
g_warning ("could not find swap file for tile");
goto out;
return;
}
if (swap_file->fd == -1)
@@ -445,18 +384,11 @@ tile_swap_command (Tile *tile,
tile_swap_open (swap_file);
if (swap_file->fd == -1)
goto out;
return;
}
}
while ((* swap_file->swap_func) (swap_file->fd,
tile, command, swap_file->user_data));
out:
#ifdef ENABLE_THREADED_TILE_SWAPPER
g_static_mutex_unlock (&swapfile_mutex);
#endif
return;
}
static void
@@ -509,95 +441,37 @@ tile_swap_open (SwapFile *swap_file)
static int
tile_swap_default (gint fd,
Tile *tile,
gint cmd,
SwapCommand cmd,
gpointer user_data)
{
DefSwapFile *def_swap_file;
def_swap_file = (DefSwapFile*) user_data;
DefSwapFile *def_swap_file = (DefSwapFile*) user_data;
switch (cmd)
{
case SWAP_IN:
tile_swap_default_in (def_swap_file, fd, tile);
break;
case SWAP_IN_ASYNC:
tile_swap_default_in_async (def_swap_file, fd, tile);
break;
case SWAP_OUT:
tile_swap_default_out (def_swap_file, fd, tile);
break;
case SWAP_DELETE:
tile_swap_default_delete (def_swap_file, fd, tile);
break;
case SWAP_COMPRESS:
g_warning ("tile_swap_default: SWAP_COMPRESS: UNFINISHED");
break;
}
return FALSE;
}
static void
tile_swap_default_in_async (DefSwapFile *def_swap_file,
gint fd,
Tile *tile)
{
#ifdef ENABLE_THREADED_TILE_SWAPPER
AsyncSwapArgs *args = g_new (AsyncSwapArgs, 1);
args->def_swap_file = def_swap_file;
args->fd = fd;
args->tile = tile;
/* add this tile to the list of tiles for the async swapin task */
g_mutex_lock (async_swapin_mutex);
g_slist_append (async_swapin_tiles_end, args);
if (! async_swapin_tiles)
async_swapin_tiles = async_swapin_tiles_end;
g_cond_broadcast (async_swapin_signal);
g_mutex_unlock (async_swapin_mutex);
#else
/* ignore; it's only a hint anyway */
/* this could be changed to call out to another program that
* tries to make the OS read the data in from disk.
*/
#endif
return;
}
/* NOTE: if you change this function, check to see if your changes
* apply to tile_swap_in_attempt() near the end of the file. The
* difference is that this version makes guarantees about what it
* provides, but tile_swap_in_attempt() just tries and gives up if
* anything goes wrong.
*
* I'm not sure that it is worthwhile to try to pull out common
* bits; I think the two functions are (at least for now) different
* enough to keep as two functions.
*
* N.B. the mutex on the tile must already have been locked on entry
* to this function. DO NOT LOCK IT HERE.
*/
static void
tile_swap_default_in (DefSwapFile *def_swap_file,
gint fd,
Tile *tile)
{
gint err;
gint nleft;
off_t offset;
err = -1;
if (tile->data)
{
return;
}
if (def_swap_file->cur_position != tile->swap_offset)
{
@@ -607,7 +481,8 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
if (offset == -1)
{
if (seek_err_msg)
g_message ("unable to seek to tile location on disk: %d", err);
g_message ("unable to seek to tile location on disk: %s",
g_strerror (errno));
seek_err_msg = FALSE;
return;
}
@@ -618,6 +493,8 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
nleft = tile->size;
while (nleft > 0)
{
gint err;
do
{
err = read (fd, tile->data + tile->size - nleft, nleft);
@@ -627,7 +504,8 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
if (err <= 0)
{
if (read_err_msg)
g_message ("unable to read tile data from disk: %s (%d/%d bytes read)",
g_message ("unable to read tile data from disk: "
"%s (%d/%d bytes read)",
g_strerror (errno), err, nleft);
read_err_msg = FALSE;
return;
@@ -650,7 +528,6 @@ tile_swap_default_out (DefSwapFile *def_swap_file,
Tile *tile)
{
gint bytes;
gint err;
gint nleft;
off_t offset;
off_t newpos;
@@ -680,11 +557,13 @@ tile_swap_default_out (DefSwapFile *def_swap_file,
nleft = tile->size;
while (nleft > 0)
{
err = write (fd, tile->data + tile->size - nleft, nleft);
gint err = write (fd, tile->data + tile->size - nleft, nleft);
if (err <= 0)
{
if (write_err_msg)
g_message ("unable to write tile data to disk: %s (%d/%d bytes written)",
g_message ("unable to write tile data to disk: "
"%s (%d/%d bytes written)",
g_strerror (errno), err, nleft);
write_err_msg = FALSE;
return;
@@ -878,9 +757,8 @@ static Gap *
tile_swap_gap_new (off_t start,
off_t end)
{
Gap *gap;
Gap *gap = g_new (Gap, 1);
gap = g_new (Gap, 1);
gap->start = start;
gap->end = end;
@@ -892,96 +770,3 @@ tile_swap_gap_destroy (Gap *gap)
{
g_free (gap);
}
#ifdef ENABLE_THREADED_TILE_SWAPPER
/* go through the list of tiles that are likely to be used soon and
* try to swap them in. If any tile is not in a state to be swapped
* in, ignore it, and the error will get dealt with when the tile
* is really needed -- assuming that the error still happens.
*
* Potential future enhancement: for non-threaded systems, we could
* fork() a process which merely attempts to bring tiles into the
* OS's buffer/page cache, where they will be read into the gimp
* more quickly. This would be pretty trivial, actually.
*/
static void
tile_swap_in_attempt (DefSwapFile *def_swap_file,
gint fd,
Tile *tile)
{
gint err = -1;
gint nleft;
TILE_MUTEX_LOCK (tile);
if (tile->data)
goto out;
if (! tile->swap_num || ! tile->swap_offset)
goto out;
if (def_swap_file->cur_position != tile->swap_offset)
{
def_swap_file->cur_position = tile->swap_offset;
if (lseek (fd, tile->swap_offset, SEEK_SET) == -1)
return;
}
tile_alloc (tile);
nleft = tile->size;
while (nleft > 0)
{
do
{
err = read (fd, tile->data + tile->size - nleft, nleft);
}
while ((err == -1) && ((errno == EAGAIN) || (errno == EINTR)));
if (err <= 0)
{
g_free (tile->data);
return;
}
nleft -= err;
}
def_swap_file->cur_position += tile->size;
out:
TILE_MUTEX_UNLOCK (tile);
}
static gpointer
tile_swap_in_thread (gpointer data)
{
AsyncSwapArgs *args;
GSList *free_item;
while (TRUE)
{
g_mutex_lock (async_swapin_mutex);
if (! async_swapin_tiles)
g_cond_wait (async_swapin_signal, async_swapin_mutex);
args = async_swapin_tiles->data;
free_item = async_swapin_tiles;
async_swapin_tiles = async_swapin_tiles->next;
g_slist_free_1 (free_item);
if (! async_swapin_tiles)
async_swapin_tiles_end = NULL;
g_mutex_unlock (async_swapin_mutex);
tile_swap_in_attempt (args->def_swap_file, args->fd, args->tile);
g_free(args);
}
}
#endif

View File

@@ -23,16 +23,14 @@
typedef enum
{
SWAP_IN = 1,
SWAP_IN_ASYNC,
SWAP_OUT,
SWAP_DELETE,
SWAP_COMPRESS
SWAP_DELETE
} SwapCommand;
typedef gint (* SwapFunc) (gint fd,
Tile *tile,
gint cmd,
SwapCommand cmd,
gpointer user_data);
@@ -43,10 +41,8 @@ gint tile_swap_add (gchar *filename,
gpointer user_data);
void tile_swap_remove (gint swap_num);
void tile_swap_in (Tile *tile);
void tile_swap_in_async (Tile *tile);
void tile_swap_out (Tile *tile);
void tile_swap_delete (Tile *tile);
void tile_swap_compress (gint swap_num);
gboolean tile_swap_test (void);

View File

@@ -103,10 +103,6 @@ tile_init (Tile *tile,
tile->listhead = NULL;
tile->rowhint = NULL;
#ifdef ENABLE_THREADED_TILE_SWAPPER
tile->mutex = g_mutex_new ();
#endif
tile_count++;
}
@@ -128,8 +124,6 @@ tile_lock (Tile *tile)
/* Increment this tile's reference count.
*/
TILE_MUTEX_LOCK (tile);
tile->ref_count++;
if (tile->ref_count == 1)
@@ -147,8 +141,6 @@ tile_lock (Tile *tile)
tile_swap_in (tile);
}
TILE_MUTEX_UNLOCK (tile);
/* Call 'tile_manager_validate' if the tile was invalid.
*/
if (! tile->valid)
@@ -166,8 +158,6 @@ tile_release (Tile *tile,
*/
tile_ref_count--;
TILE_MUTEX_LOCK (tile);
/* Decrement this tile's reference count.
*/
tile->ref_count--;
@@ -206,8 +196,6 @@ tile_release (Tile *tile,
tile_cache_insert (tile);
}
}
TILE_MUTEX_UNLOCK (tile);
}
void
@@ -260,12 +248,6 @@ tile_destroy (Tile *tile)
if (tile->listhead)
tile_cache_flush (tile);
TILE_MUTEX_UNLOCK (tile);
#ifdef ENABLE_THREADED_TILE_SWAPPER
g_mutex_free (tile->mutex);
#endif
g_free (tile);
tile_count--;
@@ -311,11 +293,7 @@ tile_is_valid (Tile *tile)
void
tile_mark_valid (Tile *tile)
{
TILE_MUTEX_LOCK (tile);
tile->valid = TRUE;
TILE_MUTEX_UNLOCK (tile);
}
void
@@ -383,11 +361,7 @@ tile_detach (Tile *tile,
tile->share_count--;
if (tile->share_count == 0 && tile->ref_count == 0)
{
tile_destroy (tile);
return;
}
TILE_MUTEX_UNLOCK (tile);
}
gpointer
@@ -395,7 +369,7 @@ tile_data_pointer (Tile *tile,
gint xoff,
gint yoff)
{
gint offset = yoff * tile->ewidth + xoff;
gsize offset = yoff * tile->ewidth + xoff;
return (gpointer) (tile->data + offset * tile->bpp);
}

View File

@@ -28,6 +28,7 @@
#include "base/base.h"
#include "core/gimp.h"
#include "core/gimpparamspecs.h"
#include "batch.h"
@@ -139,13 +140,15 @@ batch_run_cmd (Gimp *gimp,
{
GValueArray *args;
GValueArray *return_vals;
gint i = 0;
args = gimp_procedure_get_arguments (procedure);
g_value_set_int (&args->values[0], run_mode);
if (procedure->num_args > i && GIMP_IS_PARAM_SPEC_INT32 (procedure->args[i]))
g_value_set_int (&args->values[i++], run_mode);
if (procedure->num_args > 1)
g_value_set_static_string (&args->values[1], cmd);
if (procedure->num_args > i && GIMP_IS_PARAM_SPEC_STRING (procedure->args[i]))
g_value_set_static_string (&args->values[i++], cmd);
return_vals =
gimp_pdb_execute_procedure_by_name_args (gimp->pdb,

View File

@@ -40,23 +40,11 @@
#define OPAQUE_OPACITY 255
#define TRANSPARENT_OPACITY 0
#define RANDOM_TABLE_SIZE 4096
#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
/* This version of INT_MULT3 is very fast, but suffers from some
slight roundoff errors. It returns the correct result 99.987
percent of the time */
#define INT_MULT3(a,b,c,t) ((t) = (a) * (b) * (c) + 0x7F5B, ((((t) >> 7) + (t)) >> 16))
/*
This version of INT_MULT3 always gives the correct result, but runs at
approximatly one third the speed. */
/* #define INT_MULT3(a,b,c,t) (((a) * (b) * (c) + 32512) / 65025.0)
*/
#define INT_BLEND(a,b,alpha,tmp) (INT_MULT((a) - (b), alpha, tmp) + (b))
#define RANDOM_TABLE_SIZE 4096
/* A drawable has an alphachannel if contains either 4 or 2 bytes data
* aka GRAYA and RGBA and thus the macro below works. This will have
* to change if we support bigger formats. We'll do it so for now because
@@ -1231,7 +1219,7 @@ gimp_composite_dissolve_any_any_any_generic (GimpCompositeContext * ctx)
gint sb = gimp_composite_pixel_bpp[ctx->pixelformat_B];
gint x = ctx->dissolve.x;
gint y = ctx->dissolve.y;
guchar *mask = ctx->M;
const guchar *mask = ctx->M;
gint32 rand_val;
guchar *dest = ctx->D;
guchar *src = ctx->B;
@@ -1280,7 +1268,8 @@ gimp_composite_dissolve_any_any_any_generic (GimpCompositeContext * ctx)
combined_opacity = opacity;
}
dest[alpha] = (rand_val >= combined_opacity) ? 0 : OPAQUE_OPACITY;
dest[alpha] =
(rand_val >= combined_opacity) ? TRANSPARENT_OPACITY : OPAQUE_OPACITY;
dest += db;
src += sb;

View File

@@ -45,7 +45,8 @@
#define pmaxub(a,b,tmp) "\tmovq %%" #a ", %%" #tmp ";" "psubusb %%" #b ", %%" #tmp ";" "paddb %%" #tmp ", %%" #b "\n"
void
#if 0
static void
debug_display_mmx(void)
{
#define mask32(x) ((x)& (unsigned long long) 0xFFFFFFFF)
@@ -57,6 +58,7 @@ debug_display_mmx(void)
print64(mm6); printf(" "); print64(mm7); printf("\n");
printf("--------------------------------------------\n");
}
#endif
const guint32 rgba8_alpha_mask_64[2] = { 0xFF000000, 0xFF000000 };
const guint32 rgba8_b1_64[2] = { 0x01010101, 0x01010101 };
@@ -828,6 +830,7 @@ gimp_composite_multiply_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
asm("emms");
}
#if 0
static void
mmx_op_overlay(void)
{
@@ -877,6 +880,7 @@ mmx_op_overlay(void)
: "m" (*rgba8_w2_64), "m" (*rgba8_alpha_mask_64)
);
}
#endif
#if 0
void
@@ -1294,6 +1298,12 @@ gimp_composite_addition_va8_va8_va8_mmx (GimpCompositeContext *_op)
uint64 *d = (uint64 *) _op->D;
uint64 *a = (uint64 *) _op->A;
uint64 *b = (uint64 *) _op->B;
uint32 *a32;
uint32 *b32;
uint32 *d32;
uint16 *a16;
uint16 *b16;
uint16 *d16;
gulong n_pixels = _op->n_pixels;
asm volatile ("movq %0,%%mm0"
@@ -1321,9 +1331,9 @@ gimp_composite_addition_va8_va8_va8_mmx (GimpCompositeContext *_op)
d++;
}
uint32 *a32 = (uint32 *) a;
uint32 *b32 = (uint32 *) b;
uint32 *d32 = (uint32 *) d;
a32 = (uint32 *) a;
b32 = (uint32 *) b;
d32 = (uint32 *) d;
for (; n_pixels >= 2; n_pixels -= 2)
{
@@ -1345,9 +1355,9 @@ gimp_composite_addition_va8_va8_va8_mmx (GimpCompositeContext *_op)
d32++;
}
uint16 *a16 = (uint16 *) a32;
uint16 *b16 = (uint16 *) b32;
uint16 *d16 = (uint16 *) d32;
a16 = (uint16 *) a32;
b16 = (uint16 *) b32;
d16 = (uint16 *) d32;
for (; n_pixels >= 1; n_pixels -= 1)
{
@@ -1380,6 +1390,12 @@ gimp_composite_subtract_va8_va8_va8_mmx (GimpCompositeContext *_op)
uint64 *d = (uint64 *) _op->D;
uint64 *a = (uint64 *) _op->A;
uint64 *b = (uint64 *) _op->B;
uint32 *a32;
uint32 *b32;
uint32 *d32;
uint16 *a16;
uint16 *b16;
uint16 *d16;
gulong n_pixels = _op->n_pixels;
asm volatile ("movq %0,%%mm0"
@@ -1407,9 +1423,9 @@ gimp_composite_subtract_va8_va8_va8_mmx (GimpCompositeContext *_op)
d++;
}
uint32 *a32 = (uint32 *) a;
uint32 *b32 = (uint32 *) b;
uint32 *d32 = (uint32 *) d;
a32 = (uint32 *) a;
b32 = (uint32 *) b;
d32 = (uint32 *) d;
for (; n_pixels >= 2; n_pixels -= 2)
{
@@ -1431,9 +1447,9 @@ gimp_composite_subtract_va8_va8_va8_mmx (GimpCompositeContext *_op)
d32++;
}
uint16 *a16 = (uint16 *) a32;
uint16 *b16 = (uint16 *) b32;
uint16 *d16 = (uint16 *) d32;
a16 = (uint16 *) a32;
b16 = (uint16 *) b32;
d16 = (uint16 *) d32;
for (; n_pixels >= 1; n_pixels -= 1)
{

View File

@@ -316,9 +316,9 @@ gimp_composite_regression_compare_contexts (char *operation, GimpCompositeContex
* Return value:
**/
int
gimp_composite_regression_comp_rgba8 (char *str, gimp_rgba8_t *rgba8A, gimp_rgba8_t *rgba8B, gimp_rgba8_t *expected, gimp_rgba8_t *actual, u_long length)
gimp_composite_regression_comp_rgba8 (char *str, gimp_rgba8_t *rgba8A, gimp_rgba8_t *rgba8B, gimp_rgba8_t *expected, gimp_rgba8_t *actual, gulong length)
{
u_long i;
gulong i;
int failed;
int fail_count;
@@ -364,7 +364,7 @@ gimp_composite_regression_comp_rgba8 (char *str, gimp_rgba8_t *rgba8A, gimp_rgba
* Return value:
**/
int
gimp_composite_regression_comp_va8 (char *str, gimp_va8_t *va8A, gimp_va8_t *va8B, gimp_va8_t *expected, gimp_va8_t *actual, u_long length)
gimp_composite_regression_comp_va8 (char *str, gimp_va8_t *va8A, gimp_va8_t *va8B, gimp_va8_t *expected, gimp_va8_t *actual, gulong length)
{
int i;
int failed;
@@ -404,7 +404,7 @@ gimp_composite_regression_comp_va8 (char *str, gimp_va8_t *va8A, gimp_va8_t *va8
*
**/
void
gimp_composite_regression_dump_rgba8 (char *str, gimp_rgba8_t *rgba, u_long n_pixels)
gimp_composite_regression_dump_rgba8 (char *str, gimp_rgba8_t *rgba, gulong n_pixels)
{
int i;
@@ -445,12 +445,12 @@ gimp_composite_regression_timer_report (char *name, double t1, double t2)
* Return value:
**/
double
gimp_composite_regression_time_function (u_long iterations, void (*func)(), GimpCompositeContext *ctx)
gimp_composite_regression_time_function (gulong iterations, void (*func)(), GimpCompositeContext *ctx)
{
struct timeval t0;
struct timeval t1;
struct timeval tv_elapsed;
u_long i;
gulong i;
gettimeofday (&t0, NULL);
for (i = 0; i < iterations; i++) { (*func)(ctx); }
@@ -469,10 +469,10 @@ gimp_composite_regression_time_function (u_long iterations, void (*func)(), Gimp
* Return value:
**/
gimp_rgba8_t *
gimp_composite_regression_random_rgba8 (u_long n_pixels)
gimp_composite_regression_random_rgba8 (gulong n_pixels)
{
gimp_rgba8_t *rgba8;
u_long i;
gulong i;
if ((rgba8 = (gimp_rgba8_t *) calloc (sizeof(gimp_rgba8_t), n_pixels))) {
for (i = 0; i < n_pixels; i++) {
@@ -495,11 +495,11 @@ gimp_composite_regression_random_rgba8 (u_long n_pixels)
* Return value:
**/
gimp_rgba8_t *
gimp_composite_regression_fixed_rgba8 (u_long n_pixels)
gimp_composite_regression_fixed_rgba8 (gulong n_pixels)
{
gimp_rgba8_t *rgba8;
u_long i;
u_long v;
gulong i;
gulong v;
if ((rgba8 = (gimp_rgba8_t *) calloc(sizeof(gimp_rgba8_t), n_pixels))) {
for (i = 0; i < n_pixels; i++) {

View File

@@ -102,7 +102,7 @@ extern void gimp_composite_regression_print_vector_rgba8 (gimp_rgba8_t v[],
unsigned int n_pixels);
extern double gimp_composite_regression_time_function (u_long iterations,
extern double gimp_composite_regression_time_function (gulong iterations,
void (*func)(),
GimpCompositeContext *ctx);
extern int gimp_composite_regression_comp_rgba8 (char *str,
@@ -110,27 +110,27 @@ extern int gimp_composite_regression_comp_rgba8 (char *str,
gimp_rgba8_t *rgba8B,
gimp_rgba8_t *expected,
gimp_rgba8_t *actual,
u_long length);
gulong length);
extern int gimp_composite_regression_comp_va8 (char *str,
gimp_va8_t *va8A,
gimp_va8_t *va8B,
gimp_va8_t *expected,
gimp_va8_t *actual,
u_long length);
gulong length);
extern int gimp_composite_regression_compare_contexts (char *,
GimpCompositeContext *ctx1,
GimpCompositeContext *ctx2);
extern void gimp_composite_regression_dump_rgba8 (char *str,
gimp_rgba8_t *rgba,
u_long n_pixels);
gulong n_pixels);
extern void gimp_composite_regression_print_rgba8 (gimp_rgba8_t *rgba8);
extern void gimp_composite_regression_print_va8 (gimp_va8_t *va8);
extern void gimp_composite_regression_timer_report (char *name,
double t1,
double t2);
extern gimp_rgba8_t *gimp_composite_regression_random_rgba8 (u_long n_pixels);
extern gimp_rgba8_t *gimp_composite_regression_fixed_rgba8 (u_long n_pixels);
extern gimp_rgba8_t *gimp_composite_regression_random_rgba8 (gulong n_pixels);
extern gimp_rgba8_t *gimp_composite_regression_fixed_rgba8 (gulong n_pixels);
extern GimpCompositeContext *gimp_composite_context_init (GimpCompositeContext *ctx,
GimpCompositeOperation op,
GimpPixelFormat a_format,

View File

@@ -62,6 +62,7 @@ static const guint32 va8_b255_64[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
static const guint32 va8_w1_64[2] = { 0x00010001, 0x00010001 };
static const guint32 va8_w255_64[2] = { 0x00FF00FF, 0x00FF00FF };
#if 0
void
debug_display_sse (void)
{
@@ -79,6 +80,7 @@ debug_display_sse (void)
print128(xmm6); printf(" "); print128(xmm7); printf("\n");
printf("--------------------------------------------\n");
}
#endif
void
gimp_composite_addition_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)

View File

@@ -126,7 +126,7 @@ typedef struct
guchar *A; /* Source A */
guchar *B; /* Source B */
guchar *D; /* Destination */
guchar *M; /* Mask */
const guchar *M; /* Mask */
gulong n_pixels;
GimpPixelFormat pixelformat_A;

View File

@@ -65,20 +65,21 @@ TESTS = test-config
test_config_DEPENDENCIES = $(gimpconfig_libs)
test_config_LDFLAGS = -u gimp_pdb_get_type
test_config_LDFLAGS = -u xcf_init -u internal_procs_init
test_config_LDADD = \
../widgets/widgets-enums.o \
../display/display-enums.o \
../display/gimpdisplayoptions.o \
../pdb/libappinternal-procs.a \
../xcf/libappxcf.a \
../file/libappfile.a \
../plug-in/libappplug-in.a \
../pdb/libapppdb.a \
../vectors/libappvectors.a \
../plug-in/libappplug-in.a \
../core/libappcore.a \
../paint/libapppaint.a \
../xcf/libappxcf.a \
../text/libapptext.a \
../file/libappfile.a \
libappconfig.a \
../paint-funcs/libapppaint-funcs.a \
../composite/libappcomposite.a \

View File

@@ -36,6 +36,8 @@
#include "config-types.h"
#include "gimpconfig-file.h"
#include "gimp-intl.h"
@@ -74,7 +76,7 @@ gimp_config_file_copy (const gchar *source,
if (fwrite (buffer, 1, nbytes, dfile) < nbytes)
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Error while writing '%s': %s"),
_("Error writing '%s': %s"),
gimp_filename_to_utf8 (dest), g_strerror (errno));
fclose (sfile);
fclose (dfile);
@@ -85,7 +87,7 @@ gimp_config_file_copy (const gchar *source,
if (ferror (sfile))
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Error while reading '%s': %s"),
_("Error reading '%s': %s"),
gimp_filename_to_utf8 (source), g_strerror (errno));
fclose (sfile);
fclose (dfile);
@@ -97,7 +99,7 @@ gimp_config_file_copy (const gchar *source,
if (fclose (dfile) == EOF)
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Error while writing '%s': %s"),
_("Error writing '%s': %s"),
gimp_filename_to_utf8 (dest), g_strerror (errno));
return FALSE;
}

View File

@@ -88,6 +88,7 @@ enum
PROP_INSTALL_COLORMAP,
PROP_MIN_COLORS,
PROP_COLOR_MANAGEMENT,
PROP_COLOR_PROFILE_POLICY,
PROP_SAVE_DOCUMENT_HISTORY
};
@@ -131,7 +132,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
"interpolation-type",
INTERPOLATION_TYPE_BLURB,
GIMP_TYPE_INTERPOLATION_TYPE,
GIMP_INTERPOLATION_LINEAR,
GIMP_INTERPOLATION_CUBIC,
GIMP_PARAM_STATIC_STRINGS);
path = gimp_config_build_plug_in_path ("plug-ins");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PLUG_IN_PATH,
@@ -346,6 +347,12 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_TYPE_COLOR_CONFIG,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_COLOR_PROFILE_POLICY,
"color-profile-policy",
COLOR_PROFILE_POLICY_BLURB,
GIMP_TYPE_COLOR_PROFILE_POLICY,
GIMP_COLOR_PROFILE_POLICY_ASK,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAVE_DOCUMENT_HISTORY,
"save-document-history",
SAVE_DOCUMENT_HISTORY_BLURB,
@@ -565,6 +572,9 @@ gimp_core_config_set_property (GObject *object,
gimp_config_sync (g_value_get_object (value),
G_OBJECT (core_config->color_management), 0);
break;
case PROP_COLOR_PROFILE_POLICY:
core_config->color_profile_policy = g_value_get_enum (value);
break;
case PROP_SAVE_DOCUMENT_HISTORY:
core_config->save_document_history = g_value_get_boolean (value);
break;
@@ -702,6 +712,9 @@ gimp_core_config_get_property (GObject *object,
case PROP_COLOR_MANAGEMENT:
g_value_set_object (value, core_config->color_management);
break;
case PROP_COLOR_PROFILE_POLICY:
g_value_set_enum (value, core_config->color_profile_policy);
break;
case PROP_SAVE_DOCUMENT_HISTORY:
g_value_set_boolean (value, core_config->save_document_history);
break;

View File

@@ -79,6 +79,7 @@ struct _GimpCoreConfig
gboolean install_cmap;
gint min_colors;
GimpColorConfig *color_management;
GimpColorProfilePolicy color_profile_policy;
gboolean save_document_history;
};

View File

@@ -65,7 +65,8 @@ enum
PROP_NAV_PREVIEW_SIZE,
PROP_DEFAULT_VIEW,
PROP_DEFAULT_FULLSCREEN_VIEW,
PROP_ACTIVATE_ON_FOCUS
PROP_ACTIVATE_ON_FOCUS,
PROP_SPACE_BAR_ACTION
};
@@ -118,7 +119,7 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_MARCHING_ANTS_SPEED,
"marching-ants-speed",
MARCHING_ANTS_SPEED_BLURB,
50, G_MAXINT, 300,
10, 1000, 100,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RESIZE_WINDOWS_ON_ZOOM,
"resize-windows-on-zoom",
@@ -198,7 +199,6 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
GIMP_TYPE_VIEW_SIZE,
GIMP_VIEW_SIZE_MEDIUM,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_DEFAULT_VIEW,
"default-view",
DEFAULT_VIEW_BLURB,
@@ -216,6 +216,12 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
ACTIVATE_ON_FOCUS_BLURB,
DEFAULT_ACTIVATE_ON_FOCUS,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_SPACE_BAR_ACTION,
"space-bar-action",
SPACE_BAR_ACTION_BLURB,
GIMP_TYPE_SPACE_BAR_ACTION,
GIMP_SPACE_BAR_ACTION_PAN,
GIMP_PARAM_STATIC_STRINGS);
}
static void
@@ -339,6 +345,9 @@ gimp_display_config_set_property (GObject *object,
case PROP_ACTIVATE_ON_FOCUS:
display_config->activate_on_focus = g_value_get_boolean (value);
break;
case PROP_SPACE_BAR_ACTION:
display_config->space_bar_action = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -425,6 +434,9 @@ gimp_display_config_get_property (GObject *object,
case PROP_ACTIVATE_ON_FOCUS:
g_value_set_boolean (value, display_config->activate_on_focus);
break;
case PROP_SPACE_BAR_ACTION:
g_value_set_enum (value, display_config->space_bar_action);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);

View File

@@ -67,6 +67,7 @@ struct _GimpDisplayConfig
GimpDisplayOptions *default_view;
GimpDisplayOptions *default_fullscreen_view;
gboolean activate_on_focus;
GimpSpaceBarAction space_bar_action;
};
struct _GimpDisplayConfigClass

View File

@@ -29,6 +29,9 @@ N_("Sets the canvas padding color used if the padding mode is set to " \
#define COLOR_MANAGEMENT_BLURB \
"Defines the color management behavior."
#define COLOR_PROFILE_POLICY_BLURB \
N_("How to handle embedded color profiles when opening a file.")
#define CONFIRM_ON_CLOSE_BLURB \
N_("Ask for confirmation before closing an image without saving.")
@@ -103,7 +106,7 @@ N_("The window type hint that is set on dock windows. This may affect " \
"to between 2.0 and 2.6. One important thing to keep in mind: Many images " \
"that you might get from outside sources will in all likelihood already " \
"be gamma-corrected. In these cases, the image will look washed-out if " \
"the GIMP has gamma-correction turned on. If you are going to work with " \
"GIMP has gamma-correction turned on. If you are going to work with " \
"images of this sort, turn gamma correction off by setting the value to 1.0."
#endif
@@ -183,14 +186,13 @@ N_("When enabled, GIMP will show mnemonics in menus.")
#define MIN_COLORS_BLURB \
N_("Generally only a concern for 8-bit displays, this sets the minimum " \
"number of system colors allocated for the GIMP.")
"number of system colors allocated for GIMP.")
#define MODULE_PATH_BLURB \
"Sets the module search path."
#define MONITOR_RES_FROM_GDK_BLURB \
"When enabled, the GIMP will use the monitor resolution from the " \
"windowing system."
"When enabled, GIMP will use the monitor resolution from the windowing system."
#define MONITOR_XRESOLUTION_BLURB \
N_("Sets the monitor's horizontal resolution, in dots per inch. If set to " \
@@ -203,9 +205,8 @@ N_("Sets the monitor's vertical resolution, in dots per inch. If set to " \
"resolution information.")
#define MOVE_TOOL_CHANGES_ACTIVE_BLURB \
N_("If enabled, the move tool changes the active layer or path when a layer " \
"or path is being picked. This used to be the default behaviour in older " \
"versions.")
N_("If enabled, the move tool sets the edited layer or path as active. " \
"This used to be the default behaviour in older versions.")
#define NAVIGATION_PREVIEW_SIZE_BLURB \
N_("Sets the size of the navigation preview available in the lower right " \
@@ -268,10 +269,10 @@ N_("Remember the current tool, pattern, color, and brush across GIMP " \
N_("Add all opened and saved files to the document history on disk.")
#define SAVE_SESSION_INFO_BLURB \
N_("Save the positions and sizes of the main dialogs when the GIMP exits.")
N_("Save the positions and sizes of the main dialogs when GIMP exits.")
#define SAVE_TOOL_OPTIONS_BLURB \
N_("Save the tool options when the GIMP exits.")
N_("Save the tool options when GIMP exits.")
#define SCRIPT_FU_PATH_BLURB \
"This path will be searched for scripts when the Script-Fu plug-in is run."
@@ -331,6 +332,9 @@ N_("Enable displaying a handy GIMP tip on startup.")
#define SHOW_TOOLTIPS_BLURB \
N_("Show a tooltip when the pointer hovers over an item.")
#define SPACE_BAR_ACTION_BLURB \
N_("What to do when the space bar is pressed in the image window.")
#define SWAP_PATH_BLURB \
N_("Sets the swap file location. GIMP uses a tile based memory allocation " \
"scheme. The swap file is used to quickly and easily swap tiles out to " \
@@ -354,16 +358,16 @@ N_("When enabled, you can change keyboard shortcuts for menu items " \
"by hitting a key combination while the menu item is highlighted.")
#define SAVE_ACCELS_BLURB \
N_("Save changed keyboard shortcuts when the GIMP exits.")
N_("Save changed keyboard shortcuts when GIMP exits.")
#define RESTORE_ACCELS_BLURB \
N_("Restore saved keyboard shortcuts on each GIMP startup.")
#define TEMP_PATH_BLURB \
N_("Sets the folder for temporary storage. Files will appear here " \
"during the course of running the GIMP. Most files will disappear " \
"when the GIMP exits, but some files are likely to remain, so it is " \
"best if this folder not be one that is shared by other users.")
"during the course of running GIMP. Most files will disappear " \
"when GIMP exits, but some files are likely to remain, so it " \
"is best if this folder not be one that is shared by other users.")
#define THEME_BLURB \
"The name of the theme to use."
@@ -400,7 +404,7 @@ N_("Sets the manner in which transparency is displayed in images.")
N_("Sets the size of the checkerboard used to display transparency.")
#define TRUST_DIRTY_FLAG_BLURB \
N_("When enabled, the GIMP will not save an image if it has not been changed " \
N_("When enabled, GIMP will not save an image if it has not been changed " \
"since it was opened.")
#define UNDO_LEVELS_BLURB \

View File

@@ -530,3 +530,42 @@ gimp_rc_save (GimpRc *rc)
g_free (header);
g_object_unref (global);
}
/**
* gimp_rc_migrate:
* @rc: a #GimpRc object.
*
* Resets all GimpParamConfigPath properties of the passed rc object
* to their default values, in order to prevent paths in a migrated
* gimprc to refer to folders in the old GIMP's user directory.
**/
void
gimp_rc_migrate (GimpRc *rc)
{
GParamSpec **pspecs;
guint n_pspecs;
gint i;
g_return_if_fail (GIMP_IS_RC (rc));
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (rc), &n_pspecs);
for (i = 0; i < n_pspecs; i++)
{
GParamSpec *pspec = pspecs[i];
if (GIMP_IS_PARAM_SPEC_CONFIG_PATH (pspec))
{
GValue value = { 0, };
g_value_init (&value, pspec->value_type);
g_param_value_set_default (pspec, &value);
g_object_set_property (G_OBJECT (rc), pspec->name, &value);
g_value_unset (&value);
}
}
g_free (pspecs);
}

Some files were not shown because too many files have changed in this diff Show More