Commit f43d1aaa authored by charras's avatar charras

Added text justification for graphic texts in libedit and more(see changelog)

parent a56c02e9
...@@ -4,6 +4,15 @@ KiCad ChangeLog 2009 ...@@ -4,6 +4,15 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-june-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Eeschema:
Added text justification for graphic texts in libedit
Minor bug 2803506 fixed (error when mirroring bus entries)
Some code cleaning.
Better locating algo for arcs in libedit
2009-may-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2009-may-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++Eeschema: ++Eeschema:
......
...@@ -250,8 +250,8 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine ) ...@@ -250,8 +250,8 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
rect.SetSize( textsize ); rect.SetSize( textsize );
/* Now, calculate the rect origin, according to text justification /* Now, calculate the rect origin, according to text justification
* At this point the area origin is the text origin (m_Pos). * At this point the rectangle origin is the text origin (m_Pos).
* This is true only for left and top text justified texts. * This is true only for left and top text justified texts (using top to bottom Y axis orientation).
* and must be recalculated for others justifications * and must be recalculated for others justifications
* also, note the V justification is relative to the first line * also, note the V justification is relative to the first line
*/ */
...@@ -290,13 +290,14 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine ) ...@@ -290,13 +290,14 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
/*************************************************/ /*************************************************/
bool EDA_TextStruct::HitTest( const wxPoint& posref ) bool EDA_TextStruct::TextHitTest( const wxPoint& posref )
/*************************************************/ /*************************************************/
/* locate function /**
* return: * Function TextHitTest (overlayed)
* true if posref is inside the text area. * tests if the given point is inside this object.
* false else. * @param posref point to test
* @return bool - true if a hit, else false
*/ */
{ {
EDA_Rect rect = GetTextBox( -1 ); // Get the full text area. EDA_Rect rect = GetTextBox( -1 ); // Get the full text area.
...@@ -310,13 +311,13 @@ bool EDA_TextStruct::HitTest( const wxPoint& posref ) ...@@ -310,13 +311,13 @@ bool EDA_TextStruct::HitTest( const wxPoint& posref )
/** /**
* Function HitTest (overlayed) * Function TextHitTest (overlayed)
* tests if the given EDA_Rect intersect this object. * tests if the given EDA_Rect intersect this object.
* @param refArea the given EDA_Rect to test * @param refArea the given EDA_Rect to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
/*********************************************************/ /*********************************************************/
bool EDA_TextStruct::HitTest( EDA_Rect& refArea ) bool EDA_TextStruct::TextHitTest( EDA_Rect& refArea )
/*********************************************************/ /*********************************************************/
{ {
if( refArea.Inside( m_Pos ) ) if( refArea.Inside( m_Pos ) )
......
...@@ -620,7 +620,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct ) ...@@ -620,7 +620,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
static void MirrorYPoint( wxPoint& point, wxPoint& Center ) static void MirrorYPoint( wxPoint& point, wxPoint& Center )
{ {
point.x -= Center.x; point.x -= Center.x;
point.x = -point.x; NEGATE(point.x);
point.x += Center.x; point.x += Center.x;
} }
...@@ -683,6 +683,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center ) ...@@ -683,6 +683,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
DrawRaccord = (DrawBusEntryStruct*) DrawStruct; DrawRaccord = (DrawBusEntryStruct*) DrawStruct;
MirrorYPoint( DrawRaccord->m_Pos, Center ); MirrorYPoint( DrawRaccord->m_Pos, Center );
NEGATE(DrawRaccord->m_Size.x);
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
......
...@@ -254,44 +254,24 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -254,44 +254,24 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
*/ */
bool LibDrawField::HitTest( const wxPoint& refPos ) bool LibDrawField::HitTest( const wxPoint& refPos )
{ {
EDA_Rect bbox; // bounding box for the text
int dx; // X size for the full text
bbox.SetOrigin( m_Pos );
dx = m_Size.x * m_Text.Len();
// Reference designator text has one additional character (displays U?) // Reference designator text has one additional character (displays U?)
if( m_FieldId == REFERENCE ) if( m_FieldId == REFERENCE )
dx += m_Size.x; m_Text.Append('?');
// if using TextHitTest() remember this function uses top to bottom y axis convention
// spacing between characters is 0.1 the character size // and for lib items we are using bottom to top convention
dx = (int) ( (double) dx * 10.0 / 9 ); // so for non center Y justification we use a trick.
int dy = m_Size.y; GRTextVertJustifyType vJustify = m_VJustify;
if ( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
if( m_Orient ) m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
EXCHG( dx, dy ); // Swap X and Y size for a vertical text else if ( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
m_VJustify = GR_TEXT_VJUSTIFY_TOP;
// adjust position of the left bottom corner according to the justification
// pos is at this point correct for a left and top justified text
// Horizontal justification
if( m_HJustify == GR_TEXT_HJUSTIFY_CENTER )
bbox.Offset( -dx / 2, 0 );
else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
bbox.Offset( -dx, 0 );
// Vertical justification
if( m_VJustify == GR_TEXT_VJUSTIFY_CENTER )
bbox.Offset( 0, -dy / 2 );
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
bbox.Offset( 0, -dy );
bbox.SetSize( dx, dy ); bool hit = TextHitTest(refPos);
m_VJustify = vJustify;
if( bbox.Inside( refPos ) ) if( m_FieldId == REFERENCE )
return true; m_Text.RemoveLast( );
return hit;
return false;
} }
......
...@@ -59,7 +59,16 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -59,7 +59,16 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent;
GRTextHorizJustifyType hjustify; GRTextHorizJustifyType hjustify;
GRTextVertJustifyType vjustify; GRTextVertJustifyType vjustify;
int LineWidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; int LineWidth = m_Width;
if (LineWidth == 0) // Use default values for pen size
{
if ( m_Bold )
LineWidth = GetPenSizeForBold( m_Size.x );
else
LineWidth = g_DrawDefaultLineThickness;
}
// Clip pen size for small texts: // Clip pen size for small texts:
LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold ); LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold );
...@@ -153,7 +162,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -153,7 +162,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
DrawGraphicText( panel, DC, pos, color, m_Text, DrawGraphicText( panel, DC, pos, color, m_Text,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
m_Size, hjustify, vjustify, LineWidth, m_Italic, m_Bold, false ); m_Size, hjustify, vjustify, LineWidth, m_Italic, m_Bold );
} }
else else
{ {
......
...@@ -95,7 +95,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) : ...@@ -95,7 +95,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
*/ */
bool SCH_TEXT::HitTest( const wxPoint& aPosRef ) bool SCH_TEXT::HitTest( const wxPoint& aPosRef )
{ {
return EDA_TextStruct::HitTest( aPosRef ); return TextHitTest( aPosRef );
} }
......
This diff is collapsed.
...@@ -281,6 +281,15 @@ public: ...@@ -281,6 +281,15 @@ public:
virtual bool Save( FILE* aFile ) const; virtual bool Save( FILE* aFile ) const;
virtual bool Load( char* line, wxString& errorMsg ); virtual bool Load( char* line, wxString& errorMsg );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param aRefPos A wxPoint to test
* @return bool - true if a hit, else false
*/
virtual bool HitTest( const wxPoint& aRefPos );
LibDrawArc* GenCopy(); LibDrawArc* GenCopy();
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
...@@ -322,6 +331,14 @@ public: ...@@ -322,6 +331,14 @@ public:
virtual bool Save( FILE* aFile ) const; virtual bool Save( FILE* aFile ) const;
virtual bool Load( char* line, wxString& errorMsg ); virtual bool Load( char* line, wxString& errorMsg );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param aRefPos A wxPoint to test
* @return bool - true if a hit, else false
*/
virtual bool HitTest( const wxPoint& aRefPos );
LibDrawCircle* GenCopy(); LibDrawCircle* GenCopy();
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
...@@ -360,6 +377,26 @@ public: ...@@ -360,6 +377,26 @@ public:
virtual bool Save( FILE* aFile ) const; virtual bool Save( FILE* aFile ) const;
virtual bool Load( char* line, wxString& errorMsg ); virtual bool Load( char* line, wxString& errorMsg );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
virtual bool HitTest( const wxPoint& refPos );
/**
* Function HitTest (overlayed)
* tests if the given EDA_Rect intersect this object.
* For now, an ending point must be inside this rect.
* @param refArea : the given EDA_Rect
* @return bool - true if a hit, else false
*/
virtual bool HitTest( EDA_Rect& refArea )
{
return TextHitTest( refArea );
}
LibDrawText* GenCopy(); LibDrawText* GenCopy();
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
......
...@@ -16,71 +16,105 @@ Dialog_BodyGraphicText_Properties_base::Dialog_BodyGraphicText_Properties_base( ...@@ -16,71 +16,105 @@ Dialog_BodyGraphicText_Properties_base::Dialog_BodyGraphicText_Properties_base(
wxBoxSizer* bMainSizer; wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL ); bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer; wxBoxSizer* bPropertiesSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL ); bPropertiesSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperBoxSizer;
bUpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bTextValueBoxSizer;
bTextValueBoxSizer = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 ); m_staticText1->Wrap( -1 );
bLeftSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bTextValueBoxSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextValue->SetMinSize( wxSize( 200,-1 ) ); m_TextValue->SetMinSize( wxSize( 200,-1 ) );
bLeftSizer->Add( m_TextValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bTextValueBoxSizer->Add( m_TextValue, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxStaticBoxSizer* sOptionsSizer; bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND, 5 );
sOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _(" Text Options : ") ), wxVERTICAL );
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to Units"), wxDefaultPosition, wxDefaultSize, 0 ); wxBoxSizer* bTextSizeSizer;
bTextSizeSizer = new wxBoxSizer( wxVERTICAL );
sOptionsSizer->Add( m_CommonUnit, 0, wxALL, 5 ); m_TextSizeText = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextSizeText->Wrap( -1 );
bTextSizeSizer->Add( m_TextSizeText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to convert"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bTextSizeSizer->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bUpperBoxSizer->Add( bTextSizeSizer, 0, 0, 5 );
sOptionsSizer->Add( m_CommonConvert, 0, wxALL, 5 ); bPropertiesSizer->Add( bUpperBoxSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bBottomtBoxSizer;
bBottomtBoxSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sOptionsSizer;
sOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _(" Text Options : ") ), wxVERTICAL );
m_Orient = new wxCheckBox( this, wxID_ANY, _("Vertical"), wxDefaultPosition, wxDefaultSize, 0 ); m_Orient = new wxCheckBox( this, wxID_ANY, _("Vertical"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_Orient, 0, wxALL, 5 ); sOptionsSizer->Add( m_Orient, 0, wxALL, 5 );
bLeftSizer->Add( sOptionsSizer, 0, 0, 5 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sOptionsSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 ); m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to Units"), wxDefaultPosition, wxDefaultSize, 0 );
wxBoxSizer* bRightSizer; sOptionsSizer->Add( m_CommonUnit, 0, wxALL, 5 );
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_TextSizeText = new wxStaticText( this, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to convert"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextSizeText->Wrap( -1 );
bRightSizer->Add( m_TextSizeText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); sOptionsSizer->Add( m_CommonConvert, 0, wxALL|wxEXPAND, 5 );
bRightSizer->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bBottomtBoxSizer->Add( sOptionsSizer, 0, 0, 5 );
wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_TextShapeOptNChoices = sizeof( m_TextShapeOptChoices ) / sizeof( wxString ); int m_TextShapeOptNChoices = sizeof( m_TextShapeOptChoices ) / sizeof( wxString );
m_TextShapeOpt = new wxRadioBox( this, wxID_ANY, _("Text Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeOptNChoices, m_TextShapeOptChoices, 1, wxRA_SPECIFY_COLS ); m_TextShapeOpt = new wxRadioBox( this, wxID_ANY, _("Text Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeOptNChoices, m_TextShapeOptChoices, 1, wxRA_SPECIFY_COLS );
m_TextShapeOpt->SetSelection( 3 ); m_TextShapeOpt->SetSelection( 0 );
bRightSizer->Add( m_TextShapeOpt, 0, wxALL|wxEXPAND, 5 ); bBottomtBoxSizer->Add( m_TextShapeOpt, 0, wxALL|wxEXPAND, 5 );
wxString m_TextHJustificationOptChoices[] = { _("Align left"), _("Align center"), _("Align right") };
int m_TextHJustificationOptNChoices = sizeof( m_TextHJustificationOptChoices ) / sizeof( wxString );
m_TextHJustificationOpt = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_TextHJustificationOptNChoices, m_TextHJustificationOptChoices, 1, wxRA_SPECIFY_COLS );
m_TextHJustificationOpt->SetSelection( 1 );
bBottomtBoxSizer->Add( m_TextHJustificationOpt, 0, wxALL|wxEXPAND, 5 );
wxString m_TextVJustificationOptChoices[] = { _("Align bottom"), _("Align center"), _("Align top") };
int m_TextVJustificationOptNChoices = sizeof( m_TextVJustificationOptChoices ) / sizeof( wxString );
m_TextVJustificationOpt = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_TextVJustificationOptNChoices, m_TextVJustificationOptChoices, 1, wxRA_SPECIFY_COLS );
m_TextVJustificationOpt->SetSelection( 1 );
bBottomtBoxSizer->Add( m_TextVJustificationOpt, 0, wxALL|wxEXPAND, 5 );
bPropertiesSizer->Add( bBottomtBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
bPropertiesSizer->Add( bRightSizer, 0, wxEXPAND, 5 );
bMainSizer->Add( bRightSizer, 0, wxEXPAND, 5 ); bMainSizer->Add( bPropertiesSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer4; wxBoxSizer* bButtonsBoxSizer;
bSizer4 = new wxBoxSizer( wxVERTICAL ); bButtonsBoxSizer = new wxBoxSizer( wxVERTICAL );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_buttonOK, 0, wxALL, 5 ); bButtonsBoxSizer->Add( m_buttonOK, 0, wxALL, 5 );
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_buttonCANCEL, 0, wxALL, 5 ); bButtonsBoxSizer->Add( m_buttonCANCEL, 0, wxALL, 5 );
bMainSizer->Add( bSizer4, 0, wxALIGN_CENTER_VERTICAL, 5 ); bMainSizer->Add( bButtonsBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
// Connect Events // Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( Dialog_BodyGraphicText_Properties_base::OnInitDialog ) );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnOkClick ), NULL, this ); m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnCancelClick ), NULL, this ); m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnCancelClick ), NULL, this );
} }
...@@ -88,7 +122,6 @@ Dialog_BodyGraphicText_Properties_base::Dialog_BodyGraphicText_Properties_base( ...@@ -88,7 +122,6 @@ Dialog_BodyGraphicText_Properties_base::Dialog_BodyGraphicText_Properties_base(
Dialog_BodyGraphicText_Properties_base::~Dialog_BodyGraphicText_Properties_base() Dialog_BodyGraphicText_Properties_base::~Dialog_BodyGraphicText_Properties_base()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( Dialog_BodyGraphicText_Properties_base::OnInitDialog ) );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnOkClick ), NULL, this ); m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnCancelClick ), NULL, this ); m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnCancelClick ), NULL, this );
} }
...@@ -17,8 +17,9 @@ ...@@ -17,8 +17,9 @@
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statline.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/button.h> #include <wx/button.h>
...@@ -36,23 +37,25 @@ class Dialog_BodyGraphicText_Properties_base : public wxDialog ...@@ -36,23 +37,25 @@ class Dialog_BodyGraphicText_Properties_base : public wxDialog
protected: protected:
wxStaticText* m_staticText1; wxStaticText* m_staticText1;
wxTextCtrl* m_TextValue; wxTextCtrl* m_TextValue;
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxCheckBox* m_Orient;
wxStaticText* m_TextSizeText; wxStaticText* m_TextSizeText;
wxTextCtrl* m_TextSize; wxTextCtrl* m_TextSize;
wxCheckBox* m_Orient;
wxStaticLine* m_staticline1;
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxRadioBox* m_TextShapeOpt; wxRadioBox* m_TextShapeOpt;
wxRadioBox* m_TextHJustificationOpt;
wxRadioBox* m_TextVJustificationOpt;
wxButton* m_buttonOK; wxButton* m_buttonOK;
wxButton* m_buttonCANCEL; wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
public: public:
Dialog_BodyGraphicText_Properties_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic text properties:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 360,180 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); Dialog_BodyGraphicText_Properties_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic text properties:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 511,193 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~Dialog_BodyGraphicText_Properties_base(); ~Dialog_BodyGraphicText_Properties_base();
}; };
......
...@@ -66,7 +66,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE ...@@ -66,7 +66,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
wxString m_FieldVJustifyCtrlChoices[] = { _("Align bottom"), _("Align center"), _("Align top") }; wxString m_FieldVJustifyCtrlChoices[] = { _("Align bottom"), _("Align center"), _("Align top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldVJustifyCtrl->SetSelection( 1 ); m_FieldVJustifyCtrl->SetSelection( 1 );
m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") ); m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") );
......
...@@ -434,7 +434,7 @@ ...@@ -434,7 +434,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Vert Justify</property> <property name="label">Vert. Justify</property>
<property name="majorDimension">1</property> <property name="majorDimension">1</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
...@@ -900,7 +900,7 @@ ...@@ -900,7 +900,7 @@
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">textSizeBoxSizer</property> <property name="name">textSizeBoxSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
......
...@@ -32,7 +32,7 @@ public: ...@@ -32,7 +32,7 @@ public:
~Dialog_BodyGraphicText_Properties() {}; ~Dialog_BodyGraphicText_Properties() {};
private: private:
void OnInitDialog( wxInitDialogEvent& event ); void InitDialog( );
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
}; };
...@@ -43,12 +43,13 @@ Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_Li ...@@ -43,12 +43,13 @@ Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_Li
{ {
m_Parent = aParent; m_Parent = aParent;
m_GraphicText = aGraphicText; m_GraphicText = aGraphicText;
InitDialog( );
} }
/********************************************************************************/ /*****************************************************/
void Dialog_BodyGraphicText_Properties::OnInitDialog( wxInitDialogEvent& event ) void Dialog_BodyGraphicText_Properties::InitDialog( )
/********************************************************************************/ /*****************************************************/
{ {
wxString msg; wxString msg;
...@@ -69,6 +70,38 @@ wxString msg; ...@@ -69,6 +70,38 @@ wxString msg;
shape |= 2; shape |= 2;
m_TextShapeOpt->SetSelection(shape); m_TextShapeOpt->SetSelection(shape);
switch ( m_GraphicText->m_HJustify )
{
case GR_TEXT_HJUSTIFY_LEFT:
m_TextHJustificationOpt->SetSelection(0);
break;
case GR_TEXT_HJUSTIFY_CENTER:
m_TextHJustificationOpt->SetSelection(1);
break;
case GR_TEXT_HJUSTIFY_RIGHT:
m_TextHJustificationOpt->SetSelection(2);
break;
}
switch ( m_GraphicText->m_VJustify )
{
case GR_TEXT_VJUSTIFY_BOTTOM:
m_TextVJustificationOpt->SetSelection(0);
break;
case GR_TEXT_VJUSTIFY_CENTER:
m_TextVJustificationOpt->SetSelection(1);
break;
case GR_TEXT_VJUSTIFY_TOP:
m_TextVJustificationOpt->SetSelection(2);
break;
}
} }
else else
{ {
...@@ -130,6 +163,37 @@ wxString Line; ...@@ -130,6 +163,37 @@ wxString Line;
else else
m_GraphicText->m_Bold = false; m_GraphicText->m_Bold = false;
switch ( m_TextHJustificationOpt->GetSelection() )
{
case 0:
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
break;
case 1:
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
break;
case 2:
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
break;
}
switch ( m_TextVJustificationOpt->GetSelection() )
{
case 0:
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
break;
case 1:
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break;
case 2:
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_TOP;
break;
}
} }
Close(); Close();
......
This diff is collapsed.
...@@ -58,9 +58,9 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_SheetPropertiesFrame, wxDialog ) ...@@ -58,9 +58,9 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_SheetPropertiesFrame, wxDialog )
BEGIN_EVENT_TABLE( WinEDA_SheetPropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SheetPropertiesFrame, wxDialog )
////@begin WinEDA_SheetPropertiesFrame event table entries ////@begin WinEDA_SheetPropertiesFrame event table entries
EVT_BUTTON( wxID_CANCEL, WinEDA_SheetPropertiesFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_SheetPropertiesFrame::OnCancelClick )
EVT_BUTTON( wxID_OK, WinEDA_SheetPropertiesFrame::OnOkClick ) EVT_BUTTON( wxID_OK, WinEDA_SheetPropertiesFrame::OnOkClick )
////@end WinEDA_SheetPropertiesFrame event table entries ////@end WinEDA_SheetPropertiesFrame event table entries
...@@ -112,18 +112,20 @@ bool WinEDA_SheetPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const ...@@ -112,18 +112,20 @@ bool WinEDA_SheetPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const
m_SheetNameTextSize = NULL; m_SheetNameTextSize = NULL;
m_SheetNameSize = NULL; m_SheetNameSize = NULL;
m_btClose = NULL; m_btClose = NULL;
////@end WinEDA_SheetPropertiesFrame member initialisation ////@end WinEDA_SheetPropertiesFrame member initialisation
////@begin WinEDA_SheetPropertiesFrame creation ////@begin WinEDA_SheetPropertiesFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS); SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style ); wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls(); CreateControls();
if (GetSizer()) if( GetSizer() )
{ {
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints( this );
} }
Centre(); Centre();
////@end WinEDA_SheetPropertiesFrame creation ////@end WinEDA_SheetPropertiesFrame creation
return true; return true;
} }
...@@ -140,56 +142,85 @@ void WinEDA_SheetPropertiesFrame::CreateControls() ...@@ -140,56 +142,85 @@ void WinEDA_SheetPropertiesFrame::CreateControls()
WinEDA_SheetPropertiesFrame* itemDialog1 = this; WinEDA_SheetPropertiesFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
itemDialog1->SetSizer(itemBoxSizer2);
itemDialog1->SetSizer( itemBoxSizer2 );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer3, 0, wxGROW | wxALL, 5 );
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _("Filename:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Filename:" ), wxDefaultPosition,
m_FileNameWin = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxSize(300, -1), wxTE_PROCESS_ENTER ); wxDefaultSize, 0 );
itemBoxSizer4->Add(m_FileNameWin, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5); itemBoxSizer4->Add( itemStaticText5,
0,
wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _("Sheetname:"), wxDefaultPosition, wxDefaultSize, 0 ); wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
itemBoxSizer4->Add(itemStaticText7, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); 5 );
m_SheetNameWin = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(300, -1), 0 ); m_FileNameWin =
itemBoxSizer4->Add(m_SheetNameWin, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5); new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ), wxDefaultPosition, wxSize( 300,
-1 ),
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL); wxTE_PROCESS_ENTER );
itemBoxSizer3->Add(itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer4->Add( m_FileNameWin, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
m_FileNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _(
itemBoxSizer9->Add(m_FileNameTextSize, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); "Sheetname:" ), wxDefaultPosition,
wxDefaultSize, 0 );
m_FileNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer4->Add( itemStaticText7,
itemBoxSizer9->Add(m_FileNameSize, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5); 0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
m_SheetNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); 5 );
itemBoxSizer9->Add(m_SheetNameTextSize, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_SheetNameWin =
m_SheetNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition, wxSize( 300,
itemBoxSizer9->Add(m_SheetNameSize, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5); -1 ), 0 );
itemBoxSizer4->Add( m_SheetNameWin, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
itemBoxSizer2->Add(5, 5, 1, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer3->Add( itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
itemBoxSizer2->Add(itemBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_FileNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _(
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); "Size" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer15->Add(m_btClose, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer9->Add( m_FileNameTextSize,
0,
wxButton* itemButton17 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_FileNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer9->Add( m_FileNameSize, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
m_SheetNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer9->Add( m_SheetNameTextSize,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_SheetNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer9->Add( m_SheetNameSize, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
itemBoxSizer2->Add( 5, 5, 1, wxGROW | wxALL, 5 );
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _(
"&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer15->Add( m_btClose, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxButton* itemButton17 = new wxButton( itemDialog1, wxID_OK, _(
"&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
itemButton17->SetDefault(); itemButton17->SetDefault();
itemBoxSizer15->Add(itemButton17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer15->Add( itemButton17, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
// Set validators // Set validators
m_SheetNameWin->SetValidator( wxTextValidator(wxFILTER_NONE, & m_CurrentSheet->m_SheetName) ); m_SheetNameWin->SetValidator( wxTextValidator( wxFILTER_NONE, &m_CurrentSheet->m_SheetName ) );
////@end WinEDA_SheetPropertiesFrame content construction ////@end WinEDA_SheetPropertiesFrame content construction
m_btClose->SetFocus(); m_btClose->SetFocus();
...@@ -215,8 +246,9 @@ wxBitmap WinEDA_SheetPropertiesFrame::GetBitmapResource( const wxString& name ) ...@@ -215,8 +246,9 @@ wxBitmap WinEDA_SheetPropertiesFrame::GetBitmapResource( const wxString& name )
{ {
// Bitmap retrieval // Bitmap retrieval
////@begin WinEDA_SheetPropertiesFrame bitmap retrieval ////@begin WinEDA_SheetPropertiesFrame bitmap retrieval
wxUnusedVar(name); wxUnusedVar( name );
return wxNullBitmap; return wxNullBitmap;
////@end WinEDA_SheetPropertiesFrame bitmap retrieval ////@end WinEDA_SheetPropertiesFrame bitmap retrieval
} }
...@@ -229,8 +261,9 @@ wxIcon WinEDA_SheetPropertiesFrame::GetIconResource( const wxString& name ) ...@@ -229,8 +261,9 @@ wxIcon WinEDA_SheetPropertiesFrame::GetIconResource( const wxString& name )
{ {
// Icon retrieval // Icon retrieval
////@begin WinEDA_SheetPropertiesFrame icon retrieval ////@begin WinEDA_SheetPropertiesFrame icon retrieval
wxUnusedVar(name); wxUnusedVar( name );
return wxNullIcon; return wxNullIcon;
////@end WinEDA_SheetPropertiesFrame icon retrieval ////@end WinEDA_SheetPropertiesFrame icon retrieval
} }
...@@ -266,8 +299,9 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event ) ...@@ -266,8 +299,9 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
if( ( fn.GetFullPath() != m_CurrentSheet->GetFileName() ) if( ( fn.GetFullPath() != m_CurrentSheet->GetFileName() )
|| ( m_CurrentSheet->m_AssociatedScreen == NULL) ) || ( m_CurrentSheet->m_AssociatedScreen == NULL) )
{ {
msg = _( "Changing a Filename can change all the schematic \ msg = _(
structures and cannot be undone.\nOk to continue renaming?" ); "Changing a Filename can change all the schematic \
structures and cannot be undone.\nOk to continue renaming?" );
if( m_CurrentSheet->m_AssociatedScreen == NULL || IsOK( NULL, msg ) ) if( m_CurrentSheet->m_AssociatedScreen == NULL || IsOK( NULL, msg ) )
{ //do not prompt on a new sheet. in fact, we should not allow a sheet to be created { //do not prompt on a new sheet. in fact, we should not allow a sheet to be created
......
...@@ -543,21 +543,21 @@ private: ...@@ -543,21 +543,21 @@ private:
wxPoint aPos ); wxPoint aPos );
public: public:
/** /**
* Function HitTest * Function TextHitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
* @param ref_pos A wxPoint to test * @param ref_pos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool HitTest( const wxPoint& ref_pos ); bool TextHitTest( const wxPoint& ref_pos );
/** /**
* Function HitTest (overlayed) * Function TextHitTest (overlayed)
* tests if the given EDA_Rect intersect this object. * tests if the given EDA_Rect intersect this object.
* For now, the anchor must be inside this rect. * For now, the anchor must be inside this rect.
* @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
*/ */
bool HitTest( EDA_Rect& refArea ); bool TextHitTest( EDA_Rect& refArea );
/** /**
* Function LenSize * Function LenSize
......
...@@ -69,6 +69,11 @@ static inline const wxChar* GetChars( wxString s ) ...@@ -69,6 +69,11 @@ static inline const wxChar* GetChars( wxString s )
while( Angle > 900 ) \ while( Angle > 900 ) \
Angle -= 1800; } Angle -= 1800; }
/* Normalize angle to be in the -180.0 .. 180.0 range */
#define NORMALIZE_ANGLE_180( Angle ) { while( Angle <= -1800 ) \
Angle += 3600;\
while( Angle > 1800 ) \
Angle -= 3600; }
/*****************************/ /*****************************/
/* macro to exchange 2 items */ /* macro to exchange 2 items */
......
...@@ -279,7 +279,6 @@ public: ...@@ -279,7 +279,6 @@ public:
// ratsnest functions // ratsnest functions
void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */ void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */
void ReCompile_Ratsnest_After_Changes( wxDC* DC );
int Test_1_Net_Ratsnest( wxDC* DC, int net_code ); int Test_1_Net_Ratsnest( wxDC* DC, int net_code );
void build_ratsnest_module( wxDC* DC, MODULE* Module ); void build_ratsnest_module( wxDC* DC, MODULE* Module );
void trace_ratsnest_module( wxDC* DC ); void trace_ratsnest_module( wxDC* DC );
...@@ -1011,7 +1010,7 @@ public: ...@@ -1011,7 +1010,7 @@ public:
// loading Footprint // loading Footprint
MODULE* Import_Module( wxDC* DC ); MODULE* Import_Module( wxDC* DC );
void Export_Module( MODULE* ptmod, bool createlib ); void Export_Module( MODULE* ptmod, bool createlib );
void Load_Module_Module_From_BOARD( MODULE* Module ); void Load_Module_From_BOARD( MODULE* Module );
// functions to edit footprint edges // functions to edit footprint edges
void Edit_Edge_Width( EDGE_MODULE* Edge ); void Edit_Edge_Width( EDGE_MODULE* Edge );
......
No preview for this file type
This diff is collapsed.
...@@ -179,7 +179,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) ...@@ -179,7 +179,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
} }
GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST; GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST;
ReCompile_Ratsnest_After_Changes( &dc ); Compile_Ratsnest( &dc, true );
SetToolbars(); SetToolbars();
} }
......
...@@ -54,7 +54,6 @@ float MinCout; ...@@ -54,7 +54,6 @@ float MinCout;
/* Fonctions locales */ /* Fonctions locales */
static int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide ); static int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide );
static void Build_PlacedPads_List( BOARD* Pcb );
static int Tri_PlaceModules( MODULE** pt_ref, MODULE** pt_compare ); static int Tri_PlaceModules( MODULE** pt_ref, MODULE** pt_compare );
static void TracePenaliteRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, static void TracePenaliteRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
...@@ -309,10 +308,8 @@ end_of_tst: ...@@ -309,10 +308,8 @@ end_of_tst:
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
} }
/* Recalcul de la liste des pads, detruite par les calculs precedents */
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
GetBoard()->Build_Pads_Full_List(); Compile_Ratsnest( DC, true );
DrawPanel->ReDraw( DC, TRUE ); DrawPanel->ReDraw( DC, TRUE );
DrawPanel->m_AbortEnable = FALSE; DrawPanel->m_AbortEnable = FALSE;
...@@ -585,8 +582,6 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC ) ...@@ -585,8 +582,6 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
Module->DisplayInfo( this ); Module->DisplayInfo( this );
Build_PlacedPads_List( GetBoard() );
LastPosOK.x = GetBoard()->m_BoundaryBox.m_Pos.x; LastPosOK.x = GetBoard()->m_BoundaryBox.m_Pos.x;
LastPosOK.y = GetBoard()->m_BoundaryBox.m_Pos.y; LastPosOK.y = GetBoard()->m_BoundaryBox.m_Pos.y;
...@@ -912,51 +907,6 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC ) ...@@ -912,51 +907,6 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
} }
/********************************************/
void Build_PlacedPads_List( BOARD* aPcb )
/********************************************/
/*
* construction de la liste ( sous forme d'une liste de stucture )
* des caract utiles des pads du PCB pour Placement Automatique )
* Cette liste est restreinte a la liste des pads des modules deja places sur
* la carte.
*
* parametres:
* adresse du buffer de classement = Pcb->ptr_pads;
*
* Variables globales mise a jour:
* pointeur ptr_pads (adr de classement de la liste des pads)
* nb_pads = nombre utile de pastilles classes
* m_Status_Pcb |= LISTE_PAD_OK
*/
{
aPcb->m_Pads.clear();
aPcb->m_NbNodes = 0;
// Initialisation du buffer et des variables de travail
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
if( module->m_ModuleStatus & MODULE_to_PLACE )
continue;
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
aPcb->m_Pads.push_back( pad );
pad->SetSubNet( 0 );
pad->SetSubRatsnest( 0 );
pad->SetParent( module );
if( pad->GetNet() )
aPcb->m_NbNodes++;
}
}
aPcb->m_Status_Pcb |= LISTE_PAD_OK;
aPcb->m_Status_Pcb &= ~(LISTE_RATSNEST_ITEM_OK | RATSNEST_ITEM_LOCAL_OK);
}
/*****************************************************************/ /*****************************************************************/
/* Construction de la zone de penalite ( rectangle ) d'un module */ /* Construction de la zone de penalite ( rectangle ) d'un module */
/*****************************************************************/ /*****************************************************************/
...@@ -1099,8 +1049,6 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC ) ...@@ -1099,8 +1049,6 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC )
if( BaseListeModules == NULL ) if( BaseListeModules == NULL )
return NULL; return NULL;
Build_PlacedPads_List( pcbframe->GetBoard() );
/* Tri par surface decroissante des modules /* Tri par surface decroissante des modules
* (on place les plus gros en 1er), surface ponderee par le nombre de pads */ * (on place les plus gros en 1er), surface ponderee par le nombre de pads */
......
...@@ -189,9 +189,9 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -189,9 +189,9 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
// Placement des PADS sur le board // // Placement des PADS sur le board //
///////////////////////////////////// /////////////////////////////////////
for( unsigned i=0; i<aPcb->GetPadsCount(); ++i ) for( unsigned i=0; i < aPcb->GetPadsCount(); ++i )
{ {
D_PAD* pad = aPcb->m_Pads[i]; D_PAD* pad = aPcb->m_NetInfo->GetPad(i);
if( net_code != pad->GetNet() || (flag & FORCE_PADS) ) if( net_code != pad->GetNet() || (flag & FORCE_PADS) )
{ {
......
...@@ -18,8 +18,7 @@ class EDA_BoardDesignSettings; ...@@ -18,8 +18,7 @@ class EDA_BoardDesignSettings;
* Enum LAYER_T * Enum LAYER_T
* gives the allowed types of layers, same as Specctra DSN spec. * gives the allowed types of layers, same as Specctra DSN spec.
*/ */
enum LAYER_T enum LAYER_T {
{
LT_SIGNAL, LT_SIGNAL,
LT_POWER, LT_POWER,
LT_MIXED, LT_MIXED,
...@@ -92,12 +91,11 @@ public: ...@@ -92,12 +91,11 @@ public:
DLIST<TRACK> m_Track; // linked list of TRACKs and SEGVIAs DLIST<TRACK> m_Track; // linked list of TRACKs and SEGVIAs
DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs
std::vector<D_PAD*> m_Pads; // Entry for a sorted pad list (used in ratsnest calculations)
NETINFO_LIST* m_NetInfo; // nets info list (name, design constraints .. NETINFO_LIST* m_NetInfo; // nets info list (name, design constraints ..
std::vector<RATSNEST_ITEM> m_FullRatsnest; // Rastnest list for the BOARD std::vector<RATSNEST_ITEM> m_FullRatsnest; // Rastnest list for the BOARD
std::vector<RATSNEST_ITEM> m_LocalRatsnest; /* Rastnest list relative to a given footprint std::vector<RATSNEST_ITEM> m_LocalRatsnest; /* Rastnest list relative to a given footprint
(used while moving a footprint) */ * (used while moving a footprint) */
ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress
...@@ -120,6 +118,7 @@ public: ...@@ -120,6 +118,7 @@ public:
* @param aControl An int which can vary how the item is added. * @param aControl An int which can vary how the item is added.
*/ */
void Add( BOARD_ITEM* aBoardItem, int aControl = 0 ); void Add( BOARD_ITEM* aBoardItem, int aControl = 0 );
#define ADD_APPEND 1 ///< aControl flag for Add( aControl ), appends not inserts #define ADD_APPEND 1 ///< aControl flag for Add( aControl ), appends not inserts
...@@ -172,6 +171,7 @@ public: ...@@ -172,6 +171,7 @@ public:
return NULL; return NULL;
} }
/** /**
* Function GetMARKERCount * Function GetMARKERCount
* @return int - The number of MARKERS. * @return int - The number of MARKERS.
...@@ -181,6 +181,7 @@ public: ...@@ -181,6 +181,7 @@ public:
return (int) m_markers.size(); return (int) m_markers.size();
} }
/** /**
* Function GetCopperLayerCount * Function GetCopperLayerCount
* @return int - The number of copper layers in the BOARD. * @return int - The number of copper layers in the BOARD.
...@@ -242,6 +243,7 @@ public: ...@@ -242,6 +243,7 @@ public:
return m_FullRatsnest.size(); return m_FullRatsnest.size();
} }
/** Function GetNodesCount /** Function GetNodesCount
* @return the number of pads members of nets (i.e. with netcode > 0) * @return the number of pads members of nets (i.e. with netcode > 0)
*/ */
...@@ -252,19 +254,9 @@ public: ...@@ -252,19 +254,9 @@ public:
*/ */
unsigned GetPadsCount() unsigned GetPadsCount()
{ {
return m_Pads.size(); return m_NetInfo->GetPadsCount();
} }
/** Function Build_Pads_Full_List
* Create the pad list
* initialise:
* m_Pads (list of pads)
* set m_Status_Pcb = LISTE_PAD_OK;
* and clear for all pads in list the m_SubRatsnest member;
* clear m_Pcb->m_FullRatsnest
*/
void Build_Pads_Full_List();
// Calcul du rectangle d'encadrement: // Calcul du rectangle d'encadrement:
bool ComputeBoundaryBox(); bool ComputeBoundaryBox();
...@@ -322,7 +314,7 @@ public: ...@@ -322,7 +314,7 @@ public:
* @param aNetname A Netname to search for. * @param aNetname A Netname to search for.
* @return NETINFO_ITEM* - the net or NULL if not found. * @return NETINFO_ITEM* - the net or NULL if not found.
*/ */
NETINFO_ITEM* FindNet( const wxString & aNetname ) const; NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
/** /**
* Function FindModuleByReference * Function FindModuleByReference
...@@ -341,7 +333,7 @@ public: ...@@ -341,7 +333,7 @@ public:
* @param aSortbyPadsCount : true = sort by active pads count, false = no sort (i.e. leave the sort by net names) * @param aSortbyPadsCount : true = sort by active pads count, false = no sort (i.e. leave the sort by net names)
* @return int - net names count. * @return int - net names count.
*/ */
int ReturnSortedNetnamesList( wxArrayString & aNames, bool aSortbyPadsCount); int ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount );
/** /**
* Function Save * Function Save
...@@ -364,6 +356,7 @@ public: ...@@ -364,6 +356,7 @@ public:
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
...@@ -383,6 +376,7 @@ public: ...@@ -383,6 +376,7 @@ public:
/*************************/ /*************************/
/* Copper Areas handling */ /* Copper Areas handling */
/*************************/ /*************************/
/** /**
* Function HitTestForAnyFilledArea * Function HitTestForAnyFilledArea
* tests if the given wxPoint is within the bounds of a filled area of this zone. * tests if the given wxPoint is within the bounds of a filled area of this zone.
...@@ -393,19 +387,27 @@ public: ...@@ -393,19 +387,27 @@ public:
* @param aEndLayer the last layer (-1 to ignore it) to test * @param aEndLayer the last layer (-1 to ignore it) to test
* @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL * @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL
*/ */
ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos, int aStartLayer, int aEndLayer = -1 ); ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos,
int aStartLayer,
int aEndLayer = -1 );
/** /**
* Function RedrawAreasOutlines * Function RedrawAreasOutlines
* Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 ) * Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 )
*/ */
void RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer); void RedrawAreasOutlines( WinEDA_DrawPanel* panel,
wxDC* aDC,
int aDrawMode,
int aLayer );
/** /**
* Function RedrawFilledAreas * Function RedrawFilledAreas
* Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 ) * Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 )
*/ */
void RedrawFilledAreas(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer); void RedrawFilledAreas( WinEDA_DrawPanel* panel,
wxDC* aDC,
int aDrawMode,
int aLayer );
/** /**
* Function SetAreasNetCodesFromNetNames * Function SetAreasNetCodesFromNetNames
...@@ -417,7 +419,7 @@ public: ...@@ -417,7 +419,7 @@ public:
* @return : error count * @return : error count
* For non copper areas, netcode is set to 0 * For non copper areas, netcode is set to 0
*/ */
int SetAreasNetCodesFromNetNames(void); int SetAreasNetCodesFromNetNames( void );
/** /**
* Function GetArea * Function GetArea
...@@ -432,22 +434,25 @@ public: ...@@ -432,22 +434,25 @@ public:
return NULL; return NULL;
} }
/** /**
* Function GetAreaIndex * Function GetAreaIndex
* returns the Area Index for the given Zone Container. * returns the Area Index for the given Zone Container.
* @param aArea :The ZONE_CONTAINER to find. * @param aArea :The ZONE_CONTAINER to find.
* @return an Area Index in m_ZoneDescriptorList or -1 if non found. * @return an Area Index in m_ZoneDescriptorList or -1 if non found.
*/ */
int GetAreaIndex( const ZONE_CONTAINER* aArea) const int GetAreaIndex( const ZONE_CONTAINER* aArea ) const
{ {
for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
{ {
if ( aArea == GetArea( ii ) ) // Found ! if( aArea == GetArea( ii ) ) // Found !
return ii; return ii;
} }
return -1; return -1;
} }
/** /**
* Function GetAreaCount * Function GetAreaCount
* @return int - The number of Areas or ZONE_CONTAINER. * @return int - The number of Areas or ZONE_CONTAINER.
...@@ -457,7 +462,9 @@ public: ...@@ -457,7 +462,9 @@ public:
return (int) m_ZoneDescriptorList.size(); return (int) m_ZoneDescriptorList.size();
} }
/* Functions used in test, merge and cut outlines */ /* Functions used in test, merge and cut outlines */
/** /**
* Function AddArea * Function AddArea
* add empty copper area to net * add empty copper area to net
...@@ -480,7 +487,7 @@ public: ...@@ -480,7 +487,7 @@ public:
ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch ); ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch );
/** /**
Function CompleteArea * Function CompleteArea
* complete copper area contour by adding a line from last to first corner * complete copper area contour by adding a line from last to first corner
* if there is only 1 or 2 corners, remove (delete) the area * if there is only 1 or 2 corners, remove (delete) the area
* @param area_to_complete = area to complete or remove * @param area_to_complete = area to complete or remove
...@@ -515,7 +522,9 @@ public: ...@@ -515,7 +522,9 @@ public:
* Also sets areas->utility1 flags if areas are modified * Also sets areas->utility1 flags if areas are modified
*/ */
int ClipAreaPolygon( ZONE_CONTAINER* CurrArea, int ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
bool bMessageBoxArc, bool bMessageBoxInt, bool bRetainArcs = TRUE ); bool bMessageBoxArc,
bool bMessageBoxInt,
bool bRetainArcs = TRUE );
/** /**
* Process an area that has been modified, by clipping its polygon against * Process an area that has been modified, by clipping its polygon against
...@@ -582,7 +591,8 @@ public: ...@@ -582,7 +591,8 @@ public:
* @param aCreate_Markers: if true create DRC markers. False: do not creates anything * @param aCreate_Markers: if true create DRC markers. False: do not creates anything
* @return errors count * @return errors count
*/ */
int Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine,bool aCreate_Markers ); int Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine,
bool aCreate_Markers );
/****** function relative to ratsnest calculations: */ /****** function relative to ratsnest calculations: */
...@@ -592,7 +602,6 @@ public: ...@@ -592,7 +602,6 @@ public:
* @param aNetcode = netcode to analyse. if -1, analyse all nets * @param aNetcode = netcode to analyse. if -1, analyse all nets
*/ */
void Test_Connections_To_Copper_Areas( int aNetcode = -1 ); void Test_Connections_To_Copper_Areas( int aNetcode = -1 );
}; };
#endif // #ifndef CLASS_BOARD_H #endif // #ifndef CLASS_BOARD_H
...@@ -479,14 +479,8 @@ bool COTATION::HitTest( const wxPoint& ref_pos ) ...@@ -479,14 +479,8 @@ bool COTATION::HitTest( const wxPoint& ref_pos )
int ux0, uy0; int ux0, uy0;
int dx, dy, spot_cX, spot_cY; int dx, dy, spot_cX, spot_cY;
if( m_Text ) if( m_Text && m_Text->TextHitTest( ref_pos ) )
{
// because HitTest() is present in both base classes of TEXTE_PCB
// use a clarifying cast to tell compiler which HitTest()
// to call.
if( static_cast<EDA_TextStruct*>(m_Text)->HitTest( ref_pos ) )
return true; return true;
}
/* Localisation des SEGMENTS ?) */ /* Localisation des SEGMENTS ?) */
ux0 = Barre_ox; ux0 = Barre_ox;
......
...@@ -53,10 +53,10 @@ public: ...@@ -53,10 +53,10 @@ public:
m_NetCode = aNetCode; m_NetCode = aNetCode;
} }
/** function Draw /** function Draw
*/ */
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset ); void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset );
}; };
/***************************************************************/ /***************************************************************/
...@@ -71,6 +71,9 @@ private: ...@@ -71,6 +71,9 @@ private:
// boost::ptr_vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints .. // boost::ptr_vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints ..
std::vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints .. std::vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints ..
public:
std::vector<D_PAD*> m_PadsFullList; // Entry for a sorted pad list (used in ratsnest calculations)
public: public:
NETINFO_LIST( BOARD* aParent ); NETINFO_LIST( BOARD* aParent );
~NETINFO_LIST(); ~NETINFO_LIST();
...@@ -103,6 +106,37 @@ public: ...@@ -103,6 +106,37 @@ public:
* The list is sorted by names. * The list is sorted by names.
*/ */
void BuildListOfNets(); void BuildListOfNets();
/** Function GetPadsCount
* @return the number of pads in board
*/
unsigned GetPadsCount()
{
return m_PadsFullList.size();
}
/** Function GetPad
* @return the pad idx from m_PadsFullList
*/
D_PAD* GetPad( unsigned aIdx)
{
if (aIdx < m_PadsFullList.size() )
return m_PadsFullList[aIdx];
else
return NULL;
}
private:
/** Function Build_Pads_Full_List
* Create the pad list
* initialise:
* m_Pads (list of pads)
* set m_Status_Pcb = LISTE_PAD_OK;
* and clear for all pads in list the m_SubRatsnest member;
* clear m_Pcb->m_FullRatsnest
*/
void Build_Pads_Full_List();
}; };
/** class NETINFO_ITEM /** class NETINFO_ITEM
...@@ -188,8 +222,6 @@ public: ...@@ -188,8 +222,6 @@ public:
}; };
/****************************************************************/ /****************************************************************/
/* description d'un point de piste pour le suivi des connexions */ /* description d'un point de piste pour le suivi des connexions */
/****************************************************************/ /****************************************************************/
......
...@@ -44,6 +44,7 @@ void NETINFO_LIST::DeleteData() ...@@ -44,6 +44,7 @@ void NETINFO_LIST::DeleteData()
delete m_NetBuffer[ii]; delete m_NetBuffer[ii];
m_NetBuffer.clear(); m_NetBuffer.clear();
m_PadsFullList.clear();
} }
...@@ -90,14 +91,14 @@ void NETINFO_LIST::BuildListOfNets() ...@@ -90,14 +91,14 @@ void NETINFO_LIST::BuildListOfNets()
AppendNet( net_item ); AppendNet( net_item );
/* Build the PAD list, sorted by net */ /* Build the PAD list, sorted by net */
m_Parent->Build_Pads_Full_List(); Build_Pads_Full_List();
/* Build netnames list, and create a netcode for each netname */ /* Build netnames list, and create a netcode for each netname */
D_PAD* last_pad = NULL; D_PAD* last_pad = NULL;
int netcode = 0; int netcode = 0;
for( unsigned ii = 0; ii < m_Parent->m_Pads.size(); ii++ ) for( unsigned ii = 0; ii < m_PadsFullList.size(); ii++ )
{ {
pad = m_Parent->m_Pads[ii]; pad = m_PadsFullList[ii];
if( pad->GetNetname().IsEmpty() ) // pad not connected if( pad->GetNetname().IsEmpty() ) // pad not connected
{ {
pad->SetNet( 0 ); pad->SetNet( 0 );
...@@ -130,9 +131,9 @@ void NETINFO_LIST::BuildListOfNets() ...@@ -130,9 +131,9 @@ void NETINFO_LIST::BuildListOfNets()
} }
/**********************************/ /*****************************************/
void BOARD::Build_Pads_Full_List() void NETINFO_LIST::Build_Pads_Full_List()
/**********************************/ /*****************************************/
/** Function Build_Pads_Full_List /** Function Build_Pads_Full_List
* Create the pad list, sorted by net names * Create the pad list, sorted by net names
...@@ -143,19 +144,19 @@ void BOARD::Build_Pads_Full_List() ...@@ -143,19 +144,19 @@ void BOARD::Build_Pads_Full_List()
* (m_Pcb->m_FullRatsnest uses pointer to pads) * (m_Pcb->m_FullRatsnest uses pointer to pads)
*/ */
{ {
if( m_Status_Pcb & LISTE_PAD_OK ) if( m_Parent->m_Status_Pcb & LISTE_PAD_OK )
return; return;
// empty the old list // empty the old list
m_Pads.clear(); m_PadsFullList.clear();
m_FullRatsnest.clear(); m_Parent->m_FullRatsnest.clear();
/* Clear variables used in rastnest computation */ /* Clear variables used in rastnest computation */
for( MODULE* module = m_Modules; module; module = module->Next() ) for( MODULE* module = m_Parent->m_Modules; module; module = module->Next() )
{ {
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{ {
m_Pads.push_back( pad ); m_PadsFullList.push_back( pad );
pad->SetSubRatsnest( 0 ); pad->SetSubRatsnest( 0 );
pad->SetParent( module ); pad->SetParent( module );
...@@ -163,7 +164,7 @@ void BOARD::Build_Pads_Full_List() ...@@ -163,7 +164,7 @@ void BOARD::Build_Pads_Full_List()
} }
// Sort pad list per net // Sort pad list per net
sort( m_Pads.begin(), m_Pads.end(), PadlistSortByNetnames ); sort( m_PadsFullList.begin(), m_PadsFullList.end(), PadlistSortByNetnames );
m_Status_Pcb = LISTE_PAD_OK; m_Parent->m_Status_Pcb = LISTE_PAD_OK;
} }
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
*/ */
bool HitTest( const wxPoint& refPos ) bool HitTest( const wxPoint& refPos )
{ {
return EDA_TextStruct::HitTest( refPos ); return TextHitTest( refPos );
} }
...@@ -70,7 +70,7 @@ public: ...@@ -70,7 +70,7 @@ public:
*/ */
bool HitTest( EDA_Rect& refArea ) bool HitTest( EDA_Rect& refArea )
{ {
return EDA_TextStruct::HitTest( refArea ); return TextHitTest( refArea );
} }
/** /**
......
...@@ -278,7 +278,7 @@ void WinEDA_BasePcbFrame::test_connexions( wxDC* DC ) ...@@ -278,7 +278,7 @@ void WinEDA_BasePcbFrame::test_connexions( wxDC* DC )
// Clear the cluster identifier for all pads // Clear the cluster identifier for all pads
for( unsigned i = 0; i< m_Pcb->GetPadsCount(); ++i ) for( unsigned i = 0; i< m_Pcb->GetPadsCount(); ++i )
{ {
D_PAD* pad = m_Pcb->m_Pads[i]; D_PAD* pad = m_Pcb->m_NetInfo->GetPad(i);
pad->SetZoneSubNet( 0 ); pad->SetZoneSubNet( 0 );
pad->SetSubNet( 0 ); pad->SetSubNet( 0 );
...@@ -326,7 +326,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code ) ...@@ -326,7 +326,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
for( unsigned i = 0; i<m_Pcb->GetPadsCount(); ++i ) for( unsigned i = 0; i<m_Pcb->GetPadsCount(); ++i )
{ {
D_PAD* pad = m_Pcb->m_Pads[i]; D_PAD* pad = m_Pcb->m_NetInfo->GetPad(i);
int pad_net_code = pad->GetNet(); int pad_net_code = pad->GetNet();
...@@ -555,7 +555,7 @@ static int SortPadsByXCoord( const void* pt_ref, const void* pt_comp ) ...@@ -555,7 +555,7 @@ static int SortPadsByXCoord( const void* pt_ref, const void* pt_comp )
void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector ) void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector )
/*****************************************************************************/ /*****************************************************************************/
{ {
aVector->insert( aVector->end(), aBoard->m_Pads.begin(), aBoard->m_Pads.end() ); aVector->insert( aVector->end(), aBoard->m_NetInfo->m_PadsFullList.begin(), aBoard->m_NetInfo->m_PadsFullList.end() );
qsort( &(*aVector)[0], aBoard->GetPadsCount(), sizeof( D_PAD*), SortPadsByXCoord ); qsort( &(*aVector)[0], aBoard->GetPadsCount(), sizeof( D_PAD*), SortPadsByXCoord );
} }
......
...@@ -179,7 +179,7 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm ) ...@@ -179,7 +179,7 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
return; return;
TRACK* trackList = Marque_Une_Piste( this, DC, pt_segm, &nb_segm, 0 ); TRACK* trackList = Marque_Une_Piste( this, DC, pt_segm, &nb_segm, 0 );
int net_code = pt_segm->GetNet();
if( nb_segm ) /* Il y a nb_segm segments de piste a effacer */ if( nb_segm ) /* Il y a nb_segm segments de piste a effacer */
{ {
int ii = 0; int ii = 0;
...@@ -195,5 +195,7 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm ) ...@@ -195,5 +195,7 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
} }
SaveItemEfface( trackList, nb_segm ); SaveItemEfface( trackList, nb_segm );
if ( net_code > 0 )
test_1_net_connexion( DC, net_code );
} }
} }
...@@ -631,11 +631,6 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event ) ...@@ -631,11 +631,6 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
wxBeginBusyCursor(); wxBeginBusyCursor();
// running the module editor and selecting "Update module in current board"
// causes the list to become obsolete because of the new pads from the
// revised module.
m_Parent->GetBoard()->Build_Pads_Full_List();
// run all the tests, with no UI at this time. // run all the tests, with no UI at this time.
m_tester->RunTests(); m_tester->RunTests();
......
...@@ -583,7 +583,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -583,7 +583,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
{ {
for( unsigned ii = 0; ii<m_pcb->GetPadsCount(); ++ii ) for( unsigned ii = 0; ii<m_pcb->GetPadsCount(); ++ii )
{ {
D_PAD* pad = m_pcb->m_Pads[ii]; D_PAD* pad = m_pcb->m_NetInfo->GetPad( ii );
/* No problem if pads are on an other layer, /* No problem if pads are on an other layer,
* But if a drill hole exists (a pad on a single layer can have a hole!) * But if a drill hole exists (a pad on a single layer can have a hole!)
......
...@@ -45,8 +45,7 @@ void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC * DC ) ...@@ -45,8 +45,7 @@ void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC * DC )
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
} }
m_ModuleEditFrame->Load_Module_Module_From_BOARD( m_ModuleEditFrame->Load_Module_From_BOARD( (MODULE*) GetScreen()->GetCurItem() );
(MODULE*) GetScreen()->GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
GoToEditor = FALSE; GoToEditor = FALSE;
......
...@@ -170,7 +170,7 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb ) ...@@ -170,7 +170,7 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
if( pcb->GetPadsCount() > 0 ) if( pcb->GetPadsCount() > 0 )
{ {
pads.insert( pads.end(), pcb->m_Pads.begin(), pcb->m_Pads.end() ); pads.insert( pads.end(), pcb->m_NetInfo->m_PadsFullList.begin(), pcb->m_NetInfo->m_PadsFullList.end() );
qsort( &pads[0], pcb->GetPadsCount(), sizeof( D_PAD* ), Pad_list_Sort_by_Shapes ); qsort( &pads[0], pcb->GetPadsCount(), sizeof( D_PAD* ), Pad_list_Sort_by_Shapes );
} }
......
...@@ -279,7 +279,6 @@ void WinEDA_PcbFrame::Erase_Modules( bool query ) ...@@ -279,7 +279,6 @@ void WinEDA_PcbFrame::Erase_Modules( bool query )
GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
m_Pcb->m_Pads.clear(); // empty the pad list pointers
m_Pcb->m_NetInfo->DeleteData(); m_Pcb->m_NetInfo->DeleteData();
m_Pcb->m_FullRatsnest.clear(); // empty the pad list pointers m_Pcb->m_FullRatsnest.clear(); // empty the pad list pointers
m_Pcb->m_LocalRatsnest.clear(); // empty the pad list pointers m_Pcb->m_LocalRatsnest.clear(); // empty the pad list pointers
......
...@@ -131,7 +131,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) ...@@ -131,7 +131,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
module->DisplayInfo( this ); module->DisplayInfo( this );
Place_Module( module, DC ); Place_Module( module, DC );
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
GetBoard()->Build_Pads_Full_List(); GetBoard()->m_NetInfo->BuildListOfNets();
return module; return module;
} }
......
...@@ -44,9 +44,9 @@ static void ReadDocLib( const wxString& ModLibName ); ...@@ -44,9 +44,9 @@ static void ReadDocLib( const wxString& ModLibName );
static ModList* MList; static ModList* MList;
/***************************************************************************/ /********************************************************************/
void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module ) void WinEDA_ModuleEditFrame::Load_Module_From_BOARD( MODULE* Module )
/***************************************************************************/ /********************************************************************/
{ {
MODULE* NewModule; MODULE* NewModule;
WinEDA_BasePcbFrame* parent = (WinEDA_BasePcbFrame*) GetParent(); WinEDA_BasePcbFrame* parent = (WinEDA_BasePcbFrame*) GetParent();
...@@ -77,7 +77,7 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module ) ...@@ -77,7 +77,7 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module )
Module->m_Flags = 0; Module->m_Flags = 0;
GetBoard()->Build_Pads_Full_List(); GetBoard()->m_NetInfo->BuildListOfNets();
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0; GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
Place_Module( Module, NULL ); Place_Module( Module, NULL );
......
...@@ -585,7 +585,7 @@ D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int masque_ ...@@ -585,7 +585,7 @@ D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int masque_
{ {
for( unsigned i=0; i<Pcb->GetPadsCount(); ++i ) for( unsigned i=0; i<Pcb->GetPadsCount(); ++i )
{ {
D_PAD* pad = Pcb->m_Pads[i]; D_PAD* pad = Pcb->m_NetInfo->GetPad(i);
if( pad->m_Pos != ref_pos ) if( pad->m_Pos != ref_pos )
continue; continue;
......
...@@ -125,7 +125,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode ) ...@@ -125,7 +125,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
void WinEDA_ModuleEditFrame::LoadModuleFromBoard( wxCommandEvent& event ) void WinEDA_ModuleEditFrame::LoadModuleFromBoard( wxCommandEvent& event )
{ {
GetScreen()->ClearUndoRedoList(); GetScreen()->ClearUndoRedoList();
Load_Module_Module_From_BOARD( NULL ); Load_Module_From_BOARD( NULL );
GetScreen()->ClrModify(); GetScreen()->ClrModify();
if( m_Draw3DFrame ) if( m_Draw3DFrame )
......
...@@ -189,12 +189,12 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -189,12 +189,12 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
module->m_Flags = 0; module->m_Flags = 0;
} }
if( module->m_Flags & IS_NEW ) // Copy command: delete new footprint if( (module->m_Flags & IS_NEW) ) // Copy command: delete new footprint
{ {
module->DeleteStructure(); module->DeleteStructure();
module = NULL; module = NULL;
pcbframe->GetBoard()->m_Status_Pcb = 0; pcbframe->GetBoard()->m_Status_Pcb = 0;
pcbframe->GetBoard()->Build_Pads_Full_List(); pcbframe->GetBoard()->m_NetInfo->BuildListOfNets();
} }
} }
...@@ -241,15 +241,11 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module ) ...@@ -241,15 +241,11 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
newmodule = new MODULE( GetBoard() ); newmodule = new MODULE( GetBoard() );
newmodule->Copy( module ); newmodule->Copy( module );
/* no, Add() below does this
newmodule->SetParent( GetBoard() );
*/
GetBoard()->Add( newmodule, ADD_APPEND ); GetBoard()->Add( newmodule, ADD_APPEND );
newmodule->m_Flags = IS_NEW; newmodule->m_Flags = IS_NEW;
GetBoard()->Build_Pads_Full_List(); GetBoard()->m_NetInfo->BuildListOfNets();
newmodule->DisplayInfo( this ); newmodule->DisplayInfo( this );
GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK; GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
...@@ -327,9 +323,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe ...@@ -327,9 +323,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
/* Sauvegarde en buffer des undelete */ /* Sauvegarde en buffer des undelete */
SaveItemEfface( module, 1 ); SaveItemEfface( module, 1 );
GetBoard()->m_Status_Pcb = 0; Compile_Ratsnest( DC, true );
GetBoard()->Build_Pads_Full_List();
ReCompile_Ratsnest_After_Changes( DC );
// redraw the area where the module was // redraw the area where the module was
if( DC ) if( DC )
...@@ -529,7 +523,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC ) ...@@ -529,7 +523,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
Module->Draw( m_PcbFrame->DrawPanel, DC, GR_OR ); Module->Draw( m_PcbFrame->DrawPanel, DC, GR_OR );
/* affichage chevelu general si necessaire */ /* affichage chevelu general si necessaire */
m_PcbFrame->ReCompile_Ratsnest_After_Changes( DC ); m_PcbFrame->Compile_Ratsnest( DC, true );
} }
} }
else else
...@@ -695,7 +689,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC ) ...@@ -695,7 +689,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC )
} }
/* affichage chevelu general si necessaire */ /* affichage chevelu general si necessaire */
ReCompile_Ratsnest_After_Changes( DC ); Compile_Ratsnest( DC, true );
module->DisplayInfo( this ); module->DisplayInfo( this );
...@@ -765,7 +759,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module, ...@@ -765,7 +759,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
module->Draw( DrawPanel, DC, GR_OR ); module->Draw( DrawPanel, DC, GR_OR );
/* Reaffichage chevelu general si necessaire */ /* Reaffichage chevelu general si necessaire */
ReCompile_Ratsnest_After_Changes( DC ); Compile_Ratsnest( DC, true );
} }
else else
{ {
......
...@@ -428,7 +428,7 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC ) ...@@ -428,7 +428,7 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
for( unsigned ii = 0; ii<m_Pcb->GetPadsCount(); ++ii ) for( unsigned ii = 0; ii<m_Pcb->GetPadsCount(); ++ii )
{ {
pad = m_Pcb->m_Pads[ii]; pad = m_Pcb->m_NetInfo->GetPad(ii);
pad->SetSubRatsnest( 0 ); pad->SetSubRatsnest( 0 );
} }
...@@ -500,17 +500,6 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC ) ...@@ -500,17 +500,6 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
} }
/**********************************************************************/
void WinEDA_BasePcbFrame::ReCompile_Ratsnest_After_Changes( wxDC* DC )
/**********************************************************************/
/* recompile rastnest after a module move, delete, ..
*/
{
if( g_Show_Ratsnest && DC )
Compile_Ratsnest( DC, TRUE );
}
/*********************************************************************/ /*********************************************************************/
void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code ) void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code )
...@@ -776,7 +765,7 @@ void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module ) ...@@ -776,7 +765,7 @@ void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
if( (GetBoard()->m_Status_Pcb & LISTE_PAD_OK) == 0 ) if( (GetBoard()->m_Status_Pcb & LISTE_PAD_OK) == 0 )
{ {
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
GetBoard()->Build_Pads_Full_List(); GetBoard()->m_NetInfo->BuildListOfNets();
} }
/* Compute the "local" ratsnest if needed (when this footprint starts move) /* Compute the "local" ratsnest if needed (when this footprint starts move)
......
...@@ -153,7 +153,6 @@ void Out_Pads( BOARD* Pcb, FILE* outfile ) ...@@ -153,7 +153,6 @@ void Out_Pads( BOARD* Pcb, FILE* outfile )
{ {
D_PAD* pt_pad; D_PAD* pt_pad;
//MODULE * Module;
int netcode, mod_num, nb_pads, plink; int netcode, mod_num, nb_pads, plink;
LISTE_PAD* pt_liste_pad, * pt_start_liste, LISTE_PAD* pt_liste_pad, * pt_start_liste,
* pt_end_liste, * pt_liste_pad_limite; * pt_end_liste, * pt_liste_pad_limite;
...@@ -161,7 +160,7 @@ void Out_Pads( BOARD* Pcb, FILE* outfile ) ...@@ -161,7 +160,7 @@ void Out_Pads( BOARD* Pcb, FILE* outfile )
int no_conn = Pcb->GetPadsCount() + 1;/* valeur incrementee pour indiquer int no_conn = Pcb->GetPadsCount() + 1;/* valeur incrementee pour indiquer
* que le pad n'est pas deja connecte a une piste*/ * que le pad n'est pas deja connecte a une piste*/
pt_liste_pad = pt_start_liste = &Pcb->m_Pads[0]; pt_liste_pad = pt_start_liste = &Pcb->m_NetInfo->m_PadsFullList[0];
pt_liste_pad_limite = pt_start_liste + Pcb->GetPadsCount(); pt_liste_pad_limite = pt_start_liste + Pcb->GetPadsCount();
if( pt_liste_pad == NULL ) if( pt_liste_pad == NULL )
......
...@@ -337,7 +337,6 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC, ...@@ -337,7 +337,6 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
int r, c, side, d, apx_dist, nr, nc; int r, c, side, d, apx_dist, nr, nc;
int result, skip; int result, skip;
int i; int i;
LISTE_PAD* ptr;
long curcell, newcell, buddy, lastopen, lastclos, lastmove; long curcell, newcell, buddy, lastopen, lastclos, lastmove;
int newdist, olddir, _self; int newdist, olddir, _self;
int current_net_code; int current_net_code;
...@@ -432,13 +431,13 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC, ...@@ -432,13 +431,13 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
/* Regenere les barrieres restantes (qui peuvent empieter sur le placement /* Regenere les barrieres restantes (qui peuvent empieter sur le placement
* des bits precedents) */ * des bits precedents) */
ptr = (LISTE_PAD*) &pcbframe->GetBoard()->m_Pads[0];
i = pcbframe->GetBoard()->GetPadsCount(); i = pcbframe->GetBoard()->GetPadsCount();
for( ; i > 0; i--, ptr++ ) for( unsigned ii = 0; ii < pcbframe->GetBoard()->GetPadsCount(); ii++ )
{ {
if( (pt_cur_ch->m_PadStart != *ptr) && (pt_cur_ch->m_PadEnd != *ptr) ) D_PAD * ptr = pcbframe->GetBoard()->m_NetInfo->GetPad(ii);
if( (pt_cur_ch->m_PadStart != ptr) && (pt_cur_ch->m_PadEnd != ptr) )
{ {
Place_1_Pad_Board( pcbframe->GetBoard(), *ptr, ~CURRENT_PAD, marge, WRITE_AND_CELL ); Place_1_Pad_Board( pcbframe->GetBoard(), ptr, ~CURRENT_PAD, marge, WRITE_AND_CELL );
} }
} }
......
...@@ -95,9 +95,7 @@ void WinEDA_BasePcbFrame::UnDeleteItem( wxDC* DC ) ...@@ -95,9 +95,7 @@ void WinEDA_BasePcbFrame::UnDeleteItem( wxDC* DC )
item->SetState( DELETED, OFF ); /* Creal DELETED flag */ item->SetState( DELETED, OFF ); /* Creal DELETED flag */
item->m_Flags = 0; item->m_Flags = 0;
GetBoard()->m_Status_Pcb = 0; Compile_Ratsnest( DC, true );
GetBoard()->Build_Pads_Full_List();
ReCompile_Ratsnest_After_Changes( DC );
break; break;
#endif #endif
...@@ -167,8 +165,6 @@ BOARD_ITEM* WinEDA_BasePcbFrame::SaveItemEfface( BOARD_ITEM* aItem, int nbitems ...@@ -167,8 +165,6 @@ BOARD_ITEM* WinEDA_BasePcbFrame::SaveItemEfface( BOARD_ITEM* aItem, int nbitems
m_Pcb->m_Modules.Remove( module ); m_Pcb->m_Modules.Remove( module );
module->SetState( DELETED, ON ); module->SetState( DELETED, ON );
g_UnDeleteStack[g_UnDeleteStackPtr++] = module; g_UnDeleteStack[g_UnDeleteStackPtr++] = module;
GetBoard()->m_Status_Pcb = 0;
GetBoard()->Build_Pads_Full_List();
} }
break; break;
#endif #endif
......
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