|
|
# The Selection Tool – further development blueprints
|
|
|
|
|
|
Maciej Sumiński/CERN \<maciej.suminski@cern.ch\>, November 2013
|
|
|
|
|
|
The current selection tool, that is compatible with the GAL, does not
|
|
|
provide enough means to perform all actions required to design a PCB. To
|
|
|
make it fully operational, more functionality is required.
|
|
|
|
|
|
### Delete
|
|
|
|
|
|
Deletes selected items or groups of items. Activated by a hotkey (e.g.
|
|
|
Delete) or a command in the Context Menu (CM). Shortcuts should be
|
|
|
consistent with the legacy KiCad edit panel.
|
|
|
|
|
|
### Cut/Copy/Paste
|
|
|
|
|
|
Right now KiCad allows only to copy selected blocks by the following
|
|
|
steps:
|
|
|
|
|
|
- Select the area to be copied (it works only for items selected by a
|
|
|
selection box, even if it is a single item it needs to be selected
|
|
|
by a selection box). This begins the movement operation.
|
|
|
- Move it to the destination place.
|
|
|
- Right click and select “Copy block” from the CM.
|
|
|
- The new copy is fixed in the spot where the command was issued.
|
|
|
|
|
|
The way we would like to have it in the new tool is just like in any
|
|
|
other modern graphical application:
|
|
|
*Cut/copy operation:*
|
|
|
|
|
|
- Select the area to be cut/copied. Allow user to refine the selection
|
|
|
by toggling some of the selected items (by clicking them with Shift
|
|
|
held).
|
|
|
- Press Ctrl-X/C or select the command from Edit Menu/CM.
|
|
|
- Pick reference point or item (the point that will be used for
|
|
|
dragging the pasted block later). It should be possible to snap the
|
|
|
cursor to pads/vias/tracks (switchable by the \[tbd\] key).
|
|
|
|
|
|
*Paste operation:*
|
|
|
|
|
|
- Move the cursor to the coarse destination, press Ctrl+V and finely
|
|
|
move the block to the desired location (it should be also to do it
|
|
|
in the reverse order, i.e. by first pressing Ctrl+V and then move
|
|
|
the block).
|
|
|
- The cursor is tied to the reference point selected when copying the
|
|
|
block.
|
|
|
- The cursor can be snapped to pads/vias/tracks/other items by the
|
|
|
\[tbd\]. Snapping allows to place components both in the grid nodes
|
|
|
or to connect them directly to existing items.
|
|
|
- Pressing the \[tbd\] key should enable linear movement mode (i.e.
|
|
|
move the selected block only horizontally or vertically to make
|
|
|
alignment easier).
|
|
|
- Pasted vias and tracks inherit nets from the items they were placed
|
|
|
over if there is a direct eletrical connection between the objects
|
|
|
(e.g. a via pasted on a pad gets the netcode from that pad)
|
|
|
- Single click finishes the paste operation.
|
|
|
|
|
|
Cut/copied items could be stored in the system clipboard in the KiCad
|
|
|
s-expression format. It could be easily achievable by extracting all
|
|
|
PCB\_IO::Format() functions to another class.
|
|
|
|
|
|
### Grid settings
|
|
|
|
|
|
Currently, it is possible to change the grid density by clicking through
|
|
|
the CM or hotkeys (Ctrl+\` & \`). The CM entries should be accessible by
|
|
|
hotkeys and let the user change the grid settings by keys combination.
|
|
|
To sum up:
|
|
|
|
|
|
- To change the grid density to another: activate the CM, press G to
|
|
|
highlight “Grid density” menu item and then a specific number/letter
|
|
|
to switch to the desired density.
|
|
|
- Ctrl+\` and \` cycle through the default grids to keep the current
|
|
|
KiCad users habits.
|
|
|
|
|
|
In the context menu there could be only one unit per row (either mm or
|
|
|
mils, not both at the same time), as users usually know the value
|
|
|
expressed in one of the units and do not need to know the equivalent in
|
|
|
the other one. Another possibility is to display values using only the
|
|
|
currently selected unit.
|
|
|
|
|
|
*To do: find out if it is possible with wxWidgets (i.e. to have a deeper
|
|
|
level menu accessible by a hotkey).*
|
|
|
|
|
|
### Zoom settings
|
|
|
|
|
|
The zoom options are right now fully available in the CM (and hotkeys
|
|
|
too), but they could be grouped together into one menu position that is
|
|
|
later expanded to all options (please have a look at the CM plan at the
|
|
|
end of the document) and accessible by hotkeys in a similar way to the
|
|
|
grid settings.
|
|
|
|
|
|
### Selection filter
|
|
|
|
|
|
Pcbnew allows to select only items of a specific type by checking
|
|
|
appropriate checkboxes after selecting an area meant to be modified (the
|
|
|
window titled “Block operation”).
|
|
|
Instead, there could be a dockable window with checkboxes that prevents
|
|
|
selection of given items or filters them out after the selection is
|
|
|
performed.
|
|
|
|
|
|
Filtration rules could be the following:
|
|
|
|
|
|
- item type (pad/track/via) as a list of checkboxes
|
|
|
- item net/class, selected from a combo box
|
|
|
|
|
|
Then buttons with available actions that apply to the items that fulfill
|
|
|
the filter rules:
|
|
|
|
|
|
- **Select** to extend the selection
|
|
|
- **Unselect** to remove items from the selection
|
|
|
- **Invert** to toggle the selection
|
|
|
- **Update** to filter out items that do match the rules
|
|
|
- **Highlight** to show the items in brighter colors
|
|
|
- **Unhighlight** to restore normal colors
|
|
|
|
|
|
In the future, it could be extended by handling Python expressions in
|
|
|
order to create more sophisticated filtering rules (eg. “IsModule() &&
|
|
|
PinCount() \> 8” to select modules that have more than 8 pins).
|
|
|
|
|
|
### The selection tool as the default tool
|
|
|
|
|
|
The Tool Framework puts activated tools on a stack, so if one tool
|
|
|
finishes its operation then the stack is unrolled and the previous tool
|
|
|
is active again. This may lead to a situation where there is no active
|
|
|
tool and therefore no context menu accessible. The selection tool should
|
|
|
be always at the bottom of the stack, to ensure there is a context menu
|
|
|
for user and basic mouse events handling.
|
|
|
|
|
|
*To be discussed: the selection tool may be also required in higher
|
|
|
parts of the stack – e.g. for pointing an object that should be modified
|
|
|
by a different tool. The stack right now does not allow duplicate tool
|
|
|
entries, should it be changed or there should be another way of invoking
|
|
|
specific functions of other tools? For example, the move tool calls the
|
|
|
GetSelection() function to obtain the currently selected items.*
|
|
|
|
|
|
### Net highlighting
|
|
|
|
|
|
To make it easier to follow connections on a PCB, there should be a net
|
|
|
highlight mode available. In principle it should work exactly the same
|
|
|
as the high contrast mode, but highlighting nets instead of layers (the
|
|
|
Push and Shove router uses that mode). It should be activated by
|
|
|
clicking on a single component (pad/via/track) belonging to the desired
|
|
|
net with the \[tbd\] key pressed or selecting “Highlight net” in the CM.
|
|
|
|
|
|
### Properties dialog
|
|
|
|
|
|
There should be a properties dialog available for all item types, same
|
|
|
as the one currently available in Pcbnew. The dialog should be shown
|
|
|
after a double click on an item or selected from the CM.
|
|
|
|
|
|
### Update of displayed coordinates
|
|
|
|
|
|
In the GAL mode, the status bar should update the information about
|
|
|
cursor location (X & Y coordinates), as it is done in the default
|
|
|
renderer. Another missing thing are informations about the currently
|
|
|
selected/recently clicked item. This could be displayed after hovering
|
|
|
the mouse cursor over an item, without any clicking and replace the
|
|
|
board statistics informations (number of tracks, vias, etc.)
|
|
|
|
|
|
### Update the 'file changed' flag
|
|
|
|
|
|
Changes introduced by the tools using the Tool Framework should make the
|
|
|
“Save file” toolbar button and menu entry active. This could be
|
|
|
reimplemented using the Observer design pattern, instead of updating the
|
|
|
button on every update UI event (such as mouse movement).
|
|
|
|
|
|
### Alignment of items
|
|
|
|
|
|
For a block of selected items, give an option to align one edge of every
|
|
|
item bounding box to the edge of another item (e.g. the leftmost edge or
|
|
|
the top edge) or centered.
|
|
|
Another related functionality is items spread that puts parts evenly
|
|
|
distanced from each other alongside a chosen axis.
|
|
|
|
|
|
### Undo & redo
|
|
|
|
|
|
Currently one can only revert the current operation (i.e. it is possible
|
|
|
to undo a movement that is still not confirmed by releasing a mouse
|
|
|
button). Tools should have an option to revert at least a few recent
|
|
|
operations, possibly making it consistent with the default KiCad undo
|
|
|
buffer.
|
|
|
The operations should be available under the default hotkeys: Ctrl+Z
|
|
|
(undo), Ctrl+Y (redo).
|
|
|
The most desired solution would be to put all the code associated with
|
|
|
undo/redo operations into a single class. Right now it is spread to
|
|
|
UNDO\_REDO\_CONTAINER, ITEM\_PICKER, PICKED\_ITEMS\_LIST, PCB\_SCREEN
|
|
|
(and ancestors) and PCB\_EDIT\_FRAME.
|
|
|
|
|
|
*Proposed changes:*
|
|
|
|
|
|
- Change the name of ITEM\_PICKER to ITEM\_STATE or UNDO\_ENTRY (it
|
|
|
took me a while to assure myself that this is about holding an item
|
|
|
state) and leave its interface as it is now
|
|
|
- Replace the PICKED\_ITEMS\_LIST with a (typedefed?)
|
|
|
std::list<ITEM_STATE>
|
|
|
- Move undo/redo related functionality from PCB\_SCREEN and
|
|
|
PCB\_SCREEN to UNDO\_REDO\_CONTAINER (how about renaming it to
|
|
|
UNDO\_BUFFER?)
|
|
|
- Limit the undo/redo hotkeys handling functions to something similar
|
|
|
to:
|
|
|
@void PCB\_EDIT\_FRAME::Undo/Redo( wxCommandEvent& event )
|
|
|
{
|
|
|
if( m\_undoContainer.Undo/RedoSize() \<= 0 )
|
|
|
return;
|
|
|
|
|
|
m\_undoContainer.Undo/Redo();
|
|
|
OnModify();
|
|
|
m\_canvas-\>Refresh();
|
|
|
}@
|
|
|
|
|
|
- Add an accessor to the undo buffer.
|
|
|
|
|
|
### Moving cursor using arrow keys
|
|
|
|
|
|
This functionality is currently available in KiCad. It lets users
|
|
|
manipulate items more precisely. To extend it, there could be hotkeys
|
|
|
available to increase a unit movement distance (e.g. by default a single
|
|
|
key press moves an item by 1 grid unit and with Ctrl held by 10
|
|
|
units).
|
|
|
Selected item specific menus
|
|
|
If selected items are of the same type, there could be some extra
|
|
|
specific actions displayed, e.g.
|
|
|
|
|
|
- for zones: Show/Hide/Refill
|
|
|
- for items that belong to the same net: Show/Hide ratsnest, Highlight
|
|
|
|
|
|
## Summary
|
|
|
|
|
|
We should be able to choose any action without any mouse movement, but
|
|
|
only using hotkeys. The CM is designed mainly for the new users to ease
|
|
|
the learning curve and let them learn shortcuts.
|
|
|
Short descriptions of menu actions should pop up, if the mouse cursor is
|
|
|
held over them for a while (e.g. Selection filter: allows to filter
|
|
|
selected items by layer or type).
|
|
|
|
|
|
## Proposal of the new context menu
|
|
|
|
|
|
The illustration presents the concept of the new context menu. Menu
|
|
|
entries prefixed with 'G' are shown only for groups of objects, 'S'
|
|
|
stands for single items, 'T' for type dependent, items without any
|
|
|
prefix are always shown.
|
|
|
Please note that every single item is accessible by a hotkey
|
|
|
combination, e.g. to switch the grid density to 7620: run the context
|
|
|
menu and press G, 8.
|
|
|
|
|
|
|
|
|
|
|
|
### Files
|
|
|
* [sel_filter.png](/uploads/053c7e8e6f1f24f252d221de23d2c17c/sel_filter.png)
|
|
|
* [context_menu.png](/uploads/b8d6a934d0202bd81dfefc95136834e4/context_menu.png)
|
|
|
* [alignment.png](/uploads/28073736f6fff5e768545bbff26104c2/alignment.png)
|
|
|
* [highlight_net.png](/uploads/d1fd306abed37e31af6cc0b09542b1b7/highlight_net.png) |
|
|
\ No newline at end of file |