Commit 9861941d authored by stambaughw's avatar stambaughw

Component library editor and viewer improvements and library draw object changes.

* Component library viewer restores state between uses.
* Fixed automatic zoom calculations in library viewer.
* Make library entry list dialog restore previous selection.
* Fix bounding box calculation for vertical field and text draw objects.
* Changed library draw object comparison to test for greater and less than.
* Initial preparation for merging separate library component draw item lists.
parent afb6898f
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include "protos.h" #include "protos.h"
LibDrawText::LibDrawText(LIB_COMPONENT * aParent) : LibDrawText::LibDrawText(LIB_COMPONENT * aParent) :
LIB_DRAW_ITEM( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ), LIB_DRAW_ITEM( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ),
EDA_TextStruct() EDA_TextStruct()
...@@ -176,7 +174,7 @@ LIB_DRAW_ITEM* LibDrawText::DoGenCopy() ...@@ -176,7 +174,7 @@ LIB_DRAW_ITEM* LibDrawText::DoGenCopy()
{ {
LibDrawText* newitem = new LibDrawText(NULL); LibDrawText* newitem = new LibDrawText(NULL);
newitem->m_Pos = m_Pos; newitem->m_Pos = m_Pos;
newitem->m_Orient = m_Orient; newitem->m_Orient = m_Orient;
newitem->m_Size = m_Size; newitem->m_Size = m_Size;
newitem->m_Attributs = m_Attributs; newitem->m_Attributs = m_Attributs;
...@@ -193,14 +191,30 @@ LIB_DRAW_ITEM* LibDrawText::DoGenCopy() ...@@ -193,14 +191,30 @@ LIB_DRAW_ITEM* LibDrawText::DoGenCopy()
} }
bool LibDrawText::DoCompare( const LIB_DRAW_ITEM& other ) const int LibDrawText::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE );
const LibDrawText* tmp = ( LibDrawText* ) &other; const LibDrawText* tmp = ( LibDrawText* ) &other;
return ( ( m_Pos == tmp->m_Pos ) && ( m_Size == tmp->m_Size ) int result = m_Text.CmpNoCase( tmp->m_Text );
&& ( m_Text == tmp->m_Text ) );
if( result != 0 )
return result;
if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x;
if( m_Pos.y != tmp->m_Pos.y )
return m_Pos.y - tmp->m_Pos.y;
if( m_Size.x != tmp->m_Size.x )
return m_Size.x - tmp->m_Size.x;
if( m_Size.y != tmp->m_Size.y )
return m_Size.y - tmp->m_Size.y;
return 0;
} }
...@@ -259,7 +273,8 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -259,7 +273,8 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
{ {
wxPoint pos1, pos2; wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE ); int color = ReturnLayerColor( LAYER_DEVICE );
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
if( ( m_Selected & IS_SELECTED ) ) if( ( m_Selected & IS_SELECTED ) )
...@@ -270,16 +285,18 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -270,16 +285,18 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset; pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
/* The text orientation may need to be flipped if the
* transformation matrix causes xy axes to be flipped. */
int t1 = ( aTransformMatrix[0][0] != 0 ) ^ ( m_Orient != 0 );
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, m_Text, DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, m_Orient, m_Size, m_HJustify, m_VJustify,
m_Size, m_HJustify, m_VJustify,
GetPenSize( ), m_Italic, m_Bold ); GetPenSize( ), m_Italic, m_Bold );
#if 0
EDA_Rect bBox = GetBoundingBox();
bBox.Inflate( 1, 1 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
} }
...@@ -294,3 +311,22 @@ void LibDrawText::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -294,3 +311,22 @@ void LibDrawText::DisplayInfo( WinEDA_DrawFrame* frame )
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE ); frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE );
} }
EDA_Rect LibDrawText::GetBoundingBox()
{
EDA_Rect rect = GetTextBox();
rect.m_Pos.y *= -1;
rect.m_Pos.y -= rect.GetHeight();
wxPoint orig = rect.GetOrigin();
wxPoint end = rect.GetEnd();
wxPoint center = rect.Centre();
RotatePoint( &orig, center, m_Orient );
RotatePoint( &end, center, m_Orient );
rect.SetOrigin( orig );
rect.SetEnd( end );
return rect;
}
...@@ -486,7 +486,7 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc, ...@@ -486,7 +486,7 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc,
/* Enable this to draw the bounding box around the component to validate /* Enable this to draw the bounding box around the component to validate
* the bounding box calculations. */ * the bounding box calculations. */
#if 0 #if 0
EDA_Rect bBox = LibEntry->GetBoundaryBox( Multi, convert ); EDA_Rect bBox = GetBoundaryBox( multi, convert );
GRRect( &panel->m_ClipBox, dc, bBox.GetOrigin().x, bBox.GetOrigin().y, GRRect( &panel->m_ClipBox, dc, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif #endif
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include "base_struct.h" #include "base_struct.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "class_drawpanel.h"
#include "trigo.h"
#include "program.h" #include "program.h"
#include "general.h" #include "general.h"
...@@ -309,9 +311,20 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -309,9 +311,20 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxString* text = aData ? (wxString*)aData : &m_Text; wxString* text = aData ? (wxString*)aData : &m_Text;
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
DrawGraphicText( aPanel, aDC, text_pos, (EDA_Colors) color, *text, DrawGraphicText( aPanel, aDC, text_pos, (EDA_Colors) color, *text,
m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, m_Orient, m_Size, m_HJustify, m_VJustify, linewidth,
m_Size, m_HJustify, m_VJustify, linewidth, m_Italic, m_Italic, m_Bold );
m_Bold );
/* Set to one (1) to draw bounding box around field text to validate
* bounding box calculation. */
#if 0
wxString tmp = m_Text;
m_Text = *text;
EDA_Rect bBox = GetBoundingBox();
m_Text = tmp;
bBox.Inflate( 1, 1 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
} }
...@@ -404,14 +417,33 @@ void LibDrawField::Copy( LibDrawField* Target ) const ...@@ -404,14 +417,33 @@ void LibDrawField::Copy( LibDrawField* Target ) const
} }
bool LibDrawField::DoCompare( const LIB_DRAW_ITEM& other ) const int LibDrawField::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_FIELD_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_FIELD_DRAW_TYPE );
const LibDrawField* tmp = ( LibDrawField* ) &other; const LibDrawField* tmp = ( LibDrawField* ) &other;
return ( ( m_FieldId == tmp->m_FieldId ) && ( m_Text == tmp->m_Text ) if( m_FieldId == tmp->m_FieldId )
&& ( m_Pos == tmp->m_Pos ) && ( m_Size == tmp->m_Size ) ); return m_FieldId - tmp->m_FieldId;
int result = m_Text.CmpNoCase( tmp->m_Text );
if( result != 0 )
return result;
if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x;
if( m_Pos.y != tmp->m_Pos.y )
return m_Pos.y - tmp->m_Pos.y;
if( m_Size.x != tmp->m_Size.x )
return m_Size.x - tmp->m_Size.x;
if( m_Size.y != tmp->m_Size.y )
return m_Size.y - tmp->m_Size.y;
return 0;
} }
...@@ -476,6 +508,25 @@ wxString LibDrawField::GetFullText( int unit ) ...@@ -476,6 +508,25 @@ wxString LibDrawField::GetFullText( int unit )
} }
EDA_Rect LibDrawField::GetBoundingBox()
{
EDA_Rect rect = GetTextBox();
rect.m_Pos.y *= -1;
rect.m_Pos.y -= rect.GetHeight();
wxPoint orig = rect.GetOrigin();
wxPoint end = rect.GetEnd();
wxPoint center = rect.Centre();
RotatePoint( &orig, center, m_Orient );
RotatePoint( &end, center, m_Orient );
rect.SetOrigin( orig );
rect.SetEnd( end );
return rect;
}
/** /**
* Function ReturnDefaultFieldName * Function ReturnDefaultFieldName
* Return the default field name from its index (REFERENCE, VALUE ..) * Return the default field name from its index (REFERENCE, VALUE ..)
......
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
* *
* @return EDA_Rect - Bounding rectangle. * @return EDA_Rect - Bounding rectangle.
*/ */
virtual EDA_Rect GetBoundingBox() { return GetTextBox(); } virtual EDA_Rect GetBoundingBox();
/** /**
* Function HitTest * Function HitTest
...@@ -132,7 +132,7 @@ public: ...@@ -132,7 +132,7 @@ public:
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy(); virtual LIB_DRAW_ITEM* DoGenCopy();
virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const; virtual int DoCompare( const LIB_DRAW_ITEM& other ) const;
virtual void DoOffset( const wxPoint& offset ); virtual void DoOffset( const wxPoint& offset );
virtual bool DoTestInside( EDA_Rect& rect ); virtual bool DoTestInside( EDA_Rect& rect );
virtual void DoMove( const wxPoint& newPosition ); virtual void DoMove( const wxPoint& newPosition );
......
...@@ -368,6 +368,15 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, ...@@ -368,6 +368,15 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
Entry->m_DrawPinNum, Entry->m_DrawPinName, Entry->m_DrawPinNum, Entry->m_DrawPinName,
aColor, aDrawMode ); aColor, aDrawMode );
} }
/* Set to one (1) to draw bounding box around pin to validate bounding
* box calculation. */
#if 0
EDA_Rect bBox = GetBoundingBox();
bBox.Inflate( 5, 5 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
} }
...@@ -1083,13 +1092,27 @@ LIB_DRAW_ITEM* LibDrawPin::DoGenCopy() ...@@ -1083,13 +1092,27 @@ LIB_DRAW_ITEM* LibDrawPin::DoGenCopy()
} }
bool LibDrawPin::DoCompare( const LIB_DRAW_ITEM& other ) const int LibDrawPin::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_PIN_DRAW_TYPE );
const LibDrawPin* tmp = ( LibDrawPin* ) &other; const LibDrawPin* tmp = ( LibDrawPin* ) &other;
return ( m_Pos == tmp->m_Pos ); if( m_PinNum != tmp->m_PinNum )
return m_PinNum - tmp->m_PinNum;
int result = m_PinName.CmpNoCase( tmp->m_PinName );
if( result != 0 )
return result;
if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x;
if( m_Pos.y != tmp->m_Pos.y )
return m_Pos.y - tmp->m_Pos.y;
return 0;
} }
......
...@@ -85,7 +85,28 @@ bool LIB_DRAW_ITEM::operator==( const LIB_DRAW_ITEM& other ) const ...@@ -85,7 +85,28 @@ bool LIB_DRAW_ITEM::operator==( const LIB_DRAW_ITEM& other ) const
return ( ( Type() == other.Type() ) return ( ( Type() == other.Type() )
&& ( m_Unit == other.m_Unit ) && ( m_Unit == other.m_Unit )
&& ( m_Convert == other.m_Convert ) && ( m_Convert == other.m_Convert )
&& DoCompare( other ) ); && DoCompare( other ) == 0 );
}
bool LIB_DRAW_ITEM::operator<( const LIB_DRAW_ITEM& other ) const
{
int result = Type() - other.Type();
if( result < 0 )
return true;
result = m_Unit - other.m_Unit;
if( result < 0 )
return true;
result = m_Convert - other.m_Convert;
if( result < 0 )
return true;
return DoCompare( other ) < 0;
} }
...@@ -276,14 +297,25 @@ LIB_DRAW_ITEM* LibDrawArc::DoGenCopy() ...@@ -276,14 +297,25 @@ LIB_DRAW_ITEM* LibDrawArc::DoGenCopy()
} }
bool LibDrawArc::DoCompare( const LIB_DRAW_ITEM& other ) const int LibDrawArc::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_ARC_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_ARC_DRAW_TYPE );
const LibDrawArc* tmp = ( LibDrawArc* ) &other; const LibDrawArc* tmp = ( LibDrawArc* ) &other;
return ( ( m_Pos == tmp->m_Pos ) && ( m_t1 == tmp->m_t1 ) if( m_Pos.x != tmp->m_Pos.x )
&& ( m_t2 == tmp->m_t2 ) ); return m_Pos.x - tmp->m_Pos.x;
if( m_Pos.y != tmp->m_Pos.y )
return m_Pos.y - tmp->m_Pos.y;
if( m_t1 != tmp->m_t1 )
return m_t1 - tmp->m_t1;
if( m_t2 != tmp->m_t2 )
return m_t2 - tmp->m_t2;
return 0;
} }
...@@ -591,13 +623,22 @@ LIB_DRAW_ITEM* LibDrawCircle::DoGenCopy() ...@@ -591,13 +623,22 @@ LIB_DRAW_ITEM* LibDrawCircle::DoGenCopy()
} }
bool LibDrawCircle::DoCompare( const LIB_DRAW_ITEM& other ) const int LibDrawCircle::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_CIRCLE_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_CIRCLE_DRAW_TYPE );
const LibDrawCircle* tmp = ( LibDrawCircle* ) &other; const LibDrawCircle* tmp = ( LibDrawCircle* ) &other;
return ( ( m_Pos == tmp->m_Pos ) && ( m_Radius == tmp->m_Radius ) ); if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x;
if( m_Pos.y != tmp->m_Pos.y )
return m_Pos.y - tmp->m_Pos.y;
if( m_Radius != tmp->m_Radius )
return m_Radius - tmp->m_Radius;
return 0;
} }
...@@ -673,6 +714,14 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -673,6 +714,14 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
else else
GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
m_Radius, GetPenSize( ), color ); m_Radius, GetPenSize( ), color );
/* Set to one (1) to draw bounding box around circle to validate bounding
* box calculation. */
#if 0
EDA_Rect bBox = GetBoundingBox();
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
} }
...@@ -785,13 +834,25 @@ LIB_DRAW_ITEM* LibDrawSquare::DoGenCopy() ...@@ -785,13 +834,25 @@ LIB_DRAW_ITEM* LibDrawSquare::DoGenCopy()
} }
bool LibDrawSquare::DoCompare( const LIB_DRAW_ITEM& other ) const int LibDrawSquare::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_RECT_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_RECT_DRAW_TYPE );
const LibDrawSquare* tmp = ( LibDrawSquare* ) &other; const LibDrawSquare* tmp = ( LibDrawSquare* ) &other;
return ( ( m_Pos == tmp->m_Pos ) && ( m_End == tmp->m_End ) ); if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x;
if( m_Pos.y != tmp->m_Pos.y )
return m_Pos.y - tmp->m_Pos.y;
if( m_End.x != tmp->m_End.x )
return m_End.x - tmp->m_End.x;
if( m_End.y != tmp->m_End.y )
return m_End.y - tmp->m_End.y;
return 0;
} }
...@@ -870,6 +931,15 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -870,6 +931,15 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
else else
GRRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GRRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
GetPenSize( ), color ); GetPenSize( ), color );
/* Set to one (1) to draw bounding box around rectangle to validate
* bounding box calculation. */
#if 0
EDA_Rect bBox = GetBoundingBox();
bBox.Inflate( m_Width + 1, m_Width + 1 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
} }
...@@ -1009,13 +1079,25 @@ LIB_DRAW_ITEM* LibDrawSegment::DoGenCopy() ...@@ -1009,13 +1079,25 @@ LIB_DRAW_ITEM* LibDrawSegment::DoGenCopy()
} }
bool LibDrawSegment::DoCompare( const LIB_DRAW_ITEM& other ) const int LibDrawSegment::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_LINE_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_LINE_DRAW_TYPE );
const LibDrawSegment* tmp = ( LibDrawSegment* ) &other; const LibDrawSegment* tmp = ( LibDrawSegment* ) &other;
return ( ( m_Pos == tmp->m_Pos ) && ( m_End == tmp->m_End ) ); if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x;
if( m_Pos.y != tmp->m_Pos.y )
return m_Pos.y - tmp->m_Pos.y;
if( m_End.x != tmp->m_End.x )
return m_End.x - tmp->m_End.x;
if( m_End.y != tmp->m_End.y )
return m_End.y - tmp->m_End.y;
return 0;
} }
...@@ -1082,6 +1164,15 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -1082,6 +1164,15 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
GRLine( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GRLine( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
GetPenSize( ), color ); GetPenSize( ), color );
/* Set to one (1) to draw bounding box around line segment to validate
* bounding box calculation. */
#if 0
EDA_Rect bBox = GetBoundingBox();
bBox.Inflate( m_Width + 2, m_Width + 2 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
} }
...@@ -1257,21 +1348,24 @@ LIB_DRAW_ITEM* LibDrawPolyline::DoGenCopy() ...@@ -1257,21 +1348,24 @@ LIB_DRAW_ITEM* LibDrawPolyline::DoGenCopy()
} }
bool LibDrawPolyline::DoCompare( const LIB_DRAW_ITEM& other ) const int LibDrawPolyline::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_POLYLINE_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_POLYLINE_DRAW_TYPE );
const LibDrawPolyline* tmp = ( LibDrawPolyline* ) &other; const LibDrawPolyline* tmp = ( LibDrawPolyline* ) &other;
if( m_PolyPoints.size() != tmp->m_PolyPoints.size() ) if( m_PolyPoints.size() != tmp->m_PolyPoints.size() )
return false; return m_PolyPoints.size() - tmp->m_PolyPoints.size();
for( size_t i = 0; i < m_PolyPoints.size(); i++ ) for( size_t i = 0; i < m_PolyPoints.size(); i++ )
{ {
if( m_PolyPoints[i] != tmp->m_PolyPoints[i] ) if( m_PolyPoints[i].x != tmp->m_PolyPoints[i].x )
return false; return m_PolyPoints[i].x - tmp->m_PolyPoints[i].x;
if( m_PolyPoints[i].y != tmp->m_PolyPoints[i].y )
return m_PolyPoints[i].y - tmp->m_PolyPoints[i].y;
} }
return true;
return 0;
} }
...@@ -1383,6 +1477,15 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -1383,6 +1477,15 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
else else
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
Buf_Poly_Drawings, 0, GetPenSize( ), color, color ); Buf_Poly_Drawings, 0, GetPenSize( ), color, color );
/* Set to one (1) to draw bounding box around polyline to validate
* bounding box calculation. */
#if 0
EDA_Rect bBox = GetBoundingBox();
bBox.Inflate( m_Width + 1, m_Width + 1 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
} }
...@@ -1589,22 +1692,24 @@ LIB_DRAW_ITEM* LibDrawBezier::DoGenCopy() ...@@ -1589,22 +1692,24 @@ LIB_DRAW_ITEM* LibDrawBezier::DoGenCopy()
} }
bool LibDrawBezier::DoCompare( const LIB_DRAW_ITEM& other ) const int LibDrawBezier::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_BEZIER_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_BEZIER_DRAW_TYPE );
const LibDrawBezier* tmp = ( LibDrawBezier* ) &other; const LibDrawBezier* tmp = ( LibDrawBezier* ) &other;
if( m_BezierPoints.size() != tmp->m_BezierPoints.size() ) if( m_BezierPoints.size() != tmp->m_BezierPoints.size() )
return false; return m_BezierPoints.size() - tmp->m_BezierPoints.size();
for( size_t i = 0; i < m_BezierPoints.size(); i++ ) for( size_t i = 0; i < m_BezierPoints.size(); i++ )
{ {
if( m_BezierPoints[i] != tmp->m_BezierPoints[i] ) if( m_BezierPoints[i].x != tmp->m_BezierPoints[i].x )
return false; return m_BezierPoints[i].x - tmp->m_BezierPoints[i].x;
if( m_BezierPoints[i].y != tmp->m_BezierPoints[i].y )
return m_BezierPoints[i].y - tmp->m_BezierPoints[i].y;
} }
return true; return 0;
} }
...@@ -1712,6 +1817,14 @@ void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -1712,6 +1817,14 @@ void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 0, GetPenSize(), color, color ); &PolyPointsTraslated[0], 0, GetPenSize(), color, color );
/* Set to one (1) to draw bounding box around bezier curve to validate
* bounding box calculation. */
#if 0
EDA_Rect bBox = GetBoundingBox();
bBox.Inflate( m_Width + 1, m_Width + 1 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
class LIB_COMPONENT; class LIB_COMPONENT;
class PLOTTER; class PLOTTER;
class LIB_DRAW_ITEM;
#define TARGET_PIN_DIAM 12 /* Circle diameter drawn at the active end of #define TARGET_PIN_DIAM 12 /* Circle diameter drawn at the active end of
...@@ -36,7 +37,8 @@ class PLOTTER; ...@@ -36,7 +37,8 @@ class PLOTTER;
* Enum ElectricPinType * Enum ElectricPinType
* is the set of schematic pin types, used in ERC tests. * is the set of schematic pin types, used in ERC tests.
*/ */
enum ElectricPinType { enum ElectricPinType
{
PIN_INPUT, PIN_INPUT,
PIN_OUTPUT, PIN_OUTPUT,
PIN_BIDI, PIN_BIDI,
...@@ -62,10 +64,11 @@ extern const wxChar* MsgPinElectricType[]; ...@@ -62,10 +64,11 @@ extern const wxChar* MsgPinElectricType[];
* Enum DrawPinShape * Enum DrawPinShape
* is the set of shapes allowed for pins. * is the set of shapes allowed for pins.
*/ */
enum DrawPinShape { enum DrawPinShape
NONE = 0, {
INVERT = 1, NONE = 0,
CLOCK = 2, INVERT = 1,
CLOCK = 2,
LOWLEVEL_IN = 4, LOWLEVEL_IN = 4,
LOWLEVEL_OUT = 8 LOWLEVEL_OUT = 8
}; };
...@@ -75,10 +78,11 @@ enum DrawPinShape { ...@@ -75,10 +78,11 @@ enum DrawPinShape {
* Enum DrawPinOrient * Enum DrawPinOrient
* is the set of orientations allowed for pins. * is the set of orientations allowed for pins.
*/ */
enum DrawPinOrient { enum DrawPinOrient
{
PIN_RIGHT = 'R', PIN_RIGHT = 'R',
PIN_LEFT = 'L', PIN_LEFT = 'L',
PIN_UP = 'U', PIN_UP = 'U',
PIN_DOWN = 'D', PIN_DOWN = 'D',
}; };
...@@ -200,7 +204,7 @@ public: ...@@ -200,7 +204,7 @@ public:
/** /**
* Test LIB_DRAW_ITEM objects for equivalence. * Test LIB_DRAW_ITEM objects for equivalence.
* *
* @param tst - Object to test against. * @param other - Object to test against.
* *
* @return bool - True if object is identical to this object. * @return bool - True if object is identical to this object.
*/ */
...@@ -210,6 +214,15 @@ public: ...@@ -210,6 +214,15 @@ public:
return *this == *other; return *this == *other;
} }
/**
* Test if another draw item is less than this draw object.
*
* @param other - Draw item to compare against.
*
* @return bool - True if object is less than this object.
*/
bool operator<( const LIB_DRAW_ITEM& other) const;
/** /**
* Set drawing object offset from the current position. * Set drawing object offset from the current position.
* *
...@@ -261,7 +274,7 @@ protected: ...@@ -261,7 +274,7 @@ protected:
* *
* This is called by the == operator. * This is called by the == operator.
*/ */
virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const = 0; virtual int DoCompare( const LIB_DRAW_ITEM& other ) const = 0;
virtual void DoOffset( const wxPoint& offset ) = 0; virtual void DoOffset( const wxPoint& offset ) = 0;
virtual bool DoTestInside( EDA_Rect& rect ) = 0; virtual bool DoTestInside( EDA_Rect& rect ) = 0;
virtual void DoMove( const wxPoint& newPosition ) = 0; virtual void DoMove( const wxPoint& newPosition ) = 0;
...@@ -270,6 +283,12 @@ protected: ...@@ -270,6 +283,12 @@ protected:
}; };
/**
* Helper for defining a list of library draw object pointers.
*/
typedef boost::ptr_vector< LIB_DRAW_ITEM > LIB_DRAW_ITEM_LIST;
/********/ /********/
/* Pins */ /* Pins */
/********/ /********/
...@@ -395,7 +414,7 @@ public: ...@@ -395,7 +414,7 @@ public:
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy(); virtual LIB_DRAW_ITEM* DoGenCopy();
virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const; virtual int DoCompare( const LIB_DRAW_ITEM& other ) const;
virtual void DoOffset( const wxPoint& offset ); virtual void DoOffset( const wxPoint& offset );
virtual bool DoTestInside( EDA_Rect& rect ); virtual bool DoTestInside( EDA_Rect& rect );
virtual void DoMove( const wxPoint& newPosition ); virtual void DoMove( const wxPoint& newPosition );
...@@ -471,7 +490,7 @@ public: ...@@ -471,7 +490,7 @@ public:
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy(); virtual LIB_DRAW_ITEM* DoGenCopy();
virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const; virtual int DoCompare( const LIB_DRAW_ITEM& other ) const;
virtual void DoOffset( const wxPoint& offset ); virtual void DoOffset( const wxPoint& offset );
virtual bool DoTestInside( EDA_Rect& rect ); virtual bool DoTestInside( EDA_Rect& rect );
virtual void DoMove( const wxPoint& newPosition ); virtual void DoMove( const wxPoint& newPosition );
...@@ -543,7 +562,7 @@ public: ...@@ -543,7 +562,7 @@ public:
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy(); virtual LIB_DRAW_ITEM* DoGenCopy();
virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const; virtual int DoCompare( const LIB_DRAW_ITEM& other ) const;
virtual void DoOffset( const wxPoint& offset ); virtual void DoOffset( const wxPoint& offset );
virtual bool DoTestInside( EDA_Rect& rect ); virtual bool DoTestInside( EDA_Rect& rect );
virtual void DoMove( const wxPoint& newPosition ); virtual void DoMove( const wxPoint& newPosition );
...@@ -586,7 +605,7 @@ public: ...@@ -586,7 +605,7 @@ public:
* @param refPos A wxPoint to test * @param refPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
virtual bool HitTest( const wxPoint& refPos ); virtual bool HitTest( const wxPoint& refPos );
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is near a segment * @return true if the point aPosRef is near a segment
...@@ -604,7 +623,7 @@ public: ...@@ -604,7 +623,7 @@ public:
* @param refArea : the given EDA_Rect * @param refArea : the given EDA_Rect
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
virtual bool HitTest( EDA_Rect& refArea ) virtual bool HitTest( EDA_Rect& refArea )
{ {
return TextHitTest( refArea ); return TextHitTest( refArea );
} }
...@@ -620,9 +639,11 @@ public: ...@@ -620,9 +639,11 @@ public:
virtual void DisplayInfo( WinEDA_DrawFrame* frame ); virtual void DisplayInfo( WinEDA_DrawFrame* frame );
virtual EDA_Rect GetBoundingBox();
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy(); virtual LIB_DRAW_ITEM* DoGenCopy();
virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const; virtual int DoCompare( const LIB_DRAW_ITEM& other ) const;
virtual void DoOffset( const wxPoint& offset ); virtual void DoOffset( const wxPoint& offset );
virtual bool DoTestInside( EDA_Rect& rect ); virtual bool DoTestInside( EDA_Rect& rect );
virtual void DoMove( const wxPoint& newPosition ); virtual void DoMove( const wxPoint& newPosition );
...@@ -693,7 +714,7 @@ public: ...@@ -693,7 +714,7 @@ public:
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy(); virtual LIB_DRAW_ITEM* DoGenCopy();
virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const; virtual int DoCompare( const LIB_DRAW_ITEM& other ) const;
virtual void DoOffset( const wxPoint& offset ); virtual void DoOffset( const wxPoint& offset );
virtual bool DoTestInside( EDA_Rect& rect ); virtual bool DoTestInside( EDA_Rect& rect );
virtual void DoMove( const wxPoint& newPosition ); virtual void DoMove( const wxPoint& newPosition );
...@@ -763,7 +784,7 @@ public: ...@@ -763,7 +784,7 @@ public:
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy(); virtual LIB_DRAW_ITEM* DoGenCopy();
virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const; virtual int DoCompare( const LIB_DRAW_ITEM& other ) const;
virtual void DoOffset( const wxPoint& offset ); virtual void DoOffset( const wxPoint& offset );
virtual bool DoTestInside( EDA_Rect& rect ); virtual bool DoTestInside( EDA_Rect& rect );
virtual void DoMove( const wxPoint& newPosition ); virtual void DoMove( const wxPoint& newPosition );
...@@ -844,7 +865,7 @@ public: ...@@ -844,7 +865,7 @@ public:
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy(); virtual LIB_DRAW_ITEM* DoGenCopy();
virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const; virtual int DoCompare( const LIB_DRAW_ITEM& other ) const;
virtual void DoOffset( const wxPoint& offset ); virtual void DoOffset( const wxPoint& offset );
virtual bool DoTestInside( EDA_Rect& rect ); virtual bool DoTestInside( EDA_Rect& rect );
virtual void DoMove( const wxPoint& newPosition ); virtual void DoMove( const wxPoint& newPosition );
...@@ -925,7 +946,7 @@ public: ...@@ -925,7 +946,7 @@ public:
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy(); virtual LIB_DRAW_ITEM* DoGenCopy();
virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const; virtual int DoCompare( const LIB_DRAW_ITEM& other ) const;
virtual void DoOffset( const wxPoint& offset ); virtual void DoOffset( const wxPoint& offset );
virtual bool DoTestInside( EDA_Rect& rect ); virtual bool DoTestInside( EDA_Rect& rect );
virtual void DoMove( const wxPoint& newPosition ); virtual void DoMove( const wxPoint& newPosition );
......
...@@ -44,12 +44,6 @@ bool g_HVLines = true; // Bool: force H or V directions (Wires, Bus ..) ...@@ -44,12 +44,6 @@ bool g_HVLines = true; // Bool: force H or V directions (Wires, Bus ..)
struct EESchemaVariables g_EESchemaVar; struct EESchemaVariables g_EESchemaVar;
/* Variables globales pour Libview */
wxString g_CurrentViewLibraryName; /* nom de la librairie en cours d'examen */
wxString g_CurrentViewComponentName; /* nom du le composant en cours d'examen */
int g_ViewConvert; /* Vue normal / convert */
int g_ViewUnit; /* part a afficher (A, B ..) */
/* Variables globales pour Schematic Edit */ /* Variables globales pour Schematic Edit */
int g_DefaultTextLabelSize = DEFAULT_SIZE_TEXT; int g_DefaultTextLabelSize = DEFAULT_SIZE_TEXT;
......
...@@ -125,11 +125,6 @@ struct EESchemaVariables ...@@ -125,11 +125,6 @@ struct EESchemaVariables
extern struct EESchemaVariables g_EESchemaVar; extern struct EESchemaVariables g_EESchemaVar;
/* Variables globales pour Libview */
extern wxString g_CurrentViewLibraryName; /* nom de la librairie en cours d'examen */
extern wxString g_CurrentViewComponentName; /* nom du le composant en cours d'examen */
extern int g_ViewConvert; /* Vue normal / convert */
extern int g_ViewUnit; /* part a afficher (A, B ..) */
/* Variables globales pour Schematic Edit */ /* Variables globales pour Schematic Edit */
extern int g_DefaultTextLabelSize; extern int g_DefaultTextLabelSize;
......
...@@ -31,7 +31,6 @@ static wxPoint OldPos; ...@@ -31,7 +31,6 @@ static wxPoint OldPos;
wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent ) wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
{ {
wxString name;
WinEDA_ViewlibFrame* Viewer; WinEDA_ViewlibFrame* Viewer;
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
WinEDA_SchematicFrame* frame; WinEDA_SchematicFrame* frame;
...@@ -39,23 +38,23 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent ) ...@@ -39,23 +38,23 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
Viewer = frame->m_ViewlibFrame; Viewer = frame->m_ViewlibFrame;
/* Close the current Lib browser, if open, and open a new one, in "modal" mode */ /* Close the current Lib browser, if open, and open a new one, in
* "modal" mode */
if( Viewer ) if( Viewer )
Viewer->Destroy(); Viewer->Destroy();
Viewer = frame->m_ViewlibFrame = Viewer = frame->m_ViewlibFrame = new WinEDA_ViewlibFrame( frame, NULL,
new WinEDA_ViewlibFrame( frame, NULL, &semaphore ); &semaphore );
Viewer->AdjustScrollBars(); Viewer->AdjustScrollBars();
// Show the library viewer frame until it is closed // Show the library viewer frame until it is closed
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
{ {
wxYield(); wxYield();
wxMilliSleep( 50 ); wxMilliSleep( 50 );
} }
name = g_CurrentViewComponentName; return Viewer->GetEntryName();
return name;
} }
......
...@@ -248,7 +248,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field ) ...@@ -248,7 +248,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
if( Field->m_Orient ) if( Field->m_Orient )
Field->m_Orient = 0; Field->m_Orient = 0;
else else
Field->m_Orient = 1; Field->m_Orient = 900;
int drawMode = g_XorMode; int drawMode = g_XorMode;
...@@ -264,24 +264,20 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field ) ...@@ -264,24 +264,20 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
LIB_DRAW_ITEM* WinEDA_LibeditFrame::LocateItemUsingCursor() LIB_DRAW_ITEM* WinEDA_LibeditFrame::LocateItemUsingCursor()
{ {
LIB_DRAW_ITEM* DrawEntry = m_drawItem;
if( m_component == NULL ) if( m_component == NULL )
return NULL; return NULL;
if( ( DrawEntry == NULL ) || ( DrawEntry->m_Flags == 0 ) ) if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
{ {
DrawEntry = m_drawItem = m_drawItem = m_component->LocateDrawItem( m_unit, m_convert,
m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, TYPE_NOT_INIT,
GetScreen()->m_MousePosition ); GetScreen()->m_MousePosition );
if( DrawEntry == NULL ) if( m_drawItem == NULL )
{ m_drawItem = m_component->LocateDrawItem( m_unit, m_convert,
DrawEntry = m_drawItem = TYPE_NOT_INIT,
m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, GetScreen()->m_Curseur );
GetScreen()->m_Curseur );
}
} }
return DrawEntry; return m_drawItem;
} }
...@@ -58,6 +58,8 @@ public: ...@@ -58,6 +58,8 @@ public:
void LoadSettings(); void LoadSettings();
void SaveSettings(); void SaveSettings();
wxString& GetEntryName( void ) const { return m_entryName; }
private: private:
void SelectCurrentLibrary(); void SelectCurrentLibrary();
void SelectAndViewLibraryPart( int option ); void SelectAndViewLibraryPart( int option );
...@@ -65,6 +67,13 @@ private: ...@@ -65,6 +67,13 @@ private:
void ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ); void ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
protected:
static wxString m_libraryName;
static wxString m_entryName;
static int m_unit;
static int m_convert;
static wxSize m_clientSize;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
...@@ -75,6 +75,9 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame, ...@@ -75,6 +75,9 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
WinEDAListBox dlg( frame, _( "Select Component" ), ListNames, OldName, WinEDAListBox dlg( frame, _( "Select Component" ), ListNames, OldName,
DisplayCmpDoc, wxColour( 255, 255, 255 ) ); DisplayCmpDoc, wxColour( 255, 255, 255 ) );
if( !OldName.IsEmpty() )
dlg.m_List->SetStringSelection( OldName );
dlg.MoveMouseToOrigin(); dlg.MoveMouseToOrigin();
int rsp = dlg.ShowModal(); int rsp = dlg.ShowModal();
......
...@@ -102,27 +102,27 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar() ...@@ -102,27 +102,27 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
m_HToolBar->Realize(); m_HToolBar->Realize();
} }
if( (g_CurrentViewLibraryName != wxEmptyString) if( (m_libraryName != wxEmptyString)
&& (g_CurrentViewComponentName != wxEmptyString) ) && (m_entryName != wxEmptyString) )
{ {
lib = CMP_LIBRARY::FindLibrary( g_CurrentViewLibraryName ); lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( lib != NULL ) if( lib != NULL )
{ {
component = lib->FindComponent( g_CurrentViewComponentName ); component = lib->FindComponent( m_entryName );
if( component && component->HasConversion() ) if( component && component->HasConversion() )
asdeMorgan = true; asdeMorgan = true;
entry = lib->FindEntry( g_CurrentViewComponentName ); entry = lib->FindEntry( m_entryName );
} }
} }
// Must be AFTER Realize(): // Must be AFTER Realize():
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT,
(g_ViewConvert <= 1) ? TRUE : FALSE ); (m_convert <= 1) ? TRUE : FALSE );
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
(g_ViewConvert >= 2) ? TRUE : FALSE ); (m_convert >= 2) ? TRUE : FALSE );
m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, asdeMorgan ); m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, asdeMorgan );
m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan ); m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan );
...@@ -137,7 +137,7 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar() ...@@ -137,7 +137,7 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
SelpartBox->Append( msg ); SelpartBox->Append( msg );
} }
SelpartBox->SetSelection( 0 ); SelpartBox->SetSelection( m_unit - 1 );
SelpartBox->Enable( component && component->HasConversion() ); SelpartBox->Enable( component && component->HasConversion() );
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC,
......
...@@ -16,6 +16,16 @@ ...@@ -16,6 +16,16 @@
#include "class_library.h" #include "class_library.h"
/**
* Save previous component library viewer state.
*/
wxString WinEDA_ViewlibFrame::m_libraryName;
wxString WinEDA_ViewlibFrame::m_entryName;
int WinEDA_ViewlibFrame::m_unit = 1;
int WinEDA_ViewlibFrame::m_convert = 1;
wxSize WinEDA_ViewlibFrame::m_clientSize = wxSize( -1, -1 );
/*****************************/ /*****************************/
/* class WinEDA_ViewlibFrame */ /* class WinEDA_ViewlibFrame */
/*****************************/ /*****************************/
...@@ -122,7 +132,10 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, ...@@ -122,7 +132,10 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
} }
else else
{ {
g_CurrentViewLibraryName = Library->GetName(); m_libraryName = Library->GetName();
m_entryName.Clear();
m_unit = 1;
m_convert = 1;
m_LibListSize.x = 0; m_LibListSize.x = 0;
} }
...@@ -149,7 +162,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, ...@@ -149,7 +162,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
DisplayLibInfos(); DisplayLibInfos();
if( DrawPanel ) if( DrawPanel )
DrawPanel->SetAcceleratorTable( table ); DrawPanel->SetAcceleratorTable( table );
BestZoom(); Zoom_Automatique( false );
Show( TRUE ); Show( TRUE );
} }
...@@ -162,9 +175,7 @@ WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame() ...@@ -162,9 +175,7 @@ WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
} }
/*****************************************************************/
void WinEDA_ViewlibFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_ViewlibFrame::OnCloseWindow( wxCloseEvent& Event )
/*****************************************************************/
{ {
SaveSettings(); SaveSettings();
if( m_Semaphore ) if( m_Semaphore )
...@@ -173,12 +184,10 @@ void WinEDA_ViewlibFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -173,12 +184,10 @@ void WinEDA_ViewlibFrame::OnCloseWindow( wxCloseEvent& Event )
} }
/****************************************************/ /*
void WinEDA_ViewlibFrame::OnSashDrag( wxSashEvent& event ) * Resize sub windows when dragging a sash window border
/****************************************************/
/* Resize sub windows when dragging a sash window border
*/ */
void WinEDA_ViewlibFrame::OnSashDrag( wxSashEvent& event )
{ {
if( event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE ) if( event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE )
return; return;
...@@ -212,9 +221,7 @@ void WinEDA_ViewlibFrame::OnSashDrag( wxSashEvent& event ) ...@@ -212,9 +221,7 @@ void WinEDA_ViewlibFrame::OnSashDrag( wxSashEvent& event )
} }
/*****************************************************/
void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv ) void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
/*****************************************************/
{ {
wxSize clientsize; wxSize clientsize;
wxSize maintoolbar_size; wxSize maintoolbar_size;
...@@ -270,12 +277,10 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv ) ...@@ -270,12 +277,10 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
} }
/***********************************/
int WinEDA_ViewlibFrame::BestZoom() int WinEDA_ViewlibFrame::BestZoom()
/***********************************/
{ {
int bestzoom, ii, jj; int bestzoom, ii, jj;
wxSize size, itemsize; wxSize size;
LIB_COMPONENT* component; LIB_COMPONENT* component;
CMP_LIBRARY* lib; CMP_LIBRARY* lib;
...@@ -283,33 +288,51 @@ int WinEDA_ViewlibFrame::BestZoom() ...@@ -283,33 +288,51 @@ int WinEDA_ViewlibFrame::BestZoom()
GetScreen()->m_Curseur.y = 0; GetScreen()->m_Curseur.y = 0;
bestzoom = 16; bestzoom = 16;
lib = CMP_LIBRARY::FindLibrary( g_CurrentViewLibraryName ); lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( lib == NULL ) if( lib == NULL )
return bestzoom; return bestzoom;
component = lib->FindComponent( g_CurrentViewComponentName ); component = lib->FindComponent( m_entryName );
if( component == NULL ) if( component == NULL )
{
bestzoom = 16;
GetScreen()->m_Curseur.x = 0;
GetScreen()->m_Curseur.y = 0;
return bestzoom; return bestzoom;
/*
* This fixes a bug where the client size of the drawing area is not
* correctly reported until after the window is shown. This is most
* likely due to the unmanaged windows ( vertical tool bars and message
* panel ) that are drawn in the main window which wxWidgets knows
* nothing about. When the library editor is reopened with a component
* already loading, the zoom will be calculated correctly.
*/
if( !IsShownOnScreen() )
{
if( m_clientSize != wxSize( -1, -1 ) )
size = m_clientSize;
else
size = DrawPanel->GetClientSize();
}
else
{
if( m_clientSize == wxSize( -1, -1 ) )
m_clientSize = DrawPanel->GetClientSize();
size = m_clientSize;
} }
EDA_Rect BoundaryBox = component->GetBoundaryBox( g_ViewUnit, EDA_Rect BoundaryBox = component->GetBoundaryBox( m_unit, m_convert );
g_ViewConvert );
itemsize = BoundaryBox.GetSize(); // Reserve a 25 mils margin around component bounding box.
size = DrawPanel->GetClientSize(); size -= wxSize( 25, 25 );
size -= wxSize( 25, 25 ); // reserve a 25 mils margin. ii = wxRound( ( (double) BoundaryBox.GetWidth() / double( size.x ) ) *
ii = wxRound( double( itemsize.x ) / double( size.x ) ); (double) GetScreen()->m_ZoomScalar );
jj = wxRound( double( itemsize.y ) / double( size.y ) ); jj = wxRound( ( (double) BoundaryBox.GetHeight() / (double) size.y ) *
(double) GetScreen()->m_ZoomScalar );
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
GetScreen()->m_Curseur = BoundaryBox.Centre(); GetScreen()->m_Curseur = BoundaryBox.Centre();
return bestzoom * GetScreen()->m_ZoomScalar; return bestzoom;
} }
...@@ -321,34 +344,27 @@ int WinEDA_ViewlibFrame::BestZoom() ...@@ -321,34 +344,27 @@ int WinEDA_ViewlibFrame::BestZoom()
*/ */
void WinEDA_ViewlibFrame::ReCreateListLib() void WinEDA_ViewlibFrame::ReCreateListLib()
{ {
wxArrayString libNamesList;
bool found = false;
if( m_LibList == NULL ) if( m_LibList == NULL )
return; return;
m_LibList->Clear(); m_LibList->Clear();
libNamesList = CMP_LIBRARY::GetLibraryNames(); m_LibList->Append( CMP_LIBRARY::GetLibraryNames() );
m_LibList->Append( libNamesList );
// Search for a previous selection: // Search for a previous selection:
for ( unsigned ii = 0; ii < m_LibList->GetCount(); ii++ ) int index = m_LibList->FindString( m_libraryName );
if( index != wxNOT_FOUND )
{ {
if( g_CurrentViewLibraryName.Cmp( m_LibList->GetString( ii ) ) == 0 ) m_LibList->SetSelection( index, true );
{
m_LibList->SetSelection( ii, TRUE );
found = TRUE;
break;
}
} }
else
/* If not found, clear current library selection because it can be
* deleted after a config change.
*/
if( !found )
{ {
g_CurrentViewLibraryName.Empty(); /* If not found, clear current library selection because it can be
g_CurrentViewComponentName.Empty(); * deleted after a config change. */
m_libraryName = wxEmptyString;
m_entryName = wxEmptyString;
m_unit = 1;
m_convert = 1;
} }
ReCreateListCmp(); ReCreateListCmp();
...@@ -363,17 +379,35 @@ void WinEDA_ViewlibFrame::ReCreateListCmp() ...@@ -363,17 +379,35 @@ void WinEDA_ViewlibFrame::ReCreateListCmp()
if( m_CmpList == NULL ) if( m_CmpList == NULL )
return; return;
CMP_LIBRARY* Library = CMP_LIBRARY::FindLibrary( g_CurrentViewLibraryName );
wxArrayString nameList;
m_CmpList->Clear(); m_CmpList->Clear();
g_CurrentViewComponentName.Empty();
g_ViewConvert = 1; /* Select normal/"de morgan" shape */ CMP_LIBRARY* Library = CMP_LIBRARY::FindLibrary( m_libraryName );
g_ViewUnit = 1; /* Select unit to display for multiple
* parts per package */ if( Library == NULL )
if( Library ) {
Library->GetEntryNames( nameList ); m_libraryName = wxEmptyString;
m_entryName = wxEmptyString;
m_convert = 1;
m_unit = 1;
return;
}
wxArrayString nameList;
Library->GetEntryNames( nameList );
m_CmpList->Append( nameList ); m_CmpList->Append( nameList );
int index = m_CmpList->FindString( m_entryName );
if( index == wxNOT_FOUND )
{
m_entryName = wxEmptyString;
m_convert = 1;
m_unit = 1;
}
else
{
m_CmpList->SetSelection( index, true );
}
} }
...@@ -385,9 +419,9 @@ void WinEDA_ViewlibFrame::ClickOnLibList( wxCommandEvent& event ) ...@@ -385,9 +419,9 @@ void WinEDA_ViewlibFrame::ClickOnLibList( wxCommandEvent& event )
return; return;
wxString name = m_LibList->GetString( ii ); wxString name = m_LibList->GetString( ii );
if( g_CurrentViewLibraryName == name ) if( m_libraryName == name )
return; return;
g_CurrentViewLibraryName = name; m_libraryName = name;
ReCreateListCmp(); ReCreateListCmp();
DrawPanel->Refresh(); DrawPanel->Refresh();
DisplayLibInfos(); DisplayLibInfos();
...@@ -403,13 +437,17 @@ void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event ) ...@@ -403,13 +437,17 @@ void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event )
return; return;
wxString name = m_CmpList->GetString( ii ); wxString name = m_CmpList->GetString( ii );
g_CurrentViewComponentName = name;
DisplayLibInfos(); if( m_entryName.CmpNoCase( name ) != 0 )
g_ViewUnit = 1; {
g_ViewConvert = 1; m_entryName = name;
Zoom_Automatique( FALSE ); DisplayLibInfos();
ReCreateHToolbar(); m_unit = 1;
DrawPanel->Refresh(); m_convert = 1;
Zoom_Automatique( false );
ReCreateHToolbar();
DrawPanel->Refresh();
}
} }
...@@ -422,9 +460,9 @@ void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event ) ...@@ -422,9 +460,9 @@ void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event )
int ii = m_CmpList->GetSelection(); int ii = m_CmpList->GetSelection();
if( ii >= 0 ) if( ii >= 0 )
g_CurrentViewComponentName = m_CmpList->GetString( ii ); m_entryName = m_CmpList->GetString( ii );
else else
g_CurrentViewComponentName.Empty(); m_entryName.Empty();
Close( TRUE ); Close( TRUE );
} }
......
...@@ -48,8 +48,8 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -48,8 +48,8 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_LIBVIEW_VIEWDOC: case ID_LIBVIEW_VIEWDOC:
LibEntry = CMP_LIBRARY::FindLibraryEntry( g_CurrentViewComponentName, LibEntry = CMP_LIBRARY::FindLibraryEntry( m_entryName,
g_CurrentViewLibraryName ); m_libraryName );
if( LibEntry && ( !LibEntry->m_DocFile.IsEmpty() ) ) if( LibEntry && ( !LibEntry->m_DocFile.IsEmpty() ) )
GetAssociatedDocument( this, LibEntry->m_DocFile, GetAssociatedDocument( this, LibEntry->m_DocFile,
...@@ -59,14 +59,14 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -59,14 +59,14 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT: case ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT:
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, TRUE ); m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, TRUE );
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, FALSE ); m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, FALSE );
g_ViewConvert = 1; m_convert = 1;
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT: case ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT:
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, FALSE ); m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, FALSE );
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, TRUE ); m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, TRUE );
g_ViewConvert = 2; m_convert = 2;
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
...@@ -74,7 +74,7 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -74,7 +74,7 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event )
ii = SelpartBox->GetChoice(); ii = SelpartBox->GetChoice();
if( ii < 0 ) if( ii < 0 )
return; return;
g_ViewUnit = ii + 1; m_unit = ii + 1;
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
...@@ -104,15 +104,15 @@ void WinEDA_ViewlibFrame::DisplayLibInfos() ...@@ -104,15 +104,15 @@ void WinEDA_ViewlibFrame::DisplayLibInfos()
wxString msg; wxString msg;
CMP_LIBRARY* Lib; CMP_LIBRARY* Lib;
Lib = CMP_LIBRARY::FindLibrary( g_CurrentViewLibraryName ); Lib = CMP_LIBRARY::FindLibrary( m_libraryName );
msg = _( "Library browser" ); msg = _( "Library Browser" );
msg << wxT( " [" ); msg << wxT( " [" );
if( Lib ) if( Lib )
msg << Lib->GetFullFileName(); msg << Lib->GetFullFileName();
else else
msg += _( "none selected" ); msg += _( "no library selected" );
msg << wxT( "]" ); msg << wxT( "]" );
SetTitle( msg ); SetTitle( msg );
...@@ -129,8 +129,8 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary() ...@@ -129,8 +129,8 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary()
Lib = SelectLibraryFromList( this ); Lib = SelectLibraryFromList( this );
if( Lib ) if( Lib )
{ {
g_CurrentViewComponentName.Empty(); m_entryName.Empty();
g_CurrentViewLibraryName = Lib->GetName(); m_libraryName = Lib->GetName();
DisplayLibInfos(); DisplayLibInfos();
if( m_LibList ) if( m_LibList )
{ {
...@@ -138,7 +138,7 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary() ...@@ -138,7 +138,7 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary()
DrawPanel->Refresh(); DrawPanel->Refresh();
DisplayLibInfos(); DisplayLibInfos();
ReCreateHToolbar(); ReCreateHToolbar();
int id = m_LibList->FindString( g_CurrentViewLibraryName.GetData() ); int id = m_LibList->FindString( m_libraryName.GetData() );
if( id >= 0 ) if( id >= 0 )
m_LibList->SetSelection( id ); m_LibList->SetSelection( id );
} }
...@@ -153,22 +153,22 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option ) ...@@ -153,22 +153,22 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option )
{ {
CMP_LIBRARY* Lib; CMP_LIBRARY* Lib;
if( g_CurrentViewLibraryName.IsEmpty() ) if( m_libraryName.IsEmpty() )
SelectCurrentLibrary(); SelectCurrentLibrary();
if( g_CurrentViewLibraryName.IsEmpty() ) if( m_libraryName.IsEmpty() )
return; return;
Lib = CMP_LIBRARY::FindLibrary( g_CurrentViewLibraryName ); Lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( Lib == NULL ) if( Lib == NULL )
return; return;
if( ( g_CurrentViewComponentName.IsEmpty() ) || ( option == NEW_PART ) ) if( ( m_entryName.IsEmpty() ) || ( option == NEW_PART ) )
{ {
ViewOneLibraryContent( Lib, NEW_PART ); ViewOneLibraryContent( Lib, NEW_PART );
return; return;
} }
CMP_LIB_ENTRY* LibEntry = Lib->FindEntry( g_CurrentViewComponentName ); CMP_LIB_ENTRY* LibEntry = Lib->FindEntry( m_entryName );
if( LibEntry == NULL ) if( LibEntry == NULL )
return; return;
...@@ -208,12 +208,12 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) ...@@ -208,12 +208,12 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
if( Flag == NEW_PART ) if( Flag == NEW_PART )
{ {
DisplayComponentsNamesInLib( this, Lib, CmpName, DisplayComponentsNamesInLib( this, Lib, CmpName,
g_CurrentViewComponentName ); m_entryName );
} }
if( Flag == NEXT_PART ) if( Flag == NEXT_PART )
{ {
LibEntry = Lib->GetNextEntry( g_CurrentViewComponentName ); LibEntry = Lib->GetNextEntry( m_entryName );
if( LibEntry ) if( LibEntry )
CmpName = LibEntry->m_Name.m_Text; CmpName = LibEntry->m_Name.m_Text;
...@@ -221,24 +221,24 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) ...@@ -221,24 +221,24 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
if( Flag == PREVIOUS_PART ) if( Flag == PREVIOUS_PART )
{ {
LibEntry = Lib->GetPreviousEntry( g_CurrentViewComponentName ); LibEntry = Lib->GetPreviousEntry( m_entryName );
if( LibEntry ) if( LibEntry )
CmpName = LibEntry->m_Name.m_Text; CmpName = LibEntry->m_Name.m_Text;
} }
g_ViewUnit = 1; m_unit = 1;
g_ViewConvert = 1; m_convert = 1;
LibEntry = Lib->FindEntry( CmpName ); LibEntry = Lib->FindEntry( CmpName );
g_CurrentViewComponentName = CmpName; m_entryName = CmpName;
DisplayLibInfos(); DisplayLibInfos();
Zoom_Automatique( FALSE ); Zoom_Automatique( false );
RedrawActiveWindow( &dc, TRUE ); RedrawActiveWindow( &dc, true );
if( m_CmpList ) if( m_CmpList )
{ {
int id = m_CmpList->FindString( g_CurrentViewComponentName.GetData() ); int id = m_CmpList->FindString( m_entryName.GetData() );
if( id >= 0 ) if( id >= 0 )
m_CmpList->SetSelection( id ); m_CmpList->SetSelection( id );
} }
...@@ -260,12 +260,12 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -260,12 +260,12 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
ActiveScreen = GetScreen(); ActiveScreen = GetScreen();
lib = CMP_LIBRARY::FindLibrary( g_CurrentViewLibraryName ); lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( lib == NULL ) if( lib == NULL )
return; return;
entry = lib->FindEntry( g_CurrentViewComponentName ); entry = lib->FindEntry( m_entryName );
if( entry == NULL ) if( entry == NULL )
return; return;
...@@ -292,10 +292,10 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -292,10 +292,10 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/* Temporarily change the name field text to reflect the alias name. */ /* Temporarily change the name field text to reflect the alias name. */
tmp = component->GetName(); tmp = component->GetName();
component->m_Name.m_Text = alias->GetName(); component->m_Name.m_Text = alias->GetName();
if( g_ViewUnit < 1 ) if( m_unit < 1 )
g_ViewUnit = 1; m_unit = 1;
if( g_ViewConvert < 1 ) if( m_convert < 1 )
g_ViewConvert = 1; m_convert = 1;
component->m_Name.m_Text = tmp; component->m_Name.m_Text = tmp;
} }
else else
...@@ -304,8 +304,8 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -304,8 +304,8 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
msg = _( "None" ); msg = _( "None" );
} }
component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_ViewUnit, component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit, m_convert,
g_ViewConvert, GR_DEFAULT_DRAWMODE ); GR_DEFAULT_DRAWMODE );
if( !tmp.IsEmpty() ) if( !tmp.IsEmpty() )
component->m_Name.m_Text = tmp; component->m_Name.m_Text = tmp;
......
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