mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-10-06 01:12:40 +02:00
Compare commits
188 Commits
5099a13987
...
GIMP_2_0_3
Author | SHA1 | Date | |
---|---|---|---|
|
5d8f2edfc5 | ||
|
3ceacb2f62 | ||
|
b6eaa7485e | ||
|
51f875ae31 | ||
|
187e70a294 | ||
|
a8e65adcd1 | ||
|
6614bf2ab2 | ||
|
8de5f88f7b | ||
|
3e943cdb06 | ||
|
76382c43f8 | ||
|
645ce7bcd6 | ||
|
0c1d27fbc5 | ||
|
005f592723 | ||
|
fa33e99e2f | ||
|
53fabe2f43 | ||
|
a6c2fb3bf6 | ||
|
adb719833e | ||
|
d8e251eea4 | ||
|
05c32fb5e0 | ||
|
759187e16f | ||
|
650412c26c | ||
|
3696979d75 | ||
|
beee5710bf | ||
|
f7b7907767 | ||
|
5a06a4dfa4 | ||
|
306b29a2d7 | ||
|
d60c156eb4 | ||
|
ef36480919 | ||
|
9e8991b0cb | ||
|
985568cf07 | ||
|
7f41fb21f3 | ||
|
f66e5073c9 | ||
|
d054e6321c | ||
|
1a4904f97c | ||
|
5249edb004 | ||
|
019641f530 | ||
|
0cf0a0e840 | ||
|
40fec6e22a | ||
|
da596775cb | ||
|
6e4a57cc1c | ||
|
a5344b8fd2 | ||
|
da81090f2c | ||
|
b8e3f199dd | ||
|
4091bdd8c2 | ||
|
7739c9a2bd | ||
|
264b2365c2 | ||
|
0201e18ab4 | ||
|
396877344a | ||
|
40e157cd3c | ||
|
b9d9e6b536 | ||
|
b42996f657 | ||
|
928235712e | ||
|
651a9a55f4 | ||
|
07b1f8f34b | ||
|
0cdeabe94c | ||
|
4c183e1f58 | ||
|
d68136c63b | ||
|
4d995532e5 | ||
|
74fadffc58 | ||
|
647f48646f | ||
|
b3a2df5d84 | ||
|
114f96ebd8 | ||
|
2f26dfa441 | ||
|
f2a1476a9f | ||
|
ea1716b5c3 | ||
|
e10f48a25f | ||
|
7f90720b9f | ||
|
545ad59164 | ||
|
567186464c | ||
|
0310333ffe | ||
|
96fee5b9a2 | ||
|
561ef38181 | ||
|
1b5f136e47 | ||
|
dd4db1fe4f | ||
|
4da269cbe5 | ||
|
62f099449d | ||
|
d78fdbdee4 | ||
|
8d3b43c579 | ||
|
0b573cb5c4 | ||
|
201f8bcce4 | ||
|
21c2817d84 | ||
|
766c2e84f1 | ||
|
9286c8f9b8 | ||
|
399303f963 | ||
|
c67ee1e116 | ||
|
94b85f6773 | ||
|
0b65037ad4 | ||
|
b67ccf9ce0 | ||
|
39e1e6ee66 | ||
|
c0327acc92 | ||
|
8d627bdfaf | ||
|
eee0e57b5a | ||
|
68599dbc7e | ||
|
18d8c970f5 | ||
|
4f6b93c803 | ||
|
ec80c3a04a | ||
|
664e4f05af | ||
|
5f902811e6 | ||
|
8a048d8e2b | ||
|
ba858645c1 | ||
|
104334e02a | ||
|
60776ef93f | ||
|
a37780d572 | ||
|
68a6b2ed3f | ||
|
5c9b2d2b9a | ||
|
4c1728e2cc | ||
|
2554608019 | ||
|
f235e64621 | ||
|
7319c3b6af | ||
|
08bcc1a40f | ||
|
4df9d2856f | ||
|
7e9b407fff | ||
|
35c9058ef9 | ||
|
39adf33de4 | ||
|
0e8e9434de | ||
|
791eb8e03d | ||
|
4624b2875e | ||
|
613ff5f97d | ||
|
50cfa04608 | ||
|
0733f8f318 | ||
|
d2f6d4a00d | ||
|
b81f01bb1c | ||
|
a0c4eeba91 | ||
|
d32465a9ee | ||
|
625285b3f3 | ||
|
672446e942 | ||
|
045ed12dd7 | ||
|
a47a313ab9 | ||
|
7521daf101 | ||
|
4a76803b9f | ||
|
99da037ae1 | ||
|
0f83882af0 | ||
|
05da001ea9 | ||
|
b42a1a166f | ||
|
714d766264 | ||
|
bfd6f1a3b8 | ||
|
f79b87130d | ||
|
71eb1b5fe1 | ||
|
508e6a58a2 | ||
|
ab60a34e23 | ||
|
dadc8e90ff | ||
|
f6efb17480 | ||
|
4fabadb473 | ||
|
6e52ed12da | ||
|
9b98d3c72d | ||
|
293e291c5d | ||
|
296e6d6f10 | ||
|
0b6ee206e2 | ||
|
99bd9146db | ||
|
9d89216dae | ||
|
b8c901720e | ||
|
c655deecd3 | ||
|
821ea3b629 | ||
|
e7f0f1f152 | ||
|
4d2926583e | ||
|
a3a0f02d62 | ||
|
fe82ee534a | ||
|
03267b6bf7 | ||
|
ea3de9ec90 | ||
|
59aee53c95 | ||
|
d22bdef154 | ||
|
4ccfc53f18 | ||
|
b700e1df7e | ||
|
55cffe4cc2 | ||
|
886736908c | ||
|
d1a7457ce4 | ||
|
c08be65eba | ||
|
a8ed12422f | ||
|
3f62397fe5 | ||
|
03d37bb56c | ||
|
524ac4c735 | ||
|
337e390cc1 | ||
|
2d3efafc3d | ||
|
a7e0791d49 | ||
|
d0d8a8eec4 | ||
|
65c516230a | ||
|
1560d22da1 | ||
|
4239bfc441 | ||
|
851d1a9520 | ||
|
0fa3ff9d4c | ||
|
2124a4fbf0 | ||
|
225412d37a | ||
|
e3fe4cebe1 | ||
|
7887463a89 | ||
|
389a2bcae4 | ||
|
1f1d7138f8 | ||
|
1e924e17b3 | ||
|
28f45f97ec |
611
ChangeLog
611
ChangeLog
@@ -1,3 +1,614 @@
|
||||
2004-07-17 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* Made 2.0.3 release.
|
||||
|
||||
2004-07-17 Philip Lafleur <plafleur@cvs.gnome.org>
|
||||
|
||||
* plug-ins/bmp/bmpwrite.c (WriteImage): Applied a patch from
|
||||
Brion Vibber that fixes corruption when saving RLE-encoded
|
||||
BMPs on big endian hosts. Fixes bug #147759, merged from HEAD.
|
||||
|
||||
2004-07-17 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* NEWS: updated for 2.0.3 release.
|
||||
|
||||
2004-07-14 Philip Lafleur <plafleur@cvs.gnome.org>
|
||||
|
||||
* plug-ins/common/png.c:
|
||||
* plug-ins/common/mng.c: Fixed erroneously reported warning
|
||||
message when saving indexed layers with an alpha channel but
|
||||
no transparent pixels. Merged from HEAD.
|
||||
|
||||
2004-07-14 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/script-fu/script-fu-console.[ch]
|
||||
* plug-ins/script-fu/script-fu.c
|
||||
* plug-ins/script-fu/siod-wrapper.[ch]
|
||||
* plug-ins/script-fu/siod/slib.c: merged fix for bug #139200
|
||||
(script-fu console freezes on long output from SIOD interpreter).
|
||||
|
||||
2004-07-14 Philip Lafleur <plafleur@cvs.gnome.org>
|
||||
|
||||
* plug-ins/common/mng.c (respin_cmap): Properly check the return
|
||||
value of find_unused_ia_color(). The plugin will now save indexed
|
||||
MNGs correctly; fixes bug #139947, merged from HEAD.
|
||||
|
||||
2004-07-14 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/tiff.c: merged fix for bug #147328 from HEAD
|
||||
branch. Fixes loading of CMYK TIFF images on big-endian hardware.
|
||||
|
||||
2004-07-13 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/text/gimptextundo.c (gimp_text_undo_get_memsize): merged
|
||||
some code from the HEAD branch that improves the computation of
|
||||
the memory requirements for a text undo step.
|
||||
|
||||
2004-07-13 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/jpeg.c: merged fix for bug #145212 (JPEG plug-in
|
||||
crashes on corrupt EXIF data) from HEAD branch.
|
||||
|
||||
2004-07-13 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/tools/gimptexttool.c (gimp_text_tool_create_layer): plugged
|
||||
a tiny memory leak.
|
||||
|
||||
2004-07-12 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Backported the missing gimp-path-get-point-at-dist PDB function
|
||||
from the HEAD branch (bug #138754):
|
||||
|
||||
* app/vectors/gimpstroke.[ch]: added gimp_stroke_get_point_at_dist().
|
||||
|
||||
* tools/pdbgen/pdb/paths.pdb: use the new API to implement
|
||||
gimp-path-get-point-at-dist.
|
||||
|
||||
* app/pdb/paths_cmds.c: regenerated.
|
||||
|
||||
2004-07-12 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Merged from HEAD:
|
||||
|
||||
* plug-ins/script-fu/scripts/round-corners.scm: applied patch from
|
||||
Dave Neary that changes the behavior from undo disable/enable to
|
||||
using an undo group if the script doesn't work on a copy of the
|
||||
image. Fixes bug #146344.
|
||||
|
||||
2004-07-12 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/tiff.c: applied a patch from Brion Vibber that
|
||||
sets the 'Save color values from transparent pixels' insensitive
|
||||
when there's no alpha channel. Merged from HEAD branch.
|
||||
|
||||
2004-07-11 Philip Lafleur <plafleur@cvs.gnome.org>
|
||||
|
||||
* app/widgets/gimpdevices.c (gimp_devices_check_change):
|
||||
Applied a patch from Robert Ögren, moved here from
|
||||
toolbox_check_device() - Only change devices if the event came
|
||||
from a widget that accepts extension events.
|
||||
Fixes bug #115774, merged from HEAD.
|
||||
|
||||
2004-07-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Merged from HEAD:
|
||||
|
||||
Made the undo system robust against the currently pushed undo
|
||||
being too large according to prefs settings. Fixes bug #145379.
|
||||
|
||||
* app/core/gimpimage-undo.[ch] (gimp_image_undo_push_undo)
|
||||
(gimp_image_undo_group_end): emit "undo-event" *before* calling
|
||||
gimp_image_undo_free_space() so the undo history doesn't try to
|
||||
remove an item that has never been added.
|
||||
|
||||
(gimp_image_undo_push_undo): added boolean return value indicating
|
||||
if the undo could be pushed (FALSE means the undo was to large
|
||||
and was discarded right away).
|
||||
|
||||
(gimp_image_undo_push_item): return NULL if the above returned
|
||||
FALSE.
|
||||
|
||||
* app/core/gimpimage-undo-push.c (gimp_image_undo_push_text_layer):
|
||||
changed accordingly.
|
||||
|
||||
2004-07-05 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Merged from HEAD:
|
||||
|
||||
* app/tools/gimpcolorizetool.c (gimp_colorize_tool_initialize):
|
||||
return TRUE if initialization was successful. Makes the
|
||||
tool->drawable pointer being set correctly by the calling code and
|
||||
fixes bugs where colorize was leaving the drawable in a modified
|
||||
but non-undoable state when cancelling or changing images.
|
||||
|
||||
2004-07-05 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpcontext.c (gimp_context_serialize_property):
|
||||
disabled code that was accidentially enabled and broke persistence
|
||||
of many tool options settings and of the context part of devicerc.
|
||||
|
||||
2004-07-04 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/channel_mixer.c: don't attempt to store a
|
||||
pointer to the last used filename in the plug-in parameter
|
||||
struct. Fixes bug #145380; merged from HEAD branch.
|
||||
|
||||
2004-07-01 Michael Schumacher <schumaml@cvs.gnome.org>
|
||||
|
||||
* plug-ins/common/align_layers.c: there seems to be no reason why
|
||||
this plug-in should not work on INDEXED* images, added it to the
|
||||
registered image types
|
||||
|
||||
2004-06-28 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* configure.in: bumped version number to 2.0.3, interface_age 3,
|
||||
binary_age 3.
|
||||
|
||||
2004-06-28 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Merged from HEAD:
|
||||
|
||||
Fixed bug #141930 while keeping bug #132322 fixed:
|
||||
|
||||
* app/base/curves.c (curves_lut_func)
|
||||
* app/base/levels.c (levels_lut_func): changed meaning of channel
|
||||
slots for GRAYA images: just as for GRAY images, expect the value
|
||||
channel in slot 0 and the alpha channel in slot 1, so it matches
|
||||
the meaning of slots of GimpHistogram (before this change, only
|
||||
GRAY images had their value in slot 0 and GRAYA images had it in
|
||||
slot 1, whereas the histogram had the value channel in slot 0,
|
||||
which was breaking auto levels for GRAYA images).
|
||||
|
||||
* app/tools/gimpcurvestool.c
|
||||
* app/tools/gimplevelstool.c
|
||||
* tools/pdbgen/pdb/color.pdb: adjusted channel fiddling for GRAY
|
||||
and GRAYA images accordingly.
|
||||
|
||||
* app/tools/gimpcurvestool.c (curves_update)
|
||||
* app/tools/gimplevelstool.c (levels_update): call
|
||||
gimp_color_bar_set_buffers() with the right buffers.
|
||||
|
||||
* app/pdb/color_cmds.c: regenerated.
|
||||
2004-06-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/composite/gimp-composite-regression.c: define timersub()
|
||||
macro in case it's undefined. Patch by Tim Mooney, fixes 'make
|
||||
check' on Tru64 (bug #144780). Merged from HEAD branch.
|
||||
|
||||
2004-06-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpcolorarea.c (gimp_color_area_set_color): use
|
||||
gimp_rgb_distance() for flat color areas. Fixes bug #144786;
|
||||
merged from HEAD.
|
||||
|
||||
2004-06-19 Pedro Gimeno <pggimeno@wanadoo.es>
|
||||
|
||||
* tools/pdbgen/pdb/paths.pdb: Fix typos and improve documentation.
|
||||
Merged from HEAD. Addresses bug #144267.
|
||||
|
||||
* app/pdb/paths_cmds.c
|
||||
* libgimp/gimppaths_pdb.c: regenerated.
|
||||
|
||||
2004-06-19 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/vectors/gimpbezierstroke.c (arcto_ellipsesegment): moved
|
||||
array initialization out of variable declaration (bug #144632).
|
||||
|
||||
2004-06-19 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/vectors/gimpbezierstroke.c (arcto_ellipsesegment): use
|
||||
G_SQRT2 to make circlemagic a constant value so we can initialize
|
||||
the array on declaration. Fixes bug #144632; merged from HEAD.
|
||||
|
||||
2004-06-18 Philip Lafleur <plafleur@cvs.gnome.org>
|
||||
|
||||
* app/tools/gimptransformtool.c: reverted my previous change.
|
||||
|
||||
2004-06-18 Philip Lafleur <plafleur@cvs.gnome.org>
|
||||
|
||||
* app/tools/gimptransformtool.c (gimp_transform_tool_bounds):
|
||||
If transforming a path, use the path bounds rather than the mask
|
||||
bounds. Fixes bug #144570. Merged from HEAD.
|
||||
|
||||
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.
|
||||
|
@@ -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.
|
||||
|
||||
|
4
INSTALL
4
INSTALL
@@ -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
|
||||
|
51
NEWS
51
NEWS
@@ -6,6 +6,57 @@ 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.3
|
||||
========================
|
||||
- several build fixes (#144632, #144780)
|
||||
- documentation fixes (#144267)
|
||||
- avoid use of uninitialized values in GimpColorArea widget (#144786)
|
||||
- fixed Levels tool on grayscale images with alpha channel (#141930)
|
||||
- fixed Save/Load functionality in channel-mixer plug-in (#145380)
|
||||
- fixed brokeness in GimpContext that caused tool options and device
|
||||
settings to be saved incorrectly
|
||||
- fixed bug in Colorize tool
|
||||
- fixed undo stack corruption that occured with some undo settings (#145379)
|
||||
- fixed long-standing bug that caused the tablet pointer to change
|
||||
inadvertently (#115774)
|
||||
- allow to undo script 'Round Corners' (#146344)
|
||||
- implemented gimp-path-get-point-at-dist PDB function (#138754)
|
||||
- don't crash while loading JPEG files with corrupt EXIF data (#145212)
|
||||
- fixed loading of CMYK TIFF images on big-endian hosts (#147328)
|
||||
- fixed palette handling in MNG plug-in (#139947)
|
||||
- fixed bug in Script-Fu console (#139200)
|
||||
- fixed corruption when saving RLE-encoded BMPs on big-endian hosts (#147759)
|
||||
|
||||
|
||||
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)
|
||||
|
@@ -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
|
||||
|
@@ -71,6 +71,7 @@ AM_CPPFLAGS = \
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(GTK_CFLAGS) \
|
||||
$(PANGOFT2_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
gimp_2_0_LDFLAGS = \
|
||||
|
@@ -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));
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
||||
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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));
|
||||
}
|
@@ -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__ */
|
@@ -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 */
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -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__ */
|
@@ -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));
|
||||
}
|
@@ -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
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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));
|
||||
}
|
||||
}
|
@@ -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
@@ -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__ */
|
@@ -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));
|
||||
}
|
@@ -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__ */
|
@@ -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
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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));
|
||||
}
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
440
app/airbrush.c
440
app/airbrush.c
@@ -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;
|
||||
}
|
@@ -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
|
||||
}
|
||||
|
@@ -156,7 +156,7 @@ curves_calculate_curve (Curves *curves,
|
||||
|
||||
gfloat
|
||||
curves_lut_func (Curves *curves,
|
||||
gint nchannels,
|
||||
gint n_channels,
|
||||
gint channel,
|
||||
gfloat value)
|
||||
{
|
||||
@@ -165,33 +165,39 @@ curves_lut_func (Curves *curves,
|
||||
gdouble inten;
|
||||
gint j;
|
||||
|
||||
if (nchannels == 1)
|
||||
j = 0;
|
||||
if (n_channels <= 2)
|
||||
j = channel;
|
||||
else
|
||||
j = channel + 1;
|
||||
|
||||
inten = value;
|
||||
|
||||
/* For color images this runs through the loop with j = channel +1
|
||||
the first time and j = 0 the second time */
|
||||
/* For bw images this runs through the loop with j = 0 the first and
|
||||
only time */
|
||||
/* For RGB and RGBA images this runs through the loop with j = channel + 1
|
||||
* the first time and j = 0 the second time
|
||||
*
|
||||
* For GRAY images this runs through the loop with j = 0 the first and
|
||||
* only time
|
||||
*/
|
||||
for (; j >= 0; j -= (channel + 1))
|
||||
{
|
||||
/* don't apply the overall curve to the alpha channel */
|
||||
if (j == 0 && (nchannels == 2 || nchannels == 4)
|
||||
&& channel == nchannels -1)
|
||||
if (j == 0 && (n_channels == 2 || n_channels == 4) &&
|
||||
channel == n_channels - 1)
|
||||
return inten;
|
||||
|
||||
if (inten < 0.0)
|
||||
inten = curves->curve[j][0]/255.0;
|
||||
{
|
||||
inten = curves->curve[j][0]/255.0;
|
||||
}
|
||||
else if (inten >= 1.0)
|
||||
inten = curves->curve[j][255]/255.0;
|
||||
{
|
||||
inten = curves->curve[j][255]/255.0;
|
||||
}
|
||||
else /* interpolate the curve */
|
||||
{
|
||||
index = floor(inten * 255.0);
|
||||
f = inten*255.0 - index;
|
||||
inten = ((1.0 - f) * curves->curve[j][index ] +
|
||||
inten = ((1.0 - f) * curves->curve[j][index ] +
|
||||
( f) * curves->curve[j][index + 1] ) / 255.0;
|
||||
}
|
||||
}
|
||||
|
@@ -212,7 +212,7 @@ levels_adjust_by_colors (Levels *levels,
|
||||
return;
|
||||
|
||||
/* Map selected color to corresponding lightness */
|
||||
levels->gamma[channel] = log (inten) / log (out_light);
|
||||
levels->gamma[channel] = log (inten) / log (out_light);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,32 +259,36 @@ levels_lut_func (Levels *levels,
|
||||
gdouble inten;
|
||||
gint j;
|
||||
|
||||
if (n_channels == 1)
|
||||
j = 0;
|
||||
if (n_channels <= 2)
|
||||
j = channel;
|
||||
else
|
||||
j = channel + 1;
|
||||
|
||||
inten = value;
|
||||
|
||||
/* For color images this runs through the loop with j = channel +1
|
||||
/* For RGB and RGBA images this runs through the loop with j = channel + 1
|
||||
* the first time and j = 0 the second time
|
||||
*
|
||||
* For bw images this runs through the loop with j = 0 the first and
|
||||
* only time
|
||||
* For GRAY images this runs through the loop with j = 0 the first and
|
||||
* only time
|
||||
*/
|
||||
for (; j >= 0; j -= (channel + 1))
|
||||
{
|
||||
/* don't apply the overall curve to the alpha channel */
|
||||
if (j == 0 && (n_channels == 2 || n_channels == 4)
|
||||
&& channel == n_channels -1)
|
||||
if (j == 0 && (n_channels == 2 || n_channels == 4) &&
|
||||
channel == n_channels - 1)
|
||||
return inten;
|
||||
|
||||
/* determine input intensity */
|
||||
if (levels->high_input[j] != levels->low_input[j])
|
||||
inten = ((gdouble) (255.0 * inten - levels->low_input[j]) /
|
||||
(gdouble) (levels->high_input[j] - levels->low_input[j]));
|
||||
{
|
||||
inten = ((gdouble) (255.0 * inten - levels->low_input[j]) /
|
||||
(gdouble) (levels->high_input[j] - levels->low_input[j]));
|
||||
}
|
||||
else
|
||||
inten = (gdouble) (255.0 * inten - levels->low_input[j]);
|
||||
{
|
||||
inten = (gdouble) (255.0 * inten - levels->low_input[j]);
|
||||
}
|
||||
|
||||
if (levels->gamma[j] != 0.0)
|
||||
{
|
||||
|
@@ -29,6 +29,25 @@
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifndef timersub
|
||||
/*
|
||||
* Linux <sys/time.h> has a handy macro for finding the difference between
|
||||
* two timers. This is lifted directly from <sys/time.h> on a GLIBC 2.2.x
|
||||
* system.
|
||||
*/
|
||||
#define timersub(a, b, result) \
|
||||
do { \
|
||||
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
|
||||
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
|
||||
if ((result)->tv_usec < 0) \
|
||||
{ \
|
||||
--(result)->tv_sec; \
|
||||
(result)->tv_usec += 1000000; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "base/base-types.h"
|
||||
@@ -40,11 +59,11 @@
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_print_vector:
|
||||
* @vector:
|
||||
* @format:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
* @vector:
|
||||
* @format:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_composite_regression_print_vector (guchar vector[], GimpPixelFormat format, gulong n_pixels)
|
||||
@@ -77,10 +96,10 @@ gimp_composite_regression_print_vector (guchar vector[], GimpPixelFormat format,
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_print_vector_v8:
|
||||
* @v:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
* @v:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_composite_regression_print_vector_v8 (gimp_v8_t v[], unsigned int n_pixels)
|
||||
@@ -95,10 +114,10 @@ gimp_composite_regression_print_vector_v8 (gimp_v8_t v[], unsigned int n_pixels)
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_print_vector_va8:
|
||||
* @v:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
* @v:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_composite_regression_print_vector_va8 (gimp_va8_t v[], unsigned int n_pixels)
|
||||
@@ -113,10 +132,10 @@ gimp_composite_regression_print_vector_va8 (gimp_va8_t v[], unsigned int n_pixel
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_print_vector_rgb8:
|
||||
* @rgb8:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
* @rgb8:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_composite_regression_print_vector_rgb8 (gimp_rgb8_t v[], unsigned int n_pixels)
|
||||
@@ -131,10 +150,10 @@ gimp_composite_regression_print_vector_rgb8 (gimp_rgb8_t v[], unsigned int n_pix
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_print_vector_rgba8:
|
||||
* @v:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
* @v:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_composite_regression_print_vector_rgba8 (gimp_rgba8_t v[], unsigned int n_pixels)
|
||||
@@ -149,9 +168,9 @@ gimp_composite_regression_print_vector_rgba8 (gimp_rgba8_t v[], unsigned int n_p
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_print_rgba8:
|
||||
* @rgba8:
|
||||
*
|
||||
*
|
||||
* @rgba8:
|
||||
*
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_composite_regression_print_rgba8 (gimp_rgba8_t *rgba8)
|
||||
@@ -162,9 +181,9 @@ gimp_composite_regression_print_rgba8 (gimp_rgba8_t *rgba8)
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_print_va8:
|
||||
* @va8:
|
||||
*
|
||||
*
|
||||
* @va8:
|
||||
*
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_composite_regression_print_va8 (gimp_va8_t *va8)
|
||||
@@ -175,13 +194,13 @@ gimp_composite_regression_print_va8 (gimp_va8_t *va8)
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_compare_contexts:
|
||||
* @operation:
|
||||
* @ctx1:
|
||||
* @ctx2:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
* @operation:
|
||||
* @ctx1:
|
||||
* @ctx2:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
**/
|
||||
int
|
||||
gimp_composite_regression_compare_contexts (char *operation, GimpCompositeContext *ctx1, GimpCompositeContext *ctx2)
|
||||
@@ -287,16 +306,16 @@ gimp_composite_regression_compare_contexts (char *operation, GimpCompositeContex
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_comp_rgba8:
|
||||
* @str:
|
||||
* @rgba8A:
|
||||
* @rgba8B:
|
||||
* @expected:
|
||||
* @actual:
|
||||
* @length:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
* @str:
|
||||
* @rgba8A:
|
||||
* @rgba8B:
|
||||
* @expected:
|
||||
* @actual:
|
||||
* @length:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
**/
|
||||
int
|
||||
gimp_composite_regression_comp_rgba8 (char *str, gimp_rgba8_t *rgba8A, gimp_rgba8_t *rgba8B, gimp_rgba8_t *expected, gimp_rgba8_t *actual, u_long length)
|
||||
@@ -335,16 +354,16 @@ gimp_composite_regression_comp_rgba8 (char *str, gimp_rgba8_t *rgba8A, gimp_rgba
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_comp_va8:
|
||||
* @str:
|
||||
* @va8A:
|
||||
* @va8B:
|
||||
* @expected:
|
||||
* @actual:
|
||||
* @length:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
* @str:
|
||||
* @va8A:
|
||||
* @va8B:
|
||||
* @expected:
|
||||
* @actual:
|
||||
* @length:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
**/
|
||||
int
|
||||
gimp_composite_regression_comp_va8 (char *str, gimp_va8_t *va8A, gimp_va8_t *va8B, gimp_va8_t *expected, gimp_va8_t *actual, u_long length)
|
||||
@@ -380,11 +399,11 @@ gimp_composite_regression_comp_va8 (char *str, gimp_va8_t *va8A, gimp_va8_t *va8
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_dump_rgba8:
|
||||
* @str:
|
||||
* @rgba:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
* @str:
|
||||
* @rgba:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_composite_regression_dump_rgba8 (char *str, gimp_rgba8_t *rgba, u_long n_pixels)
|
||||
@@ -406,11 +425,11 @@ gimp_composite_regression_dump_rgba8 (char *str, gimp_rgba8_t *rgba, u_long n_pi
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_timer_report:
|
||||
* @name:
|
||||
* @t1:
|
||||
* @t2:
|
||||
*
|
||||
*
|
||||
* @name:
|
||||
* @t1:
|
||||
* @t2:
|
||||
*
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_composite_regression_timer_report (char *name, double t1, double t2)
|
||||
@@ -420,12 +439,12 @@ gimp_composite_regression_timer_report (char *name, double t1, double t2)
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_time_function:
|
||||
* @iterations:
|
||||
* @func:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
* @iterations:
|
||||
* @func:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
**/
|
||||
double
|
||||
gimp_composite_regression_time_function (u_long iterations, void (*func)(), GimpCompositeContext *ctx)
|
||||
@@ -435,21 +454,21 @@ gimp_composite_regression_time_function (u_long iterations, void (*func)(), Gimp
|
||||
struct timeval tv_elapsed;
|
||||
u_long i;
|
||||
|
||||
gettimeofday(&t0, NULL);
|
||||
gettimeofday (&t0, NULL);
|
||||
for (i = 0; i < iterations; i++) { (*func)(ctx); }
|
||||
gettimeofday(&t1, NULL);
|
||||
timersub(&t1, &t0, &tv_elapsed);
|
||||
gettimeofday (&t1, NULL);
|
||||
timersub (&t1, &t0, &tv_elapsed);
|
||||
|
||||
return (tv_to_secs(tv_elapsed));
|
||||
return (tv_to_secs (tv_elapsed));
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_random_rgba8:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
**/
|
||||
gimp_rgba8_t *
|
||||
gimp_composite_regression_random_rgba8 (u_long n_pixels)
|
||||
@@ -471,11 +490,11 @@ gimp_composite_regression_random_rgba8 (u_long n_pixels)
|
||||
|
||||
/**
|
||||
* gimp_composite_regression_fixed_rgba8:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
* @n_pixels:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
**/
|
||||
gimp_rgba8_t *
|
||||
gimp_composite_regression_fixed_rgba8 (u_long n_pixels)
|
||||
@@ -499,21 +518,21 @@ gimp_composite_regression_fixed_rgba8 (u_long n_pixels)
|
||||
|
||||
/**
|
||||
* gimp_composite_context_init:
|
||||
* @ctx:
|
||||
* @op:
|
||||
* @a_format:
|
||||
* @b_format:
|
||||
* @d_format:
|
||||
* @m_format:
|
||||
* @n_pixels:
|
||||
* @A:
|
||||
* @B:
|
||||
* @M:
|
||||
* @D:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
* @ctx:
|
||||
* @op:
|
||||
* @a_format:
|
||||
* @b_format:
|
||||
* @d_format:
|
||||
* @m_format:
|
||||
* @n_pixels:
|
||||
* @A:
|
||||
* @B:
|
||||
* @M:
|
||||
* @D:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
**/
|
||||
GimpCompositeContext *
|
||||
gimp_composite_context_init (GimpCompositeContext *ctx,
|
||||
|
@@ -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
|
||||
|
@@ -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 " \
|
||||
|
@@ -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 &&
|
||||
|
@@ -1,105 +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 "display-types.h"
|
||||
|
||||
#include "gimpdisplay-area.h"
|
||||
|
||||
|
||||
#define OVERHEAD 25 /* in units of pixel area */
|
||||
|
||||
|
||||
GimpArea *
|
||||
gimp_area_new (gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2)
|
||||
{
|
||||
GimpArea *area;
|
||||
|
||||
area = g_new (GimpArea, 1);
|
||||
|
||||
area->x1 = x1;
|
||||
area->y1 = y1;
|
||||
area->x2 = x2;
|
||||
area->y2 = y2;
|
||||
|
||||
return area;
|
||||
}
|
||||
|
||||
/*
|
||||
* As far as I can tell, this function takes a GimpArea and unifies it with
|
||||
* an existing list of GimpAreas, trying to avoid overdraw. [adam]
|
||||
*/
|
||||
GSList *
|
||||
gimp_display_area_list_process (GSList *list,
|
||||
GimpArea *area)
|
||||
{
|
||||
GSList *new_list;
|
||||
GSList *l;
|
||||
gint area1, area2, area3;
|
||||
GimpArea *ga2;
|
||||
|
||||
/* start new list off */
|
||||
new_list = g_slist_prepend (NULL, area);
|
||||
|
||||
for (l = list; l; l = g_slist_next (l))
|
||||
{
|
||||
ga2 = (GimpArea *) l->data;
|
||||
|
||||
area1 = (area->x2 - area->x1) * (area->y2 - area->y1) + OVERHEAD;
|
||||
area2 = (ga2->x2 - ga2->x1) * (ga2->y2 - ga2->y1) + OVERHEAD;
|
||||
area3 = (MAX (ga2->x2, area->x2) - MIN (ga2->x1, area->x1)) *
|
||||
(MAX (ga2->y2, area->y2) - MIN (ga2->y1, area->y1)) + OVERHEAD;
|
||||
|
||||
if ((area1 + area2) < area3)
|
||||
{
|
||||
new_list = g_slist_prepend (new_list, ga2);
|
||||
}
|
||||
else
|
||||
{
|
||||
area->x1 = MIN (area->x1, ga2->x1);
|
||||
area->y1 = MIN (area->y1, ga2->y1);
|
||||
area->x2 = MAX (area->x2, ga2->x2);
|
||||
area->y2 = MAX (area->y2, ga2->y2);
|
||||
|
||||
g_free (ga2);
|
||||
}
|
||||
}
|
||||
|
||||
if (list)
|
||||
g_slist_free (list);
|
||||
|
||||
return new_list;
|
||||
}
|
||||
|
||||
GSList *
|
||||
gimp_display_area_list_free (GSList *list)
|
||||
{
|
||||
if (list)
|
||||
{
|
||||
g_slist_foreach (list, (GFunc) g_free, NULL);
|
||||
g_slist_free (list);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
@@ -1,41 +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 __GIMP_DISPLAY_AREA_H__
|
||||
#define __GIMP_DISPLAY_AREA_H__
|
||||
|
||||
|
||||
typedef struct _GimpArea GimpArea;
|
||||
|
||||
struct _GimpArea
|
||||
{
|
||||
gint x1, y1, x2, y2; /* area bounds */
|
||||
};
|
||||
|
||||
|
||||
GimpArea * gimp_area_new (gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2);
|
||||
|
||||
GSList * gimp_display_area_list_process (GSList *list,
|
||||
GimpArea *area);
|
||||
GSList * gimp_display_area_list_free (GSList *list);
|
||||
|
||||
|
||||
#endif /* __GIMP_DISPLAY_AREA_H__ */
|
@@ -1119,12 +1119,16 @@ gimp_context_serialize_property (GimpConfig *config,
|
||||
GParamSpec *pspec,
|
||||
GimpConfigWriter *writer)
|
||||
{
|
||||
#if 0
|
||||
GimpContext *context = GIMP_CONTEXT (config);
|
||||
#endif
|
||||
GimpObject *serialize_obj;
|
||||
|
||||
#if 0
|
||||
/* serialize nothing if the property is not defined */
|
||||
if (! ((1 << property_id) & context->defined_props))
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
@@ -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;
|
||||
|
@@ -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 &&
|
||||
|
@@ -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,
|
||||
|
@@ -1762,9 +1762,7 @@ gimp_image_undo_push_text_layer (GimpImage *gimage,
|
||||
|
||||
undo = gimp_text_undo_new (layer, pspec, undo_desc);
|
||||
|
||||
gimp_image_undo_push_undo (gimage, undo);
|
||||
|
||||
return TRUE;
|
||||
return gimp_image_undo_push_undo (gimage, undo);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -170,13 +170,13 @@ gimp_image_undo_group_end (GimpImage *gimage)
|
||||
{
|
||||
gimage->pushing_undo_group = GIMP_UNDO_GROUP_NONE;
|
||||
|
||||
gimp_image_undo_free_space (gimage);
|
||||
|
||||
/* Do it here, since undo_push doesn't emit this event while in
|
||||
* the middle of a group
|
||||
*/
|
||||
gimp_image_undo_event (gimage, GIMP_UNDO_EVENT_UNDO_PUSHED,
|
||||
gimp_undo_stack_peek (gimage->undo_stack));
|
||||
|
||||
gimp_image_undo_free_space (gimage);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -245,19 +245,20 @@ gimp_image_undo_push_item (GimpImage *gimage,
|
||||
pop_func, free_func);
|
||||
}
|
||||
|
||||
gimp_image_undo_push_undo (gimage, undo);
|
||||
if (gimp_image_undo_push_undo (gimage, undo))
|
||||
return undo;
|
||||
|
||||
return undo;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
gimp_image_undo_push_undo (GimpImage *gimage,
|
||||
GimpUndo *undo)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
g_return_if_fail (GIMP_IS_UNDO (undo));
|
||||
g_return_if_fail (undo->gimage == gimage);
|
||||
g_return_if_fail (gimage->undo_freeze_count == 0);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_UNDO (undo), FALSE);
|
||||
g_return_val_if_fail (undo->gimage == gimage, FALSE);
|
||||
g_return_val_if_fail (gimage->undo_freeze_count == 0, FALSE);
|
||||
|
||||
/* nuke the redo stack */
|
||||
gimp_image_undo_free_redo (gimage);
|
||||
@@ -275,9 +276,13 @@ gimp_image_undo_push_undo (GimpImage *gimage,
|
||||
{
|
||||
gimp_undo_stack_push_undo (gimage->undo_stack, undo);
|
||||
|
||||
gimp_image_undo_event (gimage, GIMP_UNDO_EVENT_UNDO_PUSHED, undo);
|
||||
|
||||
gimp_image_undo_free_space (gimage);
|
||||
|
||||
gimp_image_undo_event (gimage, GIMP_UNDO_EVENT_UNDO_PUSHED, undo);
|
||||
/* freeing undo space may have freed the newly pushed undo */
|
||||
if (gimp_undo_stack_peek (gimage->undo_stack) == undo)
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -286,7 +291,11 @@ gimp_image_undo_push_undo (GimpImage *gimage,
|
||||
undo_group = GIMP_UNDO_STACK (gimp_undo_stack_peek (gimage->undo_stack));
|
||||
|
||||
gimp_undo_stack_push_undo (undo_group, undo);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -47,7 +47,7 @@ GimpUndo * gimp_image_undo_push_item (GimpImage *gimage,
|
||||
gboolean dirties_image,
|
||||
GimpUndoPopFunc pop_func,
|
||||
GimpUndoFreeFunc free_func);
|
||||
void gimp_image_undo_push_undo (GimpImage *gimage,
|
||||
gboolean gimp_image_undo_push_undo (GimpImage *gimage,
|
||||
GimpUndo *undo);
|
||||
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -1,786 +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 <glib-object.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/tile-manager.h"
|
||||
#include "base/tile.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimpimage-projection.h"
|
||||
#include "gimplayer.h"
|
||||
#include "gimplayer-floating-sel.h"
|
||||
#include "gimplayermask.h"
|
||||
#include "gimplist.h"
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_image_projection_validate_tile (TileManager *tm,
|
||||
Tile *tile);
|
||||
static void gimp_image_construct_layers (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
static void gimp_image_construct_channels (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
static void gimp_image_initialize_projection (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
static void gimp_image_construct (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
|
||||
static void project_intensity (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
PixelRegion *src,
|
||||
PixelRegion *dest,
|
||||
PixelRegion *mask);
|
||||
static void project_intensity_alpha (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
PixelRegion *src,
|
||||
PixelRegion *dest,
|
||||
PixelRegion *mask);
|
||||
static void project_indexed (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
PixelRegion *src,
|
||||
PixelRegion *dest);
|
||||
static void project_indexed_alpha (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
PixelRegion *src,
|
||||
PixelRegion *dest,
|
||||
PixelRegion *mask);
|
||||
static void project_channel (GimpImage *gimage,
|
||||
GimpChannel *channel,
|
||||
PixelRegion *src,
|
||||
PixelRegion *src2);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_image_projection_allocate (GimpImage *gimage)
|
||||
{
|
||||
GimpImageType proj_type = 0;
|
||||
gint proj_bytes = 0;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
|
||||
/* Find the number of bytes required for the projection.
|
||||
* This includes the intensity channels and an alpha channel
|
||||
* if one doesn't exist.
|
||||
*/
|
||||
switch (gimp_image_base_type (gimage))
|
||||
{
|
||||
case GIMP_RGB:
|
||||
case GIMP_INDEXED:
|
||||
proj_bytes = 4;
|
||||
proj_type = GIMP_RGBA_IMAGE;
|
||||
break;
|
||||
|
||||
case GIMP_GRAY:
|
||||
proj_bytes = 2;
|
||||
proj_type = GIMP_GRAYA_IMAGE;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
if (gimage->projection)
|
||||
{
|
||||
if (proj_type != gimage->proj_type ||
|
||||
proj_bytes != gimage->proj_bytes ||
|
||||
gimage->width != tile_manager_width (gimage->projection) ||
|
||||
gimage->height != tile_manager_height (gimage->projection))
|
||||
{
|
||||
gimp_image_projection_free (gimage);
|
||||
}
|
||||
}
|
||||
|
||||
if (! gimage->projection)
|
||||
{
|
||||
gimage->proj_type = proj_type;
|
||||
gimage->proj_bytes = proj_bytes;
|
||||
|
||||
gimage->projection = tile_manager_new (gimage->width, gimage->height,
|
||||
gimage->proj_bytes);
|
||||
tile_manager_set_user_data (gimage->projection, gimage);
|
||||
tile_manager_set_validate_proc (gimage->projection,
|
||||
gimp_image_projection_validate_tile);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_projection_free (GimpImage *gimage)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
|
||||
if (gimage->projection)
|
||||
{
|
||||
tile_manager_unref (gimage->projection);
|
||||
gimage->projection = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
TileManager *
|
||||
gimp_image_projection (GimpImage *gimage)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if (gimage->projection == NULL ||
|
||||
tile_manager_width (gimage->projection) != gimage->width ||
|
||||
tile_manager_height (gimage->projection) != gimage->height)
|
||||
{
|
||||
gimp_image_projection_allocate (gimage);
|
||||
}
|
||||
|
||||
return gimage->projection;
|
||||
}
|
||||
|
||||
GimpImageType
|
||||
gimp_image_projection_type (const GimpImage *gimage)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
||||
|
||||
return gimage->proj_type;
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_image_projection_bytes (const GimpImage *gimage)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
|
||||
|
||||
return gimage->proj_bytes;
|
||||
}
|
||||
|
||||
gdouble
|
||||
gimp_image_projection_opacity (const GimpImage *gimage)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_OPACITY_OPAQUE);
|
||||
|
||||
return GIMP_OPACITY_OPAQUE;
|
||||
}
|
||||
|
||||
guchar *
|
||||
gimp_image_projection_get_color_at (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
Tile *tile;
|
||||
guchar *src;
|
||||
guchar *dest;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if (x < 0 || y < 0 || x >= gimage->width || y >= gimage->height)
|
||||
return NULL;
|
||||
|
||||
dest = g_new (guchar, 5);
|
||||
tile = tile_manager_get_tile (gimp_image_projection (gimage), x, y,
|
||||
TRUE, FALSE);
|
||||
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
gimp_image_get_color (gimage, gimp_image_projection_type (gimage), src, dest);
|
||||
|
||||
dest[4] = 0;
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
gint i, j;
|
||||
gint startx, starty;
|
||||
gint endx, endy;
|
||||
gint tilex, tiley;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
|
||||
tm = gimp_image_projection (gimage);
|
||||
|
||||
startx = x;
|
||||
starty = y;
|
||||
endx = x + w;
|
||||
endy = y + h;
|
||||
|
||||
/* invalidate all tiles which are located outside of the displayed area
|
||||
* all tiles inside the displayed area are constructed.
|
||||
*/
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth (tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
|
||||
if (j < x1)
|
||||
startx = MAX (startx,
|
||||
(j - (j % TILE_WIDTH) + tile_ewidth (tile)));
|
||||
else
|
||||
endx = MIN (endx, j);
|
||||
}
|
||||
else if (MIN ((i + tile_eheight (tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
|
||||
if (i < y1)
|
||||
starty = MAX (starty,
|
||||
(i - (i % TILE_HEIGHT) + tile_eheight (tile)));
|
||||
else
|
||||
endy = MIN (endy, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the tile is not valid, make sure we get the entire tile
|
||||
* in the construction extents
|
||||
*/
|
||||
if (! tile_is_valid (tile))
|
||||
{
|
||||
tilex = j - (j % TILE_WIDTH);
|
||||
tiley = i - (i % TILE_HEIGHT);
|
||||
|
||||
startx = MIN (startx, tilex);
|
||||
endx = MAX (endx, tilex + tile_ewidth (tile));
|
||||
starty = MIN (starty, tiley);
|
||||
endy = MAX (endy, tiley + tile_eheight (tile));
|
||||
|
||||
tile_mark_valid (tile); /* hmmmmmmm..... */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((endx - startx) > 0 && (endy - starty) > 0)
|
||||
gimp_image_construct (gimage,
|
||||
startx, starty,
|
||||
(endx - startx), (endy - starty));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate_without_render (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
gint i, j;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
|
||||
tm = gimp_image_projection (gimage);
|
||||
|
||||
/* invalidate all tiles which are located outside of the displayed area
|
||||
* all tiles inside the displayed area are constructed.
|
||||
*/
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_image_projection_validate_tile (TileManager *tm,
|
||||
Tile *tile)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gint x, y;
|
||||
gint w, h;
|
||||
|
||||
/* Get the gimage from the tilemanager */
|
||||
gimage = (GimpImage *) tile_manager_get_user_data (tm);
|
||||
|
||||
gimp_set_busy_until_idle (gimage->gimp);
|
||||
|
||||
/* Find the coordinates of this tile */
|
||||
tile_manager_get_tile_coordinates (tm, tile, &x, &y);
|
||||
w = tile_ewidth (tile);
|
||||
h = tile_eheight (tile);
|
||||
|
||||
gimp_image_construct (gimage, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_construct_layers (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GimpLayer *layer;
|
||||
gint x1, y1, x2, y2;
|
||||
PixelRegion src1PR, src2PR, maskPR;
|
||||
PixelRegion * mask;
|
||||
GList *list;
|
||||
GList *reverse_list;
|
||||
gint off_x;
|
||||
gint off_y;
|
||||
|
||||
/* composite the floating selection if it exists */
|
||||
if ((layer = gimp_image_floating_sel (gimage)))
|
||||
floating_sel_composite (layer, x, y, w, h, FALSE);
|
||||
|
||||
|
||||
reverse_list = NULL;
|
||||
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
layer = (GimpLayer *) list->data;
|
||||
|
||||
/* only add layers that are visible and not floating selections
|
||||
* to the list
|
||||
*/
|
||||
if (! gimp_layer_is_floating_sel (layer) &&
|
||||
gimp_item_get_visible (GIMP_ITEM (layer)))
|
||||
{
|
||||
reverse_list = g_list_prepend (reverse_list, layer);
|
||||
}
|
||||
}
|
||||
|
||||
for (list = reverse_list; list; list = g_list_next (list))
|
||||
{
|
||||
layer = (GimpLayer *) list->data;
|
||||
|
||||
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
|
||||
|
||||
x1 = CLAMP (off_x, x, x + w);
|
||||
y1 = CLAMP (off_y, y, y + h);
|
||||
x2 = CLAMP (off_x + gimp_item_width (GIMP_ITEM (layer)), x, x + w);
|
||||
y2 = CLAMP (off_y + gimp_item_height (GIMP_ITEM (layer)), y, y + h);
|
||||
|
||||
/* configure the pixel regions */
|
||||
pixel_region_init (&src1PR, gimp_image_projection (gimage),
|
||||
x1, y1, (x2 - x1), (y2 - y1),
|
||||
TRUE);
|
||||
|
||||
/* If we're showing the layer mask instead of the layer... */
|
||||
if (layer->mask && layer->mask->show_mask)
|
||||
{
|
||||
pixel_region_init (&src2PR,
|
||||
gimp_drawable_data (GIMP_DRAWABLE (layer->mask)),
|
||||
(x1 - off_x), (y1 - off_y),
|
||||
(x2 - x1), (y2 - y1), FALSE);
|
||||
|
||||
copy_gray_to_region (&src2PR, &src1PR);
|
||||
}
|
||||
/* Otherwise, normal */
|
||||
else
|
||||
{
|
||||
pixel_region_init (&src2PR,
|
||||
gimp_drawable_data (GIMP_DRAWABLE (layer)),
|
||||
(x1 - off_x), (y1 - off_y),
|
||||
(x2 - x1), (y2 - y1), FALSE);
|
||||
|
||||
if (layer->mask && layer->mask->apply_mask)
|
||||
{
|
||||
pixel_region_init (&maskPR,
|
||||
gimp_drawable_data (GIMP_DRAWABLE (layer->mask)),
|
||||
(x1 - off_x), (y1 - off_y),
|
||||
(x2 - x1), (y2 - y1), FALSE);
|
||||
mask = &maskPR;
|
||||
}
|
||||
else
|
||||
mask = NULL;
|
||||
|
||||
/* Based on the type of the layer, project the layer onto the
|
||||
* projection image...
|
||||
*/
|
||||
switch (gimp_drawable_type (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
case GIMP_RGB_IMAGE: case GIMP_GRAY_IMAGE:
|
||||
/* no mask possible */
|
||||
project_intensity (gimage, layer, &src2PR, &src1PR, mask);
|
||||
break;
|
||||
|
||||
case GIMP_RGBA_IMAGE: case GIMP_GRAYA_IMAGE:
|
||||
project_intensity_alpha (gimage, layer, &src2PR, &src1PR, mask);
|
||||
break;
|
||||
|
||||
case GIMP_INDEXED_IMAGE:
|
||||
/* no mask possible */
|
||||
project_indexed (gimage, layer, &src2PR, &src1PR);
|
||||
break;
|
||||
|
||||
case GIMP_INDEXEDA_IMAGE:
|
||||
project_indexed_alpha (gimage, layer, &src2PR, &src1PR, mask);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gimage->construct_flag = TRUE; /* something was projected */
|
||||
}
|
||||
|
||||
g_list_free (reverse_list);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_construct_channels (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GimpChannel *channel;
|
||||
PixelRegion src1PR;
|
||||
PixelRegion src2PR;
|
||||
GList *list;
|
||||
GList *reverse_list = NULL;
|
||||
|
||||
/* reverse the channel list */
|
||||
for (list = GIMP_LIST (gimage->channels)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
reverse_list = g_list_prepend (reverse_list, list->data);
|
||||
}
|
||||
|
||||
for (list = reverse_list; list; list = g_list_next (list))
|
||||
{
|
||||
channel = (GimpChannel *) list->data;
|
||||
|
||||
if (gimp_item_get_visible (GIMP_ITEM (channel)))
|
||||
{
|
||||
/* configure the pixel regions */
|
||||
pixel_region_init (&src1PR,
|
||||
gimp_image_projection (gimage),
|
||||
x, y, w, h,
|
||||
TRUE);
|
||||
pixel_region_init (&src2PR,
|
||||
gimp_drawable_data (GIMP_DRAWABLE (channel)),
|
||||
x, y, w, h,
|
||||
FALSE);
|
||||
|
||||
project_channel (gimage, channel, &src1PR, &src2PR);
|
||||
|
||||
gimage->construct_flag = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (reverse_list);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_initialize_projection (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
|
||||
GList *list;
|
||||
gint coverage = 0;
|
||||
PixelRegion PR;
|
||||
guchar clear[4] = { 0, 0, 0, 0 };
|
||||
|
||||
/* this function determines whether a visible layer
|
||||
* provides complete coverage over the image. If not,
|
||||
* the projection is initialized to transparent
|
||||
*/
|
||||
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpItem *item;
|
||||
gint off_x, off_y;
|
||||
|
||||
item = (GimpItem *) list->data;
|
||||
|
||||
gimp_item_offsets (item, &off_x, &off_y);
|
||||
|
||||
if (gimp_item_get_visible (GIMP_ITEM (item)) &&
|
||||
! gimp_drawable_has_alpha (GIMP_DRAWABLE (item)) &&
|
||||
(off_x <= x) &&
|
||||
(off_y <= y) &&
|
||||
(off_x + gimp_item_width (item) >= x + w) &&
|
||||
(off_y + gimp_item_height (item) >= y + h))
|
||||
{
|
||||
coverage = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!coverage)
|
||||
{
|
||||
pixel_region_init (&PR, gimp_image_projection (gimage),
|
||||
x, y, w, h, TRUE);
|
||||
color_region (&PR, clear);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_construct (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
|
||||
#if 0
|
||||
gint xoff;
|
||||
gint yoff;
|
||||
|
||||
/* set the construct flag, used to determine if anything
|
||||
* has been written to the gimage raw image yet.
|
||||
*/
|
||||
gimage->construct_flag = FALSE;
|
||||
|
||||
if (gimage->layers)
|
||||
{
|
||||
gimp_item_offsets (GIMP_ITEM (gimage->layers->data), &xoff, &yoff);
|
||||
}
|
||||
|
||||
if ((gimage->layers) && /* There's a layer. */
|
||||
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
|
||||
(gimp_drawable_has_alpha (GIMP_DRAWABLE (gimage->layers->data))) &&
|
||||
/* It's !flat. */
|
||||
(gimp_item_get_visible (GIMP_ITEM (gimage->layers->data))) &&
|
||||
/* It's visible. */
|
||||
(gimp_item_width (GIMP_ITEM (gimage->layers->data)) ==
|
||||
gimage->width) &&
|
||||
(gimp_item_height (GIMP_ITEM (gimage->layers->data)) ==
|
||||
gimage->height) && /* Covers all. */
|
||||
(!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) &&
|
||||
/* Not indexed. */
|
||||
(((GimpLayer *)(gimage->layers->data))->opacity == GIMP_OPACITY_OPAQUE)
|
||||
/* Opaque */
|
||||
)
|
||||
{
|
||||
gint xoff;
|
||||
gint yoff;
|
||||
|
||||
gimp_item_offsets (GIMP_ITEM (gimage->layers->data), &xoff, &yoff);
|
||||
|
||||
if ((xoff==0) && (yoff==0)) /* Starts at 0,0 */
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
gpointer pr;
|
||||
|
||||
g_warning("Can use cow-projection hack. Yay!");
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data
|
||||
(GIMP_DRAWABLE (gimage->layers->data)),
|
||||
x, y, w,h, FALSE);
|
||||
pixel_region_init (&destPR,
|
||||
gimp_image_projection (gimage),
|
||||
x, y, w,h, TRUE);
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
tile_manager_map_over_tile (destPR.tiles,
|
||||
destPR.curtile, srcPR.curtile);
|
||||
}
|
||||
|
||||
gimage->construct_flag = TRUE;
|
||||
gimp_image_construct_channels (gimage, x, y, w, h);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
gimage->construct_flag = FALSE;
|
||||
#endif
|
||||
|
||||
/* First, determine if the projection image needs to be
|
||||
* initialized--this is the case when there are no visible
|
||||
* layers that cover the entire canvas--either because layers
|
||||
* are offset or only a floating selection is visible
|
||||
*/
|
||||
gimp_image_initialize_projection (gimage, x, y, w, h);
|
||||
|
||||
/* call functions which process the list of layers and
|
||||
* the list of channels
|
||||
*/
|
||||
gimp_image_construct_layers (gimage, x, y, w, h);
|
||||
gimp_image_construct_channels (gimage, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
project_intensity (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
PixelRegion *src,
|
||||
PixelRegion *dest,
|
||||
PixelRegion *mask)
|
||||
{
|
||||
if (! gimage->construct_flag)
|
||||
initial_region (src, dest, mask, NULL,
|
||||
layer->opacity * 255.999,
|
||||
layer->mode,
|
||||
gimage->visible,
|
||||
INITIAL_INTENSITY);
|
||||
else
|
||||
combine_regions (dest, src, dest, mask, NULL,
|
||||
layer->opacity * 255.999,
|
||||
layer->mode,
|
||||
gimage->visible,
|
||||
COMBINE_INTEN_A_INTEN);
|
||||
}
|
||||
|
||||
static void
|
||||
project_intensity_alpha (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
PixelRegion *src,
|
||||
PixelRegion *dest,
|
||||
PixelRegion *mask)
|
||||
{
|
||||
if (! gimage->construct_flag)
|
||||
initial_region (src, dest, mask, NULL,
|
||||
layer->opacity * 255.999,
|
||||
layer->mode,
|
||||
gimage->visible,
|
||||
INITIAL_INTENSITY_ALPHA);
|
||||
else
|
||||
combine_regions (dest, src, dest, mask, NULL,
|
||||
layer->opacity * 255.999,
|
||||
layer->mode,
|
||||
gimage->visible,
|
||||
COMBINE_INTEN_A_INTEN_A);
|
||||
}
|
||||
|
||||
static void
|
||||
project_indexed (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
PixelRegion *src,
|
||||
PixelRegion *dest)
|
||||
{
|
||||
if (! gimage->construct_flag)
|
||||
initial_region (src, dest, NULL, gimage->cmap,
|
||||
layer->opacity * 255.999,
|
||||
layer->mode,
|
||||
gimage->visible,
|
||||
INITIAL_INDEXED);
|
||||
else
|
||||
g_warning ("%s: unable to project indexed image.", G_GNUC_PRETTY_FUNCTION);
|
||||
}
|
||||
|
||||
static void
|
||||
project_indexed_alpha (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
PixelRegion *src,
|
||||
PixelRegion *dest,
|
||||
PixelRegion *mask)
|
||||
{
|
||||
if (! gimage->construct_flag)
|
||||
initial_region (src, dest, mask, gimage->cmap,
|
||||
layer->opacity * 255.999,
|
||||
layer->mode,
|
||||
gimage->visible,
|
||||
INITIAL_INDEXED_ALPHA);
|
||||
else
|
||||
combine_regions (dest, src, dest, mask, gimage->cmap,
|
||||
layer->opacity * 255.999,
|
||||
layer->mode,
|
||||
gimage->visible,
|
||||
COMBINE_INTEN_A_INDEXED_A);
|
||||
}
|
||||
|
||||
static void
|
||||
project_channel (GimpImage *gimage,
|
||||
GimpChannel *channel,
|
||||
PixelRegion *src,
|
||||
PixelRegion *src2)
|
||||
{
|
||||
guchar col[3];
|
||||
guchar opacity;
|
||||
gint type;
|
||||
|
||||
gimp_rgba_get_uchar (&channel->color,
|
||||
&col[0], &col[1], &col[2], &opacity);
|
||||
|
||||
if (! gimage->construct_flag)
|
||||
{
|
||||
type = (channel->show_masked) ?
|
||||
INITIAL_CHANNEL_MASK : INITIAL_CHANNEL_SELECTION;
|
||||
|
||||
initial_region (src2, src, NULL, col,
|
||||
opacity,
|
||||
GIMP_NORMAL_MODE,
|
||||
NULL,
|
||||
type);
|
||||
}
|
||||
else
|
||||
{
|
||||
type = (channel->show_masked) ?
|
||||
COMBINE_INTEN_A_CHANNEL_MASK : COMBINE_INTEN_A_CHANNEL_SELECTION;
|
||||
|
||||
combine_regions (src, src2, src, NULL, col,
|
||||
opacity,
|
||||
GIMP_NORMAL_MODE,
|
||||
NULL,
|
||||
type);
|
||||
}
|
||||
}
|
@@ -1,55 +0,0 @@
|
||||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattisbvf
|
||||
*
|
||||
* 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 __GIMP_IMAGE_PROJECTION_H__
|
||||
#define __GIMP_IMAGE_PROJECTION_H__
|
||||
|
||||
|
||||
void gimp_image_projection_allocate (GimpImage *gimage);
|
||||
void gimp_image_projection_free (GimpImage *gimage);
|
||||
|
||||
TileManager * gimp_image_projection (GimpImage *gimage);
|
||||
GimpImageType gimp_image_projection_type (const GimpImage *gimage);
|
||||
gint gimp_image_projection_bytes (const GimpImage *gimage);
|
||||
gdouble gimp_image_projection_opacity (const GimpImage *gimage);
|
||||
|
||||
guchar * gimp_image_projection_get_color_at (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
void gimp_image_invalidate (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2);
|
||||
void gimp_image_invalidate_without_render (GimpImage *gimage,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2);
|
||||
|
||||
|
||||
#endif /* __GIMP_IMAGE_PROJECTION_H__ */
|
@@ -1,718 +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 "display-types.h"
|
||||
#include "tools/tools-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-projection.h"
|
||||
#include "core/gimplist.h"
|
||||
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
|
||||
#include "tools/gimptool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpdisplay-area.h"
|
||||
#include "gimpdisplay-handlers.h"
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-handlers.h"
|
||||
#include "gimpdisplayshell-transform.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_IMAGE
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_display_class_init (GimpDisplayClass *klass);
|
||||
static void gimp_display_init (GimpDisplay *gdisp);
|
||||
|
||||
static void gimp_display_finalize (GObject *object);
|
||||
static void gimp_display_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_display_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gimp_display_flush_whenever (GimpDisplay *gdisp,
|
||||
gboolean now);
|
||||
static void gimp_display_idlerender_init (GimpDisplay *gdisp);
|
||||
static gboolean gimp_display_idlerender_callback (gpointer data);
|
||||
static gboolean gimp_display_idle_render_next_area (GimpDisplay *gdisp);
|
||||
static void gimp_display_paint_area (GimpDisplay *gdisp,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
|
||||
|
||||
static GimpObjectClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_display_get_type (void)
|
||||
{
|
||||
static GType display_type = 0;
|
||||
|
||||
if (! display_type)
|
||||
{
|
||||
static const GTypeInfo display_info =
|
||||
{
|
||||
sizeof (GimpDisplayClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) gimp_display_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpDisplay),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_display_init,
|
||||
};
|
||||
|
||||
display_type = g_type_register_static (GIMP_TYPE_OBJECT,
|
||||
"GimpDisplay",
|
||||
&display_info, 0);
|
||||
}
|
||||
|
||||
return display_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_class_init (GimpDisplayClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_display_finalize;
|
||||
object_class->set_property = gimp_display_set_property;
|
||||
object_class->get_property = gimp_display_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_IMAGE,
|
||||
g_param_spec_object ("image",
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_IMAGE,
|
||||
G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_init (GimpDisplay *gdisp)
|
||||
{
|
||||
gdisp->ID = 0;
|
||||
|
||||
gdisp->gimage = NULL;
|
||||
gdisp->instance = 0;
|
||||
|
||||
gdisp->shell = NULL;
|
||||
|
||||
gdisp->update_areas = NULL;
|
||||
|
||||
gdisp->idle_render.idle_id = 0;
|
||||
gdisp->idle_render.update_areas = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_finalize (GObject *object)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
gdisp = GIMP_DISPLAY (object);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
gdisp = GIMP_DISPLAY (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_IMAGE:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
gdisp = GIMP_DISPLAY (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_IMAGE:
|
||||
g_value_set_object (value, gdisp->gimage);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GimpDisplay *
|
||||
gimp_display_new (GimpImage *gimage,
|
||||
gdouble scale,
|
||||
GimpMenuFactory *menu_factory,
|
||||
GimpItemFactory *popup_factory)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
/* If there isn't an interface, never create a gdisplay */
|
||||
if (gimage->gimp->no_interface)
|
||||
return NULL;
|
||||
|
||||
gdisp = g_object_new (GIMP_TYPE_DISPLAY, NULL);
|
||||
|
||||
gdisp->ID = gimage->gimp->next_display_ID++;
|
||||
|
||||
/* refs the image */
|
||||
gimp_display_connect (gdisp, gimage);
|
||||
|
||||
/* create the shell for the image */
|
||||
gdisp->shell = gimp_display_shell_new (gdisp, scale,
|
||||
menu_factory, popup_factory);
|
||||
|
||||
gtk_widget_show (gdisp->shell);
|
||||
|
||||
return gdisp;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_delete (GimpDisplay *gdisp)
|
||||
{
|
||||
GimpTool *active_tool;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
|
||||
|
||||
/* remove the display from the list */
|
||||
gimp_container_remove (gdisp->gimage->gimp->displays,
|
||||
GIMP_OBJECT (gdisp));
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (gdisp->gimage->gimp, HALT, gdisp);
|
||||
|
||||
active_tool = tool_manager_get_active (gdisp->gimage->gimp);
|
||||
|
||||
if (active_tool)
|
||||
{
|
||||
if (active_tool->focus_display == gdisp)
|
||||
tool_manager_focus_display_active (gdisp->gimage->gimp, NULL);
|
||||
|
||||
/* clear out the pointer to this gdisp from the active tool */
|
||||
if (active_tool->gdisp == gdisp)
|
||||
{
|
||||
active_tool->drawable = NULL;
|
||||
active_tool->gdisp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* If this gdisplay was idlerendering at the time when it was deleted,
|
||||
* deactivate the idlerendering thread before deletion!
|
||||
*/
|
||||
if (gdisp->idle_render.idle_id)
|
||||
{
|
||||
g_source_remove (gdisp->idle_render.idle_id);
|
||||
gdisp->idle_render.idle_id = 0;
|
||||
}
|
||||
|
||||
/* free the update area lists */
|
||||
gimp_display_area_list_free (gdisp->update_areas);
|
||||
gimp_display_area_list_free (gdisp->idle_render.update_areas);
|
||||
|
||||
if (gdisp->shell)
|
||||
{
|
||||
GtkWidget *shell = gdisp->shell;
|
||||
|
||||
/* set gdisp->shell to NULL *before* destroying the shell.
|
||||
* all callbacks in gimpdisplayshell-callbacks.c will check
|
||||
* this pointer and do nothing if the shell is in destruction.
|
||||
*/
|
||||
gdisp->shell = NULL;
|
||||
gtk_widget_destroy (shell);
|
||||
}
|
||||
|
||||
/* unrefs the gimage */
|
||||
gimp_display_disconnect (gdisp);
|
||||
|
||||
g_object_unref (gdisp);
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_display_get_ID (GimpDisplay *gdisp)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), -1);
|
||||
|
||||
return gdisp->ID;
|
||||
}
|
||||
|
||||
GimpDisplay *
|
||||
gimp_display_get_by_ID (Gimp *gimp,
|
||||
gint ID)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
for (list = GIMP_LIST (gimp->displays)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
gdisp = (GimpDisplay *) list->data;
|
||||
|
||||
if (gdisp->ID == ID)
|
||||
return gdisp;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_reconnect (GimpDisplay *gdisp,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
|
||||
if (gdisp->idle_render.idle_id)
|
||||
{
|
||||
g_source_remove (gdisp->idle_render.idle_id);
|
||||
gdisp->idle_render.idle_id = 0;
|
||||
}
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (gdisp->gimage->gimp, HALT, gdisp);
|
||||
|
||||
gimp_display_shell_disconnect (GIMP_DISPLAY_SHELL (gdisp->shell));
|
||||
|
||||
gimp_display_disconnect (gdisp);
|
||||
|
||||
gimp_display_connect (gdisp, gimage);
|
||||
|
||||
gimp_display_add_update_area (gdisp,
|
||||
0, 0,
|
||||
gdisp->gimage->width,
|
||||
gdisp->gimage->height);
|
||||
|
||||
gimp_display_shell_reconnect (GIMP_DISPLAY_SHELL (gdisp->shell));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_add_update_area (GimpDisplay *gdisp,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GimpArea *area;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
|
||||
|
||||
area = gimp_area_new (CLAMP (x, 0, gdisp->gimage->width),
|
||||
CLAMP (y, 0, gdisp->gimage->height),
|
||||
CLAMP (x + w, 0, gdisp->gimage->width),
|
||||
CLAMP (y + h, 0, gdisp->gimage->height));
|
||||
|
||||
gdisp->update_areas = gimp_display_area_list_process (gdisp->update_areas,
|
||||
area);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_flush (GimpDisplay *gdisp)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
|
||||
|
||||
/* Redraw on idle time */
|
||||
gimp_display_flush_whenever (gdisp, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_flush_now (GimpDisplay *gdisp)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
|
||||
|
||||
/* Redraw NOW */
|
||||
gimp_display_flush_whenever (gdisp, TRUE);
|
||||
}
|
||||
|
||||
/* Force all gdisplays to finish their idlerender projection */
|
||||
void
|
||||
gimp_display_finish_draw (GimpDisplay *gdisp)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
|
||||
|
||||
if (gdisp->idle_render.idle_id)
|
||||
{
|
||||
g_source_remove (gdisp->idle_render.idle_id);
|
||||
gdisp->idle_render.idle_id = 0;
|
||||
|
||||
while (gimp_display_idlerender_callback (gdisp));
|
||||
}
|
||||
}
|
||||
|
||||
/* utility function to check if the cursor is inside the active drawable */
|
||||
gboolean
|
||||
gimp_display_coords_in_active_drawable (GimpDisplay *gdisp,
|
||||
const GimpCoords *coords)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), FALSE);
|
||||
|
||||
if (!gdisp->gimage)
|
||||
return FALSE;
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (drawable)
|
||||
{
|
||||
GimpItem *item;
|
||||
gint x, y;
|
||||
|
||||
item = GIMP_ITEM (drawable);
|
||||
|
||||
gimp_item_offsets (item, &x, &y);
|
||||
|
||||
x = ROUND (coords->x) - x;
|
||||
y = ROUND (coords->y) - y;
|
||||
|
||||
if (x < 0 || x > gimp_item_width (item))
|
||||
return FALSE;
|
||||
|
||||
if (y < 0 || y > gimp_item_height (item))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_display_flush_whenever (GimpDisplay *gdisp,
|
||||
gboolean now)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
/* Flush the items in the displays and updates lists -
|
||||
* but only if gdisplay has been mapped and exposed
|
||||
*/
|
||||
if (! shell->select)
|
||||
{
|
||||
g_warning ("gimp_display_flush_whenever(): called unrealized");
|
||||
return;
|
||||
}
|
||||
|
||||
/* First the updates... */
|
||||
if (gdisp->update_areas)
|
||||
{
|
||||
if (now)
|
||||
{
|
||||
/* Synchronous */
|
||||
|
||||
GSList *list;
|
||||
GimpArea *area;
|
||||
|
||||
for (list = gdisp->update_areas; list; list = g_slist_next (list))
|
||||
{
|
||||
/* Paint the area specified by the GimpArea */
|
||||
area = (GimpArea *) list->data;
|
||||
|
||||
if ((area->x1 != area->x2) && (area->y1 != area->y2))
|
||||
{
|
||||
gimp_display_paint_area (gdisp,
|
||||
area->x1,
|
||||
area->y1,
|
||||
(area->x2 - area->x1),
|
||||
(area->y2 - area->y1));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Asynchronous */
|
||||
|
||||
gimp_display_idlerender_init (gdisp);
|
||||
}
|
||||
|
||||
/* Free the update lists */
|
||||
gdisp->update_areas = gimp_display_area_list_free (gdisp->update_areas);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if there was nothing to update, we still need to start the
|
||||
* selection --mitch
|
||||
*/
|
||||
gimp_display_shell_selection_visibility (shell, GIMP_SELECTION_ON);
|
||||
}
|
||||
|
||||
/* Next the displays... */
|
||||
gimp_display_shell_flush (shell, now);
|
||||
|
||||
/* ensure the consistency of the menus */
|
||||
if (! now)
|
||||
{
|
||||
GimpContext *user_context;
|
||||
|
||||
gimp_item_factory_update (shell->menubar_factory, shell);
|
||||
|
||||
user_context = gimp_get_user_context (gdisp->gimage->gimp);
|
||||
|
||||
if (gdisp == gimp_context_get_display (user_context))
|
||||
gimp_item_factory_update (shell->popup_factory, shell);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_idlerender_init (GimpDisplay *gdisp)
|
||||
{
|
||||
GSList *list;
|
||||
GimpArea *area, *new_area;
|
||||
|
||||
/* We need to merge the IdleRender's and the GimpDisplay's update_areas list
|
||||
* to keep track of which of the updates have been flushed and hence need
|
||||
* to be drawn.
|
||||
*/
|
||||
for (list = gdisp->update_areas; list; list = g_slist_next (list))
|
||||
{
|
||||
area = (GimpArea *) list->data;
|
||||
|
||||
new_area = g_memdup (area, sizeof (GimpArea));
|
||||
|
||||
gdisp->idle_render.update_areas =
|
||||
gimp_display_area_list_process (gdisp->idle_render.update_areas,
|
||||
new_area);
|
||||
}
|
||||
|
||||
/* If an idlerender was already running, merge the remainder of its
|
||||
* unrendered area with the update_areas list, and make it start work
|
||||
* on the next unrendered area in the list.
|
||||
*/
|
||||
if (gdisp->idle_render.idle_id)
|
||||
{
|
||||
new_area =
|
||||
gimp_area_new (gdisp->idle_render.basex,
|
||||
gdisp->idle_render.y,
|
||||
gdisp->idle_render.basex + gdisp->idle_render.width,
|
||||
gdisp->idle_render.y + (gdisp->idle_render.height -
|
||||
(gdisp->idle_render.y -
|
||||
gdisp->idle_render.basey)));
|
||||
|
||||
gdisp->idle_render.update_areas =
|
||||
gimp_display_area_list_process (gdisp->idle_render.update_areas,
|
||||
new_area);
|
||||
|
||||
gimp_display_idle_render_next_area (gdisp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gdisp->idle_render.update_areas == NULL)
|
||||
{
|
||||
g_warning ("Wanted to start idlerender thread with no update_areas. (+memleak)");
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_display_idle_render_next_area (gdisp);
|
||||
|
||||
gdisp->idle_render.idle_id = g_idle_add_full (G_PRIORITY_LOW,
|
||||
gimp_display_idlerender_callback,
|
||||
gdisp,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Caller frees gdisp->update_areas */
|
||||
}
|
||||
|
||||
/* Unless specified otherwise, display re-rendering is organised by
|
||||
* IdleRender, which amalgamates areas to be re-rendered and breaks
|
||||
* them into bite-sized chunks which are chewed on in a low- priority
|
||||
* idle thread. This greatly improves responsiveness for many GIMP
|
||||
* operations. -- Adam
|
||||
*/
|
||||
static gboolean
|
||||
gimp_display_idlerender_callback (gpointer data)
|
||||
{
|
||||
const gint CHUNK_WIDTH = 256;
|
||||
const gint CHUNK_HEIGHT = 128;
|
||||
gint workx, worky, workw, workh;
|
||||
GimpDisplay *gdisp = data;
|
||||
|
||||
workw = CHUNK_WIDTH;
|
||||
workh = CHUNK_HEIGHT;
|
||||
workx = gdisp->idle_render.x;
|
||||
worky = gdisp->idle_render.y;
|
||||
|
||||
if (workx + workw > gdisp->idle_render.basex + gdisp->idle_render.width)
|
||||
{
|
||||
workw = gdisp->idle_render.basex + gdisp->idle_render.width - workx;
|
||||
}
|
||||
|
||||
if (worky + workh > gdisp->idle_render.basey + gdisp->idle_render.height)
|
||||
{
|
||||
workh = gdisp->idle_render.basey + gdisp->idle_render.height - worky;
|
||||
}
|
||||
|
||||
gimp_display_paint_area (gdisp, workx, worky, workw, workh);
|
||||
|
||||
gdisp->idle_render.x += CHUNK_WIDTH;
|
||||
|
||||
if (gdisp->idle_render.x >=
|
||||
gdisp->idle_render.basex + gdisp->idle_render.width)
|
||||
{
|
||||
gdisp->idle_render.x = gdisp->idle_render.basex;
|
||||
gdisp->idle_render.y += CHUNK_HEIGHT;
|
||||
|
||||
if (gdisp->idle_render.y >=
|
||||
gdisp->idle_render.basey + gdisp->idle_render.height)
|
||||
{
|
||||
if (! gimp_display_idle_render_next_area (gdisp))
|
||||
{
|
||||
/* FINISHED */
|
||||
gdisp->idle_render.idle_id = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Still work to do. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_display_idle_render_next_area (GimpDisplay *gdisp)
|
||||
{
|
||||
GimpArea *area;
|
||||
|
||||
if (! gdisp->idle_render.update_areas)
|
||||
return FALSE;
|
||||
|
||||
area = (GimpArea *) gdisp->idle_render.update_areas->data;
|
||||
|
||||
gdisp->idle_render.update_areas =
|
||||
g_slist_remove (gdisp->idle_render.update_areas, area);
|
||||
|
||||
gdisp->idle_render.x = gdisp->idle_render.basex = area->x1;
|
||||
gdisp->idle_render.y = gdisp->idle_render.basey = area->y1;
|
||||
gdisp->idle_render.width = area->x2 - area->x1;
|
||||
gdisp->idle_render.height = area->y2 - area->y1;
|
||||
|
||||
g_free (area);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_paint_area (GimpDisplay *gdisp,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
gint x1, y1, x2, y2;
|
||||
gdouble x1_f, y1_f, x2_f, y2_f;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
/* Bounds check */
|
||||
x1 = CLAMP (x, 0, gdisp->gimage->width);
|
||||
y1 = CLAMP (y, 0, gdisp->gimage->height);
|
||||
x2 = CLAMP (x + w, 0, gdisp->gimage->width);
|
||||
y2 = CLAMP (y + h, 0, gdisp->gimage->height);
|
||||
x = x1;
|
||||
y = y1;
|
||||
w = (x2 - x1);
|
||||
h = (y2 - y1);
|
||||
|
||||
/* calculate the extents of the update as limited by what's visible */
|
||||
gimp_display_shell_untransform_xy_f (shell,
|
||||
0, 0,
|
||||
&x1_f, &y1_f,
|
||||
FALSE);
|
||||
gimp_display_shell_untransform_xy_f (shell,
|
||||
shell->disp_width, shell->disp_height,
|
||||
&x2_f, &y2_f,
|
||||
FALSE);
|
||||
|
||||
/* make sure to limit the invalidated area to a superset of the
|
||||
* untransformed sub-pixel display area, not a subset.
|
||||
* bug #116765. --mitch
|
||||
*/
|
||||
x1 = floor (x1_f);
|
||||
y1 = floor (y1_f);
|
||||
x2 = ceil (x2_f);
|
||||
y2 = ceil (y2_f);
|
||||
|
||||
gimp_image_invalidate (gdisp->gimage, x, y, w, h, x1, y1, x2, y2);
|
||||
|
||||
/* display the area */
|
||||
gimp_display_shell_transform_xy_f (shell, x, y, &x1_f, &y1_f, FALSE);
|
||||
gimp_display_shell_transform_xy_f (shell, x + w, y + h, &x2_f, &y2_f, FALSE);
|
||||
|
||||
/* make sure to expose a superset of the transformed sub-pixel expose
|
||||
* area, not a subset. bug #126942. --mitch
|
||||
*/
|
||||
x1 = floor (x1_f);
|
||||
y1 = floor (y1_f);
|
||||
x2 = ceil (x2_f);
|
||||
y2 = ceil (y2_f);
|
||||
|
||||
gimp_display_shell_expose_area (shell, x1, y1, x2 - x1, y2 - y1);
|
||||
}
|
@@ -1,103 +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 __GIMP_DISPLAY_H__
|
||||
#define __GIMP_DISPLAY_H__
|
||||
|
||||
|
||||
#include "core/gimpobject.h"
|
||||
|
||||
|
||||
typedef struct _IdleRenderStruct IdleRenderStruct;
|
||||
|
||||
struct _IdleRenderStruct
|
||||
{
|
||||
gint width;
|
||||
gint height;
|
||||
gint x;
|
||||
gint y;
|
||||
gint basex;
|
||||
gint basey;
|
||||
guint idle_id;
|
||||
GSList *update_areas; /* flushed update areas */
|
||||
};
|
||||
|
||||
|
||||
#define GIMP_TYPE_DISPLAY (gimp_display_get_type ())
|
||||
#define GIMP_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY, GimpDisplay))
|
||||
#define GIMP_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY, GimpDisplayClass))
|
||||
#define GIMP_IS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY))
|
||||
#define GIMP_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY))
|
||||
#define GIMP_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DISPLAY, GimpDisplayClass))
|
||||
|
||||
|
||||
typedef struct _GimpDisplayClass GimpDisplayClass;
|
||||
|
||||
struct _GimpDisplay
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
|
||||
gint ID; /* unique identifier for this gdisplay */
|
||||
|
||||
GimpImage *gimage; /* pointer to the associated gimage */
|
||||
gint instance; /* the instance # of this gdisplay as */
|
||||
/* taken from the gimage at creation */
|
||||
|
||||
GtkWidget *shell; /* shell widget for this gdisplay */
|
||||
|
||||
GSList *update_areas; /* Update areas list */
|
||||
|
||||
IdleRenderStruct idle_render; /* state of this gdisplay's render thread */
|
||||
};
|
||||
|
||||
struct _GimpDisplayClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_display_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpDisplay * gimp_display_new (GimpImage *gimage,
|
||||
gdouble scale,
|
||||
GimpMenuFactory *menu_factory,
|
||||
GimpItemFactory *popup_factory);
|
||||
void gimp_display_delete (GimpDisplay *gdisp);
|
||||
|
||||
gint gimp_display_get_ID (GimpDisplay *gdisp);
|
||||
GimpDisplay * gimp_display_get_by_ID (Gimp *gimp,
|
||||
gint ID);
|
||||
|
||||
void gimp_display_reconnect (GimpDisplay *gdisp,
|
||||
GimpImage *gimage);
|
||||
|
||||
void gimp_display_add_update_area (GimpDisplay *gdisp,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
|
||||
void gimp_display_flush (GimpDisplay *gdisp);
|
||||
void gimp_display_flush_now (GimpDisplay *gdisp);
|
||||
|
||||
void gimp_display_finish_draw (GimpDisplay *gdisp);
|
||||
|
||||
gboolean gimp_display_coords_in_active_drawable (GimpDisplay *gdisp,
|
||||
const GimpCoords *coords);
|
||||
|
||||
#endif /* __GIMP_DISPLAY_H__ */
|
@@ -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,
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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)
|
||||
|
@@ -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,
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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) $<
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user