Commit 3132c70e authored by Henner Zeller's avatar Henner Zeller Committed by Brian Sidebotham

* Apply Henner Zeller's patch to add connecting line from reference and labels...

* Apply Henner Zeller's patch to add connecting line from reference and labels to component position whilst moving to help identify which component the reference or label belongs too
parent 7061d6c2
......@@ -199,6 +199,16 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
LineWidth, m_Italic, m_Bold );
// While moving: don't loose visual contact to which component this label belongs.
if ( IsWireImage() )
{
const wxPoint origin = parentComponent->GetPosition();
textpos = m_Pos - origin;
textpos = parentComponent->GetScreenCoord( textpos );
textpos += parentComponent->GetPosition();
GRLine( clipbox, DC, origin.x, origin.y, textpos.x, textpos.y, 2, DARKGRAY );
}
/* Enable this to draw the bounding box around the text field to validate
* the bounding box calculations.
*/
......
......@@ -653,6 +653,7 @@ static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositio
item->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
// Draw the item item at it's new position.
item->SetWireImage(); // While moving, the item may choose to render differently
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}
......@@ -697,6 +698,11 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
// Never delete existing item, because it can be referenced by an undo/redo command
// Just restore its data
currentItem->SwapData( oldItem );
// Erase the wire representation before the 'normal' view is drawn.
if ( item->IsWireImage() )
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
item->ClearFlags();
}
......
......@@ -973,6 +973,10 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
SaveUndoItemInUndoList( undoItem );
}
// Erase the wire representation before the 'normal' view is drawn.
if ( item->IsWireImage() )
item->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
item->ClearFlags();
screen->SetModify();
screen->SetCurItem( NULL );
......
......@@ -298,7 +298,7 @@ public:
#define IS_RESIZED (1 << 5) ///< Item being resized
#define IS_DRAGGED (1 << 6) ///< Item being dragged
#define IS_DELETED (1 << 7)
#define IS_WIRE_IMAGE (1 << 8)
#define IS_WIRE_IMAGE (1 << 8) ///< Item to be drawn as wireframe while editing
#define STARTPOINT (1 << 9)
#define ENDPOINT (1 << 10)
#define SELECTED (1 << 11)
......@@ -389,11 +389,13 @@ public:
inline bool IsModified() const { return m_Flags & IS_CHANGED; }
inline bool IsMoving() const { return m_Flags & IS_MOVED; }
inline bool IsDragging() const { return m_Flags & IS_DRAGGED; }
inline bool IsWireImage() const { return m_Flags & IS_WIRE_IMAGE; }
inline bool IsSelected() const { return m_Flags & SELECTED; }
inline bool IsResized() const { return m_Flags & IS_RESIZED; }
inline bool IsHighlighted() const { return m_Flags & HIGHLIGHTED; }
inline bool IsBrightened() const { return m_Flags & BRIGHTENED; }
inline void SetWireImage() { SetFlags( IS_WIRE_IMAGE ); }
inline void SetSelected() { SetFlags( SELECTED ); ViewUpdate( COLOR ); }
inline void SetHighlighted() { SetFlags( HIGHLIGHTED ); ViewUpdate( COLOR ); }
inline void SetBrightened() { SetFlags( BRIGHTENED ); }
......
Markdown is supported
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