← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Allow to edit an schematic item while dragging


Le 28/12/2012 21:39, Antia Puentes a écrit :
In eeschema, it is not possible to access the Edit Schematic Item dialog
while dragging an item because the dragging is implemented by simulating
a block command, and the edit functionality is missing in the block
context menu, and the related hotkeys are inactive as well.

For schematic components (SCH_COMPONENT), the dragged block is composed
by the component plus its connections (if any). For other schematic
items that can be edited, like labels or text, is composed by the item
itself. As the block to be dragged is formed in two steps: first the
items (SCH_SCREEN::UpdatePickList), next its connections if the item is
a SCH_COMPONENT (SCH_SCREEN::SelectBlockItems), we can detect if the
block was originally composed by only one item.

The attached patch allows to edit an schematic item that constitutes a
block by adding the Edit Item entry to the block context menu,
independently of the operation being done: dragging, moving or copying
the block. Hotkeys for editing (HK_EDIT, HK_EDIT_COMPONENT_{VALUE,
REFERENCE, FOOTPRINT}) should work as well. For schematic components, it
takes into account that some properties should be not edited while
dragging, like the Chip Name.  In principle, for text, and local,
hierarchical and global labels all the fields are editable, but
it can be changed if needed.

More details about the patch:

- When updating the list of components of the block
(SCH_SCREEN::UpdatePickList), if the block is composed of only one item,
set the current item to point to that item (BASE_SCREEN::SetCurItem).

- When the user clicks the mouse right button to show the context menu,
check if there is an active block of only one item
(screen->IsBlockActive() && screen->GetCurrentItem() != NULL), if so,
add the Edit entry to the block context menu.

- In the Edit SCH_COMPONENT menu, if the current item is being dragged
(flag IS_DRAGGED), disable some fields.

- As for blocks composed by one item, the SCH_SCREEN::GetCurItem is now
different from NULL, it is necessary to:
  * Check if a block exists before starting a Move Item command initiated
via hotkey ('M')(SCH_EDIT_FRAME::OnMoveItem).
  * Remove the check for SCH_SCREEN::GetCurItemfor == NULL before
starting an orient and rotate block operation
(SCH_EDIT_FRAME::On{Rotate, Orient}).

Committed. Thanks.

Jean-Pierre CHARRAS