Libedit: actual line thickness taken in account by collector. Thick lines are now more easy to locate. Fix incorrect boundary box calculations for LIB_PIN items. Very minor other fixes.
This commit is contained in:
parent
0b91eb30b2
commit
fb8a6bf164
|
@ -6,7 +6,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef KICAD_BUILD_VERSION
|
||||
#define KICAD_BUILD_VERSION "(2011-05-12)"
|
||||
#define KICAD_BUILD_VERSION "(2011-05-25)"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Sep 8 2010)
|
||||
// C++ code generated with wxFormBuilder (version Nov 17 2010)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -151,7 +151,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
|
|||
m_panel1->SetSizer( p1mainSizer );
|
||||
m_panel1->Layout();
|
||||
p1mainSizer->Fit( m_panel1 );
|
||||
m_notebook1->AddPage( m_panel1, _("General Options"), false );
|
||||
m_notebook1->AddPage( m_panel1, _("General Options"), true );
|
||||
m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_panel2->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
|
||||
m_panel2->SetToolTip( _("User defined field names for schematic components. ") );
|
||||
|
@ -240,7 +240,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
|
|||
m_panel2->SetSizer( bSizer6 );
|
||||
m_panel2->Layout();
|
||||
bSizer6->Fit( m_panel2 );
|
||||
m_notebook1->AddPage( m_panel2, _("Template Field Names"), true );
|
||||
m_notebook1->AddPage( m_panel2, _("Template Field Names"), false );
|
||||
|
||||
bOptionsSizer->Add( m_notebook1, 1, wxEXPAND, 0 );
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Sep 8 2010)
|
||||
// C++ code generated with wxFormBuilder (version Nov 17 2010)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
|
|
@ -159,7 +159,7 @@ bool LIB_ARC::Load( char* aLine, wxString& aErrorMsg )
|
|||
|
||||
bool LIB_ARC::HitTest( const wxPoint& aRefPoint )
|
||||
{
|
||||
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
|
||||
int mindist = GetPenSize() / 2;
|
||||
|
||||
// Have a minimal tolerance for hit test
|
||||
if( mindist < MINIMUM_SELECTION_DISTANCE )
|
||||
|
@ -172,6 +172,9 @@ bool LIB_ARC::HitTest( const wxPoint& aRefPoint )
|
|||
bool LIB_ARC::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform )
|
||||
{
|
||||
|
||||
if( aThreshold < 0 )
|
||||
aThreshold = GetPenSize() / 2;
|
||||
|
||||
// TODO: use aTransMat to calculates parameters
|
||||
wxPoint relativePosition = aPosition;
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
|
|||
*/
|
||||
bool LIB_BEZIER::HitTest( const wxPoint& aRefPos )
|
||||
{
|
||||
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
|
||||
int mindist = GetPenSize() / 2;
|
||||
// Have a minimal tolerance for hit test
|
||||
if ( mindist < MINIMUM_SELECTION_DISTANCE )
|
||||
mindist = MINIMUM_SELECTION_DISTANCE;
|
||||
|
@ -346,6 +346,9 @@ bool LIB_BEZIER::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra
|
|||
{
|
||||
wxPoint ref, start, end;
|
||||
|
||||
if( aThreshold < 0 )
|
||||
aThreshold = GetPenSize() / 2;
|
||||
|
||||
for( unsigned ii = 1; ii < GetCornerCount(); ii++ )
|
||||
{
|
||||
start = aTransform.TransformCoordinate( m_PolyPoints[ii - 1] );
|
||||
|
|
|
@ -78,7 +78,7 @@ bool LIB_CIRCLE::Load( char* aLine, wxString& aErrorMsg )
|
|||
*/
|
||||
bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef )
|
||||
{
|
||||
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
|
||||
int mindist = GetPenSize() / 2;
|
||||
|
||||
// Have a minimal tolerance for hit test
|
||||
if( mindist < MINIMUM_SELECTION_DISTANCE )
|
||||
|
@ -97,6 +97,9 @@ bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef )
|
|||
*/
|
||||
bool LIB_CIRCLE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform )
|
||||
{
|
||||
if( aThreshold < 0 )
|
||||
aThreshold = GetPenSize() / 2;
|
||||
|
||||
wxPoint relpos = aPosRef - aTransform.TransformCoordinate( m_Pos );
|
||||
|
||||
int dist = wxRound( sqrt( ( (double) relpos.x * relpos.x ) +
|
||||
|
|
|
@ -101,7 +101,7 @@ SEARCH_RESULT LIB_COLLECTOR::Inspect( EDA_ITEM* aItem, const void* aTestData )
|
|||
|
||||
if( ( m_data.m_unit && item->GetUnit() && ( m_data.m_unit != item->GetUnit() ) )
|
||||
|| ( m_data.m_convert && item->GetConvert() && ( m_data.m_convert != item->GetConvert() ) )
|
||||
|| !item->HitTest( m_RefPos, 2, DefaultTransform ) )
|
||||
|| !item->HitTest( m_RefPos, -1, DefaultTransform ) )
|
||||
return SEARCH_CONTINUE;
|
||||
|
||||
Append( aItem );
|
||||
|
|
|
@ -22,7 +22,7 @@ class LIB_PIN;
|
|||
extern const int fill_tab[];
|
||||
|
||||
|
||||
#define MINIMUM_SELECTION_DISTANCE 15 // Minimum selection distance in mils
|
||||
#define MINIMUM_SELECTION_DISTANCE 2 // Minimum selection distance in internal units
|
||||
|
||||
|
||||
/**
|
||||
|
@ -218,6 +218,9 @@ public:
|
|||
* @param aPosition - a wxPoint to test
|
||||
* @param aThreshold - max distance to this object (usually the half
|
||||
* thickness of a line)
|
||||
* if < 0, it will be automatically set to half
|
||||
* pen size when locating lines or arcs
|
||||
* and set to 0 for other items
|
||||
* @param aTransform - the transform matrix
|
||||
* @return - true if the point \a aPosition is near this object
|
||||
*/
|
||||
|
|
|
@ -349,6 +349,9 @@ bool LIB_FIELD::HitTest( const wxPoint& aPosition )
|
|||
|
||||
bool LIB_FIELD::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform )
|
||||
{
|
||||
if( aThreshold < 0 )
|
||||
aThreshold = 0;
|
||||
|
||||
int extraCharCount = 0;
|
||||
|
||||
// Reference designator text has one or 2 additional character (displays
|
||||
|
|
|
@ -531,6 +531,9 @@ bool LIB_PIN::HitTest( const wxPoint& aPosition )
|
|||
|
||||
bool LIB_PIN::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform )
|
||||
{
|
||||
if( aThreshold < 0 )
|
||||
aThreshold = 0;
|
||||
|
||||
TRANSFORM transform = DefaultTransform;
|
||||
DefaultTransform = aTransform;
|
||||
|
||||
|
@ -1048,7 +1051,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
|
|||
/* Draw the pin end target (active end of the pin)
|
||||
*/
|
||||
BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
|
||||
#define NCSYMB_PIN_DIM TARGET_PIN_DIAM
|
||||
#define NCSYMB_PIN_DIM TARGET_PIN_RADIUS
|
||||
if( m_type == PIN_NC ) // Draw a N.C. symbol
|
||||
{
|
||||
GRLine( clipbox, aDC,
|
||||
|
@ -1064,7 +1067,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
|
|||
*/
|
||||
else if( screen == NULL || !screen->m_IsPrinting )
|
||||
{
|
||||
GRCircle( clipbox, aDC, posX, posY, TARGET_PIN_DIAM, 0, color );
|
||||
GRCircle( clipbox, aDC, posX, posY, TARGET_PIN_RADIUS, 0, color );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1504,7 +1507,7 @@ wxPoint LIB_PIN::ReturnPinEndPoint() const
|
|||
}
|
||||
|
||||
|
||||
int LIB_PIN::ReturnPinDrawOrient( const TRANSFORM& aTransform )
|
||||
int LIB_PIN::ReturnPinDrawOrient( const TRANSFORM& aTransform ) const
|
||||
{
|
||||
int orient;
|
||||
wxPoint end; // position of pin end starting at 0,0 according to its orientation, length = 1
|
||||
|
@ -1816,7 +1819,8 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
|
|||
int nameTextOffset = 0;
|
||||
bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" ));
|
||||
bool showNum = m_number != 0;
|
||||
int symbolY = TARGET_PIN_DIAM / 2;
|
||||
int minsizeV = TARGET_PIN_RADIUS;
|
||||
|
||||
|
||||
if( entry )
|
||||
{
|
||||
|
@ -1831,16 +1835,16 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
|
|||
// First, calculate boundary box corners position
|
||||
int numberTextLength = showNum ? m_PinNumSize * GetNumberString().Len() : 0;
|
||||
|
||||
// Actual text height are bigger than text size
|
||||
// Actual text height is bigger than text size
|
||||
int numberTextHeight = showNum ? wxRound( m_PinNumSize * 1.1 ) : 0;
|
||||
|
||||
if( m_shape & INVERT )
|
||||
symbolY = INVERT_PIN_RADIUS;
|
||||
minsizeV = MAX( TARGET_PIN_RADIUS, INVERT_PIN_RADIUS );
|
||||
|
||||
// calculate top left corner position
|
||||
// for the default pin orientation (PIN_RIGHT)
|
||||
begin.y = numberTextHeight + TXTMARGE;
|
||||
begin.x = MIN( -TARGET_PIN_DIAM / 2, m_length - (numberTextLength / 2) );
|
||||
begin.y = MAX( minsizeV, numberTextHeight + TXTMARGE );
|
||||
begin.x = MIN( -TARGET_PIN_RADIUS, m_length - (numberTextLength / 2) );
|
||||
|
||||
// calculate bottom right corner position and adjust top left corner position
|
||||
int nameTextLength = 0;
|
||||
|
@ -1856,20 +1860,30 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
|
|||
|
||||
nameTextLength = ( m_PinNameSize * length ) + nameTextOffset;
|
||||
// Actual text height are bigger than text size
|
||||
nameTextHeight = wxRound( m_PinNameSize * 1.1 );
|
||||
nameTextHeight = wxRound( m_PinNameSize * 1.1 ) + TXTMARGE;
|
||||
}
|
||||
|
||||
end.x = m_length + nameTextLength;
|
||||
|
||||
end.y = -nameTextHeight / 2;
|
||||
if( end.y > -symbolY )
|
||||
end.y = -symbolY;
|
||||
if( nameTextOffset ) // for values > 0, pin name is inside the body
|
||||
{
|
||||
end.x = m_length + nameTextLength;
|
||||
end.y = MIN( -minsizeV, -nameTextHeight / 2 );
|
||||
}
|
||||
else // if value == 0:
|
||||
// pin name is ouside the body, and above the pin line
|
||||
// pin num is below the pin line
|
||||
{
|
||||
end.x = MAX(m_length, nameTextLength);
|
||||
end.y = -begin.y;
|
||||
begin.y = MAX( minsizeV, nameTextHeight );
|
||||
}
|
||||
|
||||
// Now, calculate boundary box corners position for the actual pin orientation
|
||||
switch( m_orientation )
|
||||
int orient = ReturnPinDrawOrient( DefaultTransform );
|
||||
|
||||
/* Calculate the pin position */
|
||||
switch( orient )
|
||||
{
|
||||
case PIN_UP:
|
||||
|
||||
// Pin is rotated and texts positions are mirrored
|
||||
RotatePoint( &begin, wxPoint( 0, 0 ), -900 );
|
||||
RotatePoint( &end, wxPoint( 0, 0 ), -900 );
|
||||
|
@ -1883,8 +1897,6 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
|
|||
break;
|
||||
|
||||
case PIN_LEFT:
|
||||
|
||||
// Pin is mirrored, not rotated by 180.0 degrees
|
||||
NEGATE( begin.x );
|
||||
NEGATE( end.x );
|
||||
break;
|
||||
|
@ -1893,8 +1905,13 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
|
|||
break;
|
||||
}
|
||||
|
||||
begin = DefaultTransform.TransformCoordinate( begin + m_position);
|
||||
end = DefaultTransform.TransformCoordinate( end + m_position);
|
||||
// Draw Y axis is reversed in schematic:
|
||||
NEGATE( begin.y );
|
||||
NEGATE( end.y );
|
||||
|
||||
wxPoint pos1 = DefaultTransform.TransformCoordinate( m_position );
|
||||
begin += pos1;
|
||||
end += pos1;
|
||||
|
||||
bbox.SetOrigin( begin );
|
||||
bbox.SetEnd( end );
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
class SCH_COMPONENT;
|
||||
|
||||
|
||||
#define TARGET_PIN_DIAM 12 /* Circle diameter drawn at the active end of pins */
|
||||
#define TARGET_PIN_RADIUS 12 /* Circle diameter drawn at the active end of pins */
|
||||
|
||||
#define DEFAULT_TEXT_SIZE 50 /* Default size for field texts */
|
||||
#define PART_NAME_LEN 15 /* Maximum length of part name. */
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
* according to its orientation and the matrix transform (rot, mirror) \a aTransform
|
||||
* @param aTransform = transform matrix
|
||||
*/
|
||||
int ReturnPinDrawOrient( const TRANSFORM& aTransform );
|
||||
int ReturnPinDrawOrient( const TRANSFORM& aTransform ) const;
|
||||
|
||||
/**
|
||||
* Fill a string buffer with pin number.
|
||||
|
|
|
@ -321,7 +321,7 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
|
|||
|
||||
bool LIB_POLYLINE::HitTest( const wxPoint& aPosition )
|
||||
{
|
||||
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
|
||||
int mindist = GetPenSize() / 2;
|
||||
|
||||
// Have a minimal tolerance for hit test
|
||||
if( mindist < MINIMUM_SELECTION_DISTANCE )
|
||||
|
@ -334,6 +334,9 @@ bool LIB_POLYLINE::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM&
|
|||
{
|
||||
wxPoint ref, start, end;
|
||||
|
||||
if( aThreshold < 0 )
|
||||
aThreshold = GetPenSize() / 2;
|
||||
|
||||
for( unsigned ii = 1; ii < GetCornerCount(); ii++ )
|
||||
{
|
||||
start = aTransform.TransformCoordinate( m_PolyPoints[ii - 1] );
|
||||
|
|
|
@ -262,6 +262,9 @@ bool LIB_RECTANGLE::HitTest( const wxPoint& aPosition )
|
|||
|
||||
bool LIB_RECTANGLE::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform )
|
||||
{
|
||||
if( aThreshold < 0 )
|
||||
aThreshold = GetPenSize() / 2;
|
||||
|
||||
wxPoint actualStart = aTransform.TransformCoordinate( m_Pos );
|
||||
wxPoint actualEnd = aTransform.TransformCoordinate( m_End );
|
||||
|
||||
|
|
|
@ -169,6 +169,9 @@ bool LIB_TEXT::HitTest( const wxPoint& aPosition )
|
|||
|
||||
bool LIB_TEXT::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform )
|
||||
{
|
||||
if( aThreshold < 0 )
|
||||
aThreshold = 0;
|
||||
|
||||
wxPoint physicalpos = aTransform.TransformCoordinate( m_Pos );
|
||||
wxPoint tmp = m_Pos;
|
||||
m_Pos = physicalpos;
|
||||
|
|
|
@ -502,14 +502,16 @@ wxPoint SCH_SHEET::GetSheetNamePosition()
|
|||
wxPoint SCH_SHEET::GetFileNamePosition()
|
||||
{
|
||||
wxPoint pos = m_Pos;
|
||||
int margin = GetPenSize() + 4;
|
||||
|
||||
if( IsVerticalOrientation() )
|
||||
{
|
||||
pos.x += m_Size.x+4;
|
||||
pos.x += m_Size.x + margin;
|
||||
pos.y += m_Size.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.y += m_Size.y + 4;
|
||||
pos.y += m_Size.y + margin;
|
||||
}
|
||||
|
||||
return pos;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
; General Product Description Definitions
|
||||
!define PRODUCT_NAME "KiCad"
|
||||
!define PRODUCT_VERSION "2011.05.12"
|
||||
!define PRODUCT_VERSION "2011.05.25"
|
||||
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
|
||||
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
|
||||
!define COMPANY_NAME ""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
release version:
|
||||
2011 may 12
|
||||
2011 may 25
|
||||
files (.zip,.tgz):
|
||||
kicad-2011-05-12
|
||||
|
|
Loading…
Reference in New Issue