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
Please add newer entries at the top, list the date and your name with
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>
================================================================================
++Eeschema:
......
......@@ -250,8 +250,8 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
rect.SetSize( textsize );
/* Now, calculate the rect origin, according to text justification
* At this point the area origin is the text origin (m_Pos).
* This is true only for left and top text justified texts.
* At this point the rectangle origin is the text origin (m_Pos).
* 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
* also, note the V justification is relative to the first line
*/
......@@ -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:
* true if posref is inside the text area.
* false else.
/**
* Function TextHitTest (overlayed)
* tests if the given point is inside this object.
* @param posref point to test
* @return bool - true if a hit, else false
*/
{
EDA_Rect rect = GetTextBox( -1 ); // Get the full text area.
......@@ -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.
* @param refArea the given EDA_Rect to test
* @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 ) )
......
......@@ -620,7 +620,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
static void MirrorYPoint( wxPoint& point, wxPoint& Center )
{
point.x -= Center.x;
point.x = -point.x;
NEGATE(point.x);
point.x += Center.x;
}
......@@ -683,6 +683,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
case DRAW_BUSENTRY_STRUCT_TYPE:
DrawRaccord = (DrawBusEntryStruct*) DrawStruct;
MirrorYPoint( DrawRaccord->m_Pos, Center );
NEGATE(DrawRaccord->m_Size.x);
break;
case DRAW_JUNCTION_STRUCT_TYPE:
......
......@@ -254,44 +254,24 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
*/
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?)
if( m_FieldId == REFERENCE )
dx += m_Size.x;
// spacing between characters is 0.1 the character size
dx = (int) ( (double) dx * 10.0 / 9 );
int dy = m_Size.y;
if( m_Orient )
EXCHG( dx, dy ); // Swap X and Y size for a vertical text
// 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 );
m_Text.Append('?');
// if using TextHitTest() remember this function uses top to bottom y axis convention
// and for lib items we are using bottom to top convention
// so for non center Y justification we use a trick.
GRTextVertJustifyType vJustify = m_VJustify;
if ( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
else if ( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
m_VJustify = GR_TEXT_VJUSTIFY_TOP;
bool hit = TextHitTest(refPos);
m_VJustify = vJustify;
bbox.SetSize( dx, dy );
if( bbox.Inside( refPos ) )
return true;
return false;
if( m_FieldId == REFERENCE )
m_Text.RemoveLast( );
return hit;
}
......
......@@ -59,7 +59,16 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent;
GRTextHorizJustifyType hjustify;
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:
LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold );
......@@ -153,7 +162,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
{
DrawGraphicText( panel, DC, pos, color, m_Text,
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
{
......
......@@ -95,7 +95,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
*/
bool SCH_TEXT::HitTest( const wxPoint& aPosRef )
{
return EDA_TextStruct::HitTest( aPosRef );
return TextHitTest( aPosRef );
}
......
This diff is collapsed.
......@@ -281,6 +281,15 @@ public:
virtual bool Save( FILE* aFile ) const;
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();
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
......@@ -322,6 +331,14 @@ public:
virtual bool Save( FILE* aFile ) const;
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();
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
......@@ -360,6 +377,26 @@ public:
virtual bool Save( FILE* aFile ) const;
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();
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
......
......@@ -16,71 +16,105 @@ Dialog_BodyGraphicText_Properties_base::Dialog_BodyGraphicText_Properties_base(
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bPropertiesSizer;
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->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->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;
sOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _(" Text Options : ") ), wxVERTICAL );
bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND, 5 );
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 );
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;
bRightSizer = 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 );
bRightSizer->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 );
bRightSizer->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sOptionsSizer->Add( m_CommonConvert, 0, wxALL|wxEXPAND, 5 );
bBottomtBoxSizer->Add( sOptionsSizer, 0, 0, 5 );
wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
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->SetSelection( 3 );
bRightSizer->Add( m_TextShapeOpt, 0, wxALL|wxEXPAND, 5 );
m_TextShapeOpt->SetSelection( 0 );
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;
bSizer4 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bButtonsBoxSizer;
bButtonsBoxSizer = new wxBoxSizer( wxVERTICAL );
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 );
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->Layout();
// 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_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(
Dialog_BodyGraphicText_Properties_base::~Dialog_BodyGraphicText_Properties_base()
{
// 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_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnCancelClick ), NULL, this );
}
......@@ -17,8 +17,9 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statline.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/button.h>
......@@ -36,23 +37,25 @@ class Dialog_BodyGraphicText_Properties_base : public wxDialog
protected:
wxStaticText* m_staticText1;
wxTextCtrl* m_TextValue;
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxCheckBox* m_Orient;
wxStaticText* m_TextSizeText;
wxTextCtrl* m_TextSize;
wxCheckBox* m_Orient;
wxStaticLine* m_staticline1;
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxRadioBox* m_TextShapeOpt;
wxRadioBox* m_TextHJustificationOpt;
wxRadioBox* m_TextVJustificationOpt;
wxButton* m_buttonOK;
wxButton* m_buttonCANCEL;
// 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 OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
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();
};
......
......@@ -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") };
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->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") );
......
......@@ -434,7 +434,7 @@
<property name="font"></property>
<property name="hidden">0</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="maximum_size"></property>
<property name="minimum_size"></property>
......@@ -900,7 +900,7 @@
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">textSizeBoxSizer</property>
<property name="orient">wxVERTICAL</property>
......
......@@ -32,7 +32,7 @@ public:
~Dialog_BodyGraphicText_Properties() {};
private:
void OnInitDialog( wxInitDialogEvent& event );
void InitDialog( );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
};
......@@ -43,12 +43,13 @@ Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_Li
{
m_Parent = aParent;
m_GraphicText = aGraphicText;
InitDialog( );
}
/********************************************************************************/
void Dialog_BodyGraphicText_Properties::OnInitDialog( wxInitDialogEvent& event )
/********************************************************************************/
/*****************************************************/
void Dialog_BodyGraphicText_Properties::InitDialog( )
/*****************************************************/
{
wxString msg;
......@@ -69,6 +70,38 @@ wxString msg;
shape |= 2;
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
{
......@@ -130,6 +163,37 @@ wxString Line;
else
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();
......
This diff is collapsed.
This diff is collapsed.
......@@ -543,21 +543,21 @@ private:
wxPoint aPos );
public:
/**
* Function HitTest
* Function TextHitTest
* tests if the given wxPoint is within the bounds of this object.
* @param ref_pos A wxPoint to test
* @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.
* For now, the anchor must be inside this rect.
* @param refArea : the given EDA_Rect
* @return bool - true if a hit, else false
*/
bool HitTest( EDA_Rect& refArea );
bool TextHitTest( EDA_Rect& refArea );
/**
* Function LenSize
......
......@@ -69,6 +69,11 @@ static inline const wxChar* GetChars( wxString s )
while( Angle > 900 ) \
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 */
......
......@@ -279,7 +279,6 @@ public:
// ratsnest functions
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 );
void build_ratsnest_module( wxDC* DC, MODULE* Module );
void trace_ratsnest_module( wxDC* DC );
......@@ -1011,7 +1010,7 @@ public:
// loading Footprint
MODULE* Import_Module( wxDC* DC );
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
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 )
}
GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST;
ReCompile_Ratsnest_After_Changes( &dc );
Compile_Ratsnest( &dc, true );
SetToolbars();
}
......
......@@ -54,7 +54,6 @@ float MinCout;
/* Fonctions locales */
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 void TracePenaliteRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
......@@ -309,10 +308,8 @@ end_of_tst:
Module->Set_Rectangle_Encadrement();
}
/* Recalcul de la liste des pads, detruite par les calculs precedents */
GetBoard()->m_Status_Pcb = 0;
GetBoard()->Build_Pads_Full_List();
Compile_Ratsnest( DC, true );
DrawPanel->ReDraw( DC, TRUE );
DrawPanel->m_AbortEnable = FALSE;
......@@ -585,8 +582,6 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
Module->DisplayInfo( this );
Build_PlacedPads_List( GetBoard() );
LastPosOK.x = GetBoard()->m_BoundaryBox.m_Pos.x;
LastPosOK.y = GetBoard()->m_BoundaryBox.m_Pos.y;
......@@ -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 */
/*****************************************************************/
......@@ -1099,8 +1049,6 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC )
if( BaseListeModules == NULL )
return NULL;
Build_PlacedPads_List( pcbframe->GetBoard() );
/* Tri par surface decroissante des modules
* (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 )
// 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) )
{
......
This diff is collapsed.
......@@ -479,14 +479,8 @@ bool COTATION::HitTest( const wxPoint& ref_pos )
int ux0, uy0;
int dx, dy, spot_cX, spot_cY;
if( m_Text )
{
// 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 ) )
if( m_Text && m_Text->TextHitTest( ref_pos ) )
return true;
}
/* Localisation des SEGMENTS ?) */
ux0 = Barre_ox;
......
......@@ -53,10 +53,10 @@ public:
m_NetCode = aNetCode;
}
/** function Draw
*/
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset );
};
/***************************************************************/
......@@ -70,7 +70,10 @@ private:
BOARD* m_Parent;
// 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:
NETINFO_LIST( BOARD* aParent );
~NETINFO_LIST();
......@@ -103,6 +106,37 @@ public:
* The list is sorted by names.
*/
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
......@@ -119,13 +153,13 @@ private:
public:
int m_NbNodes; // Pads count for this net
int m_NbLink; // Ratsnets count for this net
int m_NbNoconn; // Ratsnets remaining to route count
int m_ForceWidth; // specific width (O = default width)
int m_NbNodes; // Pads count for this net
int m_NbLink; // Ratsnets count for this net
int m_NbNoconn; // Ratsnets remaining to route count
int m_ForceWidth; // specific width (O = default width)
std::vector <D_PAD*> m_ListPad; // List of pads connected to this net
unsigned m_RatsnestStart; // debut de liste ratsnests du net (included)
unsigned m_RatsnestEnd; // fin de liste ratsnests du net (excluded)
unsigned m_RatsnestStart; // debut de liste ratsnests du net (included)
unsigned m_RatsnestEnd; // fin de liste ratsnests du net (excluded)
NETINFO_ITEM( BOARD_ITEM* aParent );
~NETINFO_ITEM();
......@@ -188,8 +222,6 @@ public:
};
/****************************************************************/
/* description d'un point de piste pour le suivi des connexions */
/****************************************************************/
......
......@@ -44,6 +44,7 @@ void NETINFO_LIST::DeleteData()
delete m_NetBuffer[ii];
m_NetBuffer.clear();
m_PadsFullList.clear();
}
......@@ -90,14 +91,14 @@ void NETINFO_LIST::BuildListOfNets()
AppendNet( net_item );
/* 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 */
D_PAD* last_pad = NULL;
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
{
pad->SetNet( 0 );
......@@ -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
* Create the pad list, sorted by net names
......@@ -143,19 +144,19 @@ void BOARD::Build_Pads_Full_List()
* (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;
// empty the old list
m_Pads.clear();
m_FullRatsnest.clear();
m_PadsFullList.clear();
m_Parent->m_FullRatsnest.clear();
/* 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() )
{
m_Pads.push_back( pad );
m_PadsFullList.push_back( pad );
pad->SetSubRatsnest( 0 );
pad->SetParent( module );
......@@ -163,7 +164,7 @@ void BOARD::Build_Pads_Full_List()
}
// 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:
*/
bool HitTest( const wxPoint& refPos )
{
return EDA_TextStruct::HitTest( refPos );
return TextHitTest( refPos );
}
......@@ -70,7 +70,7 @@ public:
*/
bool HitTest( EDA_Rect& refArea )
{
return EDA_TextStruct::HitTest( refArea );
return TextHitTest( refArea );
}
/**
......
......@@ -278,7 +278,7 @@ void WinEDA_BasePcbFrame::test_connexions( wxDC* DC )
// Clear the cluster identifier for all pads
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->SetSubNet( 0 );
......@@ -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 )
{
D_PAD* pad = m_Pcb->m_Pads[i];
D_PAD* pad = m_Pcb->m_NetInfo->GetPad(i);
int pad_net_code = pad->GetNet();
......@@ -555,7 +555,7 @@ static int SortPadsByXCoord( const void* pt_ref, const void* pt_comp )
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 );
}
......
......@@ -179,7 +179,7 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
return;
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 */
{
int ii = 0;
......@@ -195,5 +195,7 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_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 )
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.
m_tester->RunTests();
......
......@@ -583,7 +583,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
{
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,
* 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 )
wxSize( 600, 400 ) );
}
m_ModuleEditFrame->Load_Module_Module_From_BOARD(
(MODULE*) GetScreen()->GetCurItem() );
m_ModuleEditFrame->Load_Module_From_BOARD( (MODULE*) GetScreen()->GetCurItem() );
SetCurItem( NULL );
GoToEditor = FALSE;
......
......@@ -170,7 +170,7 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
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 );
}
......
......@@ -279,7 +279,6 @@ void WinEDA_PcbFrame::Erase_Modules( bool query )
GetBoard()->m_Modules.DeleteAll();
GetBoard()->m_Status_Pcb = 0;
m_Pcb->m_Pads.clear(); // empty the pad list pointers
m_Pcb->m_NetInfo->DeleteData();
m_Pcb->m_FullRatsnest.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 )
module->DisplayInfo( this );
Place_Module( module, DC );
GetBoard()->m_Status_Pcb = 0;
GetBoard()->Build_Pads_Full_List();
GetBoard()->m_NetInfo->BuildListOfNets();
return module;
}
......
......@@ -44,9 +44,9 @@ static void ReadDocLib( const wxString& ModLibName );
static ModList* MList;
/***************************************************************************/
void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module )
/***************************************************************************/
/********************************************************************/
void WinEDA_ModuleEditFrame::Load_Module_From_BOARD( MODULE* Module )
/********************************************************************/
{
MODULE* NewModule;
WinEDA_BasePcbFrame* parent = (WinEDA_BasePcbFrame*) GetParent();
......@@ -77,7 +77,7 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module )
Module->m_Flags = 0;
GetBoard()->Build_Pads_Full_List();
GetBoard()->m_NetInfo->BuildListOfNets();
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
Place_Module( Module, NULL );
......@@ -169,7 +169,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
*/
// GetBoard()->m_Pcb->m_NetInfo->BuildListOfNets();
RecalculateAllTracksNetcode( );
if ( DC )
module->Draw( DrawPanel, DC, GR_OR );
}
......
......@@ -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 )
{
D_PAD* pad = Pcb->m_Pads[i];
D_PAD* pad = Pcb->m_NetInfo->GetPad(i);
if( pad->m_Pos != ref_pos )
continue;
......
......@@ -125,7 +125,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
void WinEDA_ModuleEditFrame::LoadModuleFromBoard( wxCommandEvent& event )
{
GetScreen()->ClearUndoRedoList();
Load_Module_Module_From_BOARD( NULL );
Load_Module_From_BOARD( NULL );
GetScreen()->ClrModify();
if( m_Draw3DFrame )
......
......@@ -189,12 +189,12 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
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 = NULL;
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 )
newmodule = new MODULE( GetBoard() );
newmodule->Copy( module );
/* no, Add() below does this
newmodule->SetParent( GetBoard() );
*/
GetBoard()->Add( newmodule, ADD_APPEND );
newmodule->m_Flags = IS_NEW;
GetBoard()->Build_Pads_Full_List();
GetBoard()->m_NetInfo->BuildListOfNets();
newmodule->DisplayInfo( this );
GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
......@@ -327,9 +323,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
/* Sauvegarde en buffer des undelete */
SaveItemEfface( module, 1 );
GetBoard()->m_Status_Pcb = 0;
GetBoard()->Build_Pads_Full_List();
ReCompile_Ratsnest_After_Changes( DC );
Compile_Ratsnest( DC, true );
// redraw the area where the module was
if( DC )
......@@ -529,7 +523,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
Module->Draw( m_PcbFrame->DrawPanel, DC, GR_OR );
/* affichage chevelu general si necessaire */
m_PcbFrame->ReCompile_Ratsnest_After_Changes( DC );
m_PcbFrame->Compile_Ratsnest( DC, true );
}
}
else
......@@ -695,7 +689,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC )
}
/* affichage chevelu general si necessaire */
ReCompile_Ratsnest_After_Changes( DC );
Compile_Ratsnest( DC, true );
module->DisplayInfo( this );
......@@ -765,7 +759,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
module->Draw( DrawPanel, DC, GR_OR );
/* Reaffichage chevelu general si necessaire */
ReCompile_Ratsnest_After_Changes( DC );
Compile_Ratsnest( DC, true );
}
else
{
......
......@@ -428,7 +428,7 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
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 );
}
......@@ -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 )
......@@ -776,7 +765,7 @@ void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
if( (GetBoard()->m_Status_Pcb & LISTE_PAD_OK) == 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)
......
......@@ -153,7 +153,6 @@ void Out_Pads( BOARD* Pcb, FILE* outfile )
{
D_PAD* pt_pad;
//MODULE * Module;
int netcode, mod_num, nb_pads, plink;
LISTE_PAD* pt_liste_pad, * pt_start_liste,
* pt_end_liste, * pt_liste_pad_limite;
......@@ -161,7 +160,7 @@ void Out_Pads( BOARD* Pcb, FILE* outfile )
int no_conn = Pcb->GetPadsCount() + 1;/* valeur incrementee pour indiquer
* 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();
if( pt_liste_pad == NULL )
......
......@@ -337,7 +337,6 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
int r, c, side, d, apx_dist, nr, nc;
int result, skip;
int i;
LISTE_PAD* ptr;
long curcell, newcell, buddy, lastopen, lastclos, lastmove;
int newdist, olddir, _self;
int current_net_code;
......@@ -432,13 +431,13 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
/* Regenere les barrieres restantes (qui peuvent empieter sur le placement
* des bits precedents) */
ptr = (LISTE_PAD*) &pcbframe->GetBoard()->m_Pads[0];
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 )
item->SetState( DELETED, OFF ); /* Creal DELETED flag */
item->m_Flags = 0;
GetBoard()->m_Status_Pcb = 0;
GetBoard()->Build_Pads_Full_List();
ReCompile_Ratsnest_After_Changes( DC );
Compile_Ratsnest( DC, true );
break;
#endif
......@@ -167,8 +165,6 @@ BOARD_ITEM* WinEDA_BasePcbFrame::SaveItemEfface( BOARD_ITEM* aItem, int nbitems
m_Pcb->m_Modules.Remove( module );
module->SetState( DELETED, ON );
g_UnDeleteStack[g_UnDeleteStackPtr++] = module;
GetBoard()->m_Status_Pcb = 0;
GetBoard()->Build_Pads_Full_List();
}
break;
#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