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

Compare commits

...

124 Commits

Author SHA1 Message Date
Sven Neumann
ea1716b5c3 Made 2.0.2 release.
2004-06-15  Sven Neumann  <sven@gimp.org>

        * Made 2.0.2 release.
2004-06-15 12:19:49 +00:00
Philip Lafleur
e10f48a25f Don't round texture coordinates when not using interpolation. Fixes bug
2004-06-15  Philip Lafleur  <plafleur@cvs.gnome.org>

	* app/core/gimpdrawable-transform.c (gimp_drawable_transform_tiles_affine):
	Don't round texture coordinates when not using interpolation. Fixes
	bug #144352 for the nearest neighbor case only. Merged from HEAD.
2004-06-15 11:30:09 +00:00
Sven Neumann
7f90720b9f applied the fix for empty colormaps (bug #143009) here as well. Merged
2004-06-15  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/mng.c (respin_cmap): applied the fix for empty
	colormaps (bug #143009) here as well. Merged from HEAD branch.
2004-06-15 11:23:14 +00:00
Sven Neumann
545ad59164 regenerated (using a newer version of gtk-doc) 2004-06-15 11:10:59 +00:00
Sven Neumann
567186464c bumped version number to 2.0.2, interface_age 2, binary_age 2.
2004-06-15  Sven Neumann  <sven@gimp.org>

	* configure.in: bumped version number to 2.0.2, interface_age 2,
	binary_age 2.
2004-06-15 11:09:09 +00:00
Henrik Brix Andersen
0310333ffe let extensions run synchronously when called via PDB. Fixes bug #140112.
2004-06-14 Henrik Brix Andersen <brix@gimp.org>

* app/plug-in/plug-in-run.c: let extensions run synchronously when
called via PDB. Fixes bug #140112. Merged from HEAD.
2004-06-14 11:59:15 +00:00
Manish Singh
96fee5b9a2 Make sure PangoFT2 is using a recent enough fontconfig since many people
2004-06-13  Manish Singh  <yosh@gimp.org>

        * configure.in: Make sure PangoFT2 is using a recent enough fontconfig
        since many people have broken and confused setups.
2004-06-14 02:37:16 +00:00
Manish Singh
561ef38181 Reorged, to address bug #142907 and bug #143069. Accel implementations
2004-06-13  Manish Singh  <yosh@gimp.org>

        * app/base/cpu-accel.c: Reorged, to address bug #142907 and
        bug #143069. Accel implementations #define HAVE_ACCEL, and cpu_accel()
        keys on that. Both PPC and X86 implementations check for __GNUC__.
        X86 stuff is only used with USE_MMX is defined. The SSE OS check
        is now checked in arch_accel(), not cpu_accel(). Finally, the
        arch x86_64 checks now are EM64T aware (which didn't matter in
        practice).
2004-06-14 00:53:30 +00:00
Sven Neumann
1b5f136e47 ChangeLog formatting 2004-06-09 11:14:14 +00:00
Sven Neumann
dd4db1fe4f added ca.po (Catalan).
2004-06-09  Sven Neumann  <sven@gimp.org>

	* Makefile.am (tips_POFILES): added ca.po (Catalan).
2004-06-09 11:10:50 +00:00
Jordi Mallach
4da269cbe5 Added Catalan translation by Xavier Beà <xbea@pie.xtec.es>. 2004-06-08 10:39:51 +00:00
Jordi Mallach
62f099449d Updated Catalan translation by Xavier Beà <xbea@pie.xtec.es>. 2004-06-08 10:26:10 +00:00
Jordi Mallach
d78fdbdee4 Updated Catalan translation by Xavier Conde Rueda <xaviconde@eresmas.com>. 2004-06-08 10:23:08 +00:00
Jordi Mallach
8d3b43c579 Updated Catalan translation by Xavier Beà <xbea@pie.xtec.es>. 2004-06-08 08:47:05 +00:00
Pablo G. del Campo
0b573cb5c4 Updated Spanish translation by Francisco Vila
2004-06-07 Pablo G. del Campo <pablodc@bigfoot.com>

        * es.po: Updated Spanish translation by
                 Francisco Vila <francisco.vila@hispalinux.es>.
2004-06-08 01:27:13 +00:00
Sven Neumann
201f8bcce4 Updated Brazilian Portuguese translation from Joao S. O. Bueno
2004-06-07  Sven Neumann  <sven@gimp.org>

	* pt_br.po: Updated Brazilian Portuguese translation
	from Joao S. O. Bueno <gwidion@mpc.com.br>.
2004-06-07 22:04:15 +00:00
Sven Neumann
21c2817d84 Updated Brazilian Portuguese translation from Joao S. O. Bueno
2004-06-07  Sven Neumann  <sven@gimp.org>

	* pt_br.po: Updated Brazilian Portuguese translation
	from Joao S. O. Bueno <gwidion@mpc.com.br>.
2004-06-07 18:49:15 +00:00
Michael Natterer
766c2e84f1 Merged from HEAD:
2004-06-07  Michael Natterer  <mitch@gimp.org>

	Merged from HEAD:

	* app/core/gimplayer.c (gimp_layer_set_tiles): don't set
	layer->mask's offsets. It is wrong because GimpDrawable::set_tiles()
	is a lowlevel function which is used by stuff like scale and
	resize which keep the mask in sync explicitely and don't expect it
	to be moved in the middle of chaining up. Fixes bug #143860.
2004-06-07 15:14:45 +00:00
Miloslav Trmac
9286c8f9b8 Updated Czech translation.
2004-06-07  Miloslav Trmac  <mitr@volny.cz>

	* cs.po: Updated Czech translation.
2004-06-07 09:16:55 +00:00
Sven Neumann
399303f963 fixed typo that caused corruption of first row. Spotted by William Skaggs,
2004-06-07  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/blur.c: fixed typo that caused corruption of
	first row. Spotted by William Skaggs, bug #142318.
2004-06-07 09:06:41 +00:00
Sven Neumann
c67ee1e116 applied a patch from Henrik Brix Andersen that tells the user that Curve
2004-06-05  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/curve_bend.c: applied a patch from Henrik Brix
	Andersen that tells the user that Curve Bend cannot operate on
	layers with masks instead of silently applying the mask
	(bug #134748).
2004-06-05 19:21:14 +00:00
Sven Neumann
94b85f6773 merged a patch from Philip Lafleur that makes the plug-in handle images
2004-06-05  Sven Neumann  <sven@gimp.org>

	* plug-ins/sgi/sgi.c: merged a patch from Philip Lafleur that
	makes the plug-in handle images with more than 4 channels. At the
	moment the extra information is discarded (bug #143673).
2004-06-05 18:45:16 +00:00
Sven Neumann
0b65037ad4 save the proper value for type of alpha channel. Fixes bug #143522; patch
2004-06-05  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/tiff.c: save the proper value for type of alpha
	channel. Fixes bug #143522; patch by Philip Lafleur merged from
	HEAD branch.
2004-06-05 10:28:21 +00:00
Sven Neumann
b67ccf9ce0 removed a redundant transformation (merged from HEAD branch).
2004-06-05  Sven Neumann  <sven@gimp.org>

	* app/text/gimptext-bitmap.c (gimp_text_render_bitmap): removed a
	redundant transformation (merged from HEAD branch).
2004-06-04 23:46:10 +00:00
Sven Neumann
39e1e6ee66 set the focus on the text area (merged from HEAD branch).
2004-06-04  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimptexteditor.c (gimp_text_editor_new): set the
	focus on the text area (merged from HEAD branch).
2004-06-04 18:19:03 +00:00
Sven Neumann
c0327acc92 allow to move a text layer using the cursor keys (merged from HEAD
2004-06-04  Sven Neumann  <sven@gimp.org>

	* app/tools/gimptexttool.c (gimp_text_tool_class_init): allow to
	move a text layer using the cursor keys (merged from HEAD branch).
2004-06-04 17:53:51 +00:00
Sven Neumann
8d627bdfaf applied a patch by Philip Lafleur that changes the default to FALSE. Fixes
2004-06-04  Sven Neumann  <sven@gimp.org>

	* app/paint/gimppaintoptions.c (DEFAULT_PRESSURE_PRESSURE):
	applied a patch by Philip Lafleur that changes the default to
	FALSE. Fixes bug #143626; merged from HEAD branch.
2004-06-04 09:46:52 +00:00
Sven Neumann
eee0e57b5a suggest to use gimp-print 4.2.7-pre1 in case of problems (see bug
2004-06-02  Sven Neumann  <sven@gimp.org>

	* INSTALL: suggest to use gimp-print 4.2.7-pre1 in case of problems
	(see bug #138273).
2004-06-02 11:05:29 +00:00
Sven Neumann
68599dbc7e don't call gtk_entry_set_text() with a NULL text. Merged from HEAD branch.
2004-06-01  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/tiff.c: don't call gtk_entry_set_text() with a
	NULL text. Merged from HEAD branch.
2004-06-01 17:15:42 +00:00
Funda Wang
18d8c970f5 Updated Simplified Chinese translation 2004-06-01 12:05:47 +00:00
Adam Weinberger
4f6b93c803 Updated Canadian English translation.
* po/en_CA.po
	  po-plug-ins/en_CA.po:

	  Updated Canadian English translation.
2004-05-30 21:33:10 +00:00
Andras Timar
ec80c3a04a Updated Hungarian translation.
2004-05-29  Andras Timar  <timar@gnome.hu>

	* hu.po: Updated Hungarian translation.
2004-05-29 17:21:47 +00:00
Sven Neumann
664e4f05af reset the file type menu to "By Extension". Based on a patch from Philip
2004-05-29  Sven Neumann  <sven@gimp.org>

        * app/widgets/gimpfiledialog.[ch]: reset the file type menu to "By
        Extension". Based on a patch from Philip Lafleur (bug #141535).
2004-05-29 12:32:28 +00:00
Sven Neumann
5f902811e6 tools/pdbgen/pdb/layer.pdb app/pdb/layer_cmds.c fixed documentation for
2004-05-29  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/layer.pdb
	* app/pdb/layer_cmds.c
	* libgimp/gimplayer_pdb.c: fixed documentation for gimp_resize_layer.
	Patch provided by Philip Lafleur (bug #142618, merged from HEAD).
2004-05-29 11:31:39 +00:00
Andras Timar
8a048d8e2b added hu.po (Hungarian). Added Hungarian translation
2004-05-28  Andras Timar  <timar@gnome.hu>

	* Makefile.am (tips_POFILES): added hu.po (Hungarian).
	* hu.po: Added Hungarian translation
2004-05-28 20:34:09 +00:00
Andras Timar
ba858645c1 Updated Hungarian translation.
2004-05-28  Andras Timar  <timar@gnome.hu>

	* hu.po: Updated Hungarian translation.
2004-05-28 20:29:26 +00:00
Sven Neumann
104334e02a handle an empty colormap. Fixes bug #143009, merged from HEAD branch.
2004-05-27  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/png.c (respin_cmap): handle an empty colormap.
	Fixes bug #143009, merged from HEAD branch.
2004-05-27 15:24:52 +00:00
Sven Neumann
60776ef93f applied patch from Philip Lafleur that fixes color picking for XInput
2004-05-27  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimppickbutton.c: applied patch from Philip
	Lafleur that fixes color picking for XInput devices (bug #143166).
2004-05-27 15:13:53 +00:00
Sven Neumann
a37780d572 fixed handling of grid offsets in the grid drawing routine. Merged from
2004-05-27  Sven Neumann  <sven@gimp.org>

	* app/display/gimpdisplayshell-draw.c
	(gimp_display_shell_draw_grid): fixed handling of grid offsets in
	the grid drawing routine. Merged from HEAD.
2004-05-27 14:55:43 +00:00
Miloslav Trmac
68a6b2ed3f Updated Czech translation.
2004-05-27  Miloslav Trmac  <mitr@volny.cz>

	* cs.po: Updated Czech translation.
2004-05-27 12:12:19 +00:00
Gareth Owen
5c9b2d2b9a Updated British English translation 2004-05-26 23:03:43 +00:00
Sven Neumann
4c1728e2cc do not install test-sphere.scm in the stable branch.
2004-05-26  Sven Neumann  <sven@gimp.org>

	* plug-ins/script-fu/scripts/Makefile.am: do not install
	test-sphere.scm in the stable branch.
2004-05-26 17:59:39 +00:00
Sven Neumann
2554608019 removed moved files from stable branch 2004-05-26 15:32:17 +00:00
Gareth Owen
f235e64621 Updated British English translation 2004-05-26 00:01:20 +00:00
Sven Neumann
7319c3b6af removed moved files from stable branch 2004-05-24 16:38:15 +00:00
Sven Neumann
08bcc1a40f fixed range check of blur type parameter (bug #142965).
2004-05-24  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/mblur.c: fixed range check of blur type
	parameter (bug #142965).
2004-05-24 13:50:54 +00:00
Sven Neumann
4df9d2856f added lt.po (Lithuanian).
2004-05-24  Sven Neumann  <sven@gimp.org>

        * Makefile.am (tips_POFILES): added lt.po (Lithuanian).
2004-05-24 13:05:21 +00:00
Sven Neumann
7e9b407fff Applied a patch from Philip Lafleur (bug #142808):
2004-05-24  Sven Neumann  <sven@gimp.org>

	Applied a patch from Philip Lafleur (bug #142808):

	* app/paint/gimppaintcore.h: define PRESSURE_SCALE to 1.5

	* app/paint/gimpairbrush.c
	* app/paint/gimpclone.c
	* app/paint/gimpconvolve.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimperaser.c
	* app/paint/gimppaintbrush.c
	* app/paint/gimpsmudge.c: use the PRESSURE_SCALE constant.
2004-05-24 13:01:16 +00:00
Zygimantas Berucka
35c9058ef9 Updated Lithuanian translation.
2004-05-24  Zygimantas Berucka  <uid0@akl.lt>

	* lt.po: Updated Lithuanian translation.
2004-05-24 12:24:13 +00:00
Sven Neumann
39adf33de4 added "lt" (Lithuanian) to ALL_LINGUAS.
2004-05-24  Sven Neumann  <sven@gimp.org>

	* configure.in: added "lt" (Lithuanian) to ALL_LINGUAS.
2004-05-24 06:49:16 +00:00
Zygimantas Berucka
0e8e9434de Updated Lithuanian translation.
2004-05-24  Zygimantas Berucka  <uid0@akl.lt>

	* lt.po: Updated Lithuanian translation.
2004-05-24 06:29:28 +00:00
Zygimantas Berucka
791eb8e03d Updated Lithuanian translation.
2004-05-24  Zygimantas Berucka  <uid0@akl.lt>

	* lt.po: Updated Lithuanian translation.
2004-05-24 05:20:23 +00:00
Sven Neumann
4624b2875e More fixes for bug #142996, merged from HEAD branch:
2004-05-23  Sven Neumann  <sven@gimp.org>

	More fixes for bug #142996, merged from HEAD branch:

	* plug-ins/common/postscript.c
	* plug-ins/common/sparkle.c
	* plug-ins/common/sunras.c
	* plug-ins/common/uniteditor.c
	* plug-ins/fits/fits.c: fixed typos.
2004-05-23 21:13:46 +00:00
Sven Neumann
613ff5f97d Fixes for bug #142996, merged from HEAD branch:
2004-05-23  Sven Neumann  <sven@gimp.org>

	Fixes for bug #142996, merged from HEAD branch:

	* app/gui/preferences-dialog.c: added missing gettext call.

	* app/config/gimprc-blurbs.h
	* app/core/gimptemplate.c
	* app/gui/gradient-editor-menu.c: fixed typos.
2004-05-23 21:03:18 +00:00
Andras Timar
50cfa04608 Updated Hungarian translation.
2004-05-23  Andras Timar  <timar@gnome.hu>

	* hu.po: Updated Hungarian translation.
2004-05-23 15:55:17 +00:00
Henrik Brix Andersen
0733f8f318 added plug-ins/MapObject/mapobject_apply.c and plug-ins/maze/maze.h. Fixes
2004-05-23 Henrik Brix Andersen <brix@gimp.org>

* po-plugins/POTFILES.in: added plug-ins/MapObject/mapobject_apply.c
and plug-ins/maze/maze.h. Fixes part of bug #142996, merged from HEAD
branch

* app/config/gimprc-blurbs.h
* plug-ins/gfig/gfig-spiral.c (spiral_button_press)
* plug-ins/gimpressionist/orientation.c (create_orientationpage)
* plug-ins/common/diffraction.c (diffraction_dialog)
* plug-ins/common/bumpmap.c (bumpmap_dialog)
* plug-ins/maze/maze.h
* plug-ins/MapObject/mapobject_apply.c (compute_image)
* app/tools/gimpmeasuretool.c (gimp_measure_tool_dialog_update)
* plug-ins/print/gimp_main_window.c (create_scaling_frame): marked
strings for translation, corrected small typos. Fixes part of bug
#142996, merged from HEAD branch
2004-05-23 12:46:26 +00:00
Sven Neumann
d2f6d4a00d better fix for bug #123811, merged from HEAD branch.
2004-05-21  Sven Neumann  <sven@gimp.org>

	* app/paint/gimppaintcore.c (gimp_paint_core_interpolate): better
	fix for bug #123811, merged from HEAD branch.
2004-05-21 15:24:42 +00:00
Michael Natterer
b81f01bb1c delete the data only if "OK" was pressed.
2004-05-21  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdatafactoryview.c
	(gimp_data_factory_view_delete_callback): delete the data
	only if "OK" was pressed.
2004-05-20 22:38:13 +00:00
Andras Timar
a0c4eeba91 Updated Hungarian translation.
2004-05-20  Andras Timar  <timar@gnome.hu>

	* hu.po: Updated Hungarian translation.
2004-05-20 12:32:45 +00:00
Manish Singh
d32465a9ee vte sucks 2004-05-20 02:35:45 +00:00
Manish Singh
625285b3f3 Actually return values from the run function. Fixes #141338.
2004-05-19  Manish Singh  <yosh@gimp.org>

        * plug-ins/pygimp/gimpfu.py: Actually return values from the run
        function. Fixes #141338.
2004-05-20 02:29:10 +00:00
Sven Neumann
672446e942 make sure that pressure never becomes negative. Fix for bug #123811,
2004-05-19  Sven Neumann  <sven@gimp.org>

	* app/paint/gimppaintcore.c (gimp_paint_core_interpolate): make
	sure that pressure never becomes negative. Fix for bug #123811,
	merged from HEAD branch.
2004-05-19 10:33:25 +00:00
Sven Neumann
045ed12dd7 fixed wrong use of layer ID; bug #142326, merged from HEAD.
2004-05-16  Sven Neumann  <sven@gimp.org>

	* plug-ins/script-fu/scripts/old-photo.scm: fixed wrong use of
	layer ID; bug #142326, merged from HEAD.
2004-05-16 12:05:27 +00:00
Sven Neumann
a47a313ab9 fixed position of vertical line indicating the picked color. Patch from
2004-05-15  Sven Neumann  <sven@gimp.org>

	* app/tools/gimpcurvestool.c: fixed position of vertical line
	indicating the picked color. Patch from William Skaggs and
	Søren Wedel Nielsen, merged from HEAD branch. Fixes bug #142506.
2004-05-15 13:11:24 +00:00
Sven Neumann
7521daf101 merged fix for bug #142400 from HEAD branch.
2004-05-13  Sven Neumann  <sven@gimp.org>

	* de.po: merged fix for bug #142400 from HEAD branch.
2004-05-13 10:50:46 +00:00
Francisco Javier F. Serrador
4a76803b9f Updated Spanish translation.
2004-05-13  Francisco Javier F. Serrador  <serrador@cvs.gnome.org>

	* es.po: Updated Spanish translation.
2004-05-12 23:16:55 +00:00
Andras Timar
99da037ae1 Updated Hungarian translation.
2004-05-12  Andras Timar  <timar@gnome.hu>

	* hu.po: Updated Hungarian translation.
2004-05-12 05:40:31 +00:00
Karl Eichwalder
0f83882af0 update 2004-05-11 19:42:49 +00:00
Karl Eichwalder
05da001ea9 Update. 2004-05-11 18:33:26 +00:00
Karl Eichwalder
b42a1a166f fix spelling 2004-05-11 18:09:54 +00:00
Sven Neumann
714d766264 fixed spelling, merge from HEAD.
2004-05-11  Sven Neumann  <sven@gimp.org>

	* docs/gimptool.1.in: fixed spelling, merge from HEAD.
2004-05-11 15:05:56 +00:00
Samel Jn Gunnarsson
bfd6f1a3b8 Updated Icelandic translation by ki G. Karlsson <aki@akademia.is>
2004-05-10  Samel Jn Gunnarsson  <sammi@techattack.nu>

	* is.po: Updated Icelandic translation by
	ki G. Karlsson  <aki@akademia.is>
2004-05-10 22:24:04 +00:00
Andras Timar
f79b87130d Updated Hungarian translation.
2004-05-10  Andras Timar  <timar@gnome.hu>

	* hu.po: Updated Hungarian translation.
2004-05-10 19:45:31 +00:00
Sven Neumann
71eb1b5fe1 fixed size of colormap property. Fixes bug #142149; merged from HEAD
2004-05-10  Sven Neumann  <sven@gimp.org>

	* app/xcf/xcf-save.c (xcf_save_prop): fixed size of colormap
	property. Fixes bug #142149; merged from HEAD branch.
2004-05-10 18:45:20 +00:00
Sven Neumann
508e6a58a2 don't call gtk_widget_set_direction() on a non-existant widget. Fix for
2004-05-10  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimptexteditor.c (gimp_text_editor_set_direction):
	don't call gtk_widget_set_direction() on a non-existant widget.
	Fix for bug #141792, merged from HEAD branch.
2004-05-10 18:11:39 +00:00
Hans Breuer
ab60a34e23 $(FONTCONFIG_CFLAGS) app/composite/makefile.msc : don't build dll
2004-05-09  Hans Breuer  <hans@breuer.org>

	* app/makefile.msc : $(FONTCONFIG_CFLAGS)
	  app/composite/makefile.msc : don't build dll
	  app/modules/makefile.msc : ../app/gimp.lib is gone
	  plug-ins/makefile.msc : somehow the script-fu icon got lost
	  themes/default/images/makefile.msc : removed a bunch
	of stock images which are not used anymore.
	In general : make the whole build process work more out
	of the box ;-)

	* plug-ins/common/winclipboard.c : support gray images;
	fixes bug #141382

	* plug-ins/common/winprint.c : dito; fixes bug #141145
2004-05-09 21:49:58 +00:00
Manish Singh
dadc8e90ff Regenerated 2004-05-06 23:29:29 +00:00
Manish Singh
f6efb17480 Fix silly "Dodgebure" typo.
2004-05-06  Manish Singh  <yosh@gimp.org>

        * tools/pdbgen/pdb/paint_tools.pdb: Fix silly "Dodgebure" typo.
2004-05-06 23:23:01 +00:00
Sven Neumann
4fabadb473 Merged from HEAD branch:
2004-05-06  Sven Neumann  <sven@gimp.org>

	Merged from HEAD branch:

	* app/core/gimpdrawable-preview.c
	* app/core/gimpimage-projection.c: added sanity so we don't just
	plain crash when an indexed image doesn't have a colormap.

	* plug-ins/common/png.c: keep at least one entry in the colormap.
	Fixes bug #142029.
2004-05-06 20:20:02 +00:00
Sven Neumann
6e52ed12da fixed the fix 2004-05-06 14:33:23 +00:00
Sven Neumann
9b98d3c72d center the about dialog on the monitor, not on the screen. Fix for
2004-05-06  Sven Neumann  <sven@gimp.org>

	* app/gui/about-dialog.c: center the about dialog on the monitor,
	not on the screen. Fix for xinerama setups merged from HEAD branch.
2004-05-06 14:31:24 +00:00
Sven Neumann
293e291c5d removed copied files from stable branch 2004-05-05 17:10:10 +00:00
Michael Natterer
296e6d6f10 Fix bug #141719 (merged from HEAD):
2004-05-04  Michael Natterer  <mitch@gimp.org>

	Fix bug #141719 (merged from HEAD):

	* app/tools/gimpmovetool.c (gimp_move_tool_motion): use RINT()
	instead of ROUND() to round double coords to guide positions.

	* app/display/gimpdisplayshell-callbacks.c
	(gimp_display_shell_canvas_tool_events): pass RINT()-rounded
	coords to gimp_display_shell_update_cursor() instead of implicitly
	truncating by casting to int.
2004-05-04 13:14:19 +00:00
Francisco Javier F. Serrador
0b6ee206e2 Updated Spanish translation.
2004-05-04  Francisco Javier F. Serrador  <serrador@cvs.gnome.org>

	* es.po: Updated Spanish translation.
2004-05-04 12:10:00 +00:00
Miloslav Trmac
99bd9146db Updated Czech translation.
2004-05-04  Miloslav Trmac  <mitr@volny.cz>

	* cs.po: Updated Czech translation.
2004-05-04 10:31:21 +00:00
Gareth Owen
9d89216dae Updated British English translation 2004-05-04 01:34:56 +00:00
Andras Timar
b8c901720e Updated Hungarian translation.
2004-05-03  Andras Timar  <timar@gnome.hu>

	* hu.po: Updated Hungarian translation.
2004-05-03 12:11:16 +00:00
Sven Neumann
c655deecd3 added missing file.
2004-05-03  Sven Neumann  <sven@gimp.org>

        * POTFILES.in: added missing file.

        * de.po: minor update.
2004-05-03 10:27:16 +00:00
Sigurd Gartmann
821ea3b629 Updated Norwegian Bokmål translation
2004-05-03  Sigurd Gartmann  <sigurd-translate@brogar.org>

	* no.po: Updated Norwegian Bokmål translation
2004-05-03 09:18:21 +00:00
Gareth Owen
e7f0f1f152 Updated British English translation 2004-05-02 20:21:04 +00:00
Pedro Gimeno
4d2926583e Cleanups. (gimp_rect_select_tool_coords_to_integer): Undo my bogus fix for
2004-04-30  Pedro Gimeno  <pggimeno@wanadoo.es>

	* app/tools/gimprectselecttool.c: Cleanups.
	(gimp_rect_select_tool_coords_to_integer): Undo my bogus fix for
	bug #138103, which led to bug #140649.

	* app/pdb/procedural_db.c (procedural_db_init_procs): Add missing
	compat procs: gimp_channel_ops_duplicate, gimp_channel_ops_offset.
2004-04-30 19:07:28 +00:00
Manish Singh
a3a0f02d62 Quick fix to make uppercase tags work properly.
2004-04-29  Manish Singh  <yosh@gimp.org>

        * plug-ins/pygimp/plug-ins/py-slice.py: Quick fix to make uppercase
        tags work properly.
2004-04-29 16:10:55 +00:00
Andras Timar
fe82ee534a Updated Hungarian translation.
2004-04-29  Andras Timar  <timar@gnome.hu>

	* hu.po: Updated Hungarian translation.
2004-04-29 15:16:12 +00:00
Andras Timar
03267b6bf7 Updated Hungarian translation.
2004-04-27  Andras Timar  <timar@gnome.hu>

	* hu.po: Updated Hungarian translation.
2004-04-27 15:16:50 +00:00
Artur Flinta
ea3de9ec90 Updated Polish translation by GNOME PL Team.
2004-04-26  Artur Flinta  <aflinta@cvs.gnome.org>

	* pl.po: Updated Polish translation by GNOME PL Team.
2004-04-26 10:29:24 +00:00
Adam Weinberger
59aee53c95 Updated Canadian English translation.
* en_CA.po: Updated Canadian English translation.
2004-04-26 04:15:27 +00:00
Christophe Merlet
d22bdef154 Updated French translation. 2004-04-24 18:16:13 +00:00
Adam Weinberger
4ccfc53f18 Updated Canadian English translation.
* po/en_CA.po
	  po-script-fu/en_CA.po:

	  Updated Canadian English translation.
2004-04-22 16:18:10 +00:00
Sigurd Gartmann
b700e1df7e Updatet Norwegian Bokmål translation (Work by Runar Ingebrigtsen)
2004-04-22  Sigurd Gartmann  <sigurd-translate@brogar.org>

	    * no.po: Updatet Norwegian Bokmål translation (Work by Runar Ingebrigtsen)
2004-04-22 08:54:20 +00:00
Sven Neumann
55cffe4cc2 removed color cast.
2004-04-20  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/fileops.pdb (file_load_thumbnail): removed
	color cast.

	* app/pdb/fileops_cmds.c: regenerated.
2004-04-20 22:02:04 +00:00
Sven Neumann
886736908c removed moved files from stable branch 2004-04-20 21:59:39 +00:00
Miloslav Trmac
d1a7457ce4 Updated Czech translation.
2004-04-20  Miloslav Trmac  <mitr@volny.cz>

	* cs.po: Updated Czech translation.
2004-04-20 18:42:07 +00:00
Updated ja.po. T.Aihana
c08be65eba 2004-04-21 Updated ja.po. T.Aihana <aihana@gnome.gr.jp> 2004-04-20 14:59:04 +00:00
Sven Neumann
a8ed12422f check tile != NULL before unrefing it. Fixes bug #140554.
2004-04-20  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/iwarp.c (iwarp_get_pixel): check tile != NULL
	before unrefing it. Fixes bug #140554.
2004-04-20 10:16:57 +00:00
Sven Neumann
3f62397fe5 ignore gimp-intl.h. app-docs.sgml updated.
2004-04-19  Sven Neumann  <sven@gimp.org>

	* Makefile.am: ignore gimp-intl.h.
	* app-docs.sgml
	* app-sections.txt: updated.
2004-04-19 16:34:41 +00:00
Henrik Brix Andersen
03d37bb56c removed double linebreak from my last commit 2004-04-19 09:11:23 +00:00
Henrik Brix Andersen
524ac4c735 plug-ins/script-fu/scripts/gimp-headers.scm applied a patch from William
2004-04-19 Henrik Brix Andersen <brix@gimp.org>

* plug-ins/script-fu/scripts/gimp-headers.scm
* plug-ins/script-fu/scripts/gimp-labels.scm: applied a patch from
William Skaggs which changes the sub menu title for the gimp web
theme to classic.gimp.org. Fixes bug #137036.
2004-04-19 08:59:57 +00:00
Henrik Brix Andersen
337e390cc1 use g_signal_connect_object() instead of g_signal_connect(). Fixes bug
2004-04-18 Henrik Brix Andersen <brix@gimp.org>

* app/widgets/gimptemplateeditor.c
(gimp_template_editor_constructor): use g_signal_connect_object()
instead of g_signal_connect(). Fixes bug #140315.
2004-04-18 20:44:15 +00:00
Artur Flinta
2d3efafc3d Updated Polish translation by GNOME PL Team.
2004-04-18  Artur Flinta  <aflinta@cvs.gnome.org>

	* pl.po: Updated Polish translation by GNOME PL Team.
2004-04-18 20:20:25 +00:00
Pedro Gimeno
a7e0791d49 Fix a condition which was preventing GRAYA images from loading.
2004-04-18  Pedro Gimeno  <pggimeno@wanadoo.es>

	* plug-ins/common/tga.c (load_image): Fix a condition which was
	preventing GRAYA images from loading.
2004-04-18 18:55:48 +00:00
Sven Neumann
d0d8a8eec4 replaced wrong use of gimp_option_menu with gimp_int_option_menu; merged
2004-04-18  Sven Neumann  <sven@gimp.org>

	* plug-ins/print/gimp_main_window.c: replaced wrong use of
	gimp_option_menu with gimp_int_option_menu; merged from HEAD.
2004-04-17 23:35:09 +00:00
Miloslav Trmac
65c516230a Updated Czech translation.
2004-04-17  Miloslav Trmac  <mitr@volny.cz>

	* cs.po: Updated Czech translation.
2004-04-17 15:18:08 +00:00
Henrik Brix Andersen
1560d22da1 resolved conflicting mnemonic. Fixes bug #139868.
2004-04-17 Henrik Brix Andersen <brix@gimp.org>

* app/tools/gimphuesaturationtool.c
(gimp_hue_saturation_tool_dialog): resolved conflicting
mnemonic. Fixes bug #139868.
2004-04-17 02:06:40 +00:00
Adam Weinberger
4239bfc441 po-plug-ins/en_CA.po: tips/en_CA.po:
* po/en_CA.po:
	  po-plug-ins/en_CA.po:
	  tips/en_CA.po:

	  Updated Canadian English translation.
2004-04-17 00:58:48 +00:00
Henrik Brix Andersen
851d1a9520 live preview doesn't modify the undo history of the image anymore, label
2004-04-17 Henrik Brix Andersen <brix@gimp.org>

* plug-ins/common/jpeg.c (save_dialog): live preview doesn't
modify the undo history of the image anymore, label changed
accordingly. Fixes bug #140296.
2004-04-17 00:14:53 +00:00
Pedro Gimeno
0fa3ff9d4c changed a call to gimp_image_undo_enable to _undo_disable which was
2004-04-16  Pedro Gimeno  <pggimeno@wanadoo.es>

	* plug-ins/common/tile.c (tile): changed a call to
	gimp_image_undo_enable to _undo_disable which was obviously the
	intention of the author. Added a call to gimp_drawable_update to
	get the previews refreshed.
2004-04-16 17:51:34 +00:00
Maxim Dziumanenko
2124a4fbf0 Updated Ukrainian translation.
2004-04-16  Maxim Dziumanenko <mvd@mylinux.com.ua>

	* Updated Ukrainian translation.
2004-04-16 17:23:23 +00:00
Sven Neumann
225412d37a app/tools/gimpcolorpickertool.c don't use gtk_window_present() to raise
2004-04-16  Sven Neumann  <sven@gimp.org>

	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpmeasuretool.c: don't use gtk_window_present() to
	raise the tool dialog since it also moves the focus away from the
	image window. Fixes the problem described in bug #139349.
2004-04-16 13:53:51 +00:00
Sven Neumann
e3fe4cebe1 present the help browser window (merged from HEAD).
2004-04-16  Sven Neumann  <sven@gimp.org>

	* plug-ins/helpbrowser/dialog.c (browser_dialog_load): present the
	help browser window (merged from HEAD).
2004-04-16 13:21:53 +00:00
Tor Lillqvist
7887463a89 app/plug-in/plug-in-message.c (plug_in_handle_proc_install)
2004-04-15  Tor Lillqvist  <tml@iki.fi>

	* app/plug-in/plug-in-message.c (plug_in_handle_proc_install)
	* app/plug-in/plug-in-proc.h (struct _PlugInProcDef)
	* app/plug-in/plug-in-rc.c (plug_in_rc_write)
	* app/plug-in/plug-ins.c (plug_ins_init): Make PDB procedures
	(including their menu entries) installed during a plug-ins init()
	phase show up. Add a flag to PlugInProcDef that tells whether the
	proc was installed during the init() phase. Such procs aren't
	saved to the pluginrc. Move the code that initializes plug-ins
	that need initialization earlier, before the procs are added to
	the PDB and menus are built. Fixes bug #139969.
2004-04-15 22:05:51 +00:00
Tor Lillqvist
389a2bcae4 For Win32, Install gimpthumb.def, like the .def files of the other
2004-04-15  Tor Lillqvist  <tml@iki.fi>

	* libgimpthumb/Makefile.am: For Win32, Install gimpthumb.def, like
	the .def files of the other libgimp* libs.

	* app/Makefile.am (INCLUDES): Add PANGOFT2_CFLAGS.

	* gimp-zip.in: Put also libgimpthumb in the developer package.
2004-04-15 21:02:16 +00:00
Miloslav Trmac
1f1d7138f8 Updated Czech translation.
2004-04-15  Miloslav Trmac  <mitr@volny.cz>

	* cs.po: Updated Czech translation.
2004-04-15 14:27:20 +00:00
Sven Neumann
1e924e17b3 fixed declaration of initial_region() (bug #140115).
2004-04-15  Sven Neumann  <sven@gimp.org>

	* app/paint-funcs/paint-funcs.h: fixed declaration of
	initial_region() (bug #140115).
2004-04-15 12:42:07 +00:00
Sven Neumann
28f45f97ec fixed typo (bug #140039).
2004-04-14  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/film.c: fixed typo (bug #140039).
2004-04-14 15:11:34 +00:00
411 changed files with 35620 additions and 63082 deletions

399
ChangeLog
View File

@@ -1,3 +1,402 @@
2004-06-15 Sven Neumann <sven@gimp.org>
* Made 2.0.2 release.
2004-06-15 Philip Lafleur <plafleur@cvs.gnome.org>
* app/core/gimpdrawable-transform.c
(gimp_drawable_transform_tiles_affine): Don't round texture
coordinates when not using interpolation. Fixes bug #144352 for
the nearest neighbor case only. Merged from HEAD.
2004-06-15 Sven Neumann <sven@gimp.org>
* plug-ins/common/mng.c (respin_cmap): applied the fix for empty
colormaps (bug #143009) here as well. Merged from HEAD branch.
2004-06-15 Sven Neumann <sven@gimp.org>
* configure.in: bumped version number to 2.0.2, interface_age 2,
binary_age 2.
2004-06-14 Henrik Brix Andersen <brix@gimp.org>
* app/plug-in/plug-in-run.c: let extensions run synchronously when
called via PDB. Fixes bug #140112. Merged from HEAD.
2004-06-13 Manish Singh <yosh@gimp.org>
* configure.in: Make sure PangoFT2 is using a recent enough fontconfig
since many people have broken and confused setups.
2004-06-13 Manish Singh <yosh@gimp.org>
* app/base/cpu-accel.c: Reorged, to address bug #142907 and
bug #143069. Accel implementations #define HAVE_ACCEL, and cpu_accel()
keys on that. Both PPC and X86 implementations check for __GNUC__.
X86 stuff is only used with USE_MMX is defined. The SSE OS check
is now checked in arch_accel(), not cpu_accel(). Finally, the
arch x86_64 checks now are EM64T aware (which didn't matter in
practice).
2004-06-07 Michael Natterer <mitch@gimp.org>
Merged from HEAD:
* app/core/gimplayer.c (gimp_layer_set_tiles): don't set
layer->mask's offsets. It is wrong because GimpDrawable::set_tiles()
is a lowlevel function which is used by stuff like scale and
resize which keep the mask in sync explicitely and don't expect it
to be moved in the middle of chaining up. Fixes bug #143860.
2004-06-07 Sven Neumann <sven@gimp.org>
* plug-ins/common/blur.c: fixed typo that caused corruption of
first row. Spotted by William Skaggs, bug #142318.
2004-06-05 Sven Neumann <sven@gimp.org>
* plug-ins/common/curve_bend.c: applied a patch from Henrik Brix
Andersen that tells the user that Curve Bend cannot operate on
layers with masks instead of silently applying the mask
(bug #134748).
2004-06-05 Sven Neumann <sven@gimp.org>
* plug-ins/sgi/sgi.c: merged a patch from Philip Lafleur that
makes the plug-in handle images with more than 4 channels. At the
moment the extra information is discarded (bug #143673).
2004-06-05 Sven Neumann <sven@gimp.org>
* plug-ins/common/tiff.c: save the proper value for type of alpha
channel. Fixes bug #143522; patch by Philip Lafleur merged from
HEAD branch.
2004-06-05 Sven Neumann <sven@gimp.org>
* app/text/gimptext-bitmap.c (gimp_text_render_bitmap): removed a
redundant transformation (merged from HEAD branch).
2004-06-04 Sven Neumann <sven@gimp.org>
* app/widgets/gimptexteditor.c (gimp_text_editor_new): set the
focus on the text area (merged from HEAD branch).
2004-06-04 Sven Neumann <sven@gimp.org>
* app/tools/gimptexttool.c (gimp_text_tool_class_init): allow to
move a text layer using the cursor keys (merged from HEAD branch).
2004-06-04 Sven Neumann <sven@gimp.org>
* app/paint/gimppaintoptions.c (DEFAULT_PRESSURE_PRESSURE):
applied a patch by Philip Lafleur that changes the default to
FALSE. Fixes bug #143626; merged from HEAD branch.
2004-06-02 Sven Neumann <sven@gimp.org>
* INSTALL: suggest to use gimp-print 4.2.7-pre1 in case of problems
(see bug #138273).
2004-06-01 Sven Neumann <sven@gimp.org>
* plug-ins/common/tiff.c: don't call gtk_entry_set_text() with a
NULL text. Merged from HEAD branch.
2004-05-29 Sven Neumann <sven@gimp.org>
* app/widgets/gimpfiledialog.[ch]: reset the file type menu to "By
Extension". Based on a patch from Philip Lafleur (bug #141535).
2004-05-29 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/layer.pdb
* app/pdb/layer_cmds.c
* libgimp/gimplayer_pdb.c: fixed documentation for gimp_resize_layer.
Patch provided by Philip Lafleur (bug #142618, merged from HEAD).
2004-05-27 Sven Neumann <sven@gimp.org>
* plug-ins/common/png.c (respin_cmap): handle an empty colormap.
Fixes bug #143009, merged from HEAD branch.
2004-05-27 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimppickbutton.c: applied patch from Philip
Lafleur that fixes color picking for XInput devices (bug #143166).
2004-05-27 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-draw.c
(gimp_display_shell_draw_grid): fixed handling of grid offsets in
the grid drawing routine. Merged from HEAD.
2004-05-26 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/scripts/Makefile.am: do not install
test-sphere.scm in the stable branch.
2004-05-24 Sven Neumann <sven@gimp.org>
* plug-ins/common/mblur.c: fixed range check of blur type
parameter (bug #142965, merged from HEAD branch).
2004-05-24 Sven Neumann <sven@gimp.org>
Applied a patch from Philip Lafleur (bug #142808):
* app/paint/gimppaintcore.h: define PRESSURE_SCALE to 1.5
* app/paint/gimpairbrush.c
* app/paint/gimpclone.c
* app/paint/gimpconvolve.c
* app/paint/gimpdodgeburn.c
* app/paint/gimperaser.c
* app/paint/gimppaintbrush.c
* app/paint/gimpsmudge.c: use the PRESSURE_SCALE constant.
2004-05-24 Sven Neumann <sven@gimp.org>
* configure.in: added "lt" (Lithuanian) to ALL_LINGUAS.
2004-05-23 Sven Neumann <sven@gimp.org>
More fixes for bug #142996, merged from HEAD branch:
* plug-ins/common/postscript.c
* plug-ins/common/sparkle.c
* plug-ins/common/sunras.c
* plug-ins/common/uniteditor.c
* plug-ins/fits/fits.c: fixed typos.
2004-05-23 Sven Neumann <sven@gimp.org>
Fixes for bug #142996, merged from HEAD branch:
* app/gui/preferences-dialog.c: added missing gettext call.
* app/config/gimprc-blurbs.h
* app/core/gimptemplate.c
* app/gui/gradient-editor-menu.c: fixed typos.
2004-05-23 Henrik Brix Andersen <brix@gimp.org>
* app/config/gimprc-blurbs.h
* plug-ins/gfig/gfig-spiral.c (spiral_button_press)
* plug-ins/gimpressionist/orientation.c (create_orientationpage)
* plug-ins/common/diffraction.c (diffraction_dialog)
* plug-ins/common/bumpmap.c (bumpmap_dialog)
* plug-ins/maze/maze.h
* plug-ins/MapObject/mapobject_apply.c (compute_image)
* app/tools/gimpmeasuretool.c (gimp_measure_tool_dialog_update)
* plug-ins/print/gimp_main_window.c (create_scaling_frame): marked
strings for translation, corrected small typos. Fixes part of bug
#142996, merged from HEAD branch.
2004-05-21 Sven Neumann <sven@gimp.org>
* app/paint/gimppaintcore.c (gimp_paint_core_interpolate): better
fix for bug #123811, merged from HEAD branch.
2004-05-21 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdatafactoryview.c
(gimp_data_factory_view_delete_callback): delete the data
only if "OK" was pressed.
2004-05-19 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/gimpfu.py: Actually return values from the run
function. Fixes #141338.
2004-05-19 Sven Neumann <sven@gimp.org>
* app/paint/gimppaintcore.c (gimp_paint_core_interpolate): make
sure that pressure never becomes negative. Fix for bug #123811,
merged from HEAD branch.
2004-05-16 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/scripts/old-photo.scm: fixed wrong use of
layer ID; bug #142326, merged from HEAD.
2004-05-15 Sven Neumann <sven@gimp.org>
* app/tools/gimpcurvestool.c: fixed position of vertical line
indicating the picked color. Patch from William Skaggs and
Søren Wedel Nielsen, merged from HEAD branch. Fixes bug #142506.
2004-05-11 Sven Neumann <sven@gimp.org>
* docs/gimptool.1.in: fixed spelling, merge from HEAD.
2004-05-10 Sven Neumann <sven@gimp.org>
* app/xcf/xcf-save.c (xcf_save_prop): fixed size of colormap
property. Fixes bug #142149; merged from HEAD branch.
2004-05-10 Sven Neumann <sven@gimp.org>
* app/widgets/gimptexteditor.c (gimp_text_editor_set_direction):
don't call gtk_widget_set_direction() on a non-existant widget.
Fix for bug #141792, merged from HEAD branch.
2004-05-09 Hans Breuer <hans@breuer.org>
* app/makefile.msc : $(FONTCONFIG_CFLAGS)
app/composite/makefile.msc : don't build dll
app/modules/makefile.msc : ../app/gimp.lib is gone
plug-ins/makefile.msc : somehow the script-fu icon got lost
themes/default/images/makefile.msc : removed a bunch
of stock images which are not used anymore.
In general : make the whole build process work more out
of the box ;-)
* plug-ins/common/winclipboard.c : support gray images;
fixes bug #141382
* plug-ins/common/winprint.c : dito; fixes bug #141145
2004-05-06 Manish Singh <yosh@gimp.org>
* tools/pdbgen/pdb/paint_tools.pdb: Fix silly "Dodgebure" typo.
2004-05-06 Sven Neumann <sven@gimp.org>
* app/core/gimpdrawable-preview.c
* app/core/gimpimage-projection.c: added sanity so we don't just
plain crash when an indexed image doesn't have a colormap.
* plug-ins/common/png.c: keep at least one entry in the colormap.
Fixes bug #142029.
2004-05-06 Sven Neumann <sven@gimp.org>
* app/gui/about-dialog.c: center the about dialog on the monitor,
not on the screen. Fix for xinerama setups merged from HEAD branch.
2004-05-04 Michael Natterer <mitch@gimp.org>
Fix bug #141719 (merged from HEAD):
* app/tools/gimpmovetool.c (gimp_move_tool_motion): use RINT()
instead of ROUND() to round double coords to guide positions.
* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_canvas_tool_events): pass RINT()-rounded
coords to gimp_display_shell_update_cursor() instead of implicitly
truncating by casting to int.
2004-04-30 Pedro Gimeno <pggimeno@wanadoo.es>
* app/tools/gimprectselecttool.c: Cleanups.
(gimp_rect_select_tool_coords_to_integer): Undo my bogus fix for
bug #138103, which led to bug #140649.
* app/pdb/procedural_db.c (procedural_db_init_procs): Add missing
compat procs: gimp_channel_ops_duplicate, gimp_channel_ops_offset.
2004-04-29 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/plug-ins/py-slice.py: Quick fix to make uppercase
tags work properly.
2004-04-20 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/fileops.pdb (file_load_thumbnail): removed
color cast.
* app/pdb/fileops_cmds.c: regenerated.
2004-04-20 Sven Neumann <sven@gimp.org>
* plug-ins/common/iwarp.c (iwarp_get_pixel): check tile != NULL
before unrefing it. Fixes bug #140554.
2004-04-19 Henrik Brix Andersen <brix@gimp.org>
* plug-ins/script-fu/scripts/gimp-headers.scm
* plug-ins/script-fu/scripts/gimp-labels.scm: applied a patch from
William Skaggs which changes the sub menu title for the gimp web
theme to classic.gimp.org. Fixes bug #137036.
2004-04-18 Henrik Brix Andersen <brix@gimp.org>
* app/widgets/gimptemplateeditor.c
(gimp_template_editor_constructor): use g_signal_connect_object()
instead of g_signal_connect(). Fixes bug #140315.
2004-04-18 Pedro Gimeno <pggimeno@wanadoo.es>
* plug-ins/common/tga.c (load_image): Fix a condition which was
preventing GRAYA images from loading.
2004-04-18 Sven Neumann <sven@gimp.org>
* plug-ins/print/gimp_main_window.c: replaced wrong use of
gimp_option_menu with gimp_int_option_menu; merged from HEAD.
2004-04-17 Henrik Brix Andersen <brix@gimp.org>
* app/tools/gimphuesaturationtool.c
(gimp_hue_saturation_tool_dialog): resolved conflicting
mnemonic. Fixes bug #139868.
2004-04-17 Henrik Brix Andersen <brix@gimp.org>
* plug-ins/common/jpeg.c (save_dialog): live preview doesn't
modify the undo history of the image anymore, label changed
accordingly. Fixes bug #140296.
2004-04-16 Pedro Gimeno <pggimeno@wanadoo.es>
* plug-ins/common/tile.c (tile): changed a call to
gimp_image_undo_enable to _undo_disable which was obviously the
intention of the author. Added a call to gimp_drawable_update to
get the previews refreshed.
2004-04-16 Sven Neumann <sven@gimp.org>
* app/tools/gimpcolorpickertool.c
* app/tools/gimpmeasuretool.c: don't use gtk_window_present() to
raise the tool dialog since it also moves the focus away from the
image window. Fixes the problem described in bug #139349.
2004-04-16 Sven Neumann <sven@gimp.org>
* plug-ins/helpbrowser/dialog.c (browser_dialog_load): present the
help browser window (merged from HEAD).
2004-04-15 Tor Lillqvist <tml@iki.fi>
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install)
* app/plug-in/plug-in-proc.h (struct _PlugInProcDef)
* app/plug-in/plug-in-rc.c (plug_in_rc_write)
* app/plug-in/plug-ins.c (plug_ins_init): Make PDB procedures
(including their menu entries) installed during a plug-ins init()
phase show up. Add a flag to PlugInProcDef that tells whether the
proc was installed during the init() phase. Such procs aren't
saved to the pluginrc. Move the code that initializes plug-ins
that need initialization earlier, before the procs are added to
the PDB and menus are built. Fixes bug #139969.
* libgimpthumb/Makefile.am: For Win32, install gimpthumb.def, like
the .def files of the other libgimp* libs.
* app/Makefile.am (INCLUDES): Add PANGOFT2_CFLAGS.
* gimp-zip.in: Put also libgimpthumb in the developer package.
2004-04-15 Sven Neumann <sven@gimp.org>
* app/paint-funcs/paint-funcs.h: fixed declaration of
initial_region() (bug #140115).
2004-04-14 Sven Neumann <sven@gimp.org>
* plug-ins/common/film.c: fixed typo (bug #140039).
2004-04-14 Sven Neumann <sven@gimp.org>
* Made 2.0.1 release.

View File

@@ -26338,7 +26338,7 @@
* themes/Default/images/stock-eye-12.png: sharp icons
2003-03-21 Manish Singh <yosh@gimp.org>
* plug-ins/common/ps.c: always quote the filename, since system/popen
uses the shell. Also, never quote the filename if we are reading from
a parameter file (only in the win32 case). Fixes #108648.
@@ -26346,7 +26346,7 @@
* plug-ins/dbbrowser/dbbrowser_utils.c: double click on a list item
files Apply, if applicable. Remove the existing model in the treeview
(which will deallocate it) instead of clearing it.
2003-03-22 Sven Neumann <sven@gimp.org>
* themes/Default/images/stock-channel-16.png
@@ -29666,7 +29666,7 @@
This byte --> <-- is the millionth in this file!
2003-02-05 Manish Singh <yosh@gimp.org>
* plug-ins/common/jpeg.c (run): if the quality level is close to zero
in non-interactive mode, use default settings. This is hack until
the PDB gets default arguments, so gimp-file-save works sanely with
@@ -30295,7 +30295,7 @@
inspired by GimpDrawTool. Not actually used by anything yet.
2003-01-29 Manish Singh <yosh@gimp.org>
* plug-ins/common/jpeg.c (load_image): don't divide by zero if
we get all zero resolution info when we load the jpeg.

View File

@@ -236,6 +236,10 @@ certain place, e.g. if you are working in a bash shell you would say:
export CPPFLAGS="-I<path_to_header_file> -I<path_to_another_one>"
before you run configure.
* If the check for gimpprint fails even though you have version 4.2.x
installed, please try the latest available 4.2 package (which is
gimp-print 4.2.7-pre1 at the time of this writing).
Generic Instructions for Building Auto-Configured Packages

29
NEWS
View File

@@ -6,6 +6,35 @@ here. New features are being added in the HEAD branch that is supposed
to be released as GIMP version 2.2 in a not too distant future.
Bugs fixed in GIMP 2.0.2
========================
- several build fixes (#140115, #142907, #143069)
- allow plug-ins to register menu entries from within init() (#139969)
- fixed focus issues with tool dialogs (#139349)
- allow to load grayscale TGA files
- a couple of string and i18n fixes (#140296, #140039, #137036, #142996)
- fixed crash in template editor (#140315)
- fixed crash in IWarp plug-in (#140554)
- fixed snap to guides (#140649)
- made the PNG plug-in handle empty colormaps (#142029)
- fixed bug in text editor dialog (#141792)
- fixed Old Photo script-fu (#142326)
- fixed glitch in the Curves tool dialog (#142506)
- don't allow tablet pressure to become negative (#123811)
- improved range of tablet pressure values (#142808)
- better defaults for tablet pressure (#143626)
- fixed use of screen color picker with XInput devices (#143166)
- actually return values from the run function of Python scripts (#141338)
- documentation fixes (#142618)
- fixed bug in the save routine of the TIFF plug-in (#143522)
- don't let Curve Bend silently apply the layer mask (#134748)
- fixed bug in Blur plug-in (#142318)
- fixed mask offsets after crop operations (#143860)
- let extensions run synchronously when called via PDB (#140112)
- updated (and some new) translations
Bugs fixed in GIMP 2.0.1
========================
- don't leak file descriptor for the POSIX shm implementation (Yosh)

View File

@@ -161,7 +161,7 @@ this one may not necessarily fit.
not one catalog but many. For a full translation of the GIMP's UI,
you will have to add translations for the following catalogs:
po/gimp20.po -- the core
po/gimp20.pot -- the core
po-libgimp/gimp20-libgimp.pot -- the libgimp library
po-plugins/gimp20-std-plugins.pot -- most of the plug-ins
po-script-fu/gimp20-script-fu.pot -- the script-fu scripts

View File

@@ -71,6 +71,7 @@ AM_CPPFLAGS = \
INCLUDES = \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
$(PANGOFT2_CFLAGS) \
-I$(includedir)
gimp_2_0_LDFLAGS = \

View File

@@ -1,68 +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 "gui-types.h"
#include "widgets/gimpbufferview.h"
#include "buffers-commands.h"
#include "gimp-intl.h"
/* public functionss */
void
buffers_paste_buffer_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpBufferView *view = GIMP_BUFFER_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->paste_button));
}
void
buffers_paste_buffer_into_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpBufferView *view = GIMP_BUFFER_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->paste_into_button));
}
void
buffers_paste_buffer_as_new_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpBufferView *view = GIMP_BUFFER_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->paste_as_new_button));
}
void
buffers_delete_buffer_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpBufferView *view = GIMP_BUFFER_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}

View File

@@ -1,33 +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.
*/
#ifndef __BUFFERS_COMMANDS_H__
#define __BUFFERS_COMMANDS_H__
void buffers_paste_buffer_cmd_callback (GtkWidget *widget,
gpointer data);
void buffers_paste_buffer_into_cmd_callback (GtkWidget *widget,
gpointer data);
void buffers_paste_buffer_as_new_cmd_callback (GtkWidget *widget,
gpointer data);
void buffers_delete_buffer_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __BUFFERS_COMMANDS_H__ */

View File

@@ -1,606 +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 <string.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpcomponenteditor.h"
#include "widgets/gimpdock.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemtreeview.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
#include "channels-commands.h"
#include "gimp-intl.h"
/* local function prototypes */
static void channels_opacity_update (GtkAdjustment *adjustment,
gpointer data);
static void channels_color_changed (GimpColorButton *button,
gpointer data);
#define return_if_no_image(gimage,data) \
if (GIMP_IS_DISPLAY (data)) \
gimage = ((GimpDisplay *) data)->gimage; \
else if (GIMP_IS_GIMP (data)) \
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gimage = gimp_context_get_image (((GimpDock *) data)->context); \
else if (GIMP_IS_COMPONENT_EDITOR (data)) \
gimage = ((GimpImageEditor *) data)->gimage; \
else if (GIMP_IS_ITEM_TREE_VIEW (data)) \
gimage = ((GimpItemTreeView *) data)->gimage; \
else \
gimage = NULL; \
\
if (! gimage) \
return
#define return_if_no_channel(gimage,channel,data) \
return_if_no_image (gimage,data); \
channel = gimp_image_get_active_channel (gimage); \
if (! channel) \
return
/* public functions */
void
channels_new_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
channels_new_channel_query (gimage, NULL, TRUE, widget);
}
void
channels_raise_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpChannel *active_channel;
return_if_no_channel (gimage, active_channel, data);
gimp_image_raise_channel (gimage, active_channel);
gimp_image_flush (gimage);
}
void
channels_lower_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpChannel *active_channel;
return_if_no_channel (gimage, active_channel, data);
gimp_image_lower_channel (gimage, active_channel);
gimp_image_flush (gimage);
}
void
channels_duplicate_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpChannel *new_channel;
if (GIMP_IS_COMPONENT_EDITOR (data))
{
GimpRGB color;
GimpChannelType component;
GEnumClass *enum_class;
GEnumValue *enum_value;
gchar *name;
return_if_no_image (gimage, data);
gimp_rgba_set (&color, 0, 0, 0, 0.5);
component = GIMP_COMPONENT_EDITOR (data)->clicked_component;
enum_class = g_type_class_ref (GIMP_TYPE_CHANNEL_TYPE);
enum_value = g_enum_get_value (enum_class, component);
g_type_class_unref (enum_class);
name = g_strdup_printf (_("%s Channel Copy"),
gettext (enum_value->value_name));
new_channel = gimp_channel_new_from_component (gimage, component,
name, &color);
/* copied components are invisible by default so subsequent copies
* of components don't affect each other
*/
gimp_item_set_visible (GIMP_ITEM (new_channel), FALSE, FALSE);
g_free (name);
}
else
{
GimpChannel *active_channel;
return_if_no_channel (gimage, active_channel, data);
new_channel =
GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (active_channel),
G_TYPE_FROM_INSTANCE (active_channel),
TRUE));
}
gimp_image_add_channel (gimage, new_channel, -1);
gimp_image_flush (gimage);
}
void
channels_delete_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpChannel *active_channel;
return_if_no_channel (gimage, active_channel, data);
gimp_image_remove_channel (gimage, active_channel);
gimp_image_flush (gimage);
}
void
channels_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpChannelOps op;
GimpImage *gimage;
op = (GimpChannelOps) action;
if (GIMP_IS_COMPONENT_EDITOR (data))
{
GimpChannelType component;
return_if_no_image (gimage, data);
component = GIMP_COMPONENT_EDITOR (data)->clicked_component;
gimp_channel_select_component (gimp_image_get_mask (gimage), component,
op, FALSE, 0.0, 0.0);
}
else
{
GimpChannel *channel;
return_if_no_channel (gimage, channel, data);
gimp_channel_select_channel (gimp_image_get_mask (gimage),
_("Channel to Selection"),
channel, 0, 0,
op, FALSE, 0.0, 0.0);
}
gimp_image_flush (gimage);
}
void
channels_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpChannel *active_channel;
return_if_no_channel (gimage, active_channel, data);
channels_edit_channel_query (active_channel, widget);
}
/**********************************/
/* The new channel query dialog */
/**********************************/
typedef struct _NewChannelOptions NewChannelOptions;
struct _NewChannelOptions
{
GtkWidget *query_box;
GtkWidget *name_entry;
GtkWidget *color_panel;
GimpImage *gimage;
};
static gchar *channel_name = NULL;
static GimpRGB channel_color = { 0.0, 0.0, 0.0, 0.5 };
static void
new_channel_query_response (GtkWidget *widget,
gint response_id,
NewChannelOptions *options)
{
if (response_id == GTK_RESPONSE_OK)
{
GimpChannel *new_channel;
GimpImage *gimage;
if (channel_name)
g_free (channel_name);
channel_name =
g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
if ((gimage = options->gimage))
{
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
&channel_color);
new_channel = gimp_channel_new (gimage, gimage->width, gimage->height,
channel_name,
&channel_color);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
gimp_get_user_context (gimage->gimp),
GIMP_TRANSPARENT_FILL);
gimp_image_add_channel (gimage, new_channel, -1);
gimp_image_flush (gimage);
}
}
gtk_widget_destroy (options->query_box);
}
void
channels_new_channel_query (GimpImage *gimage,
GimpChannel *template,
gboolean interactive,
GtkWidget *parent)
{
NewChannelOptions *options;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *table;
GtkObject *opacity_scale_data;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! template || GIMP_IS_CHANNEL (template));
if (template || ! interactive)
{
GimpChannel *new_channel;
gint width, height;
GimpRGB color;
if (template)
{
width = gimp_item_width (GIMP_ITEM (template));
height = gimp_item_height (GIMP_ITEM (template));
color = template->color;
}
else
{
width = gimp_image_get_width (gimage);
height = gimp_image_get_height (gimage);
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 0.5);
}
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
_("New Channel"));
new_channel = gimp_channel_new (gimage,
width, height,
_("Empty Channel"),
&color);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
gimp_get_user_context (gimage->gimp),
GIMP_TRANSPARENT_FILL);
gimp_image_add_channel (gimage, new_channel, -1);
gimp_image_undo_group_end (gimage);
return;
}
/* the new options structure */
options = g_new (NewChannelOptions, 1);
options->gimage = gimage;
options->color_panel = gimp_color_panel_new (_("New Channel Color"),
&channel_color,
GIMP_COLOR_AREA_LARGE_CHECKS,
48, 64);
gimp_color_panel_set_context (GIMP_COLOR_PANEL (options->color_panel),
gimp_get_user_context (gimage->gimp));
/* The dialog */
options->query_box =
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("New Channel"), "gimp-channel-new",
GIMP_STOCK_CHANNEL,
_("New Channel Options"),
parent,
gimp_standard_help_func,
GIMP_HELP_CHANNEL_NEW,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
g_signal_connect (options->query_box, "response",
G_CALLBACK (new_channel_query_response),
options);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
/* The table */
table = gtk_table_new (2, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
/* The name entry */
options->name_entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
(channel_name ? channel_name : _("New Channel")));
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Channel Name:"), 1.0, 0.5,
options->name_entry, 2, FALSE);
/* The opacity scale */
opacity_scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("Fill Opacity:"), 100, -1,
channel_color.a * 100.0,
0.0, 100.0, 1.0, 10.0, 1,
TRUE, 0.0, 0.0,
NULL, NULL);
g_signal_connect (opacity_scale_data, "value_changed",
G_CALLBACK (channels_opacity_update),
options->color_panel);
/* The color panel */
gtk_box_pack_start (GTK_BOX (hbox), options->color_panel,
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel);
g_signal_connect (options->color_panel, "color_changed",
G_CALLBACK (channels_color_changed),
opacity_scale_data);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
gtk_widget_show (options->query_box);
}
/****************************************/
/* The edit channel attributes dialog */
/****************************************/
typedef struct _EditChannelOptions EditChannelOptions;
struct _EditChannelOptions
{
GtkWidget *query_box;
GtkWidget *name_entry;
GtkWidget *color_panel;
GimpChannel *channel;
GimpImage *gimage;
};
static void
edit_channel_query_response (GtkWidget *widget,
gint response_id,
EditChannelOptions *options)
{
if (response_id == GTK_RESPONSE_OK)
{
GimpChannel *channel = options->channel;
if (options->gimage)
{
const gchar *new_name;
GimpRGB color;
gboolean name_changed = FALSE;
gboolean color_changed = FALSE;
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
&color);
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (channel))))
name_changed = TRUE;
if (gimp_rgba_distance (&color, &channel->color) > 0.0001)
color_changed = TRUE;
if (name_changed && color_changed)
gimp_image_undo_group_start (options->gimage,
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
_("Channel Attributes"));
if (name_changed)
gimp_item_rename (GIMP_ITEM (channel), new_name);
if (color_changed)
gimp_channel_set_color (channel, &color, TRUE);
if (name_changed && color_changed)
gimp_image_undo_group_end (options->gimage);
if (name_changed || color_changed)
gimp_image_flush (options->gimage);
}
}
gtk_widget_destroy (options->query_box);
}
void
channels_edit_channel_query (GimpChannel *channel,
GtkWidget *parent)
{
EditChannelOptions *options;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *table;
GtkObject *opacity_scale_data;
options = g_new0 (EditChannelOptions, 1);
options->channel = channel;
options->gimage = gimp_item_get_image (GIMP_ITEM (channel));
channel_color = channel->color;
options->color_panel = gimp_color_panel_new (_("Edit Channel Color"),
&channel_color,
GIMP_COLOR_AREA_LARGE_CHECKS,
48, 64);
gimp_color_panel_set_context (GIMP_COLOR_PANEL (options->color_panel),
gimp_get_user_context (options->gimage->gimp));
/* The dialog */
options->query_box =
gimp_viewable_dialog_new (GIMP_VIEWABLE (channel),
_("Channel Attributes"), "gimp-channel-edit",
GIMP_STOCK_EDIT,
_("Edit Channel Attributes"),
parent,
gimp_standard_help_func,
GIMP_HELP_CHANNEL_EDIT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
g_signal_connect (options->query_box, "response",
G_CALLBACK (edit_channel_query_response),
options);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
/* The table */
table = gtk_table_new (2, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
/* The name entry */
options->name_entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
gimp_object_get_name (GIMP_OBJECT (channel)));
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Channel Name:"), 1.0, 0.5,
options->name_entry, 2, FALSE);
/* The opacity scale */
opacity_scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("Fill Opacity:"), 100, -1,
channel_color.a * 100.0,
0.0, 100.0, 1.0, 10.0, 1,
TRUE, 0.0, 0.0,
NULL, NULL);
g_signal_connect (opacity_scale_data, "value_changed",
G_CALLBACK (channels_opacity_update),
options->color_panel);
/* The color panel */
gtk_box_pack_start (GTK_BOX (hbox), options->color_panel,
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel);
g_signal_connect (options->color_panel, "color_changed",
G_CALLBACK (channels_color_changed),
opacity_scale_data);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
gtk_widget_show (options->query_box);
}
/* private functions */
static void
channels_opacity_update (GtkAdjustment *adjustment,
gpointer data)
{
GimpRGB color;
gimp_color_button_get_color (GIMP_COLOR_BUTTON (data), &color);
gimp_rgb_set_alpha (&color, adjustment->value / 100.0);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (data), &color);
}
static void
channels_color_changed (GimpColorButton *button,
gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
GimpRGB color;
gimp_color_button_get_color (button, &color);
gtk_adjustment_set_value (adj, color.a * 100.0);
}

View File

@@ -1,47 +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.
*/
#ifndef __CHANNELS_COMMANDS_H__
#define __CHANNELS_COMMANDS_H__
void channels_new_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_raise_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_lower_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_duplicate_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_delete_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void channels_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_new_channel_query (GimpImage *gimage,
GimpChannel *template,
gboolean interactive,
GtkWidget *parent);
void channels_edit_channel_query (GimpChannel *channel,
GtkWidget *parent);
#endif /* __CHANNELS_COMMANDS_H__ */

View File

@@ -1,55 +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 "gui-types.h"
#include "widgets/gimpcolormapeditor.h"
#include "colormap-editor-commands.h"
/* public functions */
void
colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->edit_button))
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
}
void
colormap_editor_add_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->add_button))
gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button),
action ? GDK_CONTROL_MASK : 0);
}

View File

@@ -1,31 +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.
*/
#ifndef __COLORMAP_EDITOR_COMMANDS_H__
#define __COLORMAP_EDITOR_COMMANDS_H__
void colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void colormap_editor_add_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __COLORMAP_EDITOR_COMMANDS_H__ */

View File

@@ -1,55 +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 "gui-types.h"
#include "widgets/gimpcolormapeditor.h"
#include "colormap-editor-commands.h"
/* public functions */
void
colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->edit_button))
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
}
void
colormap_editor_add_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->add_button))
gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button),
action ? GDK_CONTROL_MASK : 0);
}

View File

@@ -1,31 +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.
*/
#ifndef __COLORMAP_EDITOR_COMMANDS_H__
#define __COLORMAP_EDITOR_COMMANDS_H__
void colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void colormap_editor_add_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __COLORMAP_EDITOR_COMMANDS_H__ */

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 "gui-types.h"
#include "widgets/gimpdatafactoryview.h"
#include "data-commands.h"
#include "gimp-intl.h"
void
data_new_data_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->new_button))
gtk_button_clicked (GTK_BUTTON (view->new_button));
}
void
data_duplicate_data_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->duplicate_button))
gtk_button_clicked (GTK_BUTTON (view->duplicate_button));
}
void
data_edit_data_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->edit_button))
gtk_button_clicked (GTK_BUTTON (view->edit_button));
}
void
data_delete_data_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->delete_button))
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
void
data_refresh_data_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->refresh_button))
gtk_button_clicked (GTK_BUTTON (view->refresh_button));
}

View File

@@ -1,35 +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.
*/
#ifndef __DATA_COMMANDS_H__
#define __DATA_COMMANDS_H__
void data_new_data_cmd_callback (GtkWidget *widget,
gpointer data);
void data_duplicate_data_cmd_callback (GtkWidget *widget,
gpointer data);
void data_edit_data_cmd_callback (GtkWidget *widget,
gpointer data);
void data_delete_data_cmd_callback (GtkWidget *widget,
gpointer data);
void data_refresh_data_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __DATA_COMMANDS_H__ */

