I have been working on getting the things that use GimpRectangleTool
(meaning rectangle select, ellipse select, and crop tools) to use
the Shift key as a "make square" modifier, and the Control key as
an "expand from center" modifier, as discussed earlier.  This is a 
status update.

There were two things that made this a bit tricky.  The first is that
the GIMP code was set up to block key-press or key-release events
from being propagated to tools while mouse button 1 is down -- this
was done to prevent nasty things like switching tools or invoking menu
commands while a tool is in the middle of its operation.  I changed
it to allow Shift and Control key events to pass through.  This has the
potential to cause breakage for a variety of tools if Shift or Control
are pressed while you are using them.  I tried to anticipate all the 
possible problems and prevent them, but I am not 100% certain that I
got everything, so it would be good if you kept your eyes open.

The second issue is how the modifiers should affect the tool.  In PhotoShop,
pressing Shift or Control sets a constraint only if you do it *after* 
pressing mouse button 1, and releasing the modifer removes the constraint.
However, this approach won't work for the GIMP tools, because in GIMP
now, the rectangles you get can be modified after they have been created.
If you create a rectangle by expanding from a fixed center, and want to
modify it, you will want to keep the same center -- but this is impossible
if you have to wait until after you have pressed the mouse button in order
to activate the constraint.  I had quite some difficulty coming up with
a reasonable way of dealing with this -- what I finally decided is that
the most sensible thing to do is just to make each key-press, while button1
is down, toggle the constraint.  So, here is how it works now:

1) If you press the Shift key, while button1 is down, the tool goes into
"make square" mode, and stays there indefinitely.  Releasing the Shift key
has no effect.  Pressing the Shift key again toggles the tool out of
"make square" mode.

2) If you press the Control key while button1 is down, the tool goes into
"expand from center" mode, and the center is set to be the point at which
you first pressed mouse button1.  Releasing the Control key has no effect.
Pressing the Control key again toggles off the "expand from center" option.

I am not really happy with this, but I don't currently see a better way
to do it.  My general attitude, as I have expressed many times, is that
overloading key modifiers (i.e., making Shift affect both the selection
mode and the squareness) is a bad thing, and is never going to make for
a completely happy situation.  The proper solution is for GIMP to start
making us of a new key modifier (say "meta"), and dedicate it to tool
control, so that, for example, the squareness contraint could be toggled
by pressing Meta-S.

(See bug #316156 for relevant discussion.)

  -- Bill
 

 
______________ ______________ ______________ ______________
Sent via the CNPRC Email system at primate.ucdavis.edu


 
                   
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to