DRC: Center zoom on marker location, not DRC item start location
For some DRC checks, the location of the marker is not the location of the first item in the resulting DRC_ITEM, so centering the screen on PointA of the DRC_ITEM can be confusing.
This commit is contained in:
parent
b40bf4c0ea
commit
3103e3dc4c
|
@ -137,6 +137,7 @@ void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
|
||||||
m_Pos = aMarkerPos;
|
m_Pos = aMarkerPos;
|
||||||
m_drc.SetData( aErrorCode,
|
m_drc.SetData( aErrorCode,
|
||||||
aText, bText, aPos, bPos );
|
aText, bText, aPos, bPos );
|
||||||
|
m_drc.SetParent( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,6 +147,7 @@ void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
|
||||||
m_Pos = aMarkerPos;
|
m_Pos = aMarkerPos;
|
||||||
m_drc.SetData( aErrorCode,
|
m_drc.SetData( aErrorCode,
|
||||||
aText, aPos );
|
aText, aPos );
|
||||||
|
m_drc.SetParent( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
||||||
|
class MARKER_BASE;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DRC_ITEM
|
* Class DRC_ITEM
|
||||||
|
@ -51,6 +53,9 @@ protected:
|
||||||
bool m_hasSecondItem; ///< true when 2 items create a DRC/ERC error, false if only one item
|
bool m_hasSecondItem; ///< true when 2 items create a DRC/ERC error, false if only one item
|
||||||
bool m_noCoordinate;
|
bool m_noCoordinate;
|
||||||
|
|
||||||
|
/// The marker this item belongs to, if any
|
||||||
|
MARKER_BASE* m_parent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DRC_ITEM()
|
DRC_ITEM()
|
||||||
|
@ -58,6 +63,7 @@ public:
|
||||||
m_ErrorCode = 0;
|
m_ErrorCode = 0;
|
||||||
m_hasSecondItem = false;
|
m_hasSecondItem = false;
|
||||||
m_noCoordinate = false;
|
m_noCoordinate = false;
|
||||||
|
m_parent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRC_ITEM( int aErrorCode,
|
DRC_ITEM( int aErrorCode,
|
||||||
|
@ -127,6 +133,9 @@ public:
|
||||||
m_hasSecondItem = true;
|
m_hasSecondItem = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetParent( MARKER_BASE* aMarker ) { m_parent = aMarker; }
|
||||||
|
|
||||||
|
MARKER_BASE* GetParent() const { return m_parent; }
|
||||||
|
|
||||||
bool HasSecondItem() const { return m_hasSecondItem; }
|
bool HasSecondItem() const { return m_hasSecondItem; }
|
||||||
|
|
||||||
|
|
|
@ -392,10 +392,15 @@ void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
|
||||||
|
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
|
auto pos = item->GetPointA();
|
||||||
|
|
||||||
|
if( auto marker = item->GetParent() )
|
||||||
|
pos = marker->GetPos();
|
||||||
|
|
||||||
// When selecting a item, center it on GAL and just move the graphic
|
// When selecting a item, center it on GAL and just move the graphic
|
||||||
// cursor in legacy mode gives the best result
|
// cursor in legacy mode gives the best result
|
||||||
bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
|
bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
|
||||||
m_brdEditor->FocusOnLocation( item->GetPointA(), true, center );
|
m_brdEditor->FocusOnLocation( pos, true, center );
|
||||||
|
|
||||||
if( !IsModal() )
|
if( !IsModal() )
|
||||||
{
|
{
|
||||||
|
@ -575,10 +580,15 @@ void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
|
||||||
const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
|
const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
|
auto pos = item->GetPointA();
|
||||||
|
|
||||||
|
if( auto marker = item->GetParent() )
|
||||||
|
pos = marker->GetPos();
|
||||||
|
|
||||||
// When selecting a item, center it on GAL and just move the graphic
|
// When selecting a item, center it on GAL and just move the graphic
|
||||||
// cursor in legacy mode gives the best result
|
// cursor in legacy mode gives the best result
|
||||||
bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
|
bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
|
||||||
m_brdEditor->FocusOnLocation( item->GetPointA(), false, center );
|
m_brdEditor->FocusOnLocation( pos, false, center );
|
||||||
RedrawDrawPanel();
|
RedrawDrawPanel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue