RSS/Atom feed Twitter
Site is read-only, email is disabled

rectangle tool update

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

rectangle tool update William Skaggs 21 Aug 19:36
  rectangle tool update Sven Neumann 22 Aug 10:01
   rectangle tool update Raphaël Quinet 22 Aug 17:22
William Skaggs
2006-08-21 19:36:30 UTC (over 18 years ago)

rectangle tool update

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

Sven Neumann
2006-08-22 10:01:01 UTC (over 18 years ago)

rectangle tool update

Hi,

On Mon, 2006-08-21 at 10:36 -0700, William Skaggs wrote:

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.

I don't think that's a good solution. I would rather implement a different behaviour for the case where the user is changing an already created rectangle. If the user is creating a new rectangle, pressing Shift and Ctrl while the mouse button is down should activate "square" mode, respective "from center". And, and that's important, releasing the modifier keys should untoggle it. Only then can the user discover this functionality without the risk of doing something unwanted.

As soon as the rectangle is created, it's mode should not any longer be toggleable using the modifier keys. The user can still change it by pressing the check boxes in the tool options but it is rather unlikely that one ever wants to turn a circle into an ellipse or change the "from center" mode.

Sven

Raphaël Quinet
2006-08-22 17:22:55 UTC (over 18 years ago)

rectangle tool update

On Tue, 22 Aug 2006 10:01:01 +0200, Sven Neumann wrote:

On Mon, 2006-08-21 at 10:36 -0700, William Skaggs wrote:

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.

I don't think that's a good solution. I would rather implement a different behaviour for the case where the user is changing an already created rectangle. If the user is creating a new rectangle, pressing Shift and Ctrl while the mouse button is down should activate "square" mode, respective "from center". And, and that's important, releasing the modifier keys should untoggle it. Only then can the user discover this functionality without the risk of doing something unwanted.

I agree with Sven: releasing the modifier keys should immediately change the mode ("square" or "from center") back to what it was before. This instant feedback on press and release is how all other tools/options behave. Introducing a new concept of "sticky" modifiers does not improve the consitency of the GIMP user interface.

I also agree that the best way to solve this would be check the modifiers only during the initial click-drag but ignore them once the rectangle has been defined.

-Raphaël