View File

@@ -1,148 +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 <string.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "gui-types.h"
#include "core/gimpobject.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpmenufactory.h"
#include "debug-commands.h"
#include "menus.h"
#ifdef ENABLE_DEBUG_MENU
/* local function prototypes */
static void debug_dump_menus_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path);
/* public functions */
void
debug_dump_menus_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GList *list;
for (list = global_menu_factory->registered_menus;
list;
list = g_list_next (list))
{
GimpMenuFactoryEntry *entry;
GimpItemFactory *item_factory;
entry = list->data;
item_factory = gimp_item_factory_from_path (entry->identifier);
if (item_factory)
{
GtkWidget *menu_item;
g_print ("%s\n", entry->identifier);
menu_item = gtk_item_factory_get_item (GTK_ITEM_FACTORY (item_factory),
entry->entries[0].entry.path);
if (menu_item &&
menu_item->parent &&
GTK_IS_MENU (menu_item->parent))
debug_dump_menus_recurse_menu (menu_item->parent, 1,
entry->identifier);
g_print ("\n");
}
}
}
void
debug_mem_profile_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
extern gboolean gimp_debug_memsize;
gimp_debug_memsize = TRUE;
gimp_object_get_memsize (GIMP_OBJECT (data), NULL);
gimp_debug_memsize = FALSE;
}
/* private functions */
static void
debug_dump_menus_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path)
{
GtkItemFactory *item_factory;
GtkWidget *menu_item;
GList *list;
const gchar *label;
gchar *help_page;
gchar *full_path;
gchar *format_str;
for (list = GTK_MENU_SHELL (menu)->children; list; list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
if (GTK_IS_LABEL (GTK_BIN (menu_item)->child))
{
label = gtk_label_get_text (GTK_LABEL (GTK_BIN (menu_item)->child));
full_path = g_strconcat (path, "/", label, NULL);
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path (path));
help_page = g_object_get_data (G_OBJECT (menu_item),
"gimp-help-id");
help_page = g_strdup (help_page);
format_str = g_strdup_printf ("%%%ds%%%ds %%-20s %%s\n",
depth * 2, depth * 2 - 40);
g_print (format_str,
"", label, "", help_page ? help_page : "");
g_free (format_str);
g_free (help_page);
if (GTK_MENU_ITEM (menu_item)->submenu)
debug_dump_menus_recurse_menu (GTK_MENU_ITEM (menu_item)->submenu,
depth + 1, full_path);
g_free (full_path);
}
}
}
#endif /* ENABLE_DEBUG_MENU */

View File

@@ -1,38 +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.
*/
#ifndef __DEBUG_COMMANDS_H__
#define __DEBUG_COMMANDS_H__
#ifdef GIMP_UNSTABLE
#define ENABLE_DEBUG_MENU 1
#endif
#ifdef ENABLE_DEBUG_MENU
void debug_dump_menus_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void debug_mem_profile_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* ENABLE_DEBUG_MENU */
#endif /* __DEBUG_COMMANDS_H__ */

View File

@@ -1,522 +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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpcontainerview-utils.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpdockable.h"
#include "widgets/gimpdockbook.h"
#include "widgets/gimpimagedock.h"
#include "widgets/gimpsessioninfo.h"
#include "dialogs.h"
#include "dialogs-commands.h"
/* local function prototypes */
static void dialogs_create_dock (GdkScreen *screen,
gboolean show_image_menu,
const gchar *tabs[],
gint n_tabs);
/* public functions */
void
dialogs_show_toolbox_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
dialogs_show_toolbox ();
}
void
dialogs_create_toplevel_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
if (action)
{
const gchar *identifier = g_quark_to_string ((GQuark) action);
if (identifier)
gimp_dialog_factory_dialog_new (global_dialog_factory,
gtk_widget_get_screen (widget),
identifier, -1);
}
}
void
dialogs_create_dockable_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
if (action)
{
const gchar *identifier = g_quark_to_string ((GQuark) action);
if (!identifier)
return;
gimp_dialog_factory_dialog_raise (global_dock_factory,
gtk_widget_get_screen (widget),
identifier, -1);
}
}
void
dialogs_add_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
if (action)
{
GtkWidget *dockable;
const gchar *identifier;
identifier = g_quark_to_string ((GQuark) action);
if (identifier)
{
dockable =
gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory,
dockbook->dock,
identifier,
-1);
/* Maybe gimp_dialog_factory_dockable_new() returned an already
* existing singleton dockable, so check if it already is
* attached to a dockbook.
*/
if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook)
gimp_dockbook_add (dockbook, GIMP_DOCKABLE (dockable), -1);
}
}
}
void
dialogs_close_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
GimpDockable *dockable;
gint page_num;
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
dockable = (GimpDockable *)
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
if (dockable)
gimp_dockbook_remove (dockbook, dockable);
}
void
dialogs_detach_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
GimpDockable *dockable;
gint page_num;
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
dockable = (GimpDockable *)
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
if (dockable)
gimp_dockable_detach (dockable);
}
void
dialogs_toggle_view_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
GimpDockable *dockable;
GimpViewType view_type;
gint page_num;
if (! GTK_CHECK_MENU_ITEM (widget)->active)
return;
view_type = (GimpViewType) action;
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
dockable = (GimpDockable *)
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
if (dockable)
{
GimpDialogFactoryEntry *entry;
gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry);
if (entry)
{
gchar *identifier;
gchar *substring = NULL;
identifier = g_strdup (entry->identifier);
substring = strstr (identifier, "grid");
if (substring && view_type == GIMP_VIEW_TYPE_GRID)
return;
if (! substring)
{
substring = strstr (identifier, "list");
if (substring && view_type == GIMP_VIEW_TYPE_LIST)
return;
}
if (substring)
{
GimpContainerView *old_view;
GtkWidget *new_dockable;
gint preview_size = -1;
if (view_type == GIMP_VIEW_TYPE_LIST)
memcpy (substring, "list", 4);
else if (view_type == GIMP_VIEW_TYPE_GRID)
memcpy (substring, "grid", 4);
old_view = gimp_container_view_get_by_dockable (dockable);
if (old_view)
preview_size = old_view->preview_size;
new_dockable =
gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory,
dockbook->dock,
identifier,
preview_size);
/* Maybe gimp_dialog_factory_dockable_new() returned
* an already existing singleton dockable, so check
* if it already is attached to a dockbook.
*/
if (new_dockable && ! GIMP_DOCKABLE (new_dockable)->dockbook)
{
gimp_dockbook_add (dockbook, GIMP_DOCKABLE (new_dockable),
page_num);
gimp_dockbook_remove (dockbook, dockable);
gtk_notebook_set_current_page (GTK_NOTEBOOK (dockbook),
page_num);
}
}
g_free (identifier);
}
}
}
void
dialogs_preview_size_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
GimpDockable *dockable;
gint preview_size;
gint page_num;
if (! GTK_CHECK_MENU_ITEM (widget)->active)
return;
preview_size = (gint) action;
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
dockable = (GimpDockable *)
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
if (dockable)
{
GimpContainerView *view;
view = gimp_container_view_get_by_dockable (dockable);
if (view && view->preview_size != preview_size)
gimp_container_view_set_preview_size (view, preview_size,
view->preview_border_width);
}
}
void
dialogs_tab_style_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
GimpDockable *dockable;
GimpTabStyle tab_style;
gint page_num;
if (! GTK_CHECK_MENU_ITEM (widget)->active)
return;
tab_style = (gint) action;
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
dockable = (GimpDockable *)
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
if (dockable && dockable->tab_style != tab_style)
{
GtkWidget *tab_widget;
dockable->tab_style = tab_style;
tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook),
GTK_WIDGET (dockable),
tab_widget);
}
}
void
dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
dialogs_toggle_auto_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
}
static void
dialogs_change_screen_confirm_callback (GtkWidget *query_box,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
static void
dialogs_change_screen_destroy_callback (GtkWidget *query_box,
GtkWidget *dock)
{
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL);
}
void
dialogs_change_screen_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
GtkWidget *dock;
GdkScreen *screen;
GdkDisplay *display;
gint cur_screen;
gint num_screens;
GtkWidget *qbox;
dock = GTK_WIDGET (dockbook->dock);
qbox = g_object_get_data (G_OBJECT (dock), "gimp-change-screen-dialog");
if (qbox)
{
gtk_window_present (GTK_WINDOW (qbox));
return;
}
screen = gtk_widget_get_screen (dock);
display = gtk_widget_get_display (dock);
cur_screen = gdk_screen_get_number (screen);
num_screens = gdk_display_get_n_screens (display);
qbox = gimp_query_int_box ("Move Dock to Screen",
dock,
NULL, 0,
"Enter destination screen",
cur_screen, 0, num_screens - 1,
G_OBJECT (dock), "destroy",
dialogs_change_screen_confirm_callback,
dock);
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", qbox);
g_signal_connect (qbox, "destroy",
G_CALLBACK (dialogs_change_screen_destroy_callback),
dock);
gtk_widget_show (qbox);
}
void
dialogs_create_lc_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
static const gchar *tabs[] =
{
"gimp-layer-list",
"gimp-channel-list",
"gimp-vectors-list",
"gimp-undo-history"
};
dialogs_create_dock (gtk_widget_get_screen (widget), TRUE,
tabs, G_N_ELEMENTS (tabs));
}
void
dialogs_create_data_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
static const gchar *tabs[] =
{
"gimp-brush-grid",
"gimp-pattern-grid",
"gimp-gradient-list",
"gimp-palette-list",
"gimp-font-list"
};
dialogs_create_dock (gtk_widget_get_screen (widget), FALSE,
tabs, G_N_ELEMENTS (tabs));
}
void
dialogs_create_stuff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
static const gchar *tabs[] =
{
"gimp-buffer-list",
"gimp-image-list",
"gimp-document-list",
"gimp-template-list"
};
dialogs_create_dock (gtk_widget_get_screen (widget), FALSE,
tabs, G_N_ELEMENTS (tabs));
}
void
dialogs_show_toolbox (void)
{
if (! global_toolbox_factory->open_dialogs)
{
GtkWidget *toolbox;
toolbox = gimp_dialog_factory_dock_new (global_toolbox_factory,
gdk_screen_get_default ());
gtk_widget_show (toolbox);
}
else
{
GList *list;
for (list = global_toolbox_factory->open_dialogs;
list;
list = g_list_next (list))
{
if (GTK_WIDGET_TOPLEVEL (list->data))
{
gtk_window_present (GTK_WINDOW (list->data));
break;
}
}
}
}
/* private functions */
static void
dialogs_create_dock (GdkScreen *screen,
gboolean show_image_menu,
const gchar *tabs[],
gint n_tabs)
{
GtkWidget *dock;
GtkWidget *dockbook;
GtkWidget *dockable;
gint i;
dock = gimp_dialog_factory_dock_new (global_dock_factory, screen);
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dock), show_image_menu);
dockbook = gimp_dockbook_new (global_dock_factory->menu_factory);
gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0);
for (i = 0; i < n_tabs; i++)
{
dockable = gimp_dialog_factory_dialog_new (global_dock_factory,
screen,
tabs[i], -1);
if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook)
gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1);
}
gtk_widget_show (dock);
}

View File

@@ -1,76 +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.
*/
#ifndef __DIALOGS_COMMANDS_H__
#define __DIALOGS_COMMANDS_H__
void dialogs_show_toolbox_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_toplevel_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_dockable_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_add_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_close_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_detach_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_toggle_view_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_preview_size_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_tab_style_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_toggle_auto_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_change_screen_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_lc_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_data_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_stuff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_show_toolbox (void);
#endif /* __DIALOGS_COMMANDS_H__ */

View File

@@ -1,100 +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 "gui-types.h"
#include "widgets/gimpdocumentview.h"
#include "documents-commands.h"
/* public functions */
void
documents_open_document_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->open_button));
}
void
documents_raise_or_open_document_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data);
gimp_button_extended_clicked (GIMP_BUTTON (view->open_button),
GDK_SHIFT_MASK);
}
void
documents_file_open_dialog_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data);
gimp_button_extended_clicked (GIMP_BUTTON (view->open_button),
GDK_CONTROL_MASK);
}
void
documents_remove_document_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->remove_button));
}
void
documents_recreate_preview_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->refresh_button));
}
void
documents_reload_previews_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data);
gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button),
GDK_SHIFT_MASK);
}
void
documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data);
gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button),
GDK_CONTROL_MASK);
}

View File

@@ -1,39 +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.
*/
#ifndef __DOCUMENTS_COMMANDS_H__
#define __DOCUMENTS_COMMANDS_H__
void documents_open_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_raise_or_open_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_file_open_dialog_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_remove_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_recreate_preview_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_reload_previews_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __DOCUMENTS_COMMANDS_H__ */

View File

@@ -1,217 +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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-desaturate.h"
#include "core/gimpdrawable-equalize.h"
#include "core/gimpdrawable-invert.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "core/gimpitem-linked.h"
#include "widgets/gimpdock.h"
#include "widgets/gimpitemtreeview.h"
#include "display/gimpdisplay.h"
#include "drawable-commands.h"
#include "offset-dialog.h"
#include "gimp-intl.h"
#define return_if_no_image(gimage,data) \
if (GIMP_IS_DISPLAY (data)) \
gimage = ((GimpDisplay *) data)->gimage; \
else if (GIMP_IS_GIMP (data)) \
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gimage = gimp_context_get_image (((GimpDock *) data)->context); \
else if (GIMP_IS_ITEM_TREE_VIEW (data)) \
gimage = ((GimpItemTreeView *) data)->gimage; \
else \
gimage = NULL; \
\
if (! gimage) \
return
#define return_if_no_drawable(gimage,drawable,data) \
return_if_no_image (gimage,data); \
drawable = gimp_image_active_drawable (gimage); \
if (! drawable) \
return
/* public functions */
void
drawable_desaturate_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
if (! gimp_drawable_is_rgb (active_drawable))
{
g_message (_("Desaturate operates only on RGB color layers."));
return;
}
gimp_drawable_desaturate (active_drawable);
gimp_image_flush (gimage);
}
void
drawable_invert_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
if (gimp_drawable_is_indexed (active_drawable))
{
g_message (_("Invert does not operate on indexed layers."));
return;
}
gimp_drawable_invert (active_drawable);
gimp_image_flush (gimage);
}
void
drawable_equalize_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
if (gimp_drawable_is_indexed (active_drawable))
{
g_message (_("Equalize does not operate on indexed layers."));
return;
}
gimp_drawable_equalize (active_drawable, TRUE);
gimp_image_flush (gimage);
}
void
drawable_flip_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GimpItem *item;
gint off_x, off_y;
gdouble axis = 0.0;
return_if_no_drawable (gimage, active_drawable, data);
item = GIMP_ITEM (active_drawable);
gimp_item_offsets (item, &off_x, &off_y);
switch ((GimpOrientationType) action)
{
case GIMP_ORIENTATION_HORIZONTAL:
axis = ((gdouble) off_x + (gdouble) gimp_item_width (item) / 2.0);
break;
case GIMP_ORIENTATION_VERTICAL:
axis = ((gdouble) off_y + (gdouble) gimp_item_height (item) / 2.0);
break;
default:
break;
}
if (gimp_item_get_linked (item))
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Layer"));
gimp_item_flip (item, (GimpOrientationType) action, axis, FALSE);
if (gimp_item_get_linked (item))
{
gimp_item_linked_flip (item, (GimpOrientationType) action, axis, FALSE);
gimp_image_undo_group_end (gimage);
}
gimp_image_flush (gimage);
}
void
drawable_rotate_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GimpItem *item;
gint off_x, off_y;
gdouble center_x, center_y;
return_if_no_drawable (gimage, active_drawable, data);
item = GIMP_ITEM (active_drawable);
gimp_item_offsets (item, &off_x, &off_y);
center_x = ((gdouble) off_x + (gdouble) gimp_item_width (item) / 2.0);
center_y = ((gdouble) off_y + (gdouble) gimp_item_height (item) / 2.0);
if (gimp_item_get_linked (item))
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Rotate Layer"));
gimp_item_rotate (item, (GimpRotationType) action, center_x, center_y, FALSE);
if (gimp_item_get_linked (item))
{
gimp_item_linked_rotate (item, (GimpRotationType) action,
center_x, center_y, FALSE);
gimp_image_undo_group_end (gimage);
}
gimp_image_flush (gimage);
}
void
drawable_offset_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
offset_dialog_create (active_drawable, widget);
}

View File

@@ -1,39 +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.
*/
#ifndef __DRAWABLE_COMMANDS_H__
#define __DRAWABLE_COMMANDS_H__
void drawable_desaturate_cmd_callback (GtkWidget *widget,
gpointer data);
void drawable_invert_cmd_callback (GtkWidget *widget,
gpointer data);
void drawable_equalize_cmd_callback (GtkWidget *widget,
gpointer data);
void drawable_flip_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void drawable_rotate_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void drawable_offset_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __DRAWABLE_COMMANDS_H__ */

View File

@@ -1,373 +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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimp-edit.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "core/gimptoolinfo.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-transform.h"
#include "widgets/gimpdock.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpdialogfactory.h"
#include "dialogs.h"
#include "edit-commands.h"
#include "stroke-dialog.h"
#include "gimp-intl.h"
#define return_if_no_display(gdisp,data) \
if (GIMP_IS_DISPLAY (data)) \
gdisp = data; \
else if (GIMP_IS_GIMP (data)) \
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gdisp = gimp_context_get_display (((GimpDock *) data)->context); \
else \
gdisp = NULL; \
if (! gdisp) \
return
#define return_if_no_image(gimage,data) \
if (GIMP_IS_DISPLAY (data)) \
gimage = ((GimpDisplay *) data)->gimage; \
else if (GIMP_IS_GIMP (data)) \
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gimage = gimp_context_get_image (((GimpDock *) data)->context); \
else \
gimage = NULL; \
if (! gimage) \
return
#define return_if_no_drawable(gimage,drawable,data) \
return_if_no_image (gimage, data); \
drawable = gimp_image_active_drawable (gimage); \
if (! drawable) \
return;
/* local function prototypes */
static void cut_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
static void copy_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
/* public functions */
void
edit_undo_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
if (gimp_image_undo (gimage))
gimp_image_flush (gimage);
}
void
edit_redo_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
if (gimp_image_redo (gimage))
gimp_image_flush (gimage);
}
void
edit_cut_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
if (gimp_edit_cut (gimage, drawable))
gimp_image_flush (gimage);
}
void
edit_copy_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
if (gimp_edit_copy (gimage, drawable))
gimp_image_flush (gimage);
}
void
edit_paste_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplay *gdisp;
gboolean paste_into;
return_if_no_display (gdisp, data);
paste_into = (gboolean) action;
if (gdisp->gimage->gimp->global_buffer)
{
GimpDisplayShell *shell;
gint x, y, width, height;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
if (gimp_edit_paste (gdisp->gimage,
gimp_image_active_drawable (gdisp->gimage),
gdisp->gimage->gimp->global_buffer,
paste_into, x, y, width, height))
{
gimp_image_flush (gdisp->gimage);
}
}
}
void
edit_paste_as_new_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
if (gdisp->gimage->gimp->global_buffer)
{
gimp_edit_paste_as_new (gdisp->gimage->gimp,
gdisp->gimage,
gdisp->gimage->gimp->global_buffer);
}
}
void
edit_named_cut_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *qbox;
return_if_no_display (gdisp, data);
qbox = gimp_query_string_box (_("Cut Named"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_BUFFER_CUT,
_("Enter a name for this buffer"),
NULL,
G_OBJECT (gdisp->gimage), "disconnect",
cut_named_buffer_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
edit_named_copy_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *qbox;
return_if_no_display (gdisp, data);
qbox = gimp_query_string_box (_("Copy Named"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_BUFFER_COPY,
_("Enter a name for this buffer"),
NULL,
G_OBJECT (gdisp->gimage), "disconnect",
copy_named_buffer_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
edit_named_paste_cmd_callback (GtkWidget *widget,
gpointer data)
{
gimp_dialog_factory_dialog_raise (global_dock_factory,
gtk_widget_get_screen (widget),
"gimp-buffer-list|gimp-buffer-grid", -1);
}
void
edit_clear_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
gimp_edit_clear (gimage, drawable);
gimp_image_flush (gimage);
}
void
edit_fill_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpImage *gimage;
GimpDrawable *drawable;
GimpFillType fill_type;
return_if_no_drawable (gimage, drawable, data);
fill_type = (GimpFillType) action;
gimp_edit_fill (gimage, drawable, fill_type);
gimp_image_flush (gimage);
}
void
edit_stroke_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
edit_stroke_selection (GIMP_ITEM (gimp_image_get_mask (gimage)), widget);
}
void
edit_stroke_selection (GimpItem *item,
GtkWidget *parent)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GtkWidget *dialog;
g_return_if_fail (GIMP_IS_ITEM (item));
gimage = gimp_item_get_image (item);
active_drawable = gimp_image_active_drawable (gimage);
if (! active_drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
return;
}
dialog = stroke_dialog_new (item, GIMP_STOCK_SELECTION_STROKE,
GIMP_HELP_SELECTION_STROKE,
parent);
gtk_widget_show (dialog);
}
/* private functions */
static void
cut_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
{
GimpImage *gimage = GIMP_IMAGE (data);
const GimpBuffer *cut_buffer;
GimpDrawable *active_drawable;
active_drawable = gimp_image_active_drawable (gimage);
if (! active_drawable)
{
g_message (_("There is no active layer or channel to cut from."));
return;
}
cut_buffer = gimp_edit_cut (gimage, active_drawable);
if (cut_buffer)
{
GimpBuffer *new_buffer;
if (! (name && strlen (name)))
name = _("(Unnamed Buffer)");
new_buffer = gimp_buffer_new (cut_buffer->tiles, name, TRUE);
gimp_container_add (gimage->gimp->named_buffers,
GIMP_OBJECT (new_buffer));
g_object_unref (new_buffer);
gimp_image_flush (gimage);
}
}
static void
copy_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
{
GimpImage *gimage = GIMP_IMAGE (data);
const GimpBuffer *copy_buffer;
GimpDrawable *active_drawable;
active_drawable = gimp_image_active_drawable (gimage);
if (! active_drawable)
{
g_message (_("There is no active layer or channel to copy from."));
return;
}
copy_buffer = gimp_edit_copy (gimage, active_drawable);
if (copy_buffer)
{
GimpBuffer *new_buffer;
if (! (name && strlen (name)))
name = _("(Unnamed Buffer)");
new_buffer = gimp_buffer_new (copy_buffer->tiles, name, TRUE);
gimp_container_add (gimage->gimp->named_buffers,
GIMP_OBJECT (new_buffer));
g_object_unref (new_buffer);
gimp_image_flush (gimage);
}
}

View File

@@ -1,54 +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.
*/
#ifndef __EDIT_COMMANDS_H__
#define __EDIT_COMMANDS_H__
void edit_undo_cmd_callback (GtkWidget *widget,
gpointer data);
void edit_redo_cmd_callback (GtkWidget *widget,
gpointer data);
void edit_cut_cmd_callback (GtkWidget *widget,
gpointer data);
void edit_copy_cmd_callback (GtkWidget *widget,
gpointer data);
void edit_paste_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void edit_paste_as_new_cmd_callback (GtkWidget *widget,
gpointer data);
void edit_named_cut_cmd_callback (GtkWidget *widget,
gpointer data);
void edit_named_copy_cmd_callback (GtkWidget *widget,
gpointer data);
void edit_named_paste_cmd_callback (GtkWidget *widget,
gpointer data);
void edit_clear_cmd_callback (GtkWidget *widget,
gpointer data);
void edit_fill_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void edit_stroke_cmd_callback (GtkWidget *widget,
gpointer data);
void edit_stroke_selection (GimpItem *item,
GtkWidget *parent);
#endif /* __EDIT_COMMANDS_H__ */

View File

@@ -1,66 +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 "gui-types.h"
#include "widgets/gimperrorconsole.h"
#include "error-console-commands.h"
/* public functions */
void
error_console_clear_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
if (GTK_WIDGET_IS_SENSITIVE (console->clear_button))
gtk_button_clicked (GTK_BUTTON (console->clear_button));
}
void
error_console_save_all_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
if (GTK_WIDGET_IS_SENSITIVE (console->save_button))
gtk_button_clicked (GTK_BUTTON (console->save_button));
}
void
error_console_save_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
if (GTK_WIDGET_IS_SENSITIVE (console->save_button))
gimp_button_extended_clicked (GIMP_BUTTON (console->save_button),
GDK_SHIFT_MASK);
}

View File

@@ -1,34 +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.
*/
#ifndef __ERROR_CONSOLE_COMMANDS_H__
#define __ERROR_CONSOLE_COMMANDS_H__
void error_console_clear_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void error_console_save_all_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void error_console_save_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __ERROR_CONSOLE_COMMANDS_H__ */

View File

