Skip to content
Commit 433b6a66 authored by Halla Rempt's avatar Halla Rempt
Browse files

Add basic modifier key support to selection tools.

Patch by Michael Abrahams. Thanks!
CCMAIL: miabraha@gmail.com
REVIEW: 123833
BUG: 315255

This refactors polygonal, elliptical, and rectangular selection tools to
use a basic selection tool template which unifies previously duplicated
code. The template overrides the ability to execute alternate actions, but
none of those tools supported alternate actions previously and the ellipse
and rectangle were already overriding the modifier keys to begin with.

Shift: add to selection Alt: subtract from selection Shift+Alt: intersect
current selection Ctrl: replace selection

Certain key combinations allow users the ability to expose the modifier
keys to the base tool, i.e. to make proportional / translated / scaled
alterations using ctrl/alt/shift.

1) If the user clicks first and then presses modifier keys, those modifier
keys will only alter the selection method.

2) If the user presses modifier keys first and then clicks, the selection
method is locked in, and subsequent modifier keystrokes will change how
the selection is drawn.

3) If the underlying tool never takes modifier keys, modifier keys will
always alter the selection method.

These rules can be defined systematically by modifying the template.
Things to do later:

+ Basic functionality is implemented in KisToolSelectBase, which covers
the outline, contiguous, similar color and path selection tools which
inherit from KisToolSelectBase.  A more complete refactoring might define
KisToolSelectBase via the selection tool template, but it is not simple
for the path selection tool which uses a more complicated delegated
design pattern.

+ The tools need new icons (e.g. little plus/minus symbols) to give
users visual feedback when they activate the modifiers.

+ The Ctrl key should switch temporarily to the move tool, as in
Photoshop.

+ Check idiomatic naming conventions, style, etc.

The ability to add, subtract and intersect complicated shapes quickly
exposes some bugs in how the selection marquees are drawn: sometimes
extra lines are drawn, sometimes lines fail to be drawn.
parent c2ae1a40
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment