Control Group Operations

The operations of control groups (CG) are two: set and add. There are hotkey bindings for those.

However there are many common combination of actions that are carried out with groups that are worth explaining in detail. In particular, removing units from CGs.
 * Create a group with one or more units seen on the screen
 * Create a group with one or more units seen on the screen (extended)
 * Create a group with group all units of one kind seen on the screen
 * Create a group with all units of one or more kinds seen on the screen


 * Add to a group one or more units seen on the screen
 * Add to a group one or more units seen on the screen (extended)
 * Add to a group all units of one kind seen on the screen
 * Add to a group all units of one or more kinds seen on the screen
 * Remove from the group one or more units seen on the screen
 * Remove from the group all units of one or more kinds seen on the screen (impossible)
 * Remove from the group one or more units seen in the information panel
 * Remove from the group all units of one or more kinds seen in the information panel
 * Separate a selection of units into two groups

Hotkey Binding Design
The design of hotkey binding of set CG and add to CG is influenced by many factors.

Relation with the binding of the select CG hotkey
While the standard layout is designed so that the binding of set CG 1 and add to CG 1 involve a modifier (CTRL, SHIFT, ALT) the same key that is bound to select CG 1, this is not necessarily a requirement.

However, this design solution has some benefits because it's conceptually easier to relate to, and it saves keyspace. When this solution is employed, the key combination to set CG and add to CG does not necessarily involve CTRL, SHIFT or ALT. However the HB editor does not allow to use combinations that involve more than one key that is not CTRL, SHIFT or ALT, so we won't discuss this option.

This solution adds an (obvious) constraint to the binding design: it is necessary that the key which is bound to select CG can be pressed at the same time of the modifiers involved.

Location of selection modifiers on the keyboard
Selection modifiers are SHIFT and CONTROL. In particular, the function of SHIFT is to edit the selection (add or remove elements), while CONTROL modifies the operation replacing the assigned target of the operation (one unit) with all units of the type of the assigned target within the scope (screen or information panel).

Because control group operations are carried out after selection operations, a desiderata for the binding is that it is possible to carry out set CG and add to CG quickly, comfortably, safely and resilience right after (or in between of) selection operations that involve selection modifiers.

Synergy with selection modifiers
The standard layout overloads the SHIFT and CONTROL keys with other functions, such as queue command, and set CG and add to CG. In particular, SHIFT + 1 is bound to add to CG 1, while CTRL + 1 is bound to set as CG 1.

Overloading both SHIFT and CONTROL is not necessary in theory, but it is in practice. A solution that does not overload the selection modifiers could be ALT + 1 to add to CG and CTRL+ALT+1 to set CG.

In practice overloading SHIFT and CONTROL achieves speed and comfort at a very low keyspace cost, at the cost of safety and resilience. A SHIFT accidentally held down when pressing 1 will result in losing the content of CG 1.

Because SHIFT in particular is very often used to queue commands, a combination with SHIFT as the only modifier is very error prone.

Assuming we can live with the risk, let's analyze the synergies between CG operations and selection modifiers in the standard layout:

Create a group with one or more units seen on the screen
 * 1) click-select a unit or box-select a group of units
 * 2) press CONTROL together with the CG key

Create a group with one or more units seen on the screen (extended) (+) it is possible to hold SHIFT until the end, and release it together with CONTROL
 * 1) click-select a unit or box-select some units
 * 2) hold SHIFT
 * 3) click-select a unit or box-select some units (repeat if necessary)
 * 4) release+ SHIFT
 * 5) press CONTROL together with the CG key

Create a group with group all units of one kind seen on the screen
 * 1) hold CONTROL
 * 2) click-select a unit of the given kind
 * 3) press the CG key
 * 4) release CONTROL

Create a group with all units of one or more kinds seen on the screen (+) it is possible to hold SHIFT until the end, and release it together with CONTROL
 * 1) hold SHIFT and CONTROL
 * 2) click-select a unit of the given kind (repeat if necessary)
 * 3) release+ SHIFT
 * 4) press the CG key
 * 5) release CONTROL

Add to a group one or more units seen on the screen
 * 1) click-select a unit or box-select a group of units
 * 2) press SHIFT together with the CG key

Add to a group one or more units seen on the screen (extended)
 * 1) click-select a unit or box-select some units
 * 2) hold SHIFT
 * 3) click-select a unit or box-select some units (repeat if necessary)
 * 4) press the CG key
 * 5) release SHIFT

Add to a group all units of one kind seen on the screen
 * 1) hold CONTROL
 * 2) click-select a unit of the given kind
 * 3) release CONTROL
 * 4) press SHIFT together with the CG key

Add to a group all units of two or more kinds seen on the screen
 * 1) hold SHIFT and CONTROL
 * 2) click-select a unit of the given kind (repeat if necessary)
 * 3) release CONTROL
 * 4) press the CG key
 * 5) release SHIFT

Remove from a group one or more units seen on the screen
 * 1) select CG
 * 2) hold SHIFT
 * 3) click-select a unit (repeat if necessary)
 * 4) box-select some units (repeat if necessary)
 * 5) release+ SHIFT
 * 6) press the CONTROL and CG key

Remove from a group all units of one or more kinds seen on the screen this is not possible

Remove from a group one or more units seen in the information panel
 * 1) select CG
 * 2) hold SHIFT
 * 3) click a unit portrait (repeat if necessary)
 * 4) release+ SHIFT
 * 5) press the CONTROL and CG key

Remove from a group all units of one or more kinds seen in the information panel (+) it is possible to hold SHIFT until the end, and release it together with CONTROL
 * 1) select CG
 * 2) hold SHIFT and CONTROL
 * 3) click a unit portrait (repeat if necessary)
 * 4) release+ SHIFT
 * 5) press the CG key
 * 6) release CONTROL