@@ -1,469 +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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimplist.h"
#include "core/gimpimage.h"
#include "core/gimptemplate.h"
#include "file/file-open.h"
#include "file/file-save.h"
#include "file/file-utils.h"
#include "widgets/gimpdock.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpfiledialog.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplayshell.h"
#include "dialogs.h"
#include "file-commands.h"
#include "file-new-dialog.h"
#include "file-open-dialog.h"
#include "file-save-dialog.h"
#include "menus.h"
#include "gimp-intl.h"
#define REVERT_DATA_KEY "revert-confirm-dialog"
#define return_if_no_gimp(gimp,data) \
if (GIMP_IS_DISPLAY (data)) \
gimp = ((GimpDisplay *) data)->gimage->gimp; \
else if (GIMP_IS_GIMP (data)) \
gimp = data; \
else if (GIMP_IS_DOCK (data)) \
gimp = ((GimpDock *) data)->context->gimp; \
else \
gimp = NULL; \
if (! gimp) \
return
#define return_if_no_display(gdisp,data) \
if (GIMP_IS_DISPLAY (data)) \
gdisp = data; \
else if (GIMP_IS_GIMP (data)) \
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gdisp = gimp_context_get_display (((GimpDock *) data)->context); \
else \
gdisp = NULL; \
if (! gdisp) \
return
/* local function prototypes */
static void file_new_template_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data);
/* public functions */
void
file_new_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
Gimp *gimp;
GimpImage *gimage;
GtkWidget *dialog;
return_if_no_gimp (gimp, data);
/* if called from the image menu */
if (action)
gimage = gimp_context_get_image (gimp_get_user_context (gimp));
else
gimage = NULL;
dialog = gimp_dialog_factory_dialog_new (global_dialog_factory,
gtk_widget_get_screen (widget),
"gimp-file-new-dialog", -1);
if (dialog)
file_new_dialog_set (dialog, gimage, NULL);
}
void
file_type_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
gimp_file_dialog_set_file_proc (GIMP_FILE_DIALOG (data),
g_object_get_data (G_OBJECT (widget),
"file-proc"));
}
void
file_open_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
Gimp *gimp;
GimpImage *gimage;
return_if_no_gimp (gimp, data);
/* if called from the image menu */
if (action)
gimage = gimp_context_get_image (gimp_get_user_context (gimp));
else
gimage = NULL;
file_open_dialog_show (gimp, gimage, NULL, global_menu_factory, widget);
}
void
file_last_opened_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
Gimp *gimp;
GimpImagefile *imagefile;
guint num_entries;
return_if_no_gimp (gimp, data);
num_entries = gimp_container_num_children (gimp->documents);
if (action >= num_entries)
return;
imagefile = (GimpImagefile *)
gimp_container_get_child_by_index (gimp->documents, action);
if (imagefile)
{
GimpImage *gimage;
GimpPDBStatusType status;
GError *error = NULL;
gimage = file_open_with_display (gimp, GIMP_OBJECT (imagefile)->name,
&status, &error);
if (! gimage && status != GIMP_PDB_CANCEL)
{
gchar *filename;
filename =
file_utils_uri_to_utf8_filename (GIMP_OBJECT (imagefile)->name);
g_message (_("Opening '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
g_free (filename);
}
}
}
void
file_save_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
g_return_if_fail (gimp_image_active_drawable (gdisp->gimage));
/* Only save if the gimage has been modified */
if (gdisp->gimage->dirty ||
! GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->trust_dirty_flag)
{
const gchar *uri;
uri = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
if (! uri)
{
file_save_as_cmd_callback (widget, data, action);
}
else
{
GimpPDBStatusType status;
GError *error = NULL;
status = file_save (gdisp->gimage, GIMP_RUN_WITH_LAST_VALS, &error);
if (status != GIMP_PDB_SUCCESS &&
status != GIMP_PDB_CANCEL)
{
gchar *filename;
filename = file_utils_uri_to_utf8_filename (uri);
g_message (_("Saving '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
g_free (filename);
}
}
}
}
void
file_save_as_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
file_save_dialog_show (gdisp->gimage, global_menu_factory, widget);
}
void
file_save_a_copy_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
file_save_a_copy_dialog_show (gdisp->gimage, global_menu_factory, widget);
}
void
file_save_template_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplay *gdisp;
GtkWidget *qbox;
return_if_no_display (gdisp, data);
qbox = gimp_query_string_box (_("Create New Template"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_FILE_SAVE_AS_TEMPLATE,
_("Enter a name for this template"),
NULL,
G_OBJECT (gdisp->gimage), "disconnect",
file_new_template_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
file_revert_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplay *gdisp;
GtkWidget *query_box;
const gchar *uri;
return_if_no_display (gdisp, data);
uri = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
query_box = g_object_get_data (G_OBJECT (gdisp->gimage), REVERT_DATA_KEY);
if (! uri)
{
g_message (_("Revert failed. No file name associated with this image."));
}
else if (query_box)
{
gtk_window_present (GTK_WINDOW (query_box->window));
}
else
{
gchar *basename;
gchar *text;
basename = g_path_get_basename (uri);
text = g_strdup_printf (_("Revert '%s' to\n"
"'%s'?\n\n"
"You will lose all your changes, "
"including all undo information."),
basename, uri);
g_free (basename);
query_box = gimp_query_boolean_box (_("Revert Image"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_FILE_REVERT,
GIMP_STOCK_QUESTION,
text,
GTK_STOCK_YES, GTK_STOCK_NO,
G_OBJECT (gdisp->gimage),
"disconnect",
file_revert_confirm_callback,
gdisp->gimage);
g_free (text);
g_object_set_data (G_OBJECT (gdisp->gimage), REVERT_DATA_KEY,
query_box);
gtk_window_set_transient_for (GTK_WINDOW (query_box),
GTK_WINDOW (gdisp->shell));
gtk_widget_show (query_box);
}
}
void
file_close_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_shell_close (GIMP_DISPLAY_SHELL (gdisp->shell), FALSE);
}
void
file_quit_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
Gimp *gimp;
return_if_no_gimp (gimp, data);
gimp_exit (gimp, FALSE);
}
void
file_file_open_dialog (Gimp *gimp,
const gchar *uri,
GtkWidget *parent)
{
file_open_dialog_show (gimp, NULL, uri, global_menu_factory, parent);
}
/* private functions */
static void
file_new_template_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
{
GimpTemplate *template;
GimpImage *gimage;
gimage = (GimpImage *) data;
if (! (name && strlen (name)))
name = _("(Unnamed Template)");
template = gimp_template_new (name);
gimp_template_set_from_image (template, gimage);
gimp_list_uniquefy_name (GIMP_LIST (gimage->gimp->templates),
GIMP_OBJECT (template), TRUE);
gimp_container_add (gimage->gimp->templates,
GIMP_OBJECT (template));
g_object_unref (template);
}
static void
file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data)
{
GimpImage *old_gimage;
old_gimage = (GimpImage *) data;
g_object_set_data (G_OBJECT (old_gimage), REVERT_DATA_KEY, NULL);
if (revert)
{
Gimp *gimp;
GimpImage *new_gimage;
const gchar *uri;
GimpPDBStatusType status;
GError *error = NULL;
gimp = old_gimage->gimp;
uri = gimp_object_get_name (GIMP_OBJECT (old_gimage));
new_gimage = file_open_image (gimp, uri, uri, NULL,
GIMP_RUN_INTERACTIVE,
&status, &error);
if (new_gimage)
{
GList *contexts = NULL;
GList *list;
/* remember which contexts refer to old_gimage */
for (list = gimp->context_list; list; list = g_list_next (list))
{
GimpContext *context = list->data;
if (gimp_context_get_image (context) == old_gimage)
contexts = g_list_prepend (contexts, list->data);
}
gimp_displays_reconnect (gimp, old_gimage, new_gimage);
gimp_image_flush (new_gimage);
/* set the new_gimage on the remembered contexts (in reverse
* order, since older contexts are usually the parents of
* newer ones)
*/
g_list_foreach (contexts, (GFunc) gimp_context_set_image, new_gimage);
g_list_free (contexts);
/* the displays own the image now */
g_object_unref (new_gimage);
}
else if (status != GIMP_PDB_CANCEL)
{
gchar *filename;
filename = file_utils_uri_to_utf8_filename (uri);
g_message (_("Reverting to '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
g_free (filename);
}
}
}

View File

@@ -1,69 +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.
*/
#ifndef __FILE_COMMANDS_H__
#define __FILE_COMMANDS_H__
void file_new_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_type_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_open_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_last_opened_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_as_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_a_copy_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_template_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_revert_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_pref_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_close_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_quit_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_file_open_dialog (Gimp *gimp,
const gchar *uri,
GtkWidget *parent);
#endif /* __FILE_COMMANDS_H__ */

View File

@@ -1,42 +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 "gui-types.h"
#include "widgets/gimpfontview.h"
#include "fonts-commands.h"
#include "gimp-intl.h"
/* public functionss */
void
fonts_refresh_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpFontView *view = GIMP_FONT_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->refresh_button))
gtk_button_clicked (GTK_BUTTON (view->refresh_button));
}

View File

@@ -1,27 +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.
*/
#ifndef __FONTS_COMMANDS_H__
#define __FONTS_COMMANDS_H__
void fonts_refresh_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __FONTS_COMMANDS_H__ */

File diff suppressed because it is too large Load Diff

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.
*/
#ifndef __GRADIENT_EDITOR_COMMANDS_H__
#define __GRADIENT_EDITOR_COMMANDS_H__
void gradient_editor_left_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_load_left_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_save_left_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_right_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_load_right_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_save_right_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_blending_func_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_coloring_type_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_flip_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_replicate_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_split_midpoint_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_delete_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_recenter_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_redistribute_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_blend_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __GRADIENT_EDITOR_COMMANDS_H__ */

View File

@@ -1,126 +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 "gui-types.h"
#include "core/gimpgradient.h"
#include "core/gimpcontext.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimphelp-ids.h"
#include "gradients-commands.h"
#include "gimp-intl.h"
/* local function prototypes */
static void gradients_save_as_pov_query (GimpContainerEditor *editor);
static void gradients_save_as_pov_response (GtkWidget *dialog,
gint response_id,
GimpGradient *gradient);
/* public functions */
void
gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
gradients_save_as_pov_query (editor);
}
/* private functions */
static void
gradients_save_as_pov_query (GimpContainerEditor *editor)
{
GimpGradient *gradient;
GtkFileSelection *filesel;
gchar *title;
gradient = gimp_context_get_gradient (editor->view->context);
if (! gradient)
return;
title = g_strdup_printf (_("Save '%s' as POV-Ray"),
GIMP_OBJECT (gradient)->name);
filesel = GTK_FILE_SELECTION (gtk_file_selection_new (title));
g_free (title);
gtk_window_set_screen (GTK_WINDOW (filesel),
gtk_widget_get_screen (GTK_WIDGET (editor)));
gtk_window_set_role (GTK_WINDOW (filesel), "gimp-gradient-save-pov");
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
gtk_container_set_border_width (GTK_CONTAINER (filesel), 6);
gtk_container_set_border_width (GTK_CONTAINER (filesel->button_area), 4);
g_signal_connect (filesel, "response",
G_CALLBACK (gradients_save_as_pov_response),
gradient);
g_object_ref (gradient);
g_signal_connect_object (filesel, "destroy",
G_CALLBACK (g_object_unref),
gradient,
G_CONNECT_SWAPPED);
gimp_help_connect (GTK_WIDGET (filesel), gimp_standard_help_func,
GIMP_HELP_GRADIENT_SAVE_AS_POV, NULL);
gtk_widget_show (GTK_WIDGET (filesel));
}
static void
gradients_save_as_pov_response (GtkWidget *dialog,
gint response_id,
GimpGradient *gradient)
{
if (response_id == GTK_RESPONSE_OK)
{
const gchar *filename;
GError *error = NULL;
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog));
if (! gimp_gradient_save_as_pov (gradient, filename, &error))
{
g_message (error->message);
g_clear_error (&error);
}
}
gtk_widget_destroy (dialog);
}

View File

@@ -1,27 +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.
*/
#ifndef __GRADIENTS_COMMANDS_H__
#define __GRADIENTS_COMMANDS_H__
void gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __GRADIENTS_COMMANDS_H__ */

View File

@@ -1,44 +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 "gui-types.h"
#include "help-commands.h"
void
help_help_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
gimp_standard_help_func (NULL, NULL);
}
void
help_context_help_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
gimp_context_help (widget);
}

View File

@@ -1,31 +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.
*/
#ifndef __HELP_COMMANDS_H__
#define __HELP_COMMANDS_H__
void help_help_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void help_context_help_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __HELP_COMMANDS_H__ */

View File

@@ -1,655 +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 "libgimpbase/gimputils.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "config/gimpguiconfig.h"
#include "core/core-enums.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-crop.h"
#include "core/gimpimage-duplicate.h"
#include "core/gimpimage-flip.h"
#include "core/gimpimage-merge.h"
#include "core/gimpimage-resize.h"
#include "core/gimpimage-rotate.h"
#include "core/gimpimage-scale.h"
#include "core/gimpimage-undo.h"
#include "widgets/gimpdock.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpprogress.h"
#include "convert-dialog.h"
#include "image-commands.h"
#include "grid-dialog.h"
#include "resize-dialog.h"
#include "gimp-intl.h"
typedef struct
{
Resize *resize;
GimpDisplay *gdisp;
GimpImage *gimage;
} ImageResize;
#define return_if_no_display(gdisp,data) \
if (GIMP_IS_DISPLAY (data)) \
gdisp = data; \
else if (GIMP_IS_GIMP (data)) \
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gdisp = gimp_context_get_display (((GimpDock *) data)->context); \
else \
gdisp = NULL; \
if (! gdisp) \
return
#define return_if_no_image(gimage,data) \
if (GIMP_IS_DISPLAY (data)) \
gimage = ((GimpDisplay *) data)->gimage; \
else if (GIMP_IS_GIMP (data)) \
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gimage = gimp_context_get_image (((GimpDock *) data)->context); \
else \
gimage = NULL; \
if (! gimage) \
return
/* local functions */
static void image_resize_callback (GtkWidget *widget,
gpointer data);
static void image_scale_callback (GtkWidget *widget,
gpointer data);
static void image_scale_warn (ImageResize *image_scale,
const gchar *warning_title,
const gchar *warning_message);
static void image_scale_warn_callback (GtkWidget *widget,
gboolean do_scale,
gpointer data);
static void image_scale_implement (ImageResize *image_scale);
/* public functions */
void
image_convert_rgb_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
convert_to_rgb (gimage);
}
void
image_convert_grayscale_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
convert_to_grayscale (gimage);
}
void
image_convert_indexed_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
convert_to_indexed (gimage, widget);
}
void
image_resize_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpImage *gimage;
ImageResize *image_resize;
return_if_no_display (gdisp, data);
gimage = gdisp->gimage;
image_resize = g_new0 (ImageResize, 1);
image_resize->gdisp = gdisp;
image_resize->gimage = gimage;
image_resize->resize =
resize_widget_new (GIMP_VIEWABLE (gimage), gdisp->shell,
ResizeWidget,
gimage->width,
gimage->height,
gimage->xresolution,
gimage->yresolution,
gimage->unit,
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
G_CALLBACK (image_resize_callback),
image_resize);
g_signal_connect_object (gdisp, "disconnect",
G_CALLBACK (gtk_widget_destroy),
image_resize->resize->resize_shell,
G_CONNECT_SWAPPED);
g_object_weak_ref (G_OBJECT (image_resize->resize->resize_shell),
(GWeakNotify) g_free,
image_resize);
gtk_widget_show (image_resize->resize->resize_shell);
}
void
image_scale_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpImage *gimage;
ImageResize *image_scale;
return_if_no_display (gdisp, data);
gimage = gdisp->gimage;
image_scale = g_new0 (ImageResize, 1);
image_scale->gdisp = gdisp;
image_scale->gimage = gimage;
image_scale->resize =
resize_widget_new (GIMP_VIEWABLE (gimage), gdisp->shell,
ScaleWidget,
gimage->width,
gimage->height,
gimage->xresolution,
gimage->yresolution,
gimage->unit,
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
G_CALLBACK (image_scale_callback),
image_scale);
g_signal_connect_object (gdisp, "disconnect",
G_CALLBACK (gtk_widget_destroy),
image_scale->resize->resize_shell,
G_CONNECT_SWAPPED);
g_object_weak_ref (G_OBJECT (image_scale->resize->resize_shell),
(GWeakNotify) g_free,
image_scale);
gtk_widget_show (image_scale->resize->resize_shell);
}
void
image_flip_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplay *gdisp;
GimpProgress *progress;
return_if_no_display (gdisp, data);
progress = gimp_progress_start (gdisp, _("Flipping..."), TRUE, NULL, NULL);
gimp_image_flip (gdisp->gimage, (GimpOrientationType) action,
gimp_progress_update_and_flush, progress);
gimp_progress_end (progress);
gimp_image_flush (gdisp->gimage);
}
void
image_rotate_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplay *gdisp;
GimpProgress *progress;
return_if_no_display (gdisp, data);
progress = gimp_progress_start (gdisp, _("Rotating..."), TRUE, NULL, NULL);
gimp_image_rotate (gdisp->gimage, (GimpRotationType) action,
gimp_progress_update_and_flush, progress);
gimp_progress_end (progress);
gimp_image_flush (gdisp->gimage);
}
void
image_crop_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
gint x1, y1, x2, y2;
return_if_no_display (gdisp, data);
if (! gimp_channel_bounds (gimp_image_get_mask (gdisp->gimage),
&x1, &y1, &x2, &y2))
{
g_message (_("Cannot crop because the current selection is empty."));
return;
}
gimp_image_crop (gdisp->gimage, x1, y1, x2, y2, FALSE, TRUE);
gimp_image_flush (gdisp->gimage);
}
void
image_duplicate_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpImage *new_gimage;
return_if_no_image (gimage, data);
new_gimage = gimp_image_duplicate (gimage);
gimp_create_display (new_gimage->gimp, new_gimage, 1.0);
g_object_unref (new_gimage);
}
void
image_merge_layers_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
image_layers_merge_query (gimage, TRUE, widget);
}
void
image_flatten_image_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_image_flatten (gimage);
gimp_image_flush (gimage);
}
void
image_configure_grid_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
GimpImage *gimage;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimage = GIMP_IMAGE (gdisp->gimage);
if (! shell->grid_dialog)
{
shell->grid_dialog = grid_dialog_new (GIMP_IMAGE (gimage), widget);
gtk_window_set_transient_for (GTK_WINDOW (shell->grid_dialog),
GTK_WINDOW (shell));
gtk_window_set_destroy_with_parent (GTK_WINDOW (shell->grid_dialog),
TRUE);
g_object_add_weak_pointer (G_OBJECT (shell->grid_dialog),
(gpointer *) &shell->grid_dialog);
}
gtk_window_present (GTK_WINDOW (shell->grid_dialog));
}
/****************************/
/* The layer merge dialog */
/****************************/
typedef struct _LayerMergeOptions LayerMergeOptions;
struct _LayerMergeOptions
{
GtkWidget *query_box;
GimpImage *gimage;
gboolean merge_visible;
GimpMergeType merge_type;
};
static void
image_layers_merge_query_response (GtkWidget *widget,
gint response_id,
LayerMergeOptions *options)
{
GimpImage *gimage = options->gimage;
if (! gimage)
return;
if (response_id == GTK_RESPONSE_OK)
{
if (options->merge_visible)
gimp_image_merge_visible_layers (gimage, options->merge_type);
gimp_image_flush (gimage);
}
gtk_widget_destroy (options->query_box);
}
void
image_layers_merge_query (GimpImage *gimage,
/* if FALSE, anchor active layer */
gboolean merge_visible,
GtkWidget *parent)
{
LayerMergeOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
/* The new options structure */
options = g_new (LayerMergeOptions, 1);
options->gimage = gimage;
options->merge_visible = merge_visible;
options->merge_type = GIMP_EXPAND_AS_NECESSARY;
/* The dialog */
options->query_box =
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("Merge Layers"), "gimp-image-merge-layers",
GIMP_STOCK_MERGE_DOWN,
_("Layers Merge Options"),
parent,
gimp_standard_help_func,
GIMP_HELP_IMAGE_MERGE_LAYERS,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (options->query_box, "response",
G_CALLBACK (image_layers_merge_query_response),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
vbox);
frame =
gimp_int_radio_group_new (TRUE,
merge_visible ?
_("Final, Merged Layer should be:") :
_("Final, Anchored Layer should be:"),
G_CALLBACK (gimp_radio_button_update),
&options->merge_type, options->merge_type,
_("Expanded as necessary"),
GIMP_EXPAND_AS_NECESSARY, NULL,
_("Clipped to image"),
GIMP_CLIP_TO_IMAGE, NULL,
_("Clipped to bottom layer"),
GIMP_CLIP_TO_BOTTOM_LAYER, NULL,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
gtk_widget_show (vbox);
gtk_widget_show (options->query_box);
}
/* private functions */
static void
image_resize_callback (GtkWidget *widget,
gpointer data)
{
ImageResize *image_resize;
image_resize = (ImageResize *) data;
g_assert (image_resize != NULL);
g_assert (image_resize->gimage != NULL);
gtk_widget_set_sensitive (image_resize->resize->resize_shell, FALSE);
if (image_resize->resize->width > 0 &&
image_resize->resize->height > 0)
{
GimpProgress *progress;
progress = gimp_progress_start (image_resize->gdisp,
_("Resizing..."),
TRUE, NULL, NULL);
gimp_image_resize (image_resize->gimage,
image_resize->resize->width,
image_resize->resize->height,
image_resize->resize->offset_x,
image_resize->resize->offset_y,
gimp_progress_update_and_flush, progress);
gimp_progress_end (progress);
gimp_image_flush (image_resize->gimage);
}
else
{
g_message (_("Resize Error: Both width and height must be "
"greater than zero."));
}
gtk_widget_destroy (image_resize->resize->resize_shell);
}
static void
image_scale_callback (GtkWidget *widget,
gpointer data)
{
ImageResize *image_scale = data;
GimpImageScaleCheckType scale_check;
gint64 new_memsize;
gchar *warning_message;
g_assert (image_scale != NULL);
g_assert (image_scale->gimage != NULL);
gtk_widget_set_sensitive (image_scale->resize->resize_shell, FALSE);
scale_check = gimp_image_scale_check (image_scale->gimage,
image_scale->resize->width,
image_scale->resize->height,
&new_memsize);
switch (scale_check)
{
case GIMP_IMAGE_SCALE_TOO_BIG:
{
gchar *size_str;
gchar *max_size_str;
size_str = gimp_memsize_to_string (new_memsize);
max_size_str = gimp_memsize_to_string
(GIMP_GUI_CONFIG (image_scale->gimage->gimp->config)->max_new_image_size);
warning_message = g_strdup_printf
(_("You are trying to create an image with a size of %s.\n\n"
"Choose OK to create this image anyway.\n"
"Choose Cancel if you did not intend to create such a "
"large image.\n\n"
"To prevent this dialog from appearing, increase the "
"\"Maximum Image Size\" setting (currently %s) in the "
"Preferences dialog."),
size_str, max_size_str);
g_free (size_str);
g_free (max_size_str);
image_scale_warn (image_scale, _("Image exceeds maximum image size"),
warning_message);
g_free (warning_message);
}
break;
case GIMP_IMAGE_SCALE_TOO_SMALL:
warning_message = _("The chosen image size will shrink "
"some layers completely away. "
"Is this what you want?");
image_scale_warn (image_scale, _("Layer Too Small"),
warning_message);
break;
case GIMP_IMAGE_SCALE_OK:
/* If all is well, return directly after scaling image. */
image_scale_implement (image_scale);
gtk_widget_destroy (image_scale->resize->resize_shell);
break;
}
}
static void
image_scale_warn (ImageResize *image_scale,
const gchar *warning_title,
const gchar *warning_message)
{
GtkWidget *dialog;
dialog = gimp_query_boolean_box (warning_title,
image_scale->resize->resize_shell,
gimp_standard_help_func,
GIMP_HELP_IMAGE_SCALE_WARNING,
GTK_STOCK_DIALOG_QUESTION,
warning_message,
GTK_STOCK_OK, GTK_STOCK_CANCEL,
G_OBJECT (image_scale->resize->resize_shell),
"destroy",
image_scale_warn_callback,
image_scale);
gtk_widget_show (dialog);
}
static void
image_scale_warn_callback (GtkWidget *widget,
gboolean do_scale,
gpointer data)
{
ImageResize *image_scale = data;
if (do_scale) /* User doesn't mind losing layers or
* creating huge image... */
{
image_scale_implement (image_scale);
gtk_widget_destroy (image_scale->resize->resize_shell);
}
else
{
gtk_widget_set_sensitive (image_scale->resize->resize_shell, TRUE);
}
}
static void
image_scale_implement (ImageResize *image_scale)
{
GimpImage *gimage;
g_assert (image_scale != NULL);
g_assert (image_scale->gimage != NULL);
gimage = image_scale->gimage;
if (image_scale->resize->resolution_x == gimage->xresolution &&
image_scale->resize->resolution_y == gimage->yresolution &&
image_scale->resize->unit == gimage->unit &&
image_scale->resize->width == gimage->width &&
image_scale->resize->height == gimage->height)
return;
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_SCALE,
_("Scale Image"));
gimp_image_set_resolution (gimage,
image_scale->resize->resolution_x,
image_scale->resize->resolution_y);
gimp_image_set_unit (gimage, image_scale->resize->unit);
if (image_scale->resize->width != gimage->width ||
image_scale->resize->height != gimage->height)
{
if (image_scale->resize->width > 0 &&
image_scale->resize->height > 0)
{
GimpProgress *progress;
progress = gimp_progress_start (image_scale->gdisp,
_("Scaling..."),
TRUE, NULL, NULL);
gimp_image_scale (gimage,
image_scale->resize->width,
image_scale->resize->height,
image_scale->resize->interpolation,
gimp_progress_update_and_flush, progress);
gimp_progress_end (progress);
}
else
{
g_message (_("Scale Error: Both width and height must be "
"greater than zero."));
return;
}
}
gimp_image_undo_group_end (gimage);
gimp_image_flush (gimage);
}

View File

@@ -1,58 +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.
*/
#ifndef __IMAGE_COMMANDS_H__
#define __IMAGE_COMMANDS_H__
void image_convert_rgb_cmd_callback (GtkWidget *widget,
gpointer data);
void image_convert_grayscale_cmd_callback (GtkWidget *widget,
gpointer data);
void image_convert_indexed_cmd_callback (GtkWidget *widget,
gpointer data);
void image_resize_cmd_callback (GtkWidget *widget,
gpointer data);
void image_scale_cmd_callback (GtkWidget *widget,
gpointer data);
void image_flip_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void image_rotate_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void image_crop_cmd_callback (GtkWidget *widget,
gpointer data);
void image_duplicate_cmd_callback (GtkWidget *widget,
gpointer data);
void image_merge_layers_cmd_callback (GtkWidget *widet,
gpointer data);
void image_flatten_image_cmd_callback (GtkWidget *widet,
gpointer data);
void image_layers_merge_query (GimpImage *gimage,
gboolean merge_visible,
GtkWidget *parent);
void image_configure_grid_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __IMAGE_COMMANDS_H__ */

View File

@@ -1,84 +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 "gui-types.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
#include "widgets/gimpimageview.h"
#include "display/gimpdisplay.h"
#include "images-commands.h"
/* public functionss */
void
images_raise_views_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImageView *view = GIMP_IMAGE_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->raise_button))
gtk_button_clicked (GTK_BUTTON (view->raise_button));
}
void
images_new_view_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImageView *view = GIMP_IMAGE_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->new_button))
gtk_button_clicked (GTK_BUTTON (view->new_button));
}
void
images_delete_image_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImageView *view = GIMP_IMAGE_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->delete_button))
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
void
images_raise_views (GimpImage *gimage)
{
GList *list;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
for (list = GIMP_LIST (gimage->gimp->displays)->list;
list;
list = g_list_next (list))
{
GimpDisplay *display = list->data;
if (display->gimage == gimage)
gtk_window_present (GTK_WINDOW (display->shell));
}
}

View File

@@ -1,33 +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.
*/
#ifndef __IMAGES_COMMANDS_H__
#define __IMAGES_COMMANDS_H__
void images_raise_views_cmd_callback (GtkWidget *widget,
gpointer data);
void images_new_view_cmd_callback (GtkWidget *widget,
gpointer data);
void images_delete_image_cmd_callback (GtkWidget *widget,
gpointer data);
void images_raise_views (GimpImage *gimage);
#endif /* __IMAGES_COMMANDS_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,99 +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.
*/
#ifndef __LAYERS_COMMANDS_H__
#define __LAYERS_COMMANDS_H__
void layers_select_previous_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_select_next_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_select_top_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_select_bottom_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_raise_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_lower_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_raise_to_top_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_lower_to_bottom_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_new_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_duplicate_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_anchor_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_merge_down_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_delete_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_text_discard_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_resize_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_resize_to_image_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_scale_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_crop_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_add_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_apply_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_delete_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_to_selection_cmd_callback (GtkWidget *widet,
gpointer data,
guint action);
void layers_alpha_add_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_alpha_to_selection_cmd_callback (GtkWidget *widet,
gpointer data,
guint action);
void layers_merge_layers_cmd_callback (GtkWidget *widget,
gpointer data);
void layers_flatten_image_cmd_callback (GtkWidget *widget,
gpointer data);
void layers_text_tool_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_edit_attributes_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_text_tool (GimpLayer *layer,
GtkWidget *parent);
void layers_new_layer_query (GimpImage *gimage,
GimpLayer *template,
gboolean interactive,
GtkWidget *parent);
void layers_edit_layer_query (GimpLayer *layer,
GtkWidget *parent);
#endif /* __LAYERS_COMMANDS_H__ */

View File

@@ -1,99 +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 "gui-types.h"
#include "widgets/gimppaletteeditor.h"
#include "palette-editor-commands.h"
/* public functions */
void
palette_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->edit_button))
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
}
void
palette_editor_new_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->new_button))
gimp_button_extended_clicked (GIMP_BUTTON (editor->new_button),
action ? GDK_CONTROL_MASK : 0);
}
void
palette_editor_delete_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->delete_button))
gtk_button_clicked (GTK_BUTTON (editor->delete_button));
}
void
palette_editor_zoom_in_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->zoom_in_button))
gtk_button_clicked (GTK_BUTTON (editor->zoom_in_button));
}
void
palette_editor_zoom_out_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->zoom_out_button))
gtk_button_clicked (GTK_BUTTON (editor->zoom_out_button));
}
void
palette_editor_zoom_all_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->zoom_all_button))
gtk_button_clicked (GTK_BUTTON (editor->zoom_all_button));
}

View File

@@ -1,44 +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.
*/
#ifndef __PALETTE_EDITOR_COMMANDS_H__
#define __PALETTE_EDITOR_COMMANDS_H__
void palette_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_new_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_delete_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_zoom_in_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_zoom_out_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_zoom_all_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __PALETTE_EDITOR_COMMANDS_H__ */

View File

@@ -1,148 +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 "gui-types.h"
#include "core/gimppalette.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "widgets/gimpcontainertreeview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimppreview.h"
#include "palette-import-dialog.h"
#include "palettes-commands.h"
#include "gimp-intl.h"
/* local function prototypes */
static void palettes_merge_palettes_query (GimpContainerEditor *editor);
static void palettes_merge_palettes_callback (GtkWidget *widget,
const gchar *palette_name,
gpointer data);
/* public functionss */
void
palettes_import_palette_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpContainerEditor *editor;
editor = GIMP_CONTAINER_EDITOR (data);
palette_import_dialog_show (editor->view->context->gimp);
}
void
palettes_merge_palettes_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpContainerEditor *editor;
editor = GIMP_CONTAINER_EDITOR (data);
palettes_merge_palettes_query (editor);
}
/* private functions */
static void
palettes_merge_palettes_query (GimpContainerEditor *editor)
{
GtkWidget *qbox;
qbox = gimp_query_string_box (_("Merge Palette"),
GTK_WIDGET (editor),
gimp_standard_help_func,
GIMP_HELP_PALETTE_MERGE,
_("Enter a name for the merged palette"),
NULL,
G_OBJECT (editor), "destroy",
palettes_merge_palettes_callback,
editor);
gtk_widget_show (qbox);
}
static void
palettes_merge_palettes_callback (GtkWidget *widget,
const gchar *palette_name,
gpointer data)
{
#ifdef __GNUC__
#warning FIXME: reimplement palettes_merge_palettes_callback()
#endif
#if 0
GimpContainerEditor *editor;
GimpPalette *palette;
GimpPalette *new_palette;
GimpPaletteEntry *entry;
GList *sel_list;
editor = (GimpContainerEditor *) data;
sel_list = GTK_LIST (GIMP_CONTAINER_LIST_VIEW (editor->view)->gtk_list)->selection;
if (! sel_list)
{
g_message ("Can't merge palettes because there are no palettes selected.");
return;
}
new_palette = GIMP_PALETTE (gimp_palette_new (palette_name, FALSE));
while (sel_list)
{
GimpListItem *list_item;
GList *cols;
list_item = GIMP_LIST_ITEM (sel_list->data);
palette = (GimpPalette *) GIMP_PREVIEW (list_item->preview)->viewable;
if (palette)
{
for (cols = palette->colors; cols; cols = g_list_next (cols))
{
entry = (GimpPaletteEntry *) cols->data;
gimp_palette_add_entry (new_palette,
entry->name,
&entry->color);
}
}
sel_list = sel_list->next;
}
gimp_container_add (editor->view->container,
GIMP_OBJECT (new_palette));
#endif
}

View File

@@ -1,29 +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.
*/
#ifndef __PALETTES_COMMANDS_H__
#define __PALETTES_COMMANDS_H__
void palettes_import_palette_cmd_callback (GtkWidget *widget,
gpointer data);
void palettes_merge_palettes_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __PALETTES_COMMANDS_H__ */

View File

@@ -1,180 +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 "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpitem.h"
#include "plug-in/plug-in-run.h"
#include "plug-in/plug-in-proc.h"
#include "widgets/gimpdock.h"
#include "widgets/gimpitemfactory.h"
#include "display/gimpdisplay.h"
#include "plug-in-commands.h"
#include "plug-in-menus.h"
#define return_if_no_display(gdisp,data) \
if (GIMP_IS_DISPLAY (data)) \
gdisp = data; \
else if (GIMP_IS_GIMP (data)) \
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gdisp = gimp_context_get_display (((GimpDock *) data)->context); \
else \
gdisp = NULL; \
if (! gdisp) \
return
void
plug_in_run_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GtkItemFactory *item_factory;
Gimp *gimp;
ProcRecord *proc_rec;
Argument *args;
gint gdisp_ID = -1;
gint i;
gint argc;
GimpImageType drawable_type = GIMP_RGB_IMAGE;
item_factory = gtk_item_factory_from_widget (widget);
gimp = GIMP_ITEM_FACTORY (item_factory)->gimp;
proc_rec = (ProcRecord *) data;
/* construct the procedures arguments */
args = g_new0 (Argument, proc_rec->num_args);
/* initialize the argument types */
for (i = 0; i < proc_rec->num_args; i++)
args[i].arg_type = proc_rec->args[i].arg_type;
/* initialize the first argument */
args[0].value.pdb_int = GIMP_RUN_INTERACTIVE;
argc = 1;
switch (proc_rec->proc_type)
{
case GIMP_EXTENSION:
break;
case GIMP_PLUGIN:
case GIMP_TEMPORARY:
if (proc_rec->num_args >= 2 &&
proc_rec->args[1].arg_type == GIMP_PDB_IMAGE)
{
GimpDisplay *gdisplay;
gdisplay = gimp_context_get_display (gimp_get_user_context (gimp));
if (gdisplay)
{
gdisp_ID = gimp_display_get_ID (gdisplay);
args[1].value.pdb_int = gimp_image_get_ID (gdisplay->gimage);
argc++;
if (proc_rec->num_args >= 2 &&
proc_rec->args[2].arg_type == GIMP_PDB_DRAWABLE)
{
GimpDrawable *drawable;
drawable = gimp_image_active_drawable (gdisplay->gimage);
if (drawable)
{
drawable_type = gimp_drawable_type (drawable);
args[2].value.pdb_int =
gimp_item_get_ID (GIMP_ITEM (drawable));
argc++;
}
else
{
g_warning ("Uh-oh, no active drawable for the plug-in!");
g_free (args);
return;
}
}
}
}
break;
default:
g_error ("Unknown procedure type.");
g_free (args);
return;
}
/* run the plug-in procedure */
plug_in_run (gimp, proc_rec, args, argc, FALSE, TRUE, gdisp_ID);
/* remember only "standard" plug-ins */
if (proc_rec->proc_type == GIMP_PLUGIN &&
proc_rec->num_args >= 2 &&
proc_rec->args[1].arg_type == GIMP_PDB_IMAGE &&
proc_rec->args[2].arg_type == GIMP_PDB_DRAWABLE)
{
gimp->last_plug_in = proc_rec;
plug_in_menus_update (GIMP_ITEM_FACTORY (item_factory), drawable_type);
}
g_free (args);
}
void
plug_in_repeat_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplay *gdisp;
GimpDrawable *drawable;
gboolean interactive;
return_if_no_display (gdisp, data);
drawable = gimp_image_active_drawable (gdisp->gimage);
if (! drawable)
return;
interactive = action ? TRUE : FALSE;
plug_in_repeat (gdisp->gimage->gimp,
gimp_display_get_ID (gdisp),
gimp_image_get_ID (gdisp->gimage),
gimp_item_get_ID (GIMP_ITEM (drawable)),
interactive);
}

View File

@@ -1,31 +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.
*/
#ifndef __PLUG_IN_COMMANDS_H__
#define __PLUG_IN_COMMANDS_H__
void plug_in_run_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void plug_in_repeat_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __PLUG_IN_COMMANDS_H__ */

View File

@@ -1,259 +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 "gui-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimpimage-qmask.h"
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "qmask-commands.h"
#include "gimp-intl.h"
typedef struct _EditQmaskOptions EditQmaskOptions;
struct _EditQmaskOptions
{
GtkWidget *query_box;
GtkWidget *name_entry;
GtkWidget *color_panel;
GimpImage *gimage;
};
/* local function prototypes */
static void qmask_channel_query (GimpDisplayShell *shell);
static void qmask_query_response (GtkWidget *widget,
gint response_id,
EditQmaskOptions *options);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data);
static void qmask_query_color_changed (GimpColorButton *button,
gpointer data);
/* public functionss */
void
qmask_toggle_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
if (GTK_CHECK_MENU_ITEM (widget)->active !=
gimp_image_get_qmask_state (shell->gdisp->gimage))
{
gimp_image_set_qmask_state (shell->gdisp->gimage,
GTK_CHECK_MENU_ITEM (widget)->active);
gimp_image_flush (shell->gdisp->gimage);
}
}
void
qmask_invert_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
if (GTK_CHECK_MENU_ITEM (widget)->active)
{
if (action != shell->gdisp->gimage->qmask_inverted)
{
gimp_image_qmask_invert (shell->gdisp->gimage);
if (gimp_image_get_qmask_state (shell->gdisp->gimage))
gimp_image_flush (shell->gdisp->gimage);
}
}
}
void
qmask_configure_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
qmask_channel_query (shell);
}
/* private functions */
static void
qmask_channel_query (GimpDisplayShell *shell)
{
EditQmaskOptions *options;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *opacity_scale;
GtkObject *opacity_scale_data;
/* the new options structure */
options = g_new0 (EditQmaskOptions, 1);
options->gimage = shell->gdisp->gimage;
options->color_panel = gimp_color_panel_new (_("Edit Qmask Color"),
&options->gimage->qmask_color,
GIMP_COLOR_AREA_LARGE_CHECKS,
48, 64);
gimp_color_panel_set_context (GIMP_COLOR_PANEL (options->color_panel),
gimp_get_user_context (options->gimage->gimp));
/* The dialog */
options->query_box =
gimp_viewable_dialog_new (GIMP_VIEWABLE (shell->gdisp->gimage),
_("Qmask Attributes"), "gimp-qmask-edit",
GIMP_STOCK_QMASK_ON,
_("Edit QuickMask Attributes"),
GTK_WIDGET (shell),
gimp_standard_help_func,
GIMP_HELP_QMASK_EDIT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (options->query_box, "response",
G_CALLBACK (qmask_query_response),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free, options);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
gtk_widget_show (hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
/* The table */
table = gtk_table_new (1, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
/* The opacity scale */
opacity_scale_data =
gtk_adjustment_new (options->gimage->qmask_color.a * 100.0,
0.0, 100.0, 1.0, 1.0, 0.0);
opacity_scale = gtk_hscale_new (GTK_ADJUSTMENT (opacity_scale_data));
gtk_widget_set_size_request (opacity_scale, 100, -1);
gtk_scale_set_value_pos (GTK_SCALE (opacity_scale), GTK_POS_TOP);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Mask Opacity:"), 1.0, 1.0,
opacity_scale, 1, FALSE);
g_signal_connect (opacity_scale_data, "value_changed",
G_CALLBACK (qmask_query_scale_update),
options->color_panel);
/* The color panel */
gtk_box_pack_start (GTK_BOX (hbox), options->color_panel,
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel);
g_signal_connect (options->color_panel, "color_changed",
G_CALLBACK (qmask_query_color_changed),
opacity_scale_data);
gtk_widget_show (options->query_box);
}
static void
qmask_query_response (GtkWidget *widget,
gint response_id,
EditQmaskOptions *options)
{
if (response_id == GTK_RESPONSE_OK)
{
GimpChannel *channel = gimp_image_get_qmask (options->gimage);
GimpRGB color;
if (options->gimage && channel)
{
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
&color);
if (gimp_rgba_distance (&color, &channel->color) > 0.0001)
{
gimp_channel_set_color (channel, &color, TRUE);
gimp_image_flush (options->gimage);
}
}
/* update the qmask color no matter what */
options->gimage->qmask_color = color;
}
gtk_widget_destroy (options->query_box);
}
static void
qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data)
{
GimpRGB color;
gimp_color_button_get_color (GIMP_COLOR_BUTTON (data), &color);
gimp_rgb_set_alpha (&color, adjustment->value / 100.0);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (data), &color);
}
static void
qmask_query_color_changed (GimpColorButton *button,
gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
GimpRGB color;
gimp_color_button_get_color (button, &color);
gtk_adjustment_set_value (adj, color.a * 100.0);
}

View File

@@ -1,34 +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.
*/
#ifndef __QMASK_COMMANDS_H__
#define __QMASK_COMMANDS_H__
void qmask_toggle_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void qmask_invert_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void qmask_configure_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __QMASK_COMMANDS_H__ */

View File

@@ -1,259 +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 "gui-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimpimage-qmask.h"
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "qmask-commands.h"
#include "gimp-intl.h"
typedef struct _EditQmaskOptions EditQmaskOptions;
struct _EditQmaskOptions
{
GtkWidget *query_box;
GtkWidget *name_entry;
GtkWidget *color_panel;
GimpImage *gimage;
};
/* local function prototypes */
static void qmask_channel_query (GimpDisplayShell *shell);
static void qmask_query_response (GtkWidget *widget,
gint response_id,
EditQmaskOptions *options);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data);
static void qmask_query_color_changed (GimpColorButton *button,
gpointer data);
/* public functionss */
void
qmask_toggle_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
if (GTK_CHECK_MENU_ITEM (widget)->active !=
gimp_image_get_qmask_state (shell->gdisp->gimage))
{
gimp_image_set_qmask_state (shell->gdisp->gimage,
GTK_CHECK_MENU_ITEM (widget)->active);
gimp_image_flush (shell->gdisp->gimage);
}
}
void
qmask_invert_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
if (GTK_CHECK_MENU_ITEM (widget)->active)
{
if (action != shell->gdisp->gimage->qmask_inverted)
{
gimp_image_qmask_invert (shell->gdisp->gimage);
if (gimp_image_get_qmask_state (shell->gdisp->gimage))
gimp_image_flush (shell->gdisp->gimage);
}
}
}
void
qmask_configure_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
qmask_channel_query (shell);
}
/* private functions */
static void
qmask_channel_query (GimpDisplayShell *shell)
{
EditQmaskOptions *options;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *opacity_scale;
GtkObject *opacity_scale_data;
/* the new options structure */
options = g_new0 (EditQmaskOptions, 1);
options->gimage = shell->gdisp->gimage;
options->color_panel = gimp_color_panel_new (_("Edit Qmask Color"),
&options->gimage->qmask_color,
GIMP_COLOR_AREA_LARGE_CHECKS,
48, 64);
gimp_color_panel_set_context (GIMP_COLOR_PANEL (options->color_panel),
gimp_get_user_context (options->gimage->gimp));
/* The dialog */
options->query_box =
gimp_viewable_dialog_new (GIMP_VIEWABLE (shell->gdisp->gimage),
_("Qmask Attributes"), "gimp-qmask-edit",
GIMP_STOCK_QMASK_ON,
_("Edit QuickMask Attributes"),
GTK_WIDGET (shell),
gimp_standard_help_func,
GIMP_HELP_QMASK_EDIT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (options->query_box, "response",
G_CALLBACK (qmask_query_response),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free, options);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
gtk_widget_show (hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
/* The table */
table = gtk_table_new (1, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
/* The opacity scale */
opacity_scale_data =
gtk_adjustment_new (options->gimage->qmask_color.a * 100.0,
0.0, 100.0, 1.0, 1.0, 0.0);
opacity_scale = gtk_hscale_new (GTK_ADJUSTMENT (opacity_scale_data));
gtk_widget_set_size_request (opacity_scale, 100, -1);
gtk_scale_set_value_pos (GTK_SCALE (opacity_scale), GTK_POS_TOP);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Mask Opacity:"), 1.0, 1.0,
opacity_scale, 1, FALSE);
g_signal_connect (opacity_scale_data, "value_changed",
G_CALLBACK (qmask_query_scale_update),
options->color_panel);
/* The color panel */
gtk_box_pack_start (GTK_BOX (hbox), options->color_panel,
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel);
g_signal_connect (options->color_panel, "color_changed",
G_CALLBACK (qmask_query_color_changed),
opacity_scale_data);
gtk_widget_show (options->query_box);
}
static void
qmask_query_response (GtkWidget *widget,
gint response_id,
EditQmaskOptions *options)
{
if (response_id == GTK_RESPONSE_OK)
{
GimpChannel *channel = gimp_image_get_qmask (options->gimage);
GimpRGB color;
if (options->gimage && channel)
{
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
&color);
if (gimp_rgba_distance (&color, &channel->color) > 0.0001)
{
gimp_channel_set_color (channel, &color, TRUE);
gimp_image_flush (options->gimage);
}
}
/* update the qmask color no matter what */
options->gimage->qmask_color = color;
}
gtk_widget_destroy (options->query_box);
}
static void
qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data)
{
GimpRGB color;
gimp_color_button_get_color (GIMP_COLOR_BUTTON (data), &color);
gimp_rgb_set_alpha (&color, adjustment->value / 100.0);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (data), &color);
}
static void
qmask_query_color_changed (GimpColorButton *button,
gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
GimpRGB color;
gimp_color_button_get_color (button, &color);
gtk_adjustment_set_value (adj, color.a * 100.0);
}

View File

@@ -1,34 +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.
*/
#ifndef __QMASK_COMMANDS_H__
#define __QMASK_COMMANDS_H__
void qmask_toggle_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void qmask_invert_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void qmask_configure_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __QMASK_COMMANDS_H__ */

View File

@@ -1,449 +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 "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-qmask.h"
#include "core/gimpselection.h"
#include "widgets/gimpdock.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpdialogfactory.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "dialogs.h"
#include "select-commands.h"
#include "gimp-intl.h"
#define return_if_no_display(gdisp,data) \
if (GIMP_IS_DISPLAY (data)) \
gdisp = data; \
else if (GIMP_IS_GIMP (data)) \
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gdisp = gimp_context_get_display (((GimpDock *) data)->context); \
else \
gdisp = NULL; \
if (! gdisp) \
return
#define return_if_no_image(gimage,data) \
if (GIMP_IS_DISPLAY (data)) \
gimage = ((GimpDisplay *) data)->gimage; \
else if (GIMP_IS_GIMP (data)) \
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gimage = gimp_context_get_image (((GimpDock *) data)->context); \
else \
gimage = NULL; \
if (! gimage) \
return
/* local functions */
static void gimp_image_mask_feather_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
static void gimp_image_mask_border_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
static void gimp_image_mask_grow_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
static void gimp_image_mask_shrink_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
/* local variables */
static gdouble selection_feather_radius = 5.0;
static gint selection_border_radius = 5;
static gint selection_grow_pixels = 1;
static gint selection_shrink_pixels = 1;
static gboolean selection_shrink_edge_lock = FALSE;
void
select_invert_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_channel_invert (gimp_image_get_mask (gimage), TRUE);
gimp_image_flush (gimage);
}
void
select_all_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_channel_all (gimp_image_get_mask (gimage), TRUE);
gimp_image_flush (gimage);
}
void
select_none_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_channel_clear (gimp_image_get_mask (gimage), NULL, TRUE);
gimp_image_flush (gimage);
}
void
select_from_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *vectors;
return_if_no_image (gimage, data);
vectors = gimp_image_get_active_vectors (gimage);
if (!vectors)
return;
gimp_channel_select_vectors (gimp_image_get_mask (gimage),
_("Path to Selection"),
vectors,
GIMP_CHANNEL_OP_REPLACE,
TRUE, FALSE, 0, 0);
gimp_image_flush (gimage);
}
void
select_float_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_selection_float (gimp_image_get_mask (gimage),
gimp_image_active_drawable (gimage),
TRUE, 0, 0);
gimp_image_flush (gimage);
}
void
select_feather_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *qbox;
return_if_no_display (gdisp, data);
qbox = gimp_query_size_box (_("Feather Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_FEATHER,
_("Feather selection by"),
selection_feather_radius, 0, 32767, 3,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
G_OBJECT (gdisp->gimage), "disconnect",
gimp_image_mask_feather_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_sharpen_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_channel_sharpen (gimp_image_get_mask (gimage), TRUE);
gimp_image_flush (gimage);
}
void
select_shrink_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *shrink_dialog;
GtkWidget *edge_lock;
return_if_no_display (gdisp, data);
shrink_dialog =
gimp_query_size_box (_("Shrink Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_SHRINK,
_("Shrink selection by"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
G_OBJECT (gdisp->gimage), "disconnect",
gimp_image_mask_shrink_callback, gdisp->gimage);
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (shrink_dialog)), edge_lock,
FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (shrink_dialog), "edge_lock_toggle", edge_lock);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edge_lock),
! selection_shrink_edge_lock);
gtk_widget_show (edge_lock);
gtk_widget_show (shrink_dialog);
}
void
select_grow_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *qbox;
return_if_no_display (gdisp, data);
qbox = gimp_query_size_box (_("Grow Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_GROW,
_("Grow selection by"),
selection_grow_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
G_OBJECT (gdisp->gimage), "disconnect",
gimp_image_mask_grow_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_border_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *qbox;
return_if_no_display (gdisp, data);
qbox = gimp_query_size_box (_("Border Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_BORDER,
_("Border selection by"),
selection_border_radius, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
G_OBJECT (gdisp->gimage), "disconnect",
gimp_image_mask_border_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_save_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_selection_save (gimp_image_get_mask (gimage));
gimp_image_flush (gimage);
gimp_dialog_factory_dialog_raise (global_dock_factory,
gtk_widget_get_screen (widget),
"gimp-channel-list", -1);
}
void
select_toggle_quickmask_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_image_set_qmask_state (gimage, !gimp_image_get_qmask_state (gimage));
gimp_image_flush (gimage);
}
/* private functions */
static void
gimp_image_mask_feather_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
{
GimpImage *gimage;
gdouble radius_x;
gdouble radius_y;
gimage = GIMP_IMAGE (data);
selection_feather_radius = size;
radius_x = radius_y = selection_feather_radius;
if (unit != GIMP_UNIT_PIXEL)
{
gdouble factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimp_channel_feather (gimp_image_get_mask (gimage), radius_x, radius_y, TRUE);
gimp_image_flush (gimage);
}
static void
gimp_image_mask_border_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
{
GimpImage *gimage;
gdouble radius_x;
gdouble radius_y;
gimage = GIMP_IMAGE (data);
selection_border_radius = ROUND (size);
radius_x = radius_y = selection_border_radius;
if (unit != GIMP_UNIT_PIXEL)
{
gdouble factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimp_channel_border (gimp_image_get_mask (gimage), radius_x, radius_y, TRUE);
gimp_image_flush (gimage);
}
static void
gimp_image_mask_grow_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
{
GimpImage *gimage;
gdouble radius_x;
gdouble radius_y;
gimage = GIMP_IMAGE (data);
selection_grow_pixels = ROUND (size);
radius_x = radius_y = selection_grow_pixels;
if (unit != GIMP_UNIT_PIXEL)
{
gdouble factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimp_channel_grow (gimp_image_get_mask (gimage), radius_x, radius_y, TRUE);
gimp_image_flush (gimage);
}
static void
gimp_image_mask_shrink_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
{
GimpImage *gimage;
gint radius_x;
gint radius_y;
gimage = GIMP_IMAGE (data);
selection_shrink_pixels = ROUND (size);
radius_x = radius_y = selection_shrink_pixels;
selection_shrink_edge_lock =
! GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (widget),
"edge_lock_toggle"))->active;
if (unit != GIMP_UNIT_PIXEL)
{
gdouble factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimp_channel_shrink (gimp_image_get_mask (gimage), radius_x, radius_y,
selection_shrink_edge_lock, TRUE);
gimp_image_flush (gimage);
}

View File

@@ -1,49 +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.
*/
#ifndef __SELECT_COMMANDS_H__
#define __SELECT_COMMANDS_H__
void select_invert_cmd_callback (GtkWidget *widget,
gpointer data);
void select_all_cmd_callback (GtkWidget *widget,
gpointer data);
void select_none_cmd_callback (GtkWidget *widget,
gpointer data);
void select_from_vectors_cmd_callback (GtkWidget *widget,
gpointer data);
void select_float_cmd_callback (GtkWidget *widget,
gpointer data);
void select_feather_cmd_callback (GtkWidget *widget,
gpointer data);
void select_sharpen_cmd_callback (GtkWidget *widget,
gpointer data);
void select_shrink_cmd_callback (GtkWidget *widget,
gpointer data);
void select_border_cmd_callback (GtkWidget *widget,
gpointer data);
void select_grow_cmd_callback (GtkWidget *widget,
gpointer data);
void select_save_cmd_callback (GtkWidget *widget,
gpointer data);
void select_toggle_quickmask_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __SELECT_COMMANDS_H__ */

View File

@@ -1,252 +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 "gui-types.h"
#include "config/gimpconfig.h"
#include "config/gimpconfig-utils.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimplist.h"
#include "core/gimptemplate.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimptemplateeditor.h"
#include "widgets/gimptemplateview.h"
#include "widgets/gimpviewabledialog.h"
#include "dialogs.h"
#include "file-new-dialog.h"
#include "templates-commands.h"
#include "gimp-intl.h"
/* public functions */
void
templates_new_template_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->new_button));
}
void
templates_duplicate_template_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->duplicate_button));
}
void
templates_edit_template_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->edit_button));
}
void
templates_create_image_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->create_button));
}
void
templates_delete_template_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
static void
templates_new_template_response (GtkWidget *widget,
gint response_id,
GtkWidget *dialog)
{
if (response_id == GTK_RESPONSE_OK)
{
GimpTemplate *template;
Gimp *gimp;
template = g_object_get_data (G_OBJECT (dialog), "gimp-template");
gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
gimp_container_add (gimp->templates, GIMP_OBJECT (template));
gimp_context_set_template (gimp_get_user_context (gimp), template);
}
gtk_widget_destroy (dialog);
}
void
templates_new_template_dialog (Gimp *gimp,
GimpTemplate *unused,
GtkWidget *parent)
{
GimpTemplate *template;
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *editor;
dialog = gimp_viewable_dialog_new (NULL,
_("New Template"), "gimp-template-new",
GIMP_STOCK_TEMPLATE,
_("Create a New Template"),
parent,
gimp_standard_help_func,
GIMP_HELP_TEMPLATE_NEW,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (templates_new_template_response),
dialog);
main_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_vbox,
TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
template = gimp_config_duplicate (GIMP_CONFIG (gimp->config->default_image));
gimp_object_set_name (GIMP_OBJECT (template), _("Unnamed"));
editor = gimp_template_editor_new (template, gimp, TRUE);
g_object_unref (template);
g_object_set_data (G_OBJECT (dialog), "gimp", gimp);
g_object_set_data (G_OBJECT (dialog), "gimp-template", template);
gtk_box_pack_start (GTK_BOX (main_vbox), editor, FALSE, FALSE, 0);
gtk_widget_show (editor);
gtk_widget_show (dialog);
}
static void
templates_edit_template_response (GtkWidget *widget,
gint response_id,
GtkWidget *dialog)
{
if (response_id == GTK_RESPONSE_OK)
{
GimpTemplateEditor *editor;
GimpTemplate *template;
Gimp *gimp;
editor = g_object_get_data (G_OBJECT (dialog), "gimp-template-editor");
template = g_object_get_data (G_OBJECT (dialog), "gimp-template");
gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
gimp_config_sync (GIMP_CONFIG (editor->template),
GIMP_CONFIG (template), 0);
gimp_list_uniquefy_name (GIMP_LIST (gimp->templates),
GIMP_OBJECT (template), TRUE);
}
gtk_widget_destroy (dialog);
}
void
templates_edit_template_dialog (Gimp *gimp,
GimpTemplate *template,
GtkWidget *parent)
{
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *editor;
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (template),
_("Edit Template"), "gimp-template-edit",
GIMP_STOCK_EDIT,
_("Edit Template"),
parent,
gimp_standard_help_func,
GIMP_HELP_TEMPLATE_EDIT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (templates_edit_template_response),
dialog);
main_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_vbox,
TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
g_object_set_data (G_OBJECT (dialog), "gimp", gimp);
g_object_set_data (G_OBJECT (dialog), "gimp-template", template);
template = gimp_config_duplicate (GIMP_CONFIG (template));
editor = gimp_template_editor_new (template, gimp, TRUE);
g_object_unref (template);
gtk_box_pack_start (GTK_BOX (main_vbox), editor, FALSE, FALSE, 0);
gtk_widget_show (editor);
g_object_set_data (G_OBJECT (dialog), "gimp-template-editor", editor);
gtk_widget_show (dialog);
}
void
templates_file_new_dialog (Gimp *gimp,
GimpTemplate *template,
GtkWidget *parent)
{
GtkWidget *dialog;
dialog = gimp_dialog_factory_dialog_new (global_dialog_factory,
gtk_widget_get_screen (parent),
"gimp-file-new-dialog", -1);
if (dialog)
file_new_dialog_set (dialog, NULL, template);
}

View File

@@ -1,44 +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.
*/
#ifndef __TEMPLATES_COMMANDS_H__
#define __TEMPLATES_COMMANDS_H__
void templates_new_template_cmd_callback (GtkWidget *widget,
gpointer data);
void templates_duplicate_template_cmd_callback (GtkWidget *widget,
gpointer data);
void templates_edit_template_cmd_callback (GtkWidget *widget,
gpointer data);
void templates_create_image_cmd_callback (GtkWidget *widget,
gpointer data);
void templates_delete_template_cmd_callback (GtkWidget *widget,
gpointer data);
void templates_new_template_dialog (Gimp *gimp,
GimpTemplate *unused,
GtkWidget *parent);
void templates_edit_template_dialog (Gimp *gimp,
GimpTemplate *template,
GtkWidget *parent);
void templates_file_new_dialog (Gimp *gimp,
GimpTemplate *template,
GtkWidget *parent);
#endif /* __TEMPLATES_COMMANDS_H__ */

View File

@@ -1,201 +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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "config/gimpconfig.h"
#include "config/gimpconfig-utils.h"
#include "core/gimp.h"
#include "core/gimplist.h"
#include "core/gimptoolinfo.h"
#include "core/gimptooloptions.h"
#include "widgets/gimpeditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimptooloptionseditor.h"
#include "tool-options-commands.h"
#include "gimp-intl.h"
/* local function prototypes */
static void tool_options_save_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
static void tool_options_rename_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
/* public functions */
void
tool_options_save_to_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpToolOptions *options = GIMP_TOOL_OPTIONS (data);
gchar *name;
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (options)));
gimp_config_sync (GIMP_CONFIG (options->tool_info->tool_options),
GIMP_CONFIG (options), 0);
gimp_object_set_name (GIMP_OBJECT (options), name);
g_free (name);
}
void
tool_options_save_new_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context;
GimpToolInfo *tool_info;
GtkWidget *qbox;
context = gimp_get_user_context (editor->item_factory->gimp);
tool_info = gimp_context_get_tool (context);
qbox = gimp_query_string_box (_("Save Tool Options"),
GTK_WIDGET (editor),
gimp_standard_help_func,
GIMP_HELP_TOOL_OPTIONS_DIALOG,
_("Enter a name for the saved options"),
_("Saved Options"),
NULL, NULL,
tool_options_save_callback, tool_info);
gtk_widget_show (qbox);
}
void
tool_options_restore_from_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpToolOptions *options = GIMP_TOOL_OPTIONS (data);
gimp_config_sync (GIMP_CONFIG (options),
GIMP_CONFIG (options->tool_info->tool_options), 0);
}
void
tool_options_rename_saved_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpToolOptions *options = GIMP_TOOL_OPTIONS (data);
GtkWidget *qbox;
qbox = gimp_query_string_box (_("Rename Saved Tool Options"),
widget,
gimp_standard_help_func,
GIMP_HELP_TOOL_OPTIONS_DIALOG,
_("Enter a new name for the saved options"),
GIMP_OBJECT (options)->name,
NULL, NULL,
tool_options_rename_callback, options);
gtk_widget_show (qbox);
}
void
tool_options_delete_saved_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpToolOptions *options = GIMP_TOOL_OPTIONS (data);
gimp_container_remove (options->tool_info->options_presets,
GIMP_OBJECT (options));
}
void
tool_options_reset_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpToolOptionsEditor *editor = GIMP_TOOL_OPTIONS_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->reset_button))
gtk_button_clicked (GTK_BUTTON (editor->reset_button));
}
void
tool_options_reset_all_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpToolOptionsEditor *editor = GIMP_TOOL_OPTIONS_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->reset_button))
gimp_button_extended_clicked (GIMP_BUTTON (editor->reset_button),
GDK_SHIFT_MASK);
}
/* private functions */
static void
tool_options_save_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
{
GimpToolInfo *tool_info = GIMP_TOOL_INFO (data);
GimpConfig *copy;
if (! name || ! strlen (name))
name = _("Saved Options");
copy = gimp_config_duplicate (GIMP_CONFIG (tool_info->tool_options));
gimp_object_set_name (GIMP_OBJECT (copy), name);
gimp_list_uniquefy_name (GIMP_LIST (tool_info->options_presets),
GIMP_OBJECT (copy), TRUE);
gimp_container_insert (tool_info->options_presets, GIMP_OBJECT (copy), -1);
g_object_unref (copy);
}
static void
tool_options_rename_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
{
GimpToolOptions *options = GIMP_TOOL_OPTIONS (data);
if (! name || ! strlen (name))
name = _("Saved Options");
gimp_object_set_name (GIMP_OBJECT (options), name);
gimp_list_uniquefy_name (GIMP_LIST (options->tool_info->options_presets),
GIMP_OBJECT (options), TRUE);
}

View File

@@ -1,46 +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.
*/
#ifndef __TOOL_OPTIONS_COMMANDS_H__
#define __TOOL_OPTIONS_COMMANDS_H__
void tool_options_save_to_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void tool_options_save_new_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void tool_options_restore_from_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void tool_options_rename_saved_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void tool_options_delete_saved_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void tool_options_reset_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void tool_options_reset_all_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __TOOL_OPTIONS_COMMANDS_H__ */

View File

@@ -1,108 +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 "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpdock.h"
#include "display/gimpdisplay.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
#define return_if_no_gimp(gimp,data) \
if (GIMP_IS_DISPLAY (data)) \
gimp = ((GimpDisplay *) data)->gimage->gimp; \
else if (GIMP_IS_GIMP (data)) \
gimp = data; \
else if (GIMP_IS_DOCK (data)) \
gimp = ((GimpDock *) data)->context->gimp; \
else \
gimp = NULL; \
if (! gimp) \
return
void
tools_default_colors_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
Gimp *gimp;
return_if_no_gimp (gimp, data);
gimp_context_set_default_colors (gimp_get_user_context (gimp));
}
void
tools_swap_colors_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
Gimp *gimp;
return_if_no_gimp (gimp, data);
gimp_context_swap_colors (gimp_get_user_context (gimp));
}
void
tools_select_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
Gimp *gimp;
GimpToolInfo *tool_info;
GimpContext *context;
GimpDisplay *gdisp;
const gchar *identifier;
return_if_no_gimp (gimp, data);
identifier = g_quark_to_string ((GQuark) action);
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (gimp->tool_info_list, identifier);
context = gimp_get_user_context (gimp);
/* always allocate a new tool when selected from the image menu
*/
if (gimp_context_get_tool (context) != tool_info)
{
gimp_context_set_tool (context, tool_info);
}
else
{
gimp_context_tool_changed (context);
}
gdisp = gimp_context_get_display (context);
if (gdisp)
tool_manager_initialize_active (gimp, gdisp);
}

View File

@@ -1,34 +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.
*/
#ifndef __TOOLS_COMMANDS_H__
#define __TOOLS_COMMANDS_H__
void tools_default_colors_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void tools_swap_colors_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void tools_select_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __TOOLS_COMMANDS_H__ */

View File

