After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 147437 - proposed replacement for align-visible-layers plug-in
proposed replacement for align-visible-layers plug-in
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
git master
Other All
: Normal enhancement
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2004-07-12 17:42 UTC by weskaggs
Modified: 2006-02-16 16:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
source code for plug-in, align.c (37.71 KB, text/plain)
2004-07-12 17:44 UTC, weskaggs
  Details
revised align.c (41.02 KB, text/plain)
2004-07-14 15:58 UTC, weskaggs
  Details
diff againt cvs HEAD 02-23-05 (40.48 KB, patch)
2005-02-23 18:06 UTC, weskaggs
committed Details | Review

Description weskaggs 2004-07-12 17:42:27 UTC
I am attaching below the code for a plug-in that allows users to interactively
align and arrange layers in an image -- similar to align-visible-layers but
hopefully more usable.  It will mainly be useful for arranging text, I think. 
The version attached here can be installed using gimptool-2.1.  Instructions for
using it can be accessed using the "View Instructions" button; this will be
removed if/when the plug-in becomes part of the distribution and proper help is
available.
Comment 1 weskaggs 2004-07-12 17:44:42 UTC
Created attachment 29474 [details]
source code for plug-in, align.c

Install using "gimptool-2.1 --install align.c"; adds "Align Layers" entry to
Layer menu.
Comment 2 Sven Neumann 2004-07-12 17:59:50 UTC
I'd rather see bug #143163 fixed than a new plug-in being added that implements
what should actually be part of the layer properties dialog.
Comment 3 weskaggs 2004-07-12 18:20:13 UTC
Is there a layer properties dialog?  Anyway, jimmac's design is undoubtedly more
elegant, but I'm not sure it provides sufficient flexibility for all the things
one might want to do when arranging layers with respect to one another.
 
Here are a couple of suggestions you made while discussing this in IRC (placed
here so we won't forget):

1) Something like this should live in libgimpwidgets instead of in a plug-in.

2) It would be better to use stock icons (such as the gravity symbols) rather
than creating custom symbols.

3) It would be better to use gdk-pixbuf-csource than to insert xpm's in the
source code.

Comment 4 Sven Neumann 2004-07-12 19:45:26 UTC
No, there is no layer properties dialog now but it clearly is on our TODO. The
layer positioning doesn't absolutely need to be integrated with other layer
properties, it could probably also live in a plug-in.

What exactly is Jimmac's mockup missing? It certainly has the advantage that it
is simple enough to be understood w/o much further explanation. I have only
looked at the GUI of your plug-in shortly but I failed to understand how it is
supposed to be used. What I displike most about it is the clickable image area
at the top. This is a user-interface element that should be avoided and it
shouldn't be needed in order to align layers.

I suggest we merge the two bug reports and discuss the details of a dialog to
position layers before we go into implementation details.
Comment 5 weskaggs 2004-07-13 15:18:59 UTC
This plug-in is mainly intended for a specific, but commonly occurring and quite
important, usage case:  you have a set of text layers, and you want to arrange
them in a certain way -- align the vertical centers, or align the baselines and
create a specified space between the right edge of one and the left edge of
another, etc.  Unless I am missing something, Jimmac's prototype is not
sufficiently flexible to do this, because it only allows you to pick an
alignment point on the layer that is moved, not on the layer it is aligned against.
Comment 6 Sven Neumann 2004-07-13 16:12:22 UTC
I still suggest we move the two bug reports and use bug #143163 to discuss how a
useful UI for layer positioning would look like.
Comment 7 weskaggs 2004-07-14 15:58:23 UTC
Created attachment 29532 [details]
revised align.c

Well, in any case it won't be possible to have a reasonable discussion of the
pros and cons if you don't understand how the current plug-in works, so I have
tried to modify the layout to make it more helpful (at the cost of some
additional clutter).  You will find it easiest to understand if you start by
creating a few randomly scattered text layers to work with.

You are right that the use of a preview to pick which layers to use is less
than optimal.  Ultimately, I think, this should become a tool (the "Alignment
Tool"), and the layer selection should be done on the image itself.  Obviously
that's not possible in a plug-in version, though.
Comment 8 weskaggs 2005-02-23 18:03:00 UTC
Okay, I have now converted the plug-in into a tool, while at the same time
greatly simplifying the ui.  Basic usage:  activate tool, ctrl-click on a layer
to make it the "reference" layer, click on another layer to make it the "target"
layer, then press a button on the dialog to cause the target layer to be aligned
with the reference layer.  Seems to work well on layers, including floating
selections; also works on vector items but not quite correctly yet.  I would
like to extend it to handle guides and selections, but this seems like a good
point to present the code.  (I am attaching a diff against current cvs HEAD
below.)  Note that the stock symbols on the buttons are less than optimal at
this point because I wanted to avoid creating any new ones.
Comment 9 weskaggs 2005-02-23 18:06:02 UTC
Created attachment 37850 [details] [review]
diff againt cvs HEAD 02-23-05

diff creating new files gimpaligntool.[ch], gimpalignoptions.[ch] in app/tools,
and changing tools/gimp-tools.c, core/core-enums.[ch] and core/gimpitem.[ch]
Comment 10 weskaggs 2005-06-01 16:10:12 UTC
I would like to move ahead with this if possible.  I find this an essential tool
for creating complex figures -- I use the plug-in version very commonly -- and
several people have asked for this functionality on #gimp and been reasonably
satisfied when I pointed them to the plug-in.  What do I need to add or change
to make it commitable?

Concerning the comments from Sven, the general answer is that it is absolutely
essential to be able to align layers with respect to *other layers*, not just
with respect to the image as a whole.  That's why the dialogs etc mentioned in
the comments are not viable alternatives.
Comment 11 weskaggs 2005-06-03 17:48:56 UTC
Okay, after discussion with Sven, first version committed to HEAD.

2005-06-03  Bill Skaggs  <weskaggs@primate.ucdavis.edu>
 
        * gimp/app/tools/Makefile.am
        * gimp/app/tools/gimp-tools.c
        * gimp/app/tools/gimpalignoptions.c
        * gimp/app/tools/gimpalignoptions.h
        * gimp/app/tools/gimpaligntool.c
        * gimp/app/tools/gimpaligntool.h: Add new tool for
        aligning layers etc, as described in bug #147437.
 
        * gimp/app/core/gimpitem.c
        * gimp/app/core/gimpitem.h (gimp_item_align): add
        function required by new tool.
 
        * gimp/app/core/core-enums.c
        * gimp/app/core/core-enums.h: add enum for alignment
        types.
 
        * gimp/themes/Default/images/stock-hcenter-24.png
        * gimp/themes/Default/images/stock-vcenter-24.png
        * gimp/libgimpwidgets/gimpstock.c
        * gimp/libgimpwidgets/gimpstock.h
        * gimp/themes/Default/images/Makefile.am
        * gimp/themes/Default/images/makefile.msc: add two
        stock symbols, modeled on the gravity symbols.
 
Comment 12 Michael Schumacher 2005-12-18 21:44:16 UTC
Should this bug be kept open? And what is the status of the diff attached to it?
Comment 13 Michael Schumacher 2006-02-15 10:25:36 UTC
*** Bug 331252 has been marked as a duplicate of this bug. ***
Comment 14 Michael Schumacher 2006-02-15 10:31:14 UTC
IMO this is implemented in 2.3 and can be closed as fixed. Any issues should be filed as new bugs. Seems like the diff was applied as well, if this didn't happen, please change its status accordingly.
Comment 15 Sven Neumann 2006-02-15 17:27:41 UTC
Sorry, but IMO the current implementation in 2.3 is completely unusable and either needs to undergo a serious overhaul or will be backed out for the next stable release. I do very much prefer the suggestion that was made in bug #331252 and I think we should reopen that bug report.
Comment 16 weskaggs 2006-02-16 16:58:51 UTC
Not sure this is the best place to follow up, but I will anyway.  It seems to me that a tool for aligning things has three essential requirements:

1) A way to specify what item should be aligned.
2) A way to specify what that item should be aligned with.
3) A way to specify the type of alignment (i.e., horizontal center, left edge, etc).

In the alignment tool, I tried to come up with the simplest possible way of doing each of these things:

1) Click on the item.
2) Ctrl-click on the item.
3) Press one of the six buttons in the tool options.

However I am completely open to suggestions for better ways of doing it.  Simplicity can't come at the cost of making the tool non-functional, though.  The suggestion in bug #331252 does not handle requirement (2) at all, and it does not handle requirement (3) in a sufficiently flexible way.