@@ -1,759 +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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.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/gimptoolinfo.h"
#include "pdb/procedural_db.h"
#include "plug-in/plug-in-run.h"
#include "vectors/gimpvectors.h"
#include "vectors/gimpvectors-export.h"
#include "vectors/gimpvectors-import.h"
#include "widgets/gimpdock.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemtreeview.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
#include "tools/gimppainttool.h"
#include "tools/gimpvectortool.h"
#include "tools/tool_manager.h"
#include "stroke-dialog.h"
#include "vectors-commands.h"
#include "gimp-intl.h"
#define return_if_no_image(gimage,data) \
if (GIMP_IS_DISPLAY (data)) \
gimage = ((GimpDisplay *) data)->gimage; \
else if (GIMP_IS_GIMP (data)) \
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gimage = gimp_context_get_image (((GimpDock *) data)->context); \
else if (GIMP_IS_ITEM_TREE_VIEW (data)) \
gimage = ((GimpItemTreeView *) data)->gimage; \
else \
gimage = NULL; \
\
if (! gimage) \
return
#define return_if_no_vectors(gimage,vectors,data) \
return_if_no_image (gimage,data); \
vectors = gimp_image_get_active_vectors (gimage); \
if (! vectors) \
return
static void vectors_import_query (GimpImage *gimage,
GtkWidget *parent);
static void vectors_export_query (GimpImage *gimage,
GimpVectors *vectors,
GtkWidget *parent);
/* public functions */
void
vectors_new_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
vectors_new_vectors_query (gimage, NULL, TRUE, widget);
}
void
vectors_raise_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
gimp_image_raise_vectors (gimage, active_vectors);
gimp_image_flush (gimage);
}
void
vectors_lower_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
gimp_image_lower_vectors (gimage, active_vectors);
gimp_image_flush (gimage);
}
void
vectors_duplicate_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
GimpVectors *new_vectors;
return_if_no_vectors (gimage, active_vectors, data);
new_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (active_vectors),
G_TYPE_FROM_INSTANCE (active_vectors),
TRUE));
gimp_image_add_vectors (gimage, new_vectors, -1);
gimp_image_flush (gimage);
}
void
vectors_delete_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
gimp_image_remove_vectors (gimage, active_vectors);
gimp_image_flush (gimage);
}
void
vectors_merge_visible_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
gimp_image_merge_visible_vectors (gimage);
gimp_image_flush (gimage);
}
void
vectors_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpChannelOps op;
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
op = (GimpChannelOps) action;
gimp_channel_select_vectors (gimp_image_get_mask (gimage),
_("Path to Selection"),
active_vectors,
op, TRUE, FALSE, 0, 0);
gimp_image_flush (gimage);
}
void
vectors_selection_to_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
vectors_selection_to_vectors (gimage, FALSE);
}
void
vectors_stroke_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
vectors_stroke_vectors (GIMP_ITEM (active_vectors), widget);
}
void
vectors_copy_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
#ifdef __GNUC__
#warning FIXME: need vectors clipboard
#endif
}
void
vectors_paste_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
#ifdef __GNUC__
#warning FIXME: need vectors clipboard
#endif
}
void
vectors_import_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
vectors_import_query (gimage, widget);
}
void
vectors_export_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
vectors_export_query (gimage, active_vectors, widget);
}
void
vectors_vectors_tool_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
vectors_vectors_tool (active_vectors);
}
void
vectors_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
vectors_edit_vectors_query (active_vectors, widget);
}
void
vectors_stroke_vectors (GimpItem *item,
GtkWidget *parent)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GtkWidget *dialog;
g_return_if_fail (GIMP_IS_ITEM (item));
gimage = gimp_item_get_image (item);
active_drawable = gimp_image_active_drawable (gimage);
if (! active_drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
return;
}
dialog = stroke_dialog_new (item, GIMP_STOCK_PATH_STROKE,
GIMP_HELP_PATH_STROKE,
parent);
gtk_widget_show (dialog);
}
void
vectors_selection_to_vectors (GimpImage *gimage,
gboolean advanced)
{
ProcRecord *proc_rec;
Argument *args;
GimpDisplay *gdisp;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
if (advanced)
proc_rec = procedural_db_lookup (gimage->gimp,
"plug_in_sel2path_advanced");
else
proc_rec = procedural_db_lookup (gimage->gimp,
"plug_in_sel2path");
if (! proc_rec)
{
g_message ("Selection to path procedure lookup failed.");
return;
}
gdisp = gimp_context_get_display (gimp_get_user_context (gimage->gimp));
/* plug-in arguments as if called by <Image>/Filters/... */
args = g_new (Argument, 3);
args[0].arg_type = GIMP_PDB_INT32;
args[0].value.pdb_int = GIMP_RUN_INTERACTIVE;
args[1].arg_type = GIMP_PDB_IMAGE;
args[1].value.pdb_int = (gint32) gimp_image_get_ID (gimage);
args[2].arg_type = GIMP_PDB_DRAWABLE;
args[2].value.pdb_int = -1; /* unused */
plug_in_run (gimage->gimp,
proc_rec, args, 3, FALSE, TRUE,
gdisp ? gdisp->ID : 0);
g_free (args);
}
void
vectors_vectors_tool (GimpVectors *vectors)
{
GimpImage *gimage;
GimpTool *active_tool;
g_return_if_fail (GIMP_IS_VECTORS (vectors));
gimage = gimp_item_get_image (GIMP_ITEM (vectors));
active_tool = tool_manager_get_active (gimage->gimp);
if (! GIMP_IS_VECTOR_TOOL (active_tool))
{
GimpContainer *tool_info_list;
GimpToolInfo *tool_info;
tool_info_list = gimage->gimp->tool_info_list;
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (tool_info_list,
"gimp-vector-tool");
if (GIMP_IS_TOOL_INFO (tool_info))
{
gimp_context_set_tool (gimp_get_current_context (gimage->gimp),
tool_info);
active_tool = tool_manager_get_active (gimage->gimp);
}
}
if (GIMP_IS_VECTOR_TOOL (active_tool))
gimp_vector_tool_set_vectors (GIMP_VECTOR_TOOL (active_tool), vectors);
}
/**********************************/
/* The new vectors query dialog */
/**********************************/
typedef struct _NewVectorsOptions NewVectorsOptions;
struct _NewVectorsOptions
{
GtkWidget *query_box;
GtkWidget *name_entry;
GimpImage *gimage;
};
static gchar *vectors_name = NULL;
static void
new_vectors_query_response (GtkWidget *widget,
gint response_id,
NewVectorsOptions *options)
{
if (response_id == GTK_RESPONSE_OK)
{
GimpVectors *new_vectors;
GimpImage *gimage;
if (vectors_name)
g_free (vectors_name);
vectors_name =
g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
if ((gimage = options->gimage))
{
new_vectors = gimp_vectors_new (gimage, vectors_name);
gimp_image_add_vectors (gimage, new_vectors, -1);
gimp_image_flush (gimage);
}
}
gtk_widget_destroy (options->query_box);
}
void
vectors_new_vectors_query (GimpImage *gimage,
GimpVectors *template,
gboolean interactive,
GtkWidget *parent)
{
NewVectorsOptions *options;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *label;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! template || GIMP_IS_VECTORS (template));
if (template || ! interactive)
{
GimpVectors *new_vectors;
new_vectors = gimp_vectors_new (gimage, _("Empty Path"));
gimp_image_add_vectors (gimage, new_vectors, -1);
return;
}
/* the new options structure */
options = g_new (NewVectorsOptions, 1);
options->gimage = gimage;
/* The dialog */
options->query_box =
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("New Path"), "gimp-vectors-new",
GIMP_STOCK_TOOL_PATH,
_("New Path Options"),
parent,
gimp_standard_help_func,
GIMP_HELP_PATH_NEW,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (options->query_box, "response",
G_CALLBACK (new_vectors_query_response),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
/* The table */
table = gtk_table_new (2, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
/* The name entry hbox, label and entry */
label = gtk_label_new (_("Path name:"));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
options->name_entry = gtk_entry_new ();
gtk_widget_set_size_request (options->name_entry, 150, -1);
gtk_table_attach_defaults (GTK_TABLE (table), options->name_entry,
1, 2, 0, 1);
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
(vectors_name ? vectors_name : _("New Path")));
gtk_widget_show (options->name_entry);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
gtk_widget_show (options->query_box);
}
/****************************************/
/* The edit vectors attributes dialog */
/****************************************/
typedef struct _EditVectorsOptions EditVectorsOptions;
struct _EditVectorsOptions
{
GtkWidget *query_box;
GtkWidget *name_entry;
GimpVectors *vectors;
GimpImage *gimage;
};
static void
edit_vectors_query_response (GtkWidget *widget,
gint response_id,
EditVectorsOptions *options)
{
if (response_id == GTK_RESPONSE_OK)
{
GimpVectors *vectors = options->vectors;
if (options->gimage)
{
const gchar *new_name;
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (vectors))))
{
gimp_item_rename (GIMP_ITEM (vectors), new_name);
gimp_image_flush (options->gimage);
}
}
}
gtk_widget_destroy (options->query_box);
}
void
vectors_edit_vectors_query (GimpVectors *vectors,
GtkWidget *parent)
{
EditVectorsOptions *options;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *label;
g_return_if_fail (GIMP_IS_VECTORS (vectors));
options = g_new0 (EditVectorsOptions, 1);
options->vectors = vectors;
options->gimage = gimp_item_get_image (GIMP_ITEM (vectors));
/* The dialog */
options->query_box =
gimp_viewable_dialog_new (GIMP_VIEWABLE (vectors),
_("Path Attributes"), "gimp-vectors-edit",
GIMP_STOCK_EDIT,
_("Edit Path Attributes"),
parent,
gimp_standard_help_func,
GIMP_HELP_PATH_EDIT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (options->query_box, "response",
G_CALLBACK (edit_vectors_query_response),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
/* The table */
table = gtk_table_new (2, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
/* The name entry */
label = gtk_label_new (_("Path name:"));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (label);
options->name_entry = gtk_entry_new ();
gtk_widget_set_size_request (options->name_entry, 150, -1);
gtk_table_attach_defaults (GTK_TABLE (table), options->name_entry,
1, 2, 0, 1);
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
gimp_object_get_name (GIMP_OBJECT (vectors)));
gtk_widget_show (options->name_entry);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
gtk_widget_show (options->query_box);
}
/*******************************/
/* The vectors import dialog */
/*******************************/
static void
vectors_import_response (GtkWidget *dialog,
gint response_id,
GimpImage *gimage)
{
if (response_id == GTK_RESPONSE_OK)
{
const gchar *filename;
GError *error = NULL;
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog));
if (gimp_vectors_import_file (gimage, filename, FALSE, FALSE, &error))
{
gimp_image_flush (gimage);
}
else
{
g_message (error->message);
g_error_free (error);
}
}
g_object_weak_unref (G_OBJECT (gimage),
(GWeakNotify) gtk_widget_destroy, dialog);
gtk_widget_destroy (dialog);
}
static void
vectors_import_query (GimpImage *gimage,
GtkWidget *parent)
{
GtkFileSelection *filesel;
filesel =
GTK_FILE_SELECTION (gtk_file_selection_new (_("Import Paths from SVG")));
g_object_weak_ref (G_OBJECT (gimage),
(GWeakNotify) gtk_widget_destroy, filesel);
gtk_window_set_screen (GTK_WINDOW (filesel),
gtk_widget_get_screen (parent));
gtk_window_set_role (GTK_WINDOW (filesel), "gimp-vectors-import");
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
gtk_container_set_border_width (GTK_CONTAINER (filesel), 6);
gtk_container_set_border_width (GTK_CONTAINER (filesel->button_area), 4);
g_signal_connect (filesel, "response",
G_CALLBACK (vectors_import_response),
gimage);
g_signal_connect (filesel, "delete_event",
G_CALLBACK (gtk_true),
NULL);
/* FIXME: add a proper file selector
and controls for merge and scale options */
gtk_widget_show (GTK_WIDGET (filesel));
}
/*******************************/
/* The vectors export dialog */
/*******************************/
static void
vectors_export_response (GtkWidget *dialog,
gint response_id,
GimpImage *gimage)
{
if (response_id == GTK_RESPONSE_OK)
{
const gchar *filename;
GError *error = NULL;
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog));
if (! gimp_vectors_export_file (gimage, NULL, filename, &error))
{
g_message (error->message);
g_error_free (error);
}
}
g_object_weak_unref (G_OBJECT (gimage),
(GWeakNotify) gtk_widget_destroy, dialog);
gtk_widget_destroy (dialog);
}
static void
vectors_export_query (GimpImage *gimage,
GimpVectors *vectors,
GtkWidget *parent)
{
GtkFileSelection *filesel;
filesel =
GTK_FILE_SELECTION (gtk_file_selection_new (_("Export Path to SVG")));
g_object_weak_ref (G_OBJECT (gimage),
(GWeakNotify) gtk_widget_destroy, filesel);
gtk_window_set_screen (GTK_WINDOW (filesel),
gtk_widget_get_screen (parent));
gtk_window_set_role (GTK_WINDOW (filesel), "gimp-vectors-export");
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
gtk_container_set_border_width (GTK_CONTAINER (filesel), 6);
gtk_container_set_border_width (GTK_CONTAINER (filesel->button_area), 4);
g_signal_connect (filesel, "response",
G_CALLBACK (vectors_export_response),
gimage);
g_signal_connect (filesel, "delete_event",
G_CALLBACK (gtk_true),
NULL);
gtk_widget_show (GTK_WIDGET (filesel));
}

View File

@@ -1,68 +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.
*/
#ifndef __VECTORS_COMMANDS_H__
#define __VECTORS_COMMANDS_H__
void vectors_new_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_raise_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_lower_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_duplicate_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_delete_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_merge_visible_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void vectors_selection_to_vectors_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_stroke_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_copy_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_paste_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_import_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_export_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_vectors_tool_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_stroke_vectors (GimpItem *item,
GtkWidget *parent);
void vectors_selection_to_vectors (GimpImage *gimage,
gboolean advanced);
void vectors_vectors_tool (GimpVectors *vectors);
void vectors_new_vectors_query (GimpImage *gimage,
GimpVectors *template,
gboolean interactive,
GtkWidget *parent);
void vectors_edit_vectors_query (GimpVectors *vectors,
GtkWidget *parent);
#endif /* __VECTORS_COMMANDS_H__ */

View File

@@ -1,504 +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 "gui-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
#include "display/gimpdisplayshell-filter-dialog.h"
#include "display/gimpdisplayshell-scale.h"
#include "widgets/gimpdock.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpitemfactory.h"
#include "dialogs.h"
#include "info-dialog.h"
#include "info-window.h"
#include "view-commands.h"
#define return_if_no_display(gdisp, data) \
if (GIMP_IS_DISPLAY (data)) \
gdisp = data; \
else if (GIMP_IS_GIMP (data)) \
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
else if (GIMP_IS_DOCK (data)) \
gdisp = gimp_context_get_display (((GimpDock *) data)->context); \
else \
gdisp = NULL; \
if (! gdisp) \
return
#define IS_ACTIVE_DISPLAY(gdisp) \
((gdisp) == \
gimp_context_get_display (gimp_get_user_context ((gdisp)->gimage->gimp)))
void
view_zoom_out_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell),
GIMP_ZOOM_OUT, 0.0);
}
void
view_zoom_in_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell),
GIMP_ZOOM_IN, 0.0);
}
void
view_zoom_fit_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_shell_scale_fit (GIMP_DISPLAY_SHELL (gdisp->shell));
}
void
view_zoom_cmd_callback (GtkWidget *widget,
gpointer data,
guint scale)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
if (! GTK_CHECK_MENU_ITEM (widget)->active)
return;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (fabs (scale - shell->scale) > 0.0001)
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, (gdouble) scale / 10000);
}
void
view_zoom_other_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
if (! GTK_CHECK_MENU_ITEM (widget)->active)
return;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
/* check if we are activated by the user or from image_menu_set_zoom() */
if (shell->scale != shell->other_scale)
gimp_display_shell_scale_dialog (shell);
}
void
view_dot_for_dot_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (shell->dot_for_dot != GTK_CHECK_MENU_ITEM (widget)->active)
{
gimp_display_shell_scale_set_dot_for_dot (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Dot for Dot",
shell->dot_for_dot);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Dot for Dot",
shell->dot_for_dot);
}
}
void
view_info_window_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->info_window_per_display)
{
if (! shell->info_dialog)
shell->info_dialog = info_window_create (gdisp);
/* To update the fields of the info window for the first time. *
* It's no use updating it in info_window_create() because the *
* pointer of the info window is not present in the shell yet. */
info_window_update (gdisp);
info_dialog_present (shell->info_dialog);
}
else
{
info_window_follow_auto (gdisp->gimage->gimp);
}
}
void
view_navigation_window_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_dialog_factory_dialog_raise (global_dock_factory,
gtk_widget_get_screen (widget),
"gimp-navigation-view", -1);
}
void
view_display_filters_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (! shell->filters_dialog)
{
shell->filters_dialog = gimp_display_shell_filter_dialog_new (shell);
g_signal_connect (shell->filters_dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&shell->filters_dialog);
}
gtk_window_present (GTK_WINDOW (shell->filters_dialog));
}
void
view_toggle_selection_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_show_selection (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_toggle_layer_boundary_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_show_layer (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_toggle_menubar_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_show_menubar (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_toggle_rulers_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_show_rulers (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_toggle_scrollbars_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_show_scrollbars (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_toggle_statusbar_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_show_statusbar (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_toggle_guides_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_show_guides (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_snap_to_guides_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (shell->snap_to_guides != GTK_CHECK_MENU_ITEM (widget)->active)
{
shell->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Snap to Guides",
shell->snap_to_guides);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Guides",
shell->snap_to_guides);
}
}
void
view_toggle_grid_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_show_grid (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_snap_to_grid_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (shell->snap_to_grid != GTK_CHECK_MENU_ITEM (widget)->active)
{
shell->snap_to_grid = GTK_CHECK_MENU_ITEM (widget)->active;
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Snap to Grid",
shell->snap_to_grid);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Grid",
shell->snap_to_grid);
}
}
void
view_new_view_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_create_display (gdisp->gimage->gimp, gdisp->gimage,
GIMP_DISPLAY_SHELL (gdisp->shell)->scale);
}
void
view_shrink_wrap_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_shell_scale_shrink_wrap (GIMP_DISPLAY_SHELL (gdisp->shell));
}
void
view_fullscreen_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
gboolean fullscreen;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_fullscreen (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
fullscreen = (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
if (fullscreen != GTK_CHECK_MENU_ITEM (widget)->active)
{
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Fullscreen",
fullscreen);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Fullscreen",
fullscreen);
}
}
static void
view_change_screen_confirm_callback (GtkWidget *query_box,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
static void
view_change_screen_destroy_callback (GtkWidget *query_box,
GtkWidget *shell)
{
g_object_set_data (G_OBJECT (shell), "gimp-change-screen-dialog", NULL);
}
void
view_change_screen_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GdkScreen *screen;
GdkDisplay *display;
gint cur_screen;
gint num_screens;
GtkWidget *qbox;
return_if_no_display (gdisp, data);
qbox = g_object_get_data (G_OBJECT (gdisp->shell),
"gimp-change-screen-dialog");
if (qbox)
{
gtk_window_present (GTK_WINDOW (qbox));
return;
}
screen = gtk_widget_get_screen (gdisp->shell);
display = gtk_widget_get_display (gdisp->shell);
cur_screen = gdk_screen_get_number (screen);
num_screens = gdk_display_get_n_screens (display);
qbox = gimp_query_int_box ("Move Display to Screen",
gdisp->shell,
NULL, 0,
"Enter destination screen",
cur_screen, 0, num_screens - 1,
G_OBJECT (gdisp->shell), "destroy",
view_change_screen_confirm_callback,
gdisp->shell);
g_object_set_data (G_OBJECT (gdisp->shell), "gimp-change-screen-dialog", qbox);
g_signal_connect (qbox, "destroy",
G_CALLBACK (view_change_screen_destroy_callback),
gdisp->shell);
gtk_widget_show (qbox);
}

View File

@@ -1,73 +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.
*/
#ifndef __VIEW_COMMANDS_H__
#define __VIEW_COMMANDS_H__
void view_zoom_out_cmd_callback (GtkWidget *widget,
gpointer data);
void view_zoom_in_cmd_callback (GtkWidget *widget,
gpointer data);
void view_zoom_fit_cmd_callback (GtkWidget *widget,
gpointer data);
void view_zoom_cmd_callback (GtkWidget *widget,
gpointer data,
guint scale);
void view_zoom_other_cmd_callback (GtkWidget *widget,
gpointer data);
void view_dot_for_dot_cmd_callback (GtkWidget *widget,
gpointer data);
void view_info_window_cmd_callback (GtkWidget *widget,
gpointer data);
void view_navigation_window_cmd_callback (GtkWidget *widget,
gpointer data);
void view_display_filters_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_selection_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_layer_boundary_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_menubar_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_rulers_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_scrollbars_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_statusbar_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_guides_cmd_callback (GtkWidget *widget,
gpointer data);
void view_snap_to_guides_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_grid_cmd_callback (GtkWidget *widget,
gpointer data);
void view_snap_to_grid_cmd_callback (GtkWidget *widget,
gpointer data);
void view_new_view_cmd_callback (GtkWidget *widget,
gpointer data);
void view_shrink_wrap_cmd_callback (GtkWidget *widget,
gpointer data);
void view_fullscreen_cmd_callback (GtkWidget *widget,
gpointer data);
void view_change_screen_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __VIEW_COMMANDS_H__ */

View File

@@ -1,440 +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 "apptypes.h"
#include "appenv.h"
#include "airbrush.h"
#include "drawable.h"
#include "gdisplay.h"
#include "gradient.h"
#include "gimpimage.h"
#include "gimpbrush.h"
#include "gimpcontext.h"
#include "gimpui.h"
#include "paint_funcs.h"
#include "paint_core.h"
#include "paint_options.h"
#include "selection.h"
#include "temp_buf.h"
#include "tool.h"
#include "libgimp/gimpintl.h"
/* The maximum amount of pressure that can be exerted */
#define MAX_PRESSURE 0.075
/* Default pressure setting */
#define AIRBRUSH_PRESSURE_DEFAULT 10.0
#define AIRBRUSH_INCREMENTAL_DEFAULT FALSE
#define OFF 0
#define ON 1
/* the airbrush structures */
typedef struct _AirbrushTimeout AirbrushTimeout;
struct _AirbrushTimeout
{
PaintCore *paint_core;
GimpDrawable *drawable;
};
typedef struct _AirbrushOptions AirbrushOptions;
struct _AirbrushOptions
{
PaintOptions paint_options;
gdouble rate;
gdouble rate_d;
GtkObject *rate_w;
gdouble pressure;
gdouble pressure_d;
GtkObject *pressure_w;
};
/* local function prototypes */
static gpointer airbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static gpointer airbrush_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
/* the airbrush tool options */
static AirbrushOptions *airbrush_options = NULL;
/* local variables */
static gint timer; /* timer for successive paint applications */
static gint timer_state = OFF; /* state of airbrush tool */
static AirbrushTimeout airbrush_timeout;
static gdouble non_gui_pressure;
static gboolean non_gui_incremental;
/* forward function declarations */
static void airbrush_motion (PaintCore *, GimpDrawable *,
PaintPressureOptions *,
gdouble, PaintApplicationMode);
static gint airbrush_time_out (gpointer);
/* functions */
static void
airbrush_options_reset (void)
{
AirbrushOptions *options = airbrush_options;
paint_options_reset ((PaintOptions *) options);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->rate_w),
options->rate_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
options->pressure_d);
}
static AirbrushOptions *
airbrush_options_new (void)
{
AirbrushOptions *options;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *scale;
/* the new airbrush tool options structure */
options = g_new (AirbrushOptions, 1);
paint_options_init ((PaintOptions *) options,
AIRBRUSH,
airbrush_options_reset);
options->rate = options->rate_d = 80.0;
options->pressure = options->pressure_d = AIRBRUSH_PRESSURE_DEFAULT;
/* the main vbox */
vbox = ((ToolOptions *) options)->main_vbox;
/* the rate scale */
table = gtk_table_new (2, 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
options->rate_w =
gtk_adjustment_new (options->rate_d, 0.0, 150.0, 1.0, 1.0, 0.0);
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->rate_w));
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
gtk_signal_connect (GTK_OBJECT (options->rate_w), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&options->rate);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Rate:"), 1.0, 1.0,
scale, 1, FALSE);
/* the pressure scale */
options->pressure_w =
gtk_adjustment_new (options->pressure_d, 0.0, 100.0, 1.0, 1.0, 0.0);
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->pressure_w));
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
gtk_signal_connect (GTK_OBJECT (options->pressure_w), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
&options->pressure);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Pressure:"), 1.0, 1.0,
scale, 1, FALSE);
gtk_widget_show (table);
return options;
}
Tool *
tools_new_airbrush (void)
{
Tool * tool;
PaintCore * private;
/* The tool options */
if (! airbrush_options)
{
airbrush_options = airbrush_options_new ();
tools_register (AIRBRUSH, (ToolOptions *) airbrush_options);
}
tool = paint_core_new (AIRBRUSH);
private = (PaintCore *) tool->private;
private->paint_func = airbrush_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}
static gpointer
airbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state)
{
GimpBrush *brush;
gdouble rate;
if (!drawable)
return NULL;
brush = gimp_context_get_brush (NULL);
switch (state)
{
case INIT_PAINT :
/* timer_state = OFF; */
if (timer_state == ON)
{
g_warning ("killing stray timer, please report to lewing@gimp.org");
gtk_timeout_remove (timer);
}
timer_state = OFF;
break;
case MOTION_PAINT :
if (timer_state == ON)
gtk_timeout_remove (timer);
timer_state = OFF;
airbrush_motion (paint_core, drawable,
airbrush_options->paint_options.pressure_options,
airbrush_options->pressure,
airbrush_options->paint_options.incremental ?
INCREMENTAL : CONSTANT);
if (airbrush_options->rate != 0.0)
{
airbrush_timeout.paint_core = paint_core;
airbrush_timeout.drawable = drawable;
rate = airbrush_options->paint_options.pressure_options->rate ?
(10000 / (airbrush_options->rate * 2.0 * paint_core->curpressure)) :
(10000 / airbrush_options->rate);
timer = gtk_timeout_add (rate, airbrush_time_out, NULL);
timer_state = ON;
}
break;
case FINISH_PAINT :
if (timer_state == ON)
gtk_timeout_remove (timer);
timer_state = OFF;
break;
default :
break;
}
return NULL;
}
void
tools_free_airbrush (Tool *tool)
{
if (timer_state == ON)
gtk_timeout_remove (timer);
timer_state = OFF;
paint_core_free (tool);
}
static gint
airbrush_time_out (gpointer client_data)
{
/* service the timer */
airbrush_motion (airbrush_timeout.paint_core,
airbrush_timeout.drawable,
airbrush_options->paint_options.pressure_options,
airbrush_options->pressure,
airbrush_options->paint_options.incremental ?
INCREMENTAL : CONSTANT);
gdisplays_flush ();
/* restart the timer */
if (airbrush_options->rate != 0.0)
{
if (airbrush_options->paint_options.pressure_options->rate)
{
/* set a new timer */
timer = gtk_timeout_add ((10000 / (airbrush_options->rate * 2.0 * airbrush_timeout.paint_core->curpressure)),
airbrush_time_out, NULL);
return FALSE;
}
else
return TRUE;
}
else
return FALSE;
}
static void
airbrush_motion (PaintCore *paint_core,
GimpDrawable *drawable,
PaintPressureOptions *pressure_options,
double pressure,
PaintApplicationMode mode)
{
GImage *gimage;
TempBuf *area;
guchar col[MAX_CHANNELS];
gdouble scale;
if (!drawable)
return;
if (! (gimage = gimp_drawable_gimage (drawable)))
return;
if (pressure_options->size)
scale = paint_core->curpressure;
else
scale = 1.0;
if (! (area = paint_core_get_paint_area (paint_core, drawable, scale)))
return;
/* color the pixels */
if (pressure_options->color)
{
GimpRGB color;
gradient_get_color_at (gimp_context_get_gradient (NULL),
paint_core->curpressure, &color);
gimp_rgba_get_uchar (&color,
&col[RED_PIX],
&col[GREEN_PIX],
&col[BLUE_PIX],
&col[ALPHA_PIX]);
mode = INCREMENTAL;
color_pixels (temp_buf_data (area), col,
area->width * area->height, area->bytes);
}
else if (paint_core->brush && paint_core->brush->pixmap)
{
mode = INCREMENTAL;
paint_core_color_area_with_pixmap (paint_core, gimage, drawable, area,
scale, SOFT);
}
else
{
gimp_image_get_foreground (gimage, drawable, col);
col[area->bytes - 1] = OPAQUE_OPACITY;
color_pixels (temp_buf_data (area), col,
area->width * area->height, area->bytes);
}
if (pressure_options->pressure)
pressure = pressure * 2.0 * paint_core->curpressure;
/* paste the newly painted area to the image */
paint_core_paste_canvas (paint_core, drawable,
MIN (pressure, 255),
(gint) (gimp_context_get_opacity (NULL) * 255),
gimp_context_get_paint_mode (NULL),
SOFT, scale, mode);
}
static gpointer
airbrush_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state)
{
airbrush_motion (paint_core, drawable, &non_gui_pressure_options,
non_gui_pressure, non_gui_incremental);
return NULL;
}
gboolean
airbrush_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array)
{
AirbrushOptions *options = airbrush_options;
gdouble pressure = AIRBRUSH_PRESSURE_DEFAULT;
if(options)
pressure = options->pressure;
return airbrush_non_gui (drawable, pressure, num_strokes, stroke_array);
}
gboolean
airbrush_non_gui (GimpDrawable *drawable,
gdouble pressure,
gint num_strokes,
gdouble *stroke_array)
{
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
{
/* Set the paint core's paint func */
non_gui_paint_core.paint_func = airbrush_non_gui_paint_func;
non_gui_pressure = pressure;
non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0];
non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1];
airbrush_non_gui_paint_func (&non_gui_paint_core, drawable, 0);
for (i = 1; i < num_strokes; i++)
{
non_gui_paint_core.curx = stroke_array[i * 2 + 0];
non_gui_paint_core.cury = stroke_array[i * 2 + 1];
paint_core_interpolate (&non_gui_paint_core, drawable);
non_gui_paint_core.lastx = non_gui_paint_core.curx;
non_gui_paint_core.lasty = non_gui_paint_core.cury;
}
/* Finish the painting */
paint_core_finish (&non_gui_paint_core, drawable, -1);
/* Cleanup */
paint_core_cleanup ();
return TRUE;
}
return FALSE;
}

View File

@@ -37,8 +37,9 @@
#include "cpu-accel.h"
#if defined(ARCH_X86) && defined(USE_MMX) && defined(__GNUC__)
#ifdef ARCH_X86
#define HAVE_ACCEL 1
typedef enum
{
@@ -135,6 +136,8 @@ arch_get_vendor (void)
#ifdef ARCH_X86_64
if (strcmp (id, "AuthenticAMD") == 0)
return ARCH_X86_VENDOR_AMD;
else if (strcmp (id, "GenuineIntel") == 0)
return ARCH_X86_VENDOR_INTEL;
#else
if (strcmp (id, "GenuineIntel") == 0)
return ARCH_X86_VENDOR_INTEL;
@@ -287,6 +290,33 @@ arch_accel_cyrix (void)
return caps;
}
#ifdef USE_SSE
static jmp_buf sigill_return;
static void
sigill_handler (gint n)
{
longjmp (sigill_return, 1);
}
static gboolean
arch_accel_sse_os_support (void)
{
if (setjmp (sigill_return))
{
return FALSE;
}
else
{
signal (SIGILL, sigill_handler);
__asm__ __volatile__ ("xorps %xmm0, %xmm0");
signal (SIGILL, SIG_DFL);
}
return TRUE;
}
#endif /* USE_SSE */
static guint32
arch_accel (void)
{
@@ -320,21 +350,20 @@ arch_accel (void)
break;
}
#ifdef USE_SSE
if ((caps & CPU_ACCEL_X86_SSE) && !arch_accel_sse_os_support ())
caps &= ~(CPU_ACCEL_X86_SSE | CPU_ACCEL_X86_SSE2);
#endif
return caps;
}
static jmp_buf sigill_return;
static void
sigill_handler (gint n)
{
longjmp (sigill_return, 1);
}
#endif /* ARCH_X86 */
#endif /* ARCH_X86 && USE_MMX && __GNUC__ */
#if defined (ARCH_PPC) && defined (USE_ALTIVEC)
#if defined (ARCH_PPC) && defined (USE_ALTIVEC) && defined(__GNUC__)
#define HAVE_ACCEL 1
static sigjmp_buf jmpbuf;
static volatile sig_atomic_t canjump = 0;
@@ -366,22 +395,22 @@ arch_accel (void)
canjump = 1;
asm volatile ("mtspr 256, %0\n\t"
"vand %%v0, %%v0, %%v0"
:
: "r" (-1));
"vand %%v0, %%v0, %%v0"
:
: "r" (-1));
signal (SIGILL, SIG_DFL);
return CPU_ACCEL_PPC_ALTIVEC;
}
#endif /* ARCH_PPC */
#endif /* ARCH_PPC && USE_ALTIVEC && __GNUC__ */
guint32
cpu_accel (void)
{
#if defined (ARCH_X86) || (defined (ARCH_PPC) && defined (USE_ALTIVEC))
#ifdef HAVE_ACCEL
static guint32 accel = ~0U;
if (accel != ~0U)
@@ -389,26 +418,9 @@ cpu_accel (void)
accel = arch_accel ();
#ifdef USE_SSE
/* test OS support for SSE */
if (accel & CPU_ACCEL_X86_SSE)
{
if (setjmp (sigill_return))
{
accel &= ~(CPU_ACCEL_X86_SSE | CPU_ACCEL_X86_SSE2);
}
else
{
signal (SIGILL, sigill_handler);
__asm__ __volatile__ ("xorps %xmm0, %xmm0");
signal (SIGILL, SIG_DFL);
}
}
#endif /* USE_SSE */
return accel;
#else /* !ARCH_X86 && !ARCH_PPC/USE_ALTIVEC */
#else /* !HAVE_ACCEL */
return 0;
#endif
}

View File

@@ -45,8 +45,9 @@ INCLUDES = \
all : \
$(PRJ_TOP)\config.h \
$(PACKAGE).lib \
!IFDEF DLLGIMP
$(PACKAGE)-$(PKG_VER).dll
!ENDIF
$(PRJ_TOP)\config.h: $(PRJ_TOP)\config.h.win32
copy $(PRJ_TOP)\config.h.win32 $(PRJ_TOP)\config.h

View File

@@ -72,7 +72,7 @@ N_("This is the distance in pixels where Guide and Grid snapping " \
#define DEFAULT_THRESHOLD_BLURB \
N_("Tools such as fuzzy-select and bucket fill find regions based on a " \
"seed-fill algorithm. The seed fill starts at the intially selected " \
"seed-fill algorithm. The seed fill starts at the initially selected " \
"pixel and progresses in all directions until the difference of pixel " \
"intensity from the original is greater than a specified threshold. " \
"This value represents the default threshold.")
@@ -190,14 +190,14 @@ N_("Generally only a concern for 8-bit displays, this sets the minimum " \
"windowing system."
#define MONITOR_XRESOLUTION_BLURB \
"Sets the monitor's horizontal resolution, in dots per inch. If set to " \
"0, forces the X server to be queried for both horizontal and vertical " \
"resolution information."
N_("Sets the monitor's horizontal resolution, in dots per inch. If set to " \
"0, forces the X server to be queried for both horizontal and vertical " \
"resolution information.")
#define MONITOR_YRESOLUTION_BLURB \
"Sets the monitor's vertical resolution, in dots per inch. If set to " \
"0, forces the X server to be queried for both horizontal and vertical " \
"resolution information."
N_("Sets the monitor's vertical resolution, in dots per inch. If set to " \
"0, forces the X server to be queried for both horizontal and vertical " \
"resolution information.")
#define NAVIGATION_PREVIEW_SIZE_BLURB \
N_("Sets the size of the navigation preview available in the lower right " \

View File

@@ -358,8 +358,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
if (interpolation_type == GIMP_INTERPOLATION_NONE)
{
guchar color[MAX_CHANNELS];
gint iu = RINT (u[0]);
gint iv = RINT (v[0]);
gint iu = (gint) u [0];
gint iv = (gint) v [0];
gint b;
if (iu >= u1 && iu < u2 &&

View File

@@ -1,160 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpcoordmath.c
* Copyright (C) 2002 Simon Budig <simon@gimp.org>
*
* 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 <glib-object.h>
#include "vectors-types.h"
#include "gimpcoordmath.h"
#define INPUT_RESOLUTION 256
/* amul * a + bmul * b = ret_val */
void
gimp_bezier_coords_mix (const gdouble amul,
const GimpCoords *a,
const gdouble bmul,
const GimpCoords *b,
GimpCoords *ret_val)
{
if (b)
{
ret_val->x = amul * a->x + bmul * b->x ;
ret_val->y = amul * a->y + bmul * b->y ;
ret_val->pressure = amul * a->pressure + bmul * b->pressure ;
ret_val->xtilt = amul * a->xtilt + bmul * b->xtilt ;
ret_val->ytilt = amul * a->ytilt + bmul * b->ytilt ;
ret_val->wheel = amul * a->wheel + bmul * b->wheel ;
}
else
{
ret_val->x = amul * a->x;
ret_val->y = amul * a->y;
ret_val->pressure = amul * a->pressure;
ret_val->xtilt = amul * a->xtilt;
ret_val->ytilt = amul * a->ytilt;
ret_val->wheel = amul * a->wheel;
}
}
/* (a+b)/2 = ret_average */
void
gimp_bezier_coords_average (const GimpCoords *a,
const GimpCoords *b,
GimpCoords *ret_average)
{
gimp_bezier_coords_mix (0.5, a, 0.5, b, ret_average);
}
/* a + b = ret_add */
void
gimp_bezier_coords_add (const GimpCoords *a,
const GimpCoords *b,
GimpCoords *ret_add)
{
gimp_bezier_coords_mix (1.0, a, 1.0, b, ret_add);
}
/* a - b = ret_difference */
void
gimp_bezier_coords_difference (const GimpCoords *a,
const GimpCoords *b,
GimpCoords *ret_difference)
{
gimp_bezier_coords_mix (1.0, a, -1.0, b, ret_difference);
}
/* a * f = ret_product */
void
gimp_bezier_coords_scale (const gdouble f,
const GimpCoords *a,
GimpCoords *ret_product)
{
gimp_bezier_coords_mix (f, a, 0.0, NULL, ret_product);
}
/* local helper for measuring the scalarproduct of two gimpcoords. */
gdouble
gimp_bezier_coords_scalarprod (const GimpCoords *a,
const GimpCoords *b)
{
return (a->x * b->x +
a->y * b->y +
a->pressure * b->pressure +
a->xtilt * b->xtilt +
a->ytilt * b->ytilt +
a->wheel * b->wheel );
}
/*
* The "lenght" of the gimpcoord.
* Applies a metric that increases the weight on the
* pressure/xtilt/ytilt/wheel to ensure proper interpolation
*/
gdouble
gimp_bezier_coords_length2 (const GimpCoords *a)
{
GimpCoords upscaled_a;
upscaled_a.x = a->x;
upscaled_a.y = a->y;
upscaled_a.pressure = a->pressure * INPUT_RESOLUTION;
upscaled_a.xtilt = a->xtilt * INPUT_RESOLUTION;
upscaled_a.ytilt = a->ytilt * INPUT_RESOLUTION;
upscaled_a.wheel = a->wheel * INPUT_RESOLUTION;
return gimp_bezier_coords_scalarprod (&upscaled_a, &upscaled_a);
}
gdouble
gimp_bezier_coords_length (const GimpCoords *a)
{
return sqrt (gimp_bezier_coords_length2 (a));
}
gboolean
gimp_bezier_coords_equal (const GimpCoords *a,
const GimpCoords *b)
{
return ( a->x == b->x &&
a->y == b->y &&
a->pressure == b->pressure &&
a->xtilt == b->xtilt &&
a->ytilt == b->ytilt &&
a->wheel == b->wheel);
}

View File

@@ -1,46 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpcoordmath.h
* Copyright (C) 2002 Simon Budig <simon@gimp.org>
*
* 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.
*/
void gimp_bezier_coords_mix (const gdouble amul,
const GimpCoords *a,
const gdouble bmul,
const GimpCoords *b,
GimpCoords *ret_val);
void gimp_bezier_coords_average (const GimpCoords *a,
const GimpCoords *b,
GimpCoords *ret_average);
void gimp_bezier_coords_add (const GimpCoords *a,
const GimpCoords *b,
GimpCoords *ret_add);
void gimp_bezier_coords_difference (const GimpCoords *a,
const GimpCoords *b,
GimpCoords *difference);
void gimp_bezier_coords_scale (const gdouble f,
const GimpCoords *a,
GimpCoords *ret_product);
gdouble gimp_bezier_coords_scalarprod (const GimpCoords *a,
const GimpCoords *b);
gdouble gimp_bezier_coords_length (const GimpCoords *a);
gdouble gimp_bezier_coords_length2 (const GimpCoords *a);
gboolean gimp_bezier_coords_equal (const GimpCoords *a,
const GimpCoords *b);

View File

@@ -51,7 +51,7 @@ static TempBuf * gimp_drawable_preview_private (GimpDrawable *drawable,
gint width,
gint height);
static void gimp_drawable_preview_scale (GimpImageBaseType type,
guchar *cmap,
const guchar *cmap,
PixelRegion *srcPR,
PixelRegion *destPR,
gint subsample);
@@ -195,7 +195,7 @@ gimp_drawable_preview_private (GimpDrawable *drawable,
static void
gimp_drawable_preview_scale (GimpImageBaseType type,
guchar *cmap,
const guchar *cmap,
PixelRegion *srcPR,
PixelRegion *destPR,
gint subsample)
@@ -217,6 +217,8 @@ gimp_drawable_preview_scale (GimpImageBaseType type,
gint frac;
gboolean advance_dest;
g_return_if_fail (type != GIMP_INDEXED || cmap != NULL);
orig_width = srcPR->w / subsample;
orig_height = srcPR->h / subsample;
width = destPR->w;

View File

@@ -358,8 +358,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
if (interpolation_type == GIMP_INTERPOLATION_NONE)
{
guchar color[MAX_CHANNELS];
gint iu = RINT (u[0]);
gint iv = RINT (v[0]);
gint iu = (gint) u [0];
gint iv = (gint) v [0];
gint b;
if (iu >= u1 && iu < u2 &&

View File

@@ -717,6 +717,8 @@ project_indexed (GimpImage *gimage,
PixelRegion *src,
PixelRegion *dest)
{
g_return_if_fail (gimage->cmap != NULL);
if (! gimage->construct_flag)
initial_region (src, dest, NULL, gimage->cmap,
layer->opacity * 255.999,
@@ -734,6 +736,8 @@ project_indexed_alpha (GimpImage *gimage,
PixelRegion *dest,
PixelRegion *mask)
{
g_return_if_fail (gimage->cmap != NULL);
if (! gimage->construct_flag)
initial_region (src, dest, mask, gimage->cmap,
layer->opacity * 255.999,

View File

@@ -406,12 +406,6 @@ gimp_layer_set_tiles (GimpDrawable *drawable,
if (gimp_layer_is_floating_sel (layer))
floating_sel_rigor (layer, FALSE);
if (layer->mask)
{
GIMP_ITEM (layer->mask)->offset_x = offset_x;
GIMP_ITEM (layer->mask)->offset_y = offset_y;
}
}
static void

View File

@@ -717,6 +717,8 @@ project_indexed (GimpImage *gimage,
PixelRegion *src,
PixelRegion *dest)
{
g_return_if_fail (gimage->cmap != NULL);
if (! gimage->construct_flag)
initial_region (src, dest, NULL, gimage->cmap,
layer->opacity * 255.999,
@@ -734,6 +736,8 @@ project_indexed_alpha (GimpImage *gimage,
PixelRegion *dest,
PixelRegion *mask)
{
g_return_if_fail (gimage->cmap != NULL);
if (! gimage->construct_flag)
initial_region (src, dest, mask, gimage->cmap,
layer->opacity * 255.999,

View File

@@ -147,7 +147,7 @@ gimp_template_class_init (GimpTemplateClass *klass)
GIMP_CONFIG_INSTALL_PROP_RESOLUTION (object_class, PROP_XRESOLUTION,
"xresolution",
N_("The horizonal image resolution."),
N_("The horizontal image resolution."),
72.0,
0);
GIMP_CONFIG_INSTALL_PROP_RESOLUTION (object_class, PROP_YRESOLUTION,

View File

@@ -116,7 +116,8 @@ static void about_dialog_destroy (GtkObject *object,
gpointer data);
static void about_dialog_unmap (GtkWidget *widget,
gpointer data);
static gint about_dialog_logo_expose (GtkWidget *widget,
static void about_dialog_center (GtkWindow *window);
static gboolean about_dialog_logo_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer data);
static gint about_dialog_button (GtkWidget *widget,
@@ -129,10 +130,10 @@ static void reshuffle_array (void);
static gboolean about_dialog_timer (gpointer data);
static PangoFontDescription *font_desc = NULL;
static gchar **scroll_text = authors;
static gint nscroll_texts = G_N_ELEMENTS (authors);
static gint shuffle_array[G_N_ELEMENTS (authors)];
static PangoFontDescription *font_desc = NULL;
static gchar **scroll_text = authors;
static gint nscroll_texts = G_N_ELEMENTS (authors);
static gint shuffle_array[G_N_ELEMENTS (authors)];
GtkWidget *
@@ -141,7 +142,6 @@ about_dialog_create (void)
if (! about_info.about_dialog)
{
GtkWidget *widget;
GdkScreen *screen;
GdkGCValues shape_gcv;
about_info.visible = FALSE;
@@ -181,13 +181,7 @@ about_dialog_create (void)
return NULL;
}
/* move the window to the middle of the screen */
screen = gtk_widget_get_screen (widget);
gtk_window_move (GTK_WINDOW (widget),
(gdk_screen_get_width (screen) -
about_info.pixmaparea.width) / 2,
(gdk_screen_get_height (screen) -
about_info.pixmaparea.height) / 2);
about_dialog_center (GTK_WINDOW (widget));
/* place the scrolltext at the bottom of the image */
about_info.textarea.width = about_info.pixmaparea.width;
@@ -306,7 +300,27 @@ about_dialog_unmap (GtkWidget *widget,
}
}
static gint
static void
about_dialog_center (GtkWindow *window)
{
GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (window));
GdkScreen *screen;
GdkRectangle rect;
gint monitor;
gint x, y;
gdk_display_get_pointer (display, &screen, &x, &y, NULL);
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
gdk_screen_get_monitor_geometry (screen, monitor, &rect);
gtk_window_set_screen (window, screen);
gtk_window_move (window,
rect.x + (rect.width - about_info.pixmaparea.width) / 2,
rect.y + (rect.height - about_info.pixmaparea.height) / 2);
}
static gboolean
about_dialog_logo_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer data)

View File

@@ -1509,7 +1509,7 @@ prefs_dialog_new (Gimp *gimp,
prefs_boolean_option_menu_add (object, "initial-zoom-to-fit",
_("Fit to Window"),
"1:1",
_("Inital Zoom Ratio:"),
_("Initial Zoom Ratio:"),
GTK_TABLE (table), 0);
/* Pointer Movement Feedback */
@@ -1667,7 +1667,7 @@ prefs_dialog_new (Gimp *gimp,
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
0, format_names[i],
0, gettext (format_names[i]),
1, format_strings[i],
-1);

View File

@@ -1302,10 +1302,10 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
if (update_cursor)
{
gimp_display_shell_update_cursor (shell,
display_coords.x,
display_coords.y,
image_coords.x,
image_coords.y);
RINT (display_coords.x),
RINT (display_coords.y),
RINT (image_coords.x),
RINT (image_coords.y));
}
return return_val;

View File

@@ -138,6 +138,7 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
gint x0, x1, x2, x3;
gint y0, y1, y2, y3;
gint x_real, y_real;
gint x_offset, y_offset;
gint width, height;
const gint length = 2;
@@ -145,6 +146,8 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
if (! grid)
return;
g_return_if_fail (grid->xspacing > 0 && grid->yspacing > 0);
x1 = area->x;
y1 = area->y;
x2 = area->x + area->width;
@@ -153,6 +156,14 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
width = shell->gdisp->gimage->width;
height = shell->gdisp->gimage->height;
x_offset = grid->xoffset;
while (x_offset > 0)
x_offset -= grid->xspacing;
y_offset = grid->yoffset;
while (y_offset > 0)
y_offset -= grid->yspacing;
canvas = GIMP_CANVAS (shell->canvas);
gimp_canvas_set_custom_gc (canvas,
@@ -161,8 +172,11 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
switch (grid->style)
{
case GIMP_GRID_DOTS:
for (x = grid->xoffset; x <= width; x += grid->xspacing)
for (x = x_offset; x <= width; x += grid->xspacing)
{
if (x < 0)
continue;
gimp_display_shell_transform_xy (shell,
x, 0, &x_real, &y_real,
FALSE);
@@ -170,8 +184,11 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
if (x_real < x1 || x_real >= x2)
continue;
for (y = grid->yoffset; y <= height; y += grid->yspacing)
for (y = y_offset; y <= height; y += grid->yspacing)
{
if (y < 0)
continue;
gimp_display_shell_transform_xy (shell,
x, y, &x_real, &y_real,
FALSE);
@@ -185,8 +202,11 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
break;
case GIMP_GRID_INTERSECTIONS:
for (x = grid->xoffset; x <= width; x += grid->xspacing)
for (x = x_offset; x <= width; x += grid->xspacing)
{
if (x < 0)
continue;
gimp_display_shell_transform_xy (shell,
x, 0, &x_real, &y_real,
FALSE);
@@ -194,8 +214,11 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
if (x_real + length < x1 || x_real - length >= x2)
continue;
for (y = grid->yoffset; y <= height; y += grid->yspacing)
for (y = y_offset; y <= height; y += grid->yspacing)
{
if (y < 0)
continue;
gimp_display_shell_transform_xy (shell,
x, y, &x_real, &y_real,
FALSE);
@@ -229,8 +252,11 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
width, height, &x3, &y3,
FALSE);
for (x = grid->xoffset; x < width; x += grid->xspacing)
for (x = x_offset; x < width; x += grid->xspacing)
{
if (x < 0)
continue;
gimp_display_shell_transform_xy (shell,
x, 0, &x_real, &y_real,
FALSE);
@@ -240,8 +266,11 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
x_real, y0, x_real, y3 - 1);
}
for (y = grid->yoffset; y < height; y += grid->yspacing)
for (y = y_offset; y < height; y += grid->yspacing)
{
if (y < 0)
continue;
gimp_display_shell_transform_xy (shell,
0, y, &x_real, &y_real,
FALSE);

View File

@@ -116,7 +116,8 @@ static void about_dialog_destroy (GtkObject *object,
gpointer data);
static void about_dialog_unmap (GtkWidget *widget,
gpointer data);
static gint about_dialog_logo_expose (GtkWidget *widget,
static void about_dialog_center (GtkWindow *window);
static gboolean about_dialog_logo_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer data);
static gint about_dialog_button (GtkWidget *widget,
@@ -129,10 +130,10 @@ static void reshuffle_array (void);
static gboolean about_dialog_timer (gpointer data);
static PangoFontDescription *font_desc = NULL;
static gchar **scroll_text = authors;
static gint nscroll_texts = G_N_ELEMENTS (authors);
static gint shuffle_array[G_N_ELEMENTS (authors)];
static PangoFontDescription *font_desc = NULL;
static gchar **scroll_text = authors;
static gint nscroll_texts = G_N_ELEMENTS (authors);
static gint shuffle_array[G_N_ELEMENTS (authors)];
GtkWidget *
@@ -141,7 +142,6 @@ about_dialog_create (void)
if (! about_info.about_dialog)
{
GtkWidget *widget;
GdkScreen *screen;
GdkGCValues shape_gcv;
about_info.visible = FALSE;
@@ -181,13 +181,7 @@ about_dialog_create (void)
return NULL;
}
/* move the window to the middle of the screen */
screen = gtk_widget_get_screen (widget);
gtk_window_move (GTK_WINDOW (widget),
(gdk_screen_get_width (screen) -
about_info.pixmaparea.width) / 2,
(gdk_screen_get_height (screen) -
about_info.pixmaparea.height) / 2);
about_dialog_center (GTK_WINDOW (widget));
/* place the scrolltext at the bottom of the image */
about_info.textarea.width = about_info.pixmaparea.width;
@@ -306,7 +300,27 @@ about_dialog_unmap (GtkWidget *widget,
}
}
static gint
static void
about_dialog_center (GtkWindow *window)
{
GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (window));
GdkScreen *screen;
GdkRectangle rect;
gint monitor;
gint x, y;
gdk_display_get_pointer (display, &screen, &x, &y, NULL);
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
gdk_screen_get_monitor_geometry (screen, monitor, &rect);
gtk_window_set_screen (window, screen);
gtk_window_move (window,
rect.x + (rect.width - about_info.pixmaparea.width) / 2,
rect.y + (rect.height - about_info.pixmaparea.height) / 2);
}
static gboolean
about_dialog_logo_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer data)

View File

@@ -175,7 +175,7 @@ GimpItemFactoryEntry gradient_editor_menu_entries[] =
GIMP_GRAD_CURVED, "/blendingfunction/Linear" },
NULL,
GIMP_HELP_GRADIENT_EDITOR_BLENDING, NULL },
{ { N_("/blendingfunction/_Sinusodial"), NULL,
{ { N_("/blendingfunction/_Sinusoidal"), NULL,
gradient_editor_blending_func_cmd_callback,
GIMP_GRAD_SINE, "/blendingfunction/Linear" },
NULL,

View File

@@ -1509,7 +1509,7 @@ prefs_dialog_new (Gimp *gimp,
prefs_boolean_option_menu_add (object, "initial-zoom-to-fit",
_("Fit to Window"),
"1:1",
_("Inital Zoom Ratio:"),
_("Initial Zoom Ratio:"),
GTK_TABLE (table), 0);
/* Pointer Movement Feedback */
@@ -1667,7 +1667,7 @@ prefs_dialog_new (Gimp *gimp,
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
0, format_names[i],
0, gettext (format_names[i]),
1, format_strings[i],
-1);

View File

@@ -75,6 +75,10 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/intl \
$(GTK2_CFLAGS) \
!IFNDEF PANGO_WIN32_EXTENDED
$(FONTCONFIG_CFLAGS) \
$(FREETYPE2_CFLAGS) \
!ENDIF
-I$(includedir)
regex_sources = \
@@ -125,9 +129,9 @@ $(PACKAGE).lib : $(OBJECTS)
$(PACKAGE)-$(PKG_VER).dll : $(PKG_LINK) $(OBJECTS) $(PACKAGE).def
$(CC) $(CFLAGS) -LD -Fe$(PACKAGE)-$(PKG_VER).dll $(OBJECTS) $(PKG_LINK) user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:$(PACKAGE).def
$(PACKAGE).exe : $(OBJECTS) $(PACKAGE).def $(PACKAGE).res $(PKG_LINK)
$(PACKAGE).exe : $(OBJECTS) $(PACKAGE).res $(PKG_LINK)
$(CC) $(CFLAGS) -Fe$(PACKAGE).exe $(PACKAGE).res $(OBJECTS) $(PKG_LINK) \
user32.lib advapi32.lib shell32.lib wsock32.lib winspool.lib $(LDFLAGS) /def:$(PACKAGE).def
user32.lib advapi32.lib shell32.lib wsock32.lib winspool.lib $(LDFLAGS)
.c.obj :
$(CC) $(CFLAGS) -GD -c $(PKG_CFLAGS) $<

View File

@@ -1,127 +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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "plug-in/plug-in-proc.h"
#include "plug-in/plug-ins.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemfactory.h"
#include "file-commands.h"
#include "file-open-menu.h"
#include "menus.h"
#include "gimp-intl.h"
GimpItemFactoryEntry file_open_menu_entries[] =
{
{ { N_("/Automatic"), NULL,
file_type_cmd_callback, 0 },
NULL,
GIMP_HELP_FILE_OPEN_BY_EXTENSION, NULL },
MENU_SEPARATOR ("/---")
};
gint n_file_open_menu_entries = G_N_ELEMENTS (file_open_menu_entries);
void
file_open_menu_setup (GimpItemFactory *factory,
gpointer callback_data)
{
GSList *list;
for (list = factory->gimp->load_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
const gchar *locale_domain = NULL;
const gchar *item_type = NULL;
const gchar *stock_id = NULL;
gchar *help_id;
GimpItemFactoryEntry entry;
gboolean is_xcf;
GtkWidget *menu_item;
if (! file_proc->menu_path)
continue;
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_load") == 0);
if (is_xcf)
{
item_type = "<StockItem>";
stock_id = GIMP_STOCK_WILBER;
help_id = g_strdup (GIMP_HELP_FILE_OPEN_XCF);
}
else
{
const gchar *progname;
const gchar *help_domain;
progname = plug_in_proc_def_get_progname (file_proc);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_domain = plug_ins_help_domain (factory->gimp, progname, NULL);
help_id = plug_in_proc_def_get_help_id (file_proc, help_domain);
}
entry.entry.path = strstr (file_proc->menu_path, "/");
entry.entry.accelerator = NULL;
entry.entry.callback = file_type_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = (gchar *) item_type;
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.help_id = help_id;
entry.description = NULL;
gimp_item_factory_create_item (factory,
&entry,
locale_domain,
callback_data, 2, FALSE);
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
entry.entry.path);
if (menu_item)
{
g_object_set_data (G_OBJECT (menu_item), "file-proc", file_proc);
if (is_xcf)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, 1);
}
g_free (help_id);
}
}

View File

@@ -1,31 +0,0 @@
/* The GIMP -- an open 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.
*/
#ifndef __FILE_OPEN_MENU_H__
#define __FILE_OPEN_MENU_H__
extern GimpItemFactoryEntry file_open_menu_entries[];
extern gint n_file_open_menu_entries;
void file_open_menu_setup (GimpItemFactory *factory,
gpointer callback_data);
#endif /* __FILE_OPEN_MENU_H__ */

View File

@@ -1,134 +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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "plug-in/plug-in-proc.h"
#include "plug-in/plug-ins.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemfactory.h"
#include "file-commands.h"
#include "file-save-menu.h"
#include "menus.h"
#include "gimp-intl.h"
GimpItemFactoryEntry file_save_menu_entries[] =
{
{ { N_("/By Extension"), NULL,
file_type_cmd_callback, 0 },
NULL,
GIMP_HELP_FILE_SAVE_BY_EXTENSION, NULL },
MENU_SEPARATOR ("/---")
};
gint n_file_save_menu_entries = G_N_ELEMENTS (file_save_menu_entries);
void
file_save_menu_setup (GimpItemFactory *factory,
gpointer callback_data)
{
GSList *list;
for (list = factory->gimp->save_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
const gchar *locale_domain = NULL;
const gchar *item_type = NULL;
const gchar *stock_id = NULL;
gchar *help_id;
GimpItemFactoryEntry entry;
gboolean is_xcf;
GtkWidget *menu_item;
if (! file_proc->menu_path)
continue;
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_save") == 0);
if (is_xcf)
{
item_type = "<StockItem>";
stock_id = GIMP_STOCK_WILBER;
help_id = g_strdup (GIMP_HELP_FILE_SAVE_XCF);
}
else
{
const gchar *progname;
const gchar *help_domain;
progname = plug_in_proc_def_get_progname (file_proc);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_domain = plug_ins_help_domain (factory->gimp, progname, NULL);
help_id = plug_in_proc_def_get_help_id (file_proc, help_domain);
}
entry.entry.path = strstr (file_proc->menu_path, "/");
entry.entry.accelerator = NULL;
entry.entry.callback = file_type_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = (gchar *) item_type;
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.help_id = help_id;
entry.description = NULL;
gimp_item_factory_create_item (factory,
&entry,
locale_domain,
callback_data, 2, FALSE);
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
entry.entry.path);
if (menu_item)
{
g_object_set_data (G_OBJECT (menu_item), "file-proc", file_proc);
if (is_xcf)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, 1);
}
g_free (help_id);
}
}
void
file_save_menu_update (GtkItemFactory *item_factory,
gpointer data)
{
}

View File

@@ -1,33 +0,0 @@
/* The GIMP -- an open 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.
*/
#ifndef __FILE_SAVE_MENU_H__
#define __FILE_SAVE_MENU_H__
extern GimpItemFactoryEntry file_save_menu_entries[];
extern gint n_file_save_menu_entries;
void file_save_menu_setup (GimpItemFactory *factory,
gpointer callback_data);
void file_save_menu_update (GtkItemFactory *item_factory,
gpointer update_data);
#endif /* __FILE_SAVE_MENU_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,33 +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.
*/
#ifndef __IMAGE_MENU_H__
#define __IMAGE_MENU_H__
extern GimpItemFactoryEntry image_menu_entries[];
extern gint n_image_menu_entries;
void image_menu_setup (GimpItemFactory *factory,
gpointer callback_data);
void image_menu_update (GtkItemFactory *factory,
gpointer update_data);
#endif /* __IMAGE_MENU_H__ */

View File

@@ -1,522 +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 "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "file/file-utils.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpmenufactory.h"
#include "brushes-menu.h"
#include "buffers-menu.h"
#include "channels-menu.h"
#include "colormap-editor-menu.h"
#include "dialogs-menu.h"
#include "documents-menu.h"
#include "error-console-menu.h"
#include "file-open-menu.h"
#include "file-save-menu.h"
#include "file-commands.h"
#include "fonts-menu.h"
#include "gradient-editor-menu.h"
#include "gradients-menu.h"
#include "image-menu.h"
#include "images-menu.h"
#include "layers-menu.h"
#include "menus.h"
#include "palette-editor-menu.h"
#include "palettes-menu.h"
#include "patterns-menu.h"
#include "qmask-menu.h"
#include "templates-menu.h"
#include "tool-options-menu.h"
#include "toolbox-menu.h"
#include "vectors-menu.h"
#include "gimp-intl.h"
/* local function prototypes */
static void menus_last_opened_update (GimpContainer *container,
GimpImagefile *unused,
GimpItemFactory *item_factory);
static void menus_last_opened_reorder (GimpContainer *container,
GimpImagefile *unused1,
gint unused2,
GimpItemFactory *item_factory);
static void menu_can_change_accels (GimpGuiConfig *config);
/* global variables */
GimpMenuFactory *global_menu_factory = NULL;
/* private variables */
static gboolean menus_initialized = FALSE;
/* public functions */
void
menus_init (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (menus_initialized == FALSE);
menus_initialized = TRUE;
/* We need to make sure the property is installed before using it */
g_type_class_ref (GTK_TYPE_MENU);
menu_can_change_accels (GIMP_GUI_CONFIG (gimp->config));
g_signal_connect (gimp->config, "notify::can-change-accels",
G_CALLBACK (menu_can_change_accels), NULL);
global_menu_factory = gimp_menu_factory_new (gimp);
gimp_menu_factory_menu_register (global_menu_factory, "<Toolbox>",
_("Toolbox Menu"),
GIMP_HELP_TOOLBOX,
toolbox_menu_setup, NULL, FALSE,
n_toolbox_menu_entries,
toolbox_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Image>",
_("Image Menu"),
GIMP_HELP_IMAGE_WINDOW,
image_menu_setup, image_menu_update, FALSE,
n_image_menu_entries,
image_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Load>",
_("Open Menu"),
GIMP_HELP_FILE_OPEN,
file_open_menu_setup, NULL, FALSE,
n_file_open_menu_entries,
file_open_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Save>",
_("Save Menu"),
GIMP_HELP_FILE_SAVE,
file_save_menu_setup,
file_save_menu_update, FALSE,
n_file_save_menu_entries,
file_save_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Layers>",
_("Layers Menu"),
GIMP_HELP_LAYER_DIALOG,
NULL, layers_menu_update, TRUE,
n_layers_menu_entries,
layers_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Channels>",
_("Channels Menu"),
GIMP_HELP_CHANNEL_DIALOG,
NULL, channels_menu_update, TRUE,
n_channels_menu_entries,
channels_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Vectors>",
_("Paths Menu"),
GIMP_HELP_PATH_DIALOG,
NULL, vectors_menu_update, TRUE,
n_vectors_menu_entries,
vectors_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Dialogs>",
_("Dialogs Menu"),
GIMP_HELP_DOCK,
NULL, dialogs_menu_update, TRUE,
n_dialogs_menu_entries,
dialogs_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Brushes>",
_("Brushes Menu"),
GIMP_HELP_BRUSH_DIALOG,
NULL, brushes_menu_update, TRUE,
n_brushes_menu_entries,
brushes_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Patterns>",
_("Patterns Menu"),
GIMP_HELP_PATTERN_DIALOG,
NULL, patterns_menu_update, TRUE,
n_patterns_menu_entries,
patterns_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Gradients>",
_("Gradients Menu"),
GIMP_HELP_GRADIENT_DIALOG,
NULL, gradients_menu_update, TRUE,
n_gradients_menu_entries,
gradients_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Palettes>",
_("Palettes Menu"),
GIMP_HELP_PALETTE_DIALOG,
NULL, palettes_menu_update, TRUE,
n_palettes_menu_entries,
palettes_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Fonts>",
_("Fonts Menu"),
GIMP_HELP_FONT_DIALOG,
NULL, fonts_menu_update, TRUE,
n_fonts_menu_entries,
fonts_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Buffers>",
_("Buffers Menu"),
GIMP_HELP_BUFFER_DIALOG,
NULL, buffers_menu_update, TRUE,
n_buffers_menu_entries,
buffers_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Documents>",
_("Documents Menu"),
GIMP_HELP_DOCUMENT_DIALOG,
NULL, documents_menu_update, TRUE,
n_documents_menu_entries,
documents_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Templates>",
_("Templates Menu"),
GIMP_HELP_TEMPLATE_DIALOG,
NULL, templates_menu_update, TRUE,
n_templates_menu_entries,
templates_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Images>",
_("Images Menu"),
GIMP_HELP_IMAGE_DIALOG,
NULL, images_menu_update, TRUE,
n_images_menu_entries,
images_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<GradientEditor>",
_("Gradient Editor Menu"),
GIMP_HELP_GRADIENT_EDITOR_DIALOG,
NULL, gradient_editor_menu_update, TRUE,
n_gradient_editor_menu_entries,
gradient_editor_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<PaletteEditor>",
_("Palette Editor Menu"),
GIMP_HELP_PALETTE_EDITOR_DIALOG,
NULL, palette_editor_menu_update, TRUE,
n_palette_editor_menu_entries,
palette_editor_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<ColormapEditor>",
_("Indexed Palette Menu"),
GIMP_HELP_INDEXED_PALETTE_DIALOG,
NULL, colormap_editor_menu_update, TRUE,
n_colormap_editor_menu_entries,
colormap_editor_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<QMask>",
_("QuickMask Menu"),
GIMP_HELP_QMASK,
NULL, qmask_menu_update, TRUE,
n_qmask_menu_entries,
qmask_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<ErrorConsole>",
_("Error Console Menu"),
GIMP_HELP_ERRORS_DIALOG,
NULL, error_console_menu_update, TRUE,
n_error_console_menu_entries,
error_console_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<ToolOptions>",
_("Tool Options Menu"),
GIMP_HELP_TOOL_OPTIONS_DIALOG,
tool_options_menu_setup,
tool_options_menu_update, TRUE,
n_tool_options_menu_entries,
tool_options_menu_entries);
}
void
menus_exit (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_object_unref (global_menu_factory);
global_menu_factory = NULL;
g_signal_handlers_disconnect_by_func (gimp->config,
menu_can_change_accels,
NULL);
}
void
menus_restore (Gimp *gimp)
{
gchar *filename;
g_return_if_fail (GIMP_IS_GIMP (gimp));
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_load (filename);
g_free (filename);
}
void
menus_save (Gimp *gimp)
{
gchar *filename;
g_return_if_fail (GIMP_IS_GIMP (gimp));
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_save (filename);
g_free (filename);
}
void
menus_clear (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_print ("TODO: implement menus_clear()\n");
}
void
menus_last_opened_add (GimpItemFactory *item_factory)
{
GimpItemFactoryEntry *last_opened_entries;
gint n_last_opened_entries;
gint i;
g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory));
n_last_opened_entries =
GIMP_GUI_CONFIG (item_factory->gimp->config)->last_opened_size;
last_opened_entries = g_new (GimpItemFactoryEntry, n_last_opened_entries);
for (i = 0; i < n_last_opened_entries; i++)
{
last_opened_entries[i].entry.path =
g_strdup_printf ("/File/Open Recent/%02d", i + 1);
if (i < 9)
last_opened_entries[i].entry.accelerator =
g_strdup_printf ("<control>%d", i + 1);
else if (i == 9)
last_opened_entries[i].entry.accelerator = "<control>0";
else
last_opened_entries[i].entry.accelerator = "";
last_opened_entries[i].entry.callback = file_last_opened_cmd_callback;
last_opened_entries[i].entry.callback_action = i;
last_opened_entries[i].entry.item_type = "<StockItem>";
last_opened_entries[i].entry.extra_data = GTK_STOCK_OPEN;
last_opened_entries[i].quark_string = NULL;
last_opened_entries[i].help_id = GIMP_HELP_FILE_OPEN_RECENT;
last_opened_entries[i].description = NULL;
}
gimp_item_factory_create_items (item_factory,
n_last_opened_entries, last_opened_entries,
item_factory->gimp, 2, FALSE);
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
"/File/Open Recent/(None)",
FALSE);
for (i = 0; i < n_last_opened_entries; i++)
{
GtkWidget *widget;
widget = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory),
last_opened_entries[i].entry.path);
gtk_menu_reorder_child (GTK_MENU (widget->parent), widget, i + 1);
gimp_item_factory_set_visible (GTK_ITEM_FACTORY (item_factory),
last_opened_entries[i].entry.path,
FALSE);
g_free (last_opened_entries[i].entry.path);
if (i < 9)
g_free (last_opened_entries[i].entry.accelerator);
}
g_free (last_opened_entries);
g_signal_connect_object (item_factory->gimp->documents, "add",
G_CALLBACK (menus_last_opened_update),
item_factory, 0);
g_signal_connect_object (item_factory->gimp->documents, "remove",
G_CALLBACK (menus_last_opened_update),
item_factory, 0);
g_signal_connect_object (item_factory->gimp->documents, "reorder",
G_CALLBACK (menus_last_opened_reorder),
item_factory, 0);
menus_last_opened_update (item_factory->gimp->documents, NULL, item_factory);
}
void
menus_filters_subdirs_to_top (GtkMenu *menu)
{
GtkMenuItem *menu_item;
GList *list;
gboolean submenus_passed = FALSE;
gint pos;
gint items;
pos = 1;
items = 0;
for (list = GTK_MENU_SHELL (menu)->children; list; list = g_list_next (list))
{
menu_item = GTK_MENU_ITEM (list->data);
items++;
if (menu_item->submenu)
{
if (submenus_passed)
{
menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu));
gtk_menu_reorder_child (menu, GTK_WIDGET (menu_item), pos++);
}
}
else
{
submenus_passed = TRUE;
}
}
if (pos > 1 && items > pos)
{
GtkWidget *separator;
separator = gtk_menu_item_new ();
gtk_menu_shell_insert (GTK_MENU_SHELL (menu), separator, pos);
gtk_widget_show (separator);
}
}
/* private functions */
static void
menus_last_opened_update (GimpContainer *container,
GimpImagefile *unused,
GimpItemFactory *item_factory)
{
GtkWidget *widget;
gint num_documents;
gint i;
gint n = GIMP_GUI_CONFIG (item_factory->gimp->config)->last_opened_size;
num_documents = gimp_container_num_children (container);
gimp_item_factory_set_visible (GTK_ITEM_FACTORY (item_factory),
"/File/Open Recent/(None)",
num_documents == 0);
for (i = 0; i < n; i++)
{
gchar *path_str;
path_str = g_strdup_printf ("/File/Open Recent/%02d", i + 1);
widget = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory),
path_str);
g_free (path_str);
if (i < num_documents)
{
GimpImagefile *imagefile;
imagefile = (GimpImagefile *)
gimp_container_get_child_by_index (container, i);
if (g_object_get_data (G_OBJECT (widget), "gimp-imagefile") !=
(gpointer) imagefile)
{
const gchar *uri;
gchar *filename;
gchar *basename;
uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
filename = file_utils_uri_to_utf8_filename (uri);
basename = file_utils_uri_to_utf8_basename (uri);
gtk_label_set_text (GTK_LABEL (GTK_BIN (widget)->child),
basename);
gimp_help_set_help_data (widget, filename, NULL);
g_free (filename);
g_free (basename);
g_object_set_data (G_OBJECT (widget),
"gimp-imagefile", imagefile);
gtk_widget_show (widget);
}
}
else
{
g_object_set_data (G_OBJECT (widget), "gimp-imagefile", NULL);
gtk_widget_hide (widget);
}
}
}
static void
menus_last_opened_reorder (GimpContainer *container,
GimpImagefile *unused1,
gint unused2,
GimpItemFactory *item_factory)
{
menus_last_opened_update (container, unused1, item_factory);
}
static void
menu_can_change_accels (GimpGuiConfig *config)
{
g_object_set (gtk_settings_get_for_screen (gdk_screen_get_default ()),
"gtk-can-change-accels", config->can_change_accels,
NULL);
}

View File

@@ -1,43 +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.
*/
#ifndef __MENUS_H__
#define __MENUS_H__
#define MENU_SEPARATOR(path) \
{ { (path), NULL, NULL, 0, "<Separator>" }, NULL, NULL, NULL }
#define MENU_BRANCH(path) \
{ { (path), NULL, NULL, 0, "<Branch>" }, NULL, NULL, NULL }
extern GimpMenuFactory *global_menu_factory;
void menus_init (Gimp *gimp);
void menus_exit (Gimp *gimp);
void menus_restore (Gimp *gimp);
void menus_save (Gimp *gimp);
void menus_clear (Gimp *gimp);
void menus_last_opened_add (GimpItemFactory *item_factory);
void menus_filters_subdirs_to_top (GtkMenu *menu);
#endif /* __MENUS_H__ */

View File

@@ -1,396 +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 "string.h"
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "plug-in/plug-ins.h"
#include "plug-in/plug-in-def.h"
#include "plug-in/plug-in-proc.h"
#include "plug-in/plug-in-run.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "plug-in-commands.h"
#include "plug-in-menus.h"
#include "gimp-intl.h"
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
const gchar *locale_domain;
const gchar *help_domain;
};
/* local function prototypes */
static gboolean plug_in_menu_tree_traverse_func (gpointer foo,
PlugInMenuEntry *menu_entry,
GimpItemFactory *item_factory);
/* public functions */
void
plug_in_menus_init (Gimp *gimp,
GSList *plug_in_defs,
const gchar *std_plugins_domain)
{
GSList *domains = NULL;
GSList *tmp;
g_return_if_fail (std_plugins_domain != NULL);
domains = g_slist_append (domains, (gpointer) std_plugins_domain);
bindtextdomain (std_plugins_domain, gimp_locale_directory ());
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (std_plugins_domain, "UTF-8");
#endif
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
{
PlugInDef *plug_in_def;
const gchar *locale_domain;
const gchar *locale_path;
GSList *list;
plug_in_def = (PlugInDef *) tmp->data;
if (! plug_in_def->proc_defs)
continue;
locale_domain = plug_ins_locale_domain (gimp,
plug_in_def->prog,
&locale_path);
for (list = domains; list; list = list->next)
if (! strcmp (locale_domain, (const gchar *) list->data))
break;
if (! list)
{
domains = g_slist_append (domains, (gpointer) locale_domain);
bindtextdomain (locale_domain, locale_path);
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (locale_domain, "UTF-8");
#endif
}
}
g_slist_free (domains);
}
void
plug_in_menus_create (GimpItemFactory *item_factory,
GSList *proc_defs)
{
GSList *procs;
GTree *menu_entries;
g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory));
g_return_if_fail (proc_defs != NULL);
menu_entries = g_tree_new_full ((GCompareDataFunc) g_utf8_collate, NULL,
g_free, g_free);
for (procs = proc_defs; procs; procs = procs->next)
{
PlugInProcDef *proc_def = procs->data;
if (proc_def->prog &&
proc_def->menu_path &&
! proc_def->extensions &&
! proc_def->prefixes &&
! proc_def->magics)
{
PlugInMenuEntry *menu_entry;
const gchar *progname;
const gchar *locale_domain;
const gchar *help_domain;
gchar *key;
progname = plug_in_proc_def_get_progname (proc_def);
locale_domain = plug_ins_locale_domain (item_factory->gimp,
progname, NULL);
help_domain = plug_ins_help_domain (item_factory->gimp,
progname, NULL);
menu_entry = g_new0 (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->locale_domain = locale_domain;
menu_entry->help_domain = help_domain;
key = gimp_strip_uline (dgettext (locale_domain,
proc_def->menu_path));
g_tree_insert (menu_entries, key, menu_entry);
}
}
g_tree_foreach (menu_entries,
(GTraverseFunc) plug_in_menu_tree_traverse_func,
item_factory);
g_tree_destroy (menu_entries);
}
void
plug_in_menus_create_entry (GimpItemFactory *item_factory,
PlugInProcDef *proc_def,
const gchar *locale_domain,
const gchar *help_domain)
{
GimpItemFactoryEntry entry;
gchar *help_id;
g_return_if_fail (item_factory == NULL ||
GIMP_IS_ITEM_FACTORY (item_factory));
g_return_if_fail (proc_def != NULL);
help_id = plug_in_proc_def_get_help_id (proc_def, help_domain);
entry.entry.path = strstr (proc_def->menu_path, "/");
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_run_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_id = help_id;
entry.description = NULL;
if (item_factory)
{
gchar *factory_path;
factory_path = GTK_ITEM_FACTORY (item_factory)->path;
if (! strncmp (proc_def->menu_path,
factory_path, strlen (factory_path)))
{
gimp_item_factory_create_item (item_factory,
&entry,
locale_domain,
&proc_def->db_info, 2, FALSE);
}
}
else
{
GList *list;
for (list = gimp_item_factories_from_path (proc_def->menu_path);
list;
list = g_list_next (list))
{
item_factory = list->data;
gimp_item_factory_create_item (item_factory,
&entry,
locale_domain,
&proc_def->db_info, 2, FALSE);
}
}
g_free (help_id);
}
void
plug_in_menus_delete_entry (const gchar *menu_path)
{
GList *list;
gchar *path;
g_return_if_fail (menu_path != NULL);
path = gimp_strip_uline (menu_path);
for (list = gimp_item_factories_from_path (menu_path);
list;
list = g_list_next (list))
{
GtkItemFactory *item_factory = list->data;
gtk_item_factory_delete_item (GTK_ITEM_FACTORY (item_factory), path);
}
g_free (path);
}
void
plug_in_menus_update (GimpItemFactory *item_factory,
GimpImageType type)
{
GSList *list;
gchar *factory_path;
gint factory_path_len;
gboolean is_image_factory = FALSE;
g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory));
factory_path = GTK_ITEM_FACTORY (item_factory)->path;
factory_path_len = strlen (factory_path);
if (! strcmp (factory_path, "<Image>"))
is_image_factory = TRUE;
for (list = item_factory->gimp->plug_in_proc_defs;
list;
list = g_slist_next (list))
{
PlugInProcDef *proc_def = list->data;
if (proc_def->menu_path && proc_def->image_types_val)
{
gboolean sensitive;
switch (type)
{
case GIMP_RGB_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGB_IMAGE;
break;
case GIMP_RGBA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGBA_IMAGE;
break;
case GIMP_GRAY_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAY_IMAGE;
break;
case GIMP_GRAYA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAYA_IMAGE;
break;
case GIMP_INDEXED_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXED_IMAGE;
break;
case GIMP_INDEXEDA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXEDA_IMAGE;
break;
default:
sensitive = FALSE;
break;
}
if (! strncmp (proc_def->menu_path, factory_path, factory_path_len))
{
gchar *menu_path;
menu_path = gimp_strip_uline (proc_def->menu_path);
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
menu_path,
sensitive);
g_free (menu_path);
}
if (is_image_factory &&
item_factory->gimp->last_plug_in &&
item_factory->gimp->last_plug_in == &proc_def->db_info)
{
const gchar *progname;
const gchar *path;
gchar *stripped;
gchar *basename;
gchar *ellipses;
gchar *repeat;
gchar *reshow;
progname = plug_in_proc_def_get_progname (proc_def);
path = dgettext (plug_ins_locale_domain (item_factory->gimp,
progname, NULL),
proc_def->menu_path);
stripped = gimp_strip_uline (path);
basename = g_path_get_basename (stripped);
g_free (stripped);
ellipses = strstr (basename, "...");
if (ellipses && ellipses == (basename + strlen (basename) - 3))
*ellipses = '\0';
repeat = g_strdup_printf (_("Re_peat \"%s\""), basename);
reshow = g_strdup_printf (_("R_e-show \"%s\""), basename);
g_free (basename);
gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory),
"/Filters/Repeat Last", repeat);
gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory),
"/Filters/Re-Show Last", reshow);
g_free (repeat);
g_free (reshow);
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
"/Filters/Repeat Last",
sensitive);
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
"/Filters/Re-Show Last",
sensitive);
}
}
}
if (is_image_factory && ! item_factory->gimp->last_plug_in)
{
gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory),
"/Filters/Repeat Last",
_("Repeat Last"));
gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory),
"/Filters/Re-Show Last",
_("Re-Show Last"));
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
"/Filters/Repeat Last", FALSE);
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
"/Filters/Re-Show Last", FALSE);
}
}
/* private functions */
static gboolean
plug_in_menu_tree_traverse_func (gpointer foo,
PlugInMenuEntry *menu_entry,
GimpItemFactory *item_factory)
{
plug_in_menus_create_entry (item_factory,
menu_entry->proc_def,
menu_entry->locale_domain,
menu_entry->help_domain);
return FALSE;
}

View File

@@ -1,39 +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.
*/
#ifndef __PLUG_IN_MENUS_H__
#define __PLUG_IN_MENUS_H__
void plug_in_menus_init (Gimp *gimp,
GSList *plug_in_defs,
const gchar *std_plugins_domain);
void plug_in_menus_create (GimpItemFactory *item_factory,
GSList *proc_defs);
void plug_in_menus_create_entry (GimpItemFactory *item_factory,
PlugInProcDef *proc_def,
const gchar *locale_domain,
const gchar *help_domain);
void plug_in_menus_delete_entry (const gchar *menu_path);
void plug_in_menus_update (GimpItemFactory *item_factory,
GimpImageType type);
#endif /* __PLUG_IN_MENUS_H__ */

View File

@@ -1,246 +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 "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimplist.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemfactory.h"
#include "menus.h"
#include "tool-options-commands.h"
#include "tool-options-menu.h"
#include "gimp-intl.h"
/* local function prototypes */
static void tool_options_menu_update_presets (GtkItemFactory *factory,
const gchar *menu_path,
gint keep_n,
gboolean has_none,
GtkItemFactoryCallback callback,
const gchar *stock_id,
const gchar *help_id,
GimpContainer *presets);
/* global variables */
GimpItemFactoryEntry tool_options_menu_entries[] =
{
MENU_BRANCH (N_("/_Save Options to")),
{ { N_("/Save Options to/_New Entry..."), "",
tool_options_save_new_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
GIMP_HELP_TOOL_OPTIONS_SAVE, NULL },
{ { "/Save Options to/new-separator", "",
NULL, 0,
"<Separator>", NULL },
NULL,
NULL, NULL },
MENU_BRANCH (N_("/_Restore Options from")),
{ { N_("/Restore Options from/(None)"), "",
NULL, 0,
"<Item>", NULL },
NULL,
NULL, NULL },
MENU_BRANCH (N_("/Re_name Saved Options")),
{ { N_("/Rename Saved Options/(None)"), "",
NULL, 0,
"<Item>", NULL },
NULL,
NULL, NULL },
MENU_BRANCH (N_("/_Delete Saved Options")),
{ { N_("/Delete Saved Options/(None)"), "",
NULL, 0,
"<Item>", NULL },
NULL,
NULL, NULL },
{ { "/reset-separator", NULL, NULL, 0, "<Separator>", NULL },
NULL, NULL, NULL },
{ { N_("/R_eset Tool Options"), "",
tool_options_reset_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_RESET },
NULL,
GIMP_HELP_TOOL_OPTIONS_RESET, NULL },
{ { N_("/Reset _all Tool Options..."), "",
tool_options_reset_all_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_RESET },
NULL,
GIMP_HELP_TOOL_OPTIONS_RESET, NULL }
};
gint n_tool_options_menu_entries = G_N_ELEMENTS (tool_options_menu_entries);
/* public functions */
void
tool_options_menu_setup (GimpItemFactory *factory,
gpointer callback_data)
{
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (factory),
"/Restore Options from/(None)", FALSE);
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (factory),
"/Rename Saved Options/(None)", FALSE);
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (factory),
"/Delete Saved Options/(None)", FALSE);
}
#define SET_VISIBLE(menu,condition) \
gimp_item_factory_set_visible (factory, menu, (condition) != 0)
void
tool_options_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
context = gimp_get_user_context (GIMP_ITEM_FACTORY (factory)->gimp);
tool_info = gimp_context_get_tool (context);
SET_VISIBLE ("/Save Options to", tool_info->options_presets);
SET_VISIBLE ("/Restore Options from", tool_info->options_presets);
SET_VISIBLE ("/Rename Saved Options", tool_info->options_presets);
SET_VISIBLE ("/Delete Saved Options", tool_info->options_presets);
SET_VISIBLE ("/reset-separator", tool_info->options_presets);
if (! tool_info->options_presets)
return;
SET_VISIBLE ("/Save Options to/new-separator",
gimp_container_num_children (tool_info->options_presets) > 0);
tool_options_menu_update_presets (factory, "/Save Options to", 2, FALSE,
tool_options_save_to_cmd_callback,
GTK_STOCK_SAVE,
GIMP_HELP_TOOL_OPTIONS_SAVE,
tool_info->options_presets);
tool_options_menu_update_presets (factory, "/Restore Options from", 1, TRUE,
tool_options_restore_from_cmd_callback,
GTK_STOCK_REVERT_TO_SAVED,
GIMP_HELP_TOOL_OPTIONS_RESTORE,
tool_info->options_presets);
tool_options_menu_update_presets (factory, "/Rename Saved Options", 1, TRUE,
tool_options_rename_saved_cmd_callback,
GIMP_STOCK_EDIT,
GIMP_HELP_TOOL_OPTIONS_RENAME,
tool_info->options_presets);
tool_options_menu_update_presets (factory, "/Delete Saved Options", 1, TRUE,
tool_options_delete_saved_cmd_callback,
GTK_STOCK_DELETE,
GIMP_HELP_TOOL_OPTIONS_DELETE,
tool_info->options_presets);
}
/* privat function */
static void
tool_options_menu_update_presets (GtkItemFactory *factory,
const gchar *menu_path,
gint keep_n,
gboolean has_none,
GtkItemFactoryCallback callback,
const gchar *stock_id,
const gchar *help_id,
GimpContainer *presets)
{
GtkWidget *menu;
menu = gtk_item_factory_get_widget (factory, menu_path);
if (menu)
{
GList *list;
gint num_children;
list = g_list_nth (GTK_MENU_SHELL (menu)->children, keep_n - 1);
while (g_list_next (list))
gtk_widget_destroy (g_list_next (list)->data);
num_children = gimp_container_num_children (presets);
if (has_none)
{
gchar *none;
none = g_strdup_printf ("%s/(None)", menu_path);
SET_VISIBLE (none, num_children == 0);
g_free (none);
}
if (num_children > 0)
{
GimpItemFactoryEntry entry;
entry.entry.path = NULL;
entry.entry.accelerator = "";
entry.entry.callback = callback;
entry.entry.callback_action = 0;
entry.entry.item_type = stock_id ? "<StockItem>" : "<Item>";
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.help_id = help_id;
entry.description = NULL;
for (list = GIMP_LIST (presets)->list;
list;
list = g_list_next (list))
{
GimpToolOptions *options = list->data;
entry.entry.path = g_strdup_printf ("%s/%s",
menu_path,
GIMP_OBJECT (options)->name);
gimp_item_factory_create_item (GIMP_ITEM_FACTORY (factory),
&entry, NULL,
options, 2, FALSE);
g_free (entry.entry.path);
}
}
}
}
#undef SET_VISIBLE

View File

@@ -1,33 +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.
*/
#ifndef __TOOL_OPTIONS_MENU_H__
#define __TOOL_OPTIONS_MENU_H__
extern GimpItemFactoryEntry tool_options_menu_entries[];
extern gint n_tool_options_menu_entries;
void tool_options_menu_setup (GimpItemFactory *factory,
gpointer callback_data);
void tool_options_menu_update (GtkItemFactory *factory,
gpointer update_data);
#endif /* __TOOL_OPTIONS_MENU_H__ */

View File

@@ -1,349 +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 "gui-types.h"
#include "core/gimp.h"
#include "plug-in/plug-ins.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemfactory.h"
#include "debug-commands.h"
#include "dialogs-commands.h"
#include "file-commands.h"
#include "help-commands.h"
#include "menus.h"
#include "plug-in-menus.h"
#include "toolbox-menu.h"
#include "gimp-intl.h"
GimpItemFactoryEntry toolbox_menu_entries[] =
{
/* <Toolbox>/File */
MENU_BRANCH (N_("/_File")),
{ { N_("/File/_New..."), "<control>N",
file_new_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
GIMP_HELP_FILE_NEW, NULL },
{ { N_("/File/_Open..."), "<control>O",
file_open_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL,
GIMP_HELP_FILE_OPEN, NULL },
/* <Toolbox>/File/Open Recent */
MENU_BRANCH (N_("/File/Open _Recent")),
{ { N_("/File/Open Recent/(None)"), NULL, NULL, 0 },
NULL, NULL, NULL },
MENU_SEPARATOR ("/File/Open Recent/---"),
{ { N_("/File/Open Recent/Document _History"), "foo",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG, NULL },
/* <Toolbox>/File/Acquire */
MENU_BRANCH (N_("/File/_Acquire")),
MENU_SEPARATOR ("/File/---"),
{ { N_("/File/_Preferences"), NULL,
dialogs_create_toplevel_cmd_callback, 0,
"<StockItem>", GTK_STOCK_PREFERENCES },
"gimp-preferences-dialog",
GIMP_HELP_PREFS_DIALOG, NULL },
/* <Toolbox>/File/Dialogs */
MENU_BRANCH (N_("/File/_Dialogs")),
MENU_BRANCH (N_("/File/Dialogs/Create New Doc_k")),
{ { N_("/File/Dialogs/Create New Dock/_Layers, Channels & Paths"), NULL,
dialogs_create_lc_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { N_("/File/Dialogs/Create New Dock/_Brushes, Patterns & Gradients"), NULL,
dialogs_create_data_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { N_("/File/Dialogs/Create New Dock/_Misc. Stuff"), NULL,
dialogs_create_stuff_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { N_("/File/Dialogs/Tool _Options"), "<control><shift>T",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_OPTIONS },
"gimp-tool-options",
GIMP_HELP_TOOL_OPTIONS_DIALOG, NULL },
{ { N_("/File/Dialogs/_Device Status"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_DEVICE_STATUS },
"gimp-device-status",
GIMP_HELP_DEVICE_STATUS_DIALOG, NULL },
MENU_SEPARATOR ("/File/Dialogs/---"),
{ { N_("/File/Dialogs/_Layers"), "<control>L",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_LAYERS },
"gimp-layer-list",
GIMP_HELP_LAYER_DIALOG, NULL },
{ { N_("/File/Dialogs/_Channels"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_CHANNELS },
"gimp-channel-list",
GIMP_HELP_CHANNEL_DIALOG, NULL },
{ { N_("/File/Dialogs/_Paths"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_PATHS },
"gimp-vectors-list",
GIMP_HELP_PATH_DIALOG, NULL },
{ { N_("/File/Dialogs/Inde_xed Palette"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_INDEXED_PALETTE },
"gimp-indexed-palette",
GIMP_HELP_INDEXED_PALETTE_DIALOG, NULL },
{ { N_("/File/Dialogs/Histogra_m"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_HISTOGRAM },
"gimp-histogram-editor",
GIMP_HELP_HISTOGRAM_DIALOG, NULL },
{ { N_("/File/Dialogs/_Selection Editor"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_RECT_SELECT },
"gimp-selection-editor",
GIMP_HELP_SELECTION_DIALOG, NULL },
{ { N_("/File/Dialogs/Na_vigation"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_NAVIGATION },
"gimp-navigation-view",
GIMP_HELP_NAVIGATION_DIALOG, NULL },
{ { N_("/File/Dialogs/_Undo History"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_UNDO_HISTORY },
"gimp-undo-history",
GIMP_HELP_UNDO_DIALOG, NULL },
MENU_SEPARATOR ("/File/Dialogs/---"),
{ { N_("/File/Dialogs/Colo_rs"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_DEFAULT_COLORS },
"gimp-color-editor",
GIMP_HELP_COLOR_DIALOG, NULL },
{ { N_("/File/Dialogs/Brus_hes"), "<control><shift>B",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_BRUSH },
"gimp-brush-grid",
GIMP_HELP_BRUSH_DIALOG, NULL },
{ { N_("/File/Dialogs/P_atterns"), "<control><shift>P",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_PATTERN },
"gimp-pattern-grid",
GIMP_HELP_PATTERN_DIALOG, NULL },
{ { N_("/File/Dialogs/_Gradients"), "<control>G",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_GRADIENT },
"gimp-gradient-list|gimp-gradient-grid",
GIMP_HELP_GRADIENT_DIALOG, NULL },
{ { N_("/File/Dialogs/Pal_ettes"), "<control>P",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_PALETTE },
"gimp-palette-list|gimp-palette-list",
GIMP_HELP_PALETTE_DIALOG, NULL },
{ { N_("/File/Dialogs/_Fonts"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_FONT },
"gimp-font-list|gimp-font-grid",
GIMP_HELP_FONT_DIALOG, NULL },
{ { N_("/File/Dialogs/_Buffers"), "foo",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_BUFFER },
"gimp-buffer-list|gimp-buffer-grid",
GIMP_HELP_BUFFER_DIALOG, NULL },
MENU_SEPARATOR ("/File/Dialogs/---"),
{ { N_("/File/Dialogs/_Images"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_IMAGES },
"gimp-image-list|gimp-image-grid",
GIMP_HELP_IMAGE_DIALOG, NULL },
{ { N_("/File/Dialogs/Document Histor_y"), "",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG, NULL },
{ { N_("/File/Dialogs/_Templates"), "",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TEMPLATE },
"gimp-template-list|gimp-template-grid",
GIMP_HELP_TEMPLATE_DIALOG, NULL },
{ { N_("/File/Dialogs/T_ools"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOLS },
"gimp-tool-list|gimp-tool-grid",
GIMP_HELP_TOOLS_DIALOG, NULL },
{ { N_("/File/Dialogs/Error Co_nsole"), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_WARNING },
"gimp-error-console",
GIMP_HELP_ERRORS_DIALOG, NULL },
#ifdef ENABLE_DEBUG_MENU
MENU_BRANCH (N_("/File/D_ebug")),
{ { "/File/Debug/_Mem Profile", NULL,
debug_mem_profile_cmd_callback, 0 },
NULL, NULL, NULL },
{ { "/File/Debug/_Dump Items", NULL,
debug_dump_menus_cmd_callback, 0 },
NULL, NULL, NULL },
#endif /* ENABLE_DEBUG_MENU */
MENU_SEPARATOR ("/File/---"),
{ { N_("/File/_Quit"), "<control>Q",
file_quit_cmd_callback, 0,
"<StockItem>", GTK_STOCK_QUIT },
NULL,
GIMP_HELP_FILE_QUIT, NULL },
/* <Toolbox>/Xtns */
MENU_BRANCH (N_("/_Xtns")),
{ { N_("/Xtns/_Module Manager"), NULL,
dialogs_create_toplevel_cmd_callback, 0 },
"gimp-module-manager-dialog",
GIMP_HELP_MODULE_DIALOG, NULL },
MENU_SEPARATOR ("/Xtns/---"),
/* <Toolbox>/Help */
MENU_BRANCH (N_("/_Help")),
{ { N_("/Help/_Help"), "F1",
help_help_cmd_callback, 0,
"<StockItem>", GTK_STOCK_HELP },
NULL,
GIMP_HELP_HELP, NULL },
{ { N_("/Help/_Context Help"), "<shift>F1",
help_context_help_cmd_callback, 0,
"<StockItem>", GTK_STOCK_HELP },
NULL,
GIMP_HELP_HELP_CONTEXT, NULL },
{ { N_("/Help/_Tip of the Day"), NULL,
dialogs_create_toplevel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_INFO },
"gimp-tips-dialog",
GIMP_HELP_TIPS_DIALOG, NULL },
{ { N_("/Help/_About"), NULL,
dialogs_create_toplevel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_WILBER },
"gimp-about-dialog",
GIMP_HELP_ABOUT_DIALOG, NULL }
};
gint n_toolbox_menu_entries = G_N_ELEMENTS (toolbox_menu_entries);
void
toolbox_menu_setup (GimpItemFactory *factory,
gpointer callback_data)
{
static gchar *reorder_subsubmenus[] = { "/Xtns" };
GtkWidget *menu_item;
GtkWidget *menu;
GList *list;
gint i, pos;
menus_last_opened_add (factory);
plug_in_menus_create (factory, factory->gimp->plug_in_proc_defs);
/* Move all menu items under "<Toolbox>/Xtns" which are not submenus or
* separators to the top of the menu
*/
pos = 1;
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
"/Xtns/Module Manager");
if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
{
menu = menu_item->parent;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos);
list;
list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
if (! GTK_MENU_ITEM (menu_item)->submenu &&
GTK_IS_LABEL (GTK_BIN (menu_item)->child))
{
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, pos);
list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos);
pos++;
}
}
}
for (i = 0; i < G_N_ELEMENTS (reorder_subsubmenus); i++)
{
menu = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
reorder_subsubmenus[i]);
if (menu && GTK_IS_MENU (menu))
{
for (list = GTK_MENU_SHELL (menu)->children;
list;
list = g_list_next (list))
{
GtkMenuItem *menu_item;
menu_item = GTK_MENU_ITEM (list->data);
if (menu_item->submenu)
menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu));
}
}
}
}

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