Netclasses work continued

Fixed problems in libedit and crashes when no component loaded
This commit is contained in:
charras 2009-10-10 17:27:53 +00:00
parent b4fe26a31f
commit 56059efd8a
37 changed files with 1743 additions and 1370 deletions

View File

@ -8,7 +8,7 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#define BUILD_VERSION "(20091001-unstable)" #define BUILD_VERSION "(20091010-unstable)"
#ifdef HAVE_SVN_VERSION #ifdef HAVE_SVN_VERSION

View File

@ -19,6 +19,7 @@ set(CVPCB_SRCS
dialog_cvpcb_config_fbp.cpp dialog_cvpcb_config_fbp.cpp
dialog_display_options.cpp dialog_display_options.cpp
displayframe.cpp displayframe.cpp
dummy_functions.cpp
genequiv.cpp genequiv.cpp
init.cpp init.cpp
listboxes.cpp listboxes.cpp

21
cvpcb/dummy_functions.cpp Normal file
View File

@ -0,0 +1,21 @@
/* dummy_functions.cpp
*
* There are functions used in some classes.
* they are useful in pcbnew, but have no meaning or are never used
* in cvpcb or gerbview.
* but they must exist because they appear in some classes, and here, no nothing.
*/
#include "fctsys.h"
#include "common.h"
#include "pcbnew.h"
TRACK* Marque_Une_Piste( BOARD* aPcb,
TRACK* aStartSegm,
int* aSegmCount,
int* aTrackLen,
bool aReorder )
{
return NULL;
}

View File

@ -101,6 +101,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
if ( m_component )
ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate, ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
m_unit, m_convert, m_unit, m_convert,
g_EditPinByPinIsOn ); g_EditPinByPinIsOn );
@ -125,11 +126,13 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
if ( m_component )
ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate, ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
m_unit, m_convert, m_unit, m_convert,
g_EditPinByPinIsOn ); g_EditPinByPinIsOn );
if( ItemCount ) if( ItemCount )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
if ( m_component )
m_component->DeleteSelectedItems(); m_component->DeleteSelectedItems();
break; break;
@ -142,6 +145,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
if ( m_component )
ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate, ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
m_unit, m_convert, m_unit, m_convert,
g_EditPinByPinIsOn ); g_EditPinByPinIsOn );
@ -149,6 +153,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.Centre(); pt = GetScreen()->m_BlockLocate.Centre();
pt.y *= -1; pt.y *= -1;
if ( m_component )
m_component->MirrorSelectedItemsH( pt ); m_component->MirrorSelectedItemsH( pt );
break; break;
@ -166,6 +171,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
if( MustDoPlace <= 0 ) if( MustDoPlace <= 0 )
{ {
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY ) if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
if ( m_component )
m_component->ClearSelectedItems(); m_component->ClearSelectedItems();
GetScreen()->m_BlockLocate.m_Flags = 0; GetScreen()->m_BlockLocate.m_Flags = 0;
@ -213,18 +219,22 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
if ( m_component )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.m_MoveVector; pt = GetScreen()->m_BlockLocate.m_MoveVector;
pt.y *= -1; pt.y *= -1;
if ( m_component )
m_component->MoveSelectedItems( pt ); m_component->MoveSelectedItems( pt );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
if ( m_component )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.m_MoveVector; pt = GetScreen()->m_BlockLocate.m_MoveVector;
pt.y *= -1; pt.y *= -1;
if ( m_component )
m_component->CopySelectedItems( pt ); m_component->CopySelectedItems( pt );
break; break;
@ -233,9 +243,11 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
break; break;
case BLOCK_MIRROR_Y: /* Invert by popup menu, from block move */ case BLOCK_MIRROR_Y: /* Invert by popup menu, from block move */
if ( m_component )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.Centre(); pt = GetScreen()->m_BlockLocate.Centre();
pt.y *= -1; pt.y *= -1;
if ( m_component )
m_component->MirrorSelectedItemsH( pt ); m_component->MirrorSelectedItemsH( pt );
break; break;

View File

@ -599,8 +599,8 @@ bool LIB_COMPONENT::Load( FILE* file, char* line, int* lineNum,
return false; return false;
} }
m_DrawPinNum = (drawnum == 'N') ? FALSE : TRUE; m_DrawPinNum = (drawnum == 'N') ? FALSE : true;
m_DrawPinName = (drawname == 'N') ? FALSE : TRUE; m_DrawPinName = (drawname == 'N') ? FALSE : true;
/* Copy part name and prefix. */ /* Copy part name and prefix. */
strupper( name ); strupper( name );
@ -622,7 +622,7 @@ bool LIB_COMPONENT::Load( FILE* file, char* line, int* lineNum,
// Copy optional infos // Copy optional infos
if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'L' ) if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'L' )
m_UnitSelectionLocked = TRUE; m_UnitSelectionLocked = true;
if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'P' ) if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'P' )
m_Options = ENTRY_POWER; m_Options = ENTRY_POWER;
@ -862,10 +862,10 @@ void LIB_COMPONENT::SetFields( const std::vector <LIB_FIELD> aFields )
{ {
bool create = FALSE; bool create = FALSE;
if( !aFields[ii].m_Text.IsEmpty() ) if( !aFields[ii].m_Text.IsEmpty() )
create = TRUE; create = true;
if( !aFields[ii].m_Name.IsEmpty() if( !aFields[ii].m_Name.IsEmpty()
&& ( aFields[ii].m_Name != ReturnDefaultFieldName( ii ) ) ) && ( aFields[ii].m_Name != ReturnDefaultFieldName( ii ) ) )
create = TRUE; create = true;
if( create ) if( create )
{ {
LIB_FIELD*Field = new LIB_FIELD( this, ii ); LIB_FIELD*Field = new LIB_FIELD( this, ii );
@ -1302,7 +1302,7 @@ void LIB_COMPONENT::SetConversion( bool asConvert )
{ {
if( asConvert == HasConversion() ) if( asConvert == HasConversion() )
return; return;
// Duplicate items to create the converted shape
if( asConvert ) if( asConvert )
{ {
@ -1321,6 +1321,7 @@ void LIB_COMPONENT::SetConversion( bool asConvert )
} }
else else
{ {
// Delete converted shape items becuase the converted shape does not exist
LIB_DRAW_ITEM_LIST::iterator i = m_Drawings.begin(); LIB_DRAW_ITEM_LIST::iterator i = m_Drawings.begin();
while( i != m_Drawings.end() ) while( i != m_Drawings.end() )

View File

@ -31,18 +31,21 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_OptionsBoxSizer->Add( m_AsConvertButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_OptionsBoxSizer->Add( m_AsConvertButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ShowPinNumButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Show Pin Num"), wxDefaultPosition, wxDefaultSize, 0 ); m_ShowPinNumButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Show Pin Num"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowPinNumButt->SetValue(true);
m_ShowPinNumButt->SetToolTip( _("Show or hide pin numbers") ); m_ShowPinNumButt->SetToolTip( _("Show or hide pin numbers") );
m_OptionsBoxSizer->Add( m_ShowPinNumButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_OptionsBoxSizer->Add( m_ShowPinNumButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ShowPinNameButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Show Pin Name"), wxDefaultPosition, wxDefaultSize, 0 ); m_ShowPinNameButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Show Pin Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowPinNameButt->SetValue(true);
m_ShowPinNameButt->SetToolTip( _("Show or hide pin names") ); m_ShowPinNameButt->SetToolTip( _("Show or hide pin names") );
m_OptionsBoxSizer->Add( m_ShowPinNameButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_OptionsBoxSizer->Add( m_ShowPinNameButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PinsNameInsideButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Pin Name Inside"), wxDefaultPosition, wxDefaultSize, 0 ); m_PinsNameInsideButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Pin Name Inside"), wxDefaultPosition, wxDefaultSize, 0 );
m_PinsNameInsideButt->SetValue(true);
m_PinsNameInsideButt->SetToolTip( _("Check this option to have pin names inside the body and pin number outside.\nIf not checked pins names and pins numbers are outside.") ); m_PinsNameInsideButt->SetToolTip( _("Check this option to have pin names inside the body and pin number outside.\nIf not checked pins names and pins numbers are outside.") );
@ -63,7 +66,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_staticTextNbUnits->Wrap( -1 ); m_staticTextNbUnits->Wrap( -1 );
bSizernbunits->Add( m_staticTextNbUnits, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizernbunits->Add( m_staticTextNbUnits, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 16, 1 ); m_SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 16, 1 );
bSizernbunits->Add( m_SelNumberOfUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizernbunits->Add( m_SelNumberOfUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizerMidBasicPanel->Add( bSizernbunits, 1, wxEXPAND, 5 ); bSizerMidBasicPanel->Add( bSizernbunits, 1, wxEXPAND, 5 );
@ -75,7 +78,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_staticTextskew->Wrap( -1 ); m_staticTextskew->Wrap( -1 );
bSizer17->Add( m_staticTextskew, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizer17->Add( m_staticTextskew, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_SetSkew = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 ); m_SetSkew = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 );
bSizer17->Add( m_SetSkew, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizer17->Add( m_SetSkew, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMidBasicPanel->Add( bSizer17, 1, wxEXPAND, 5 ); bSizerMidBasicPanel->Add( bSizer17, 1, wxEXPAND, 5 );

View File

@ -246,7 +246,7 @@
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
@ -298,7 +298,7 @@
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
@ -350,7 +350,7 @@
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="checked">0</property> <property name="checked">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
@ -531,7 +531,7 @@
<property name="initial">1</property> <property name="initial">1</property>
<property name="max">16</property> <property name="max">16</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min">0</property> <property name="min">1</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_SelNumberOfUnits</property> <property name="name">m_SelNumberOfUnits</property>
<property name="permission">protected</property> <property name="permission">protected</property>
@ -648,7 +648,7 @@
<property name="initial">0</property> <property name="initial">0</property>
<property name="max">100</property> <property name="max">100</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min">0</property> <property name="min">1</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_SetSkew</property> <property name="name">m_SetSkew</property>
<property name="permission">protected</property> <property name="permission">protected</property>

View File

@ -522,7 +522,7 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="initial">0</property> <property name="initial">0</property>
<property name="max">40</property> <property name="max">26</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min">1</property> <property name="min">1</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -754,7 +754,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">Prevent drawing items from being &amp;moved</property> <property name="label">Parts in package locked (cannot be swapped)</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_checkLockItems</property> <property name="name">m_checkLockItems</property>
@ -949,9 +949,9 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="initial">40</property> <property name="initial">40</property>
<property name="max">10000</property> <property name="max">100</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min">0</property> <property name="min">1</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_spinPinTextPosition</property> <property name="name">m_spinPinTextPosition</property>
<property name="permission">protected</property> <property name="permission">protected</property>
@ -1190,6 +1190,79 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer121</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">12</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="bg"></property>
<property name="checked">1</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pin name &amp;inside</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_checkShowPinNameInside</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">10</property> <property name="border">10</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>

View File

@ -62,6 +62,12 @@ public:
m_checkShowPinName->SetValue( show ); m_checkShowPinName->SetValue( show );
} }
bool GetShowPinName( void ) { return m_checkShowPinName->GetValue(); } bool GetShowPinName( void ) { return m_checkShowPinName->GetValue(); }
void SetPinNameInside( bool show )
{
m_checkShowPinNameInside->SetValue( show );
}
bool GetPinNameInside( void ) { return m_checkShowPinNameInside->GetValue(); }
}; };
#endif // __dialog_lib_new_component__ #endif // __dialog_lib_new_component__

View File

@ -80,7 +80,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer4->Add( 0, 0, 1, wxEXPAND, 3 ); bSizer4->Add( 0, 0, 1, wxEXPAND, 3 );
m_spinPartCount = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxSize( 100,-1 ), wxSP_ARROW_KEYS, 1, 40, 0 ); m_spinPartCount = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxSize( 100,-1 ), wxSP_ARROW_KEYS, 1, 26, 0 );
bSizer4->Add( m_spinPartCount, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bSizer4->Add( m_spinPartCount, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
@ -118,7 +118,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer9->Add( 12, 0, 0, wxEXPAND, 3 ); bSizer9->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Prevent drawing items from being &moved"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Parts in package locked (cannot be swapped)"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_checkLockItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bSizer9->Add( m_checkLockItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
@ -146,7 +146,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer6->Add( 0, 0, 1, wxEXPAND, 3 ); bSizer6->Add( 0, 0, 1, wxEXPAND, 3 );
m_spinPinTextPosition = new wxSpinCtrl( this, wxID_ANY, wxT("40"), wxDefaultPosition, wxSize( 100,-1 ), wxSP_ARROW_KEYS, 0, 10000, 40 ); m_spinPinTextPosition = new wxSpinCtrl( this, wxID_ANY, wxT("40"), wxDefaultPosition, wxSize( 100,-1 ), wxSP_ARROW_KEYS, 1, 100, 40 );
bSizer6->Add( m_spinPinTextPosition, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bSizer6->Add( m_spinPinTextPosition, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxSize( 30,-1 ), 0 ); m_staticText5 = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxSize( 30,-1 ), 0 );
@ -181,6 +181,19 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer5->Add( bSizer12, 0, wxALL|wxEXPAND, 0 ); bSizer5->Add( bSizer12, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer121;
bSizer121 = new wxBoxSizer( wxHORIZONTAL );
bSizer121->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkShowPinNameInside = new wxCheckBox( this, wxID_ANY, _("Pin name &inside"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinNameInside->SetValue(true);
bSizer121->Add( m_checkShowPinNameInside, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer121, 1, wxEXPAND, 5 );
bSizer5->Add( 0, 5, 0, wxALL|wxEXPAND, 10 ); bSizer5->Add( 0, 5, 0, wxALL|wxEXPAND, 10 );

View File

@ -67,6 +67,8 @@ class DIALOG_LIB_NEW_COMPONENT_BASE : public wxDialog
wxCheckBox* m_checkShowPinName; wxCheckBox* m_checkShowPinName;
wxCheckBox* m_checkShowPinNameInside;
wxStdDialogButtonSizer* m_sdbSizer; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK; wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;

View File

@ -5,6 +5,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
@ -31,13 +32,12 @@
void WinEDA_LibeditFrame::OnEditComponentProperties( wxCommandEvent& event ) void WinEDA_LibeditFrame::OnEditComponentProperties( wxCommandEvent& event )
{ {
EditComponentProperties(); EditComponentProperties();
DrawPanel->Refresh();
} }
void WinEDA_LibeditFrame::EditComponentProperties() void WinEDA_LibeditFrame::EditComponentProperties()
{ {
wxASSERT( m_component != NULL && m_library != NULL );
DIALOG_EDIT_COMPONENT_IN_LIBRARY dlg( this ); DIALOG_EDIT_COMPONENT_IN_LIBRARY dlg( this );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
@ -120,15 +120,21 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
/* Update the doc, keyword and doc filename strings */ /* Update the doc, keyword and doc filename strings */
size_t i; size_t i;
int index; int index;
CMP_LIB_ENTRY* entry; CMP_LIB_ENTRY* entry = NULL;
LIB_COMPONENT* component = m_Parent->GetComponent(); LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL )
{
EndModal( wxID_CANCEL );
return;
}
CMP_LIBRARY* library = m_Parent->GetLibrary(); CMP_LIBRARY* library = m_Parent->GetLibrary();
if( m_Parent->GetAliasName().IsEmpty() ) if( m_Parent->GetAliasName().IsEmpty() )
{ {
entry = (CMP_LIB_ENTRY*) component; entry = (CMP_LIB_ENTRY*) component;
} }
else else if ( library )
{ {
entry = library->FindEntry( m_Parent->GetAliasName() ); entry = library->FindEntry( m_Parent->GetAliasName() );
} }
@ -213,21 +219,26 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
component->m_DrawPinNum = m_ShowPinNumButt->GetValue() ? 1 : 0; component->m_DrawPinNum = m_ShowPinNumButt->GetValue() ? 1 : 0;
component->m_DrawPinName = m_ShowPinNameButt->GetValue() ? 1 : 0; component->m_DrawPinName = m_ShowPinNameButt->GetValue() ? 1 : 0;
if( m_PinsNameInsideButt->GetValue() == FALSE ) if( m_PinsNameInsideButt->GetValue() == false )
component->m_TextInside = 0; component->m_TextInside = 0; // pin text outside the body (name is on the pin)
else else
{
component->m_TextInside = m_SetSkew->GetValue(); component->m_TextInside = m_SetSkew->GetValue();
// Ensure component->m_TextInside != 0, because the meaning is "text outside".
if( component->m_TextInside == 0 )
component->m_TextInside = 20; // give a reasonnable value
}
if( m_OptionPower->GetValue() == TRUE ) if( m_OptionPower->GetValue() == true )
component->m_Options = ENTRY_POWER; component->m_Options = ENTRY_POWER;
else else
component->m_Options = ENTRY_NORMAL; component->m_Options = ENTRY_NORMAL;
/* Set the option "Units locked". /* Set the option "Units locked".
* Obviously, cannot be TRUE if there is only one part */ * Obviously, cannot be true if there is only one part */
component->m_UnitSelectionLocked = m_OptionPartsLocked->GetValue(); component->m_UnitSelectionLocked = m_OptionPartsLocked->GetValue();
if( component->GetPartCount() <= 1 ) if( component->GetPartCount() <= 1 )
component->m_UnitSelectionLocked = FALSE; component->m_UnitSelectionLocked = false;
/* Update the footprint filter list */ /* Update the footprint filter list */
component->m_FootprintList.Clear(); component->m_FootprintList.Clear();
@ -273,8 +284,8 @@ edited!" ),
if( IsOK( this, _( "Remove all aliases from list?" ) ) ) if( IsOK( this, _( "Remove all aliases from list?" ) ) )
{ {
m_PartAliasList->Clear(); m_PartAliasList->Clear();
m_ButtonDeleteAllAlias->Enable( FALSE ); m_ButtonDeleteAllAlias->Enable( false );
m_ButtonDeleteOneAlias->Enable( FALSE ); m_ButtonDeleteOneAlias->Enable( false );
} }
} }
@ -316,8 +327,8 @@ library <%s>." ),
m_PartAliasList->Append( aliasname ); m_PartAliasList->Append( aliasname );
if( m_Parent->GetAliasName().IsEmpty() ) if( m_Parent->GetAliasName().IsEmpty() )
m_ButtonDeleteAllAlias->Enable( TRUE ); m_ButtonDeleteAllAlias->Enable( true );
m_ButtonDeleteOneAlias->Enable( TRUE ); m_ButtonDeleteOneAlias->Enable( true );
} }
@ -342,8 +353,8 @@ edited!" ),
if( m_PartAliasList->IsEmpty() ) if( m_PartAliasList->IsEmpty() )
{ {
m_ButtonDeleteAllAlias->Enable( FALSE ); m_ButtonDeleteAllAlias->Enable( false );
m_ButtonDeleteOneAlias->Enable( FALSE ); m_ButtonDeleteOneAlias->Enable( false );
} }
} }
@ -379,21 +390,21 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert()
|| ( m_Parent->GetShowDeMorgan() == component->HasConversion() ) ) || ( m_Parent->GetShowDeMorgan() == component->HasConversion() ) )
return false; return false;
if( m_Parent->GetShowDeMorgan() if( m_Parent->GetShowDeMorgan() )
&& !IsOK( this, _( "Add new pins for alternate body style \
( DeMorgan ) to component?" ) ) )
{ {
m_Parent->SetShowDeMorgan( false ); if( !IsOK( this, _( "Add new pins for alternate body style \
( DeMorgan ) to component?" ) ) )
return false; return false;
} }
if( !m_Parent->GetShowDeMorgan() else if( component->HasConversion() )
&& !IsOK( this, _( "Delete alternate body style (DeMorgan) draw \ {
items from component?" ) ) ) if( !IsOK( this, _( "Delete alternate body style (DeMorgan) draw items from component?" ) ) )
{ {
m_Parent->SetShowDeMorgan( true ); m_Parent->SetShowDeMorgan( true );
return false; return false;
} }
}
component->SetConversion( m_Parent->GetShowDeMorgan() ); component->SetConversion( m_Parent->GetShowDeMorgan() );
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
@ -419,7 +430,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& e
mask, /* Masque d'affichage */ mask, /* Masque d'affichage */
this, this,
wxFD_OPEN, wxFD_OPEN,
TRUE true
); );
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return; return;
@ -446,8 +457,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter(
if( IsOK( this, _( "Ok to Delete FootprintFilter LIST" ) ) ) if( IsOK( this, _( "Ok to Delete FootprintFilter LIST" ) ) )
{ {
m_FootprintFilterListBox->Clear(); m_FootprintFilterListBox->Clear();
m_ButtonDeleteAllFootprintFilter->Enable( FALSE ); m_ButtonDeleteAllFootprintFilter->Enable( false );
m_ButtonDeleteOneFootprintFilter->Enable( FALSE ); m_ButtonDeleteOneFootprintFilter->Enable( false );
} }
} }
@ -486,8 +497,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNU
} }
m_FootprintFilterListBox->Append( Line ); m_FootprintFilterListBox->Append( Line );
m_ButtonDeleteAllFootprintFilter->Enable( TRUE ); m_ButtonDeleteAllFootprintFilter->Enable( true );
m_ButtonDeleteOneFootprintFilter->Enable( TRUE ); m_ButtonDeleteOneFootprintFilter->Enable( true );
} }
@ -503,7 +514,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter(
if( !component || (m_FootprintFilterListBox->GetCount() == 0) ) if( !component || (m_FootprintFilterListBox->GetCount() == 0) )
{ {
m_ButtonDeleteAllFootprintFilter->Enable( FALSE ); m_ButtonDeleteAllFootprintFilter->Enable( false );
m_ButtonDeleteOneFootprintFilter->Enable( FALSE ); m_ButtonDeleteOneFootprintFilter->Enable( false );
} }
} }

View File

@ -113,6 +113,7 @@ library \"%s\"." ),
GetScreen()->ClearUndoRedoList(); GetScreen()->ClearUndoRedoList();
Zoom_Automatique( false ); Zoom_Automatique( false );
DrawPanel->Refresh(); DrawPanel->Refresh();
SetShowDeMorgan(m_component->HasConversion() );
} }
@ -506,7 +507,10 @@ lost!\n\nClear the current component from the screen?" ) ) )
return; return;
if( dlg.GetName().IsEmpty() ) if( dlg.GetName().IsEmpty() )
{
wxMessageBox(_("This new component has no name and cannot be created. Aborted"));
return; return;
}
name = dlg.GetName().MakeUpper(); name = dlg.GetName().MakeUpper();
name.Replace( wxT( " " ), wxT( "_" ) ); name.Replace( wxT( " " ), wxT( "_" ) );
@ -525,12 +529,25 @@ lost!\n\nClear the current component from the screen?" ) ) )
LIB_COMPONENT* component = new LIB_COMPONENT( name ); LIB_COMPONENT* component = new LIB_COMPONENT( name );
component->m_Prefix.m_Text = dlg.GetReference(); component->m_Prefix.m_Text = dlg.GetReference();
component->SetPartCount( dlg.GetPartCount() ); component->SetPartCount( dlg.GetPartCount() );
// Initialize component->m_TextInside member:
// if 0, pin text is outside the body (on the pin)
// if > 0, pin text is inside the body
component->SetConversion( dlg.GetAlternateBodyStyle() ); component->SetConversion( dlg.GetAlternateBodyStyle() );
SetShowDeMorgan( dlg.GetAlternateBodyStyle() );
if( dlg.GetPinNameInside( ) )
{
component->m_TextInside = dlg.GetPinTextPosition(); component->m_TextInside = dlg.GetPinTextPosition();
component->m_Options = ( dlg.GetPowerSymbol() ) ? ENTRY_POWER : if( component->m_TextInside == 0 )
ENTRY_NORMAL; component->m_TextInside = 1;
}
else
component->m_TextInside = 0;
component->m_Options = ( dlg.GetPowerSymbol() ) ? ENTRY_POWER : ENTRY_NORMAL;
component->m_DrawPinNum = dlg.GetShowPinNumber(); component->m_DrawPinNum = dlg.GetShowPinNumber();
component->m_DrawPinName = dlg.GetShowPinName(); component->m_DrawPinName = dlg.GetShowPinName();
component->m_UnitSelectionLocked = dlg.GetLockItems();
if( dlg.GetPartCount() < 2 )
component->m_UnitSelectionLocked = false;
if( m_component ) if( m_component )
{ {

View File

@ -20,8 +20,8 @@ class LIB_DRAW_ITEM;
class WinEDA_LibeditFrame : public WinEDA_DrawFrame class WinEDA_LibeditFrame : public WinEDA_DrawFrame
{ {
public: public:
WinEDAChoiceBox* m_SelpartBox; WinEDAChoiceBox* m_SelpartBox; // a Box to select a part to edit (if any)
WinEDAChoiceBox* m_SelAliasBox; WinEDAChoiceBox* m_SelAliasBox; // a box to select the alias to edit (if any)
public: public:
WinEDA_LibeditFrame( wxWindow* father, WinEDA_LibeditFrame( wxWindow* father,
@ -93,6 +93,7 @@ public:
m_unit = unit; m_unit = unit;
} }
int GetConvert( void ) { return m_convert; } int GetConvert( void ) { return m_convert; }
void SetConvert( int convert ) void SetConvert( int convert )
@ -101,6 +102,7 @@ public:
m_convert = convert; m_convert = convert;
} }
LIB_DRAW_ITEM* GetLastDrawItem( void ) { return m_lastDrawItem; } LIB_DRAW_ITEM* GetLastDrawItem( void ) { return m_lastDrawItem; }
void SetLastDrawItem( LIB_DRAW_ITEM* drawItem ) void SetLastDrawItem( LIB_DRAW_ITEM* drawItem )
@ -108,6 +110,7 @@ public:
m_lastDrawItem = drawItem; m_lastDrawItem = drawItem;
} }
LIB_DRAW_ITEM* GetDrawItem( void ) { return m_drawItem; } LIB_DRAW_ITEM* GetDrawItem( void ) { return m_drawItem; }
void SetDrawItem( LIB_DRAW_ITEM* drawItem ); void SetDrawItem( LIB_DRAW_ITEM* drawItem );
@ -135,8 +138,8 @@ public:
int flag_type_command = 0 ); int flag_type_command = 0 );
private: private:
void GetComponentFromUndoList(wxCommandEvent& event); void GetComponentFromUndoList( wxCommandEvent& event );
void GetComponentFromRedoList(wxCommandEvent& event); void GetComponentFromRedoList( wxCommandEvent& event );
// Edition des Pins: // Edition des Pins:
void CreatePin( wxDC* DC ); void CreatePin( wxDC* DC );
@ -184,14 +187,19 @@ protected:
wxString m_LastLibImportPath; wxString m_LastLibImportPath;
wxString m_LastLibExportPath; wxString m_LastLibExportPath;
static LIB_COMPONENT* m_component; static LIB_COMPONENT* m_component; // The current edited component (NULL if no component)
static CMP_LIBRARY* m_library; static CMP_LIBRARY* m_library; // The current active libary (NULL if none)
static LIB_DRAW_ITEM* m_lastDrawItem; static LIB_DRAW_ITEM* m_lastDrawItem;
static LIB_DRAW_ITEM* m_drawItem; static LIB_DRAW_ITEM* m_drawItem;
static wxString m_aliasName; static wxString m_aliasName;
static int m_unit; static int m_unit; // The unit number to edit and show
static int m_convert; static int m_convert; // Show the normal shape ( m_convert <= 1 )
static bool m_showDeMorgan; // or the converted shape ( m_convert > 1 )
static bool m_showDeMorgan; // true to force DeMorgan/normal tools selection enabled
// They are enabled when the loaded component has
// Graphic items for converted shape
// But under some circumstances (New component created)
// these tools must left enable
static wxSize m_clientSize; static wxSize m_clientSize;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@ -154,6 +154,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
m_Draw_Axis = true; // true pour avoir les axes dessines m_Draw_Axis = true; // true pour avoir les axes dessines
m_Draw_Grid = true; // true pour avoir la axes dessinee m_Draw_Grid = true; // true pour avoir la axes dessinee
m_ConfigPath = wxT( "LibraryEditor" ); m_ConfigPath = wxT( "LibraryEditor" );
SetShowDeMorgan( false );
// Give an icon // Give an icon
SetIcon( wxIcon( libedit_xpm ) ); SetIcon( wxIcon( libedit_xpm ) );
@ -440,8 +441,7 @@ void WinEDA_LibeditFrame::OnUpdatePartNumber( wxUpdateUIEvent& event )
/* Using the typical event.Enable() call doesn't seem to work with wxGTK /* Using the typical event.Enable() call doesn't seem to work with wxGTK
* so use the pointer to alias combobox to directly enable or disable. * so use the pointer to alias combobox to directly enable or disable.
*/ */
m_SelpartBox->Enable( m_component != NULL m_SelpartBox->Enable( m_component && m_component->GetPartCount() > 1 );
&& m_component->GetPartCount() > 1 );
} }
@ -450,8 +450,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
if( m_HToolBar == NULL ) if( m_HToolBar == NULL )
return; return;
event.Enable( m_component != NULL event.Enable( GetShowDeMorgan() ||
&& m_component->HasConversion() ); (m_component && m_component->HasConversion()) );
m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 ); m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 );
} }
@ -461,8 +461,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
if( m_HToolBar == NULL ) if( m_HToolBar == NULL )
return; return;
event.Enable( m_component != NULL event.Enable( GetShowDeMorgan() ||
&& m_component->HasConversion() ); (m_component && m_component->HasConversion()) );
m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 ); m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 );
} }

View File

@ -796,7 +796,7 @@ static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
for( pin = Entry->GetNextPin(); pin != NULL; for( pin = Entry->GetNextPin(); pin != NULL;
pin = Entry->GetNextPin( pin ) ) pin = Entry->GetNextPin( pin ) )
{ {
wxASSERT( pin->Type() != COMPONENT_PIN_DRAW_TYPE ); wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE );
if( pin->m_Unit if( pin->m_Unit
&& ( pin->m_Unit != Component2->GetUnitSelection( sheet ) ) ) && ( pin->m_Unit != Component2->GetUnitSelection( sheet ) ) )

View File

@ -12,6 +12,7 @@ set(GERBVIEW_SRCS
controle.cpp controle.cpp
dcode.cpp dcode.cpp
deltrack.cpp deltrack.cpp
dummy_functions.cpp
edit.cpp edit.cpp
export_to_pcbnew.cpp export_to_pcbnew.cpp
files.cpp files.cpp

View File

@ -0,0 +1,21 @@
/* dummy_functions.cpp
*
* There are functions used in some classes.
* they are useful in pcbnew, but have no meaning or are never used
* in cvpcb or gerbview.
* but they must exist because they appear in some classes, and here, no nothing.
*/
#include "fctsys.h"
#include "common.h"
#include "pcbnew.h"
TRACK* Marque_Une_Piste( BOARD* aPcb,
TRACK* aStartSegm,
int* aSegmCount,
int* aTrackLen,
bool aReorder )
{
return NULL;
}

View File

@ -457,9 +457,10 @@ public:
* Basic routine used by other routines when editing tracks or vias * Basic routine used by other routines when editing tracks or vias
* @param aTrackItem = the track segment or via to modify * @param aTrackItem = the track segment or via to modify
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL) * @param aItemsListPicker = the list picker to use for an undo command (can be NULL)
* @param aUseNetclassValue = true to use NetClass value, false to use g_DesignSettings value
* @return true if done, false if no not change (because DRC error) * @return true if done, false if no not change (because DRC error)
*/ */
bool SetTrackSegmentWidth( TRACK* aTrackItem, PICKED_ITEMS_LIST* aItemsListPicker ); bool SetTrackSegmentWidth( TRACK* aTrackItem, PICKED_ITEMS_LIST* aItemsListPicker, bool aUseNetclassValue );
// zone handling // zone handling

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -97,6 +97,7 @@ set(PCBNEW_SRCS
librairi.cpp librairi.cpp
loadcmp.cpp loadcmp.cpp
locate.cpp locate.cpp
magnetic_tracks_functions.cpp
menubarmodedit.cpp menubarmodedit.cpp
menubarpcb.cpp menubarpcb.cpp
mirepcb.cpp mirepcb.cpp

View File

@ -46,7 +46,8 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
return; return;
DrawPanel->CursorOff( DC ); // Erase cursor shape DrawPanel->CursorOff( DC ); // Erase cursor shape
Track = Marque_Une_Piste( this, DC, track, &nb_segm, GR_OR | GR_SURBRILL ); Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, true );
Trace_Une_Piste( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- ) for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- )
{ {

View File

@ -208,7 +208,7 @@ public:
return m_NetClassName; return m_NetClassName;
} }
#if 0 #if 1
/** /**
* Function GetTrackWidth * Function GetTrackWidth
* returns the width of tracks used to route this net. * returns the width of tracks used to route this net.
@ -220,16 +220,18 @@ public:
} }
#if 0
/** /**
* Function GetTrackWidth * Function GetTrackMinWidth
* returns the Minimum value for tracks thickness (used in DRC) * returns the Minimum value for tracks thickness (used in DRC)
*/ */
int GetTrackWidth() int GetTrackMinWidth()
{ {
wxASSERT( m_NetClass ); // wxASSERT( m_NetClass );
return m_NetClass->GetTrackMinWidth(); // return m_NetClass->GetTrackMinWidth();
return g_DesignSettings.m_TrackMinWidth;
} }
#endif
/** /**
* Function GetViaSize * Function GetViaSize
@ -238,7 +240,17 @@ public:
int GetViaSize() int GetViaSize()
{ {
wxASSERT( m_NetClass ); wxASSERT( m_NetClass );
return m_NetClass->GetViaSize(); return m_NetClass->GetViaDiameter();
}
/**
* Function GetMicroViaSize
* returns the size of vias used to route this net
*/
int GetMicroViaSize()
{
wxASSERT( m_NetClass );
return m_NetClass->GetuViaDiameter();
} }
@ -249,10 +261,22 @@ public:
int GetViaDrillSize() int GetViaDrillSize()
{ {
wxASSERT( m_NetClass ); wxASSERT( m_NetClass );
return m_NetClass->GetViaDrillSize(); return m_NetClass->GetViaDrill();
}
/**
* Function GetViaDrillSize
* returns the size of via drills used to route this net
*/
int GetMicroViaDrillSize()
{
wxASSERT( m_NetClass );
return m_NetClass->GetuViaDrill();
} }
#if 0
/** /**
* Function GetViaMinSize * Function GetViaMinSize
* returns the Minimum value for via sizes (used in DRC) * returns the Minimum value for via sizes (used in DRC)
@ -262,7 +286,7 @@ public:
wxASSERT( m_NetClass ); wxASSERT( m_NetClass );
return m_NetClass->GetViaMinSize(); return m_NetClass->GetViaMinSize();
} }
#endif
/** /**
* Function GetClearance * Function GetClearance

View File

@ -14,32 +14,6 @@
#include "protos.h" #include "protos.h"
// #define RATSNET_DEBUG
#ifdef RATSNET_DEBUG
/**************************************/
void DbgDisplayTrackInfos( TRACK* track )
/**************************************/
/* Only for ratsnest debug
*/
{
wxString msg;
msg << wxT( "Netcode " ) << track->GetNet();
msg << wxT( " - " ) << track->GetSubNet();
msg << wxT( "\nptrS " ) << (unsigned) track->start;
msg << wxT( " ptrE " ) << (unsigned) track->end;
msg << wxT( " this " ) << (unsigned) track;
wxMessageBox( msg );
}
#endif
/** /**
* Function ShowClearance * Function ShowClearance
* tests to see if the clearance border is drawn on the given track. * tests to see if the clearance border is drawn on the given track.
@ -151,17 +125,27 @@ int TRACK::GetDrillValue() const
return g_DesignSettings.m_ViaDrill; return g_DesignSettings.m_ViaDrill;
} }
/**
* Function GetLength
* returns the position of this object.
* @return the length of the track segment (0 for a via).
*/
double TRACK::GetLength()
{
wxPoint delta = m_End - m_Start;
return sqrt( (double)delta.x*delta.x + (double)delta.y*delta.y );
}
/***********************/ /***********************/
bool TRACK::IsNull() bool TRACK::IsNull()
/***********************/ /***********************/
// return TRUE if segment length = 0 // return true if segment length = 0
{ {
if( ( Type() != TYPE_VIA ) && ( m_Start == m_End ) ) if( ( Type() != TYPE_VIA ) && ( m_Start == m_End ) )
return TRUE; return true;
else else
return FALSE; return false;
} }
@ -272,24 +256,26 @@ EDA_Rect TRACK::GetBoundingBox()
return ret; return ret;
} }
/** /**
* Function Rotate * Function Rotate
* Rotate this object. * Rotate this object.
* @param const wxPoint& aRotCentre - the rotation point. * @param const wxPoint& aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @param aAngle - the rotation angle in 0.1 degree.
*/ */
void TRACK::Rotate(const wxPoint& aRotCentre, int aAngle) void TRACK::Rotate( const wxPoint& aRotCentre, int aAngle )
{ {
RotatePoint( &m_Start, aRotCentre, aAngle ); RotatePoint( &m_Start, aRotCentre, aAngle );
RotatePoint( &m_End, aRotCentre, aAngle ); RotatePoint( &m_End, aRotCentre, aAngle );
} }
/** /**
* Function Flip * Function Flip
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
* @param const wxPoint& aCentre - the rotation point. * @param const wxPoint& aCentre - the rotation point.
*/ */
void TRACK::Flip(const wxPoint& aCentre ) void TRACK::Flip( const wxPoint& aCentre )
{ {
m_Start.y = aCentre.y - (m_Start.y - aCentre.y); m_Start.y = aCentre.y - (m_Start.y - aCentre.y);
m_End.y = aCentre.y - (m_End.y - aCentre.y); m_End.y = aCentre.y - (m_End.y - aCentre.y);
@ -712,8 +698,8 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
angle = 900; // angle is in 0.1 degree angle = 900; // angle is in 0.1 degree
if( panel->GetScreen()->Scale( tsize ) >= 6 ) if( panel->GetScreen()->Scale( tsize ) >= 6 )
{ {
if( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay)){ if( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay) )
{
tsize = (tsize * 8) / 10; // small reduction to give a better look tsize = (tsize * 8) / 10; // small reduction to give a better look
DrawGraphicText( panel, DC, tpos, DrawGraphicText( panel, DC, tpos,
WHITE, net->GetShortNetname(), angle, wxSize( tsize, tsize ), WHITE, net->GetShortNetname(), angle, wxSize( tsize, tsize ),
@ -736,6 +722,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
int fillvia = 0; int fillvia = 0;
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
PCB_SCREEN* screen = frame->GetScreen(); PCB_SCREEN* screen = frame->GetScreen();
if( frame->m_DisplayViaFill == FILLED ) if( frame->m_DisplayViaFill == FILLED )
fillvia = 1; fillvia = 1;
@ -907,7 +894,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
DrawGraphicText( panel, DC, m_Start, DrawGraphicText( panel, DC, m_Start,
WHITE, net->GetShortNetname(), 0, wxSize( tsize, tsize ), WHITE, net->GetShortNetname(), 0, wxSize( tsize, tsize ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7,
false, false); false, false );
} }
} }
} }
@ -917,12 +904,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
void TRACK::DisplayInfo( WinEDA_DrawFrame* frame ) void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
int text_pos; BOARD* board = ( (WinEDA_BasePcbFrame*) frame )->GetBoard();
BOARD* board = ( (WinEDA_BasePcbFrame*)frame)->GetBoard();
#ifdef RATSNET_DEBUG
DbgDisplayTrackInfos( this );
#endif
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
@ -943,18 +925,11 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
msg = wxT( "????" ); break; msg = wxT( "????" ); break;
} }
text_pos = 1; frame->MsgPanel->AppendMessage( _( "Type" ), msg, DARKCYAN );
Affiche_1_Parametre( frame, text_pos, _( "Type" ), msg, DARKCYAN ); // Display Net Name (in pcbnew)
text_pos += 10; if( frame->m_Ident == PCB_FRAME )
if( Type() == TYPE_TRACK
|| Type() == TYPE_ZONE
|| Type() == TYPE_VIA )
{ {
/* Display NetName pour les segments de piste type cuivre */
NETINFO_ITEM* net = board->FindNet( GetNet() ); NETINFO_ITEM* net = board->FindNet( GetNet() );
if( net ) if( net )
@ -962,31 +937,18 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
else else
msg = wxT( "<noname>" ); msg = wxT( "<noname>" );
Affiche_1_Parametre( frame, text_pos, _( "NetName" ), msg, RED ); frame->MsgPanel->AppendMessage( _( "NetName" ), msg, RED );
text_pos += 20;
/* Display net code : (usefull in test or debug) */ /* Display net code : (usefull in test or debug) */
msg.Printf( wxT( "%d .%d" ), GetNet(), GetSubNet() ); msg.Printf( wxT( "%d .%d" ), GetNet(), GetSubNet() );
frame->MsgPanel->AppendMessage( _( "NetCode" ), msg, RED );
Affiche_1_Parametre( frame, text_pos, _( "NetCode" ), msg, RED );
text_pos += 8;
}
else
{
Affiche_1_Parametre( frame, text_pos, _( "Segment" ), wxEmptyString, RED );
if( m_Shape == S_CIRCLE )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Circle" ), RED );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Standard" ), RED );
text_pos += 8;
} }
#if defined(DEBUG) #if defined(DEBUG)
/* Display the flags */ /* Display the flags */
msg.Printf( wxT( "0x%08X" ), m_Flags ); msg.Printf( wxT( "0x%08X" ), m_Flags );
Affiche_1_Parametre( frame, text_pos, _( "Flags" ), msg, BLUE ); frame->MsgPanel->AppendMessage( _( "Flags" ), msg, BLUE );
text_pos += 8;
#endif #endif
@ -998,8 +960,7 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
if( GetState( SEGM_AR ) ) if( GetState( SEGM_AR ) )
msg[2] = 'A'; msg[2] = 'A';
Affiche_1_Parametre( frame, text_pos, _( "Stat" ), msg, MAGENTA ); frame->MsgPanel->AppendMessage( _( "Stat" ), msg, MAGENTA );
text_pos += 6;
/* Display layer or layer pair) */ /* Display layer or layer pair) */
if( Type() == TYPE_VIA ) if( Type() == TYPE_VIA )
@ -1014,8 +975,7 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
else else
msg = board->GetLayerName( m_Layer ); msg = board->GetLayerName( m_Layer );
Affiche_1_Parametre( frame, text_pos, _( "Layer" ), msg, BROWN ); frame->MsgPanel->AppendMessage( _( "Layer" ), msg, BROWN );
text_pos += 15;
/* Display width */ /* Display width */
valeur_param( (unsigned) m_Width, msg ); valeur_param( (unsigned) m_Width, msg );
@ -1023,8 +983,7 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
if( Type() == TYPE_VIA ) // Display Diam and Drill values if( Type() == TYPE_VIA ) // Display Diam and Drill values
{ {
// Display diameter value: // Display diameter value:
Affiche_1_Parametre( frame, text_pos, _( "Diam" ), msg, DARKCYAN ); frame->MsgPanel->AppendMessage( _( "Diam" ), msg, DARKCYAN );
text_pos += 8;
// Display drill value // Display drill value
int drill_value = GetDrillValue(); int drill_value = GetDrillValue();
@ -1032,24 +991,41 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
valeur_param( (unsigned) drill_value, msg ); valeur_param( (unsigned) drill_value, msg );
wxString title = _( "Drill" ); wxString title = _( "Drill" );
title += wxT(" "); title += wxT( " " );
if( m_Drill >= 0 ) if( m_Drill >= 0 )
title += _( "(Specific)" ); title += _( "(Specific)" );
else else
title += _( "(Default)" ); title += _( "(Default)" );
Affiche_1_Parametre( frame, text_pos, title, msg, RED ); frame->MsgPanel->AppendMessage( title, msg, RED );
} }
else else
Affiche_1_Parametre( frame, text_pos, _( "Width" ), msg, DARKCYAN ); {
frame->MsgPanel->AppendMessage( _( "Width" ), msg, DARKCYAN );
}
NETCLASS* netclass = GetNetClass(); NETCLASS* netclass = GetNetClass();
if( netclass ) if( netclass )
{ {
msg = netclass->GetName(); msg = netclass->GetName();
text_pos += 10; frame->MsgPanel->AppendMessage( _( "Net Class" ), msg, DARKCYAN );
Affiche_1_Parametre( frame, text_pos, _( "Net Class" ), msg, DARKCYAN ); }
// Display segment length
if( Type() != TYPE_VIA ) // Display Diam and Drill values
{
valeur_param( wxRound( GetLength() ), msg );
frame->MsgPanel->AppendMessage( _( "Seg Len" ), msg, DARKCYAN );
}
// Display full track length (in pcbnew)
if( frame->m_Ident == PCB_FRAME )
{
int trackLen;
Marque_Une_Piste( board, this, NULL, &trackLen, false );
valeur_param( trackLen, msg );
frame->MsgPanel->AppendMessage( _( "Track Len" ), msg, DARKCYAN );
} }
} }

View File

@ -96,6 +96,13 @@ public:
return m_Start; // it had to be start or end. return m_Start; // it had to be start or end.
} }
/**
* Function GetLength
* returns the position of this object.
* @return the length of the track segment (0 for a via).
*/
double GetLength();
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();

View File

@ -10,11 +10,13 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "protos.h" #include "protos.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
#include "collectors.h" #include "collectors.h"
#include "bitmaps.h" //external funtions used here:
extern bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
int aCurrentTool, wxSize grid, wxPoint on_grid, wxPoint* curpos );
/*************************************************************************************/ /*************************************************************************************/
static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aCollector ) static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aCollector )
@ -220,265 +222,6 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
} }
/**
* Function Join
* finds the point where line segment (b1,b0) intersects with segment (a1,a0).
* If that point would be outside of (a0,a1), the respective endpoint is used.
* Join returns the point in "res" and "true" if a suitable point was found,
* "false" if both lines are parallel or if the length of either segment is zero.
*/
static bool Join( wxPoint* res, wxPoint a0, wxPoint a1, wxPoint b0, wxPoint b1 )
{
/* References:
http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/
http://www.gekkou.co.uk/blogs/monologues/2007/12/13/1197586800000.html
*/
double denom;
double t;
// if either segment is zero length
if( a1.x==a0.x && a1.y==a0.y )
return false;
if( b1.x==b0.x && b1.y==b0.y )
return false;
a1 -= a0;
b1 -= b0;
b0 -= a0;
denom = (double) b1.y * a1.x - (double) b1.x * a1.y;
if( !denom )
{
return false; // parallel
}
t = ((double) b1.y * b0.x - (double) b1.x * b0.y ) / denom;
t = min( max( t, 0.0 ), 1.0 );
res->x = wxRound( a0.x + t * a1.x );
res->y = wxRound( a0.y + t * a1.y );
return true;
}
/*
* "Project" finds the projection of a grid point on a track. This is the point
* from where we want to draw new orthogonal tracks when starting on a track.
*/
bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track )
{
if( track->m_Start == track->m_End )
return false;
wxPoint vec = track->m_End - track->m_Start;
double t = double( on_grid.x - track->m_Start.x ) * vec.x +
double( on_grid.y - track->m_Start.y ) * vec.y;
t /= (double) vec.x * vec.x + (double) vec.y * vec.y;
t = min( max( t, 0.0 ), 1.0 );
res->x = wxRound( track->m_Start.x + t * vec.x );
res->y = wxRound( track->m_Start.y + t * vec.y );
return true;
}
/**
* Function Magnetize
* tests to see if there are any magnetic items within near reach of the given
* "curpos". If yes, then curpos is adjusted appropriately according to that
* near magnetic item and true is returned.
* @param curpos The initial position, and what to adjust if a change is needed.
* @return bool - true if the position was adjusted magnetically, else false.
*/
static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
int aCurrentTool, wxSize grid, wxPoint on_grid, wxPoint* curpos )
{
bool doCheckNet = g_MagneticPadOption != capture_always && Drc_On;
bool doTrack = false;
bool doPad = false;
bool amMovingVia = false;
TRACK* currTrack = g_CurrentTrackSegment;
BOARD_ITEM* currItem = frame->GetCurItem();
// D( printf( "currTrack=%p currItem=%p currTrack->Type()=%d currItem->Type()=%d\n", currTrack, currItem, currTrack ? currTrack->Type() : 0, currItem ? currItem->Type() : 0 ); )
if( !currTrack && currItem && currItem->Type()==TYPE_VIA && currItem->m_Flags )
{
// moving a VIA
currTrack = (TRACK*) currItem;
amMovingVia = true;
return false; // comment this return out and play with it.
}
else if( currItem != currTrack )
{
currTrack = NULL;
}
if( g_MagneticPadOption == capture_always )
doPad = true;
if( g_MagneticTrackOption == capture_always )
doTrack = true;
if( aCurrentTool == ID_TRACK_BUTT || amMovingVia )
{
int q = capture_cursor_in_track_tool;
if( g_MagneticPadOption == q )
doPad = true;
if( g_MagneticTrackOption == q )
doTrack = true;
}
// D(printf("doPad=%d doTrack=%d aCurrentTool=%d amMovingVia=%d\n", doPad, doTrack, aCurrentTool, amMovingVia );)
// The search precedence order is pads, then tracks/vias
if( doPad )
{
D_PAD* pad = Locate_Any_Pad( m_Pcb, CURSEUR_OFF_GRILLE, TRUE );
if( pad )
{
if( doCheckNet && currTrack && currTrack->GetNet() != pad->GetNet() )
return false;
*curpos = pad->m_Pos;
return true;
}
}
// after pads, only track & via tests remain, skip them if not desired
if( doTrack )
{
int layer = ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer;
for( TRACK* via = m_Pcb->m_Track;
via && (via = Locate_Via_Area( via, *curpos, layer )) != NULL;
via = via->Next() )
{
if( via != currTrack ) // a via cannot influence itself
{
if( !doCheckNet || !currTrack || currTrack->GetNet() == via->GetNet() )
{
*curpos = via->m_Start;
// D(printf("via hit\n");)
return true;
}
}
else
{
//D( printf( "skipping self\n" ); )
}
}
if( !currTrack )
{
int layer_mask = g_TabOneLayerMask[layer];
TRACK* track = Locate_Pistes( m_Pcb->m_Track, layer_mask, CURSEUR_OFF_GRILLE );
if( !track || track->Type() != TYPE_TRACK )
{
// D(printf("!currTrack and track=%p not found, layer_mask=0x%X\n", track, layer_mask );)
return false;
}
// D( printf( "Project\n" ); )
return Project( curpos, on_grid, track );
}
/*
* In two segment mode, ignore the final segment if it's inside a grid
* square.
*/
if( !amMovingVia && currTrack && g_TwoSegmentTrackBuild && currTrack->Back()
&& currTrack->m_Start.x - grid.x < currTrack->m_End.x
&& currTrack->m_Start.x + grid.x > currTrack->m_End.x
&& currTrack->m_Start.y - grid.y < currTrack->m_End.y
&& currTrack->m_Start.y + grid.y > currTrack->m_End.y )
{
currTrack = currTrack->Back();
}
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{
if( track->Type() != TYPE_TRACK )
continue;
if( doCheckNet && currTrack && currTrack->GetNet() != track->GetNet() )
continue;
if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false )
continue;
// omit the layer check if moving a via
if( !amMovingVia && !track->IsOnLayer( layer ) )
continue;
if( !track->HitTest( *curpos ) )
continue;
D(printf( "have track prospect\n");)
if( Join( curpos, track->m_Start, track->m_End, currTrack->m_Start, currTrack->m_End ) )
{
// D(printf( "join currTrack->Type()=%d\n", currTrack->Type() );)
return true;
}
if( aCurrentTool == ID_TRACK_BUTT || amMovingVia )
{
// At this point we have a drawing mouse on a track, we are drawing
// a new track and that new track is parallel to the track the
// mouse is on. Find the nearest end point of the track under mouse
// to the mouse and return that.
double distStart = hypot( double( curpos->x - track->m_Start.x ),
double( curpos->y - track->m_Start.y ));
double distEnd = hypot( double( curpos->x - track->m_End.x ),
double( curpos->y - track->m_End.y ));
// if track not via, or if its a via dragging but not with its adjacent track
if( currTrack->Type() != TYPE_VIA
|| ( currTrack->m_Start != track->m_Start && currTrack->m_Start != track->m_End ))
{
if( distStart <= currTrack->m_Width/2 )
{
// D(printf("nearest end is start\n");)
*curpos = track->m_Start;
return true;
}
if( distEnd <= currTrack->m_Width/2 )
{
// D(printf("nearest end is end\n");)
*curpos = track->m_End;
return true;
}
// @todo otherwise confine curpos such that it stays centered
// within "track"
}
}
}
}
return false;
}
/****************************************************************/ /****************************************************************/
void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/*****************************************************************/ /*****************************************************************/

View File

@ -192,7 +192,7 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
if( pt_segm == NULL ) if( pt_segm == NULL )
return; return;
TRACK* trackList = Marque_Une_Piste( this, DC, pt_segm, &segments_to_delete_count, 0 ); TRACK* trackList = Marque_Une_Piste( GetBoard(), pt_segm, &segments_to_delete_count, NULL, true );
if( segments_to_delete_count == 0 ) if( segments_to_delete_count == 0 )
return; return;

View File

@ -73,7 +73,7 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
wxStaticBoxSizer* sbMiddleLeftSizer; wxStaticBoxSizer* sbMiddleLeftSizer;
sbMiddleLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias Options:") ), wxVERTICAL ); sbMiddleLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias Options:") ), wxVERTICAL );
wxString m_OptViaTypeChoices[] = { _("Through Via"), _("Blind or Buried Via") }; wxString m_OptViaTypeChoices[] = { _("Through via"), _("Blind or buried via") };
int m_OptViaTypeNChoices = sizeof( m_OptViaTypeChoices ) / sizeof( wxString ); int m_OptViaTypeNChoices = sizeof( m_OptViaTypeChoices ) / sizeof( wxString );
m_OptViaType = new wxRadioBox( this, wxID_ANY, _("Default Via Type"), wxDefaultPosition, wxDefaultSize, m_OptViaTypeNChoices, m_OptViaTypeChoices, 1, wxRA_SPECIFY_COLS ); m_OptViaType = new wxRadioBox( this, wxID_ANY, _("Default Via Type"), wxDefaultPosition, wxDefaultSize, m_OptViaTypeNChoices, m_OptViaTypeChoices, 1, wxRA_SPECIFY_COLS );
m_OptViaType->SetSelection( 0 ); m_OptViaType->SetSelection( 0 );
@ -84,7 +84,7 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
sbMiddleLeftSizer->Add( 10, 10, 0, 0, 5 ); sbMiddleLeftSizer->Add( 10, 10, 0, 0, 5 );
wxString m_AllowMicroViaCtrlChoices[] = { _("Do Not Allow Micro Vias"), _("Allow Micro Vias") }; wxString m_AllowMicroViaCtrlChoices[] = { _("Do not allow micro vias"), _("Allow micro vias") };
int m_AllowMicroViaCtrlNChoices = sizeof( m_AllowMicroViaCtrlChoices ) / sizeof( wxString ); int m_AllowMicroViaCtrlNChoices = sizeof( m_AllowMicroViaCtrlChoices ) / sizeof( wxString );
m_AllowMicroViaCtrl = new wxRadioBox( this, wxID_ALLOW_MICROVIA, _("Micro Vias:"), wxDefaultPosition, wxDefaultSize, m_AllowMicroViaCtrlNChoices, m_AllowMicroViaCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_AllowMicroViaCtrl = new wxRadioBox( this, wxID_ALLOW_MICROVIA, _("Micro Vias:"), wxDefaultPosition, wxDefaultSize, m_AllowMicroViaCtrlNChoices, m_AllowMicroViaCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_AllowMicroViaCtrl->SetSelection( 0 ); m_AllowMicroViaCtrl->SetSelection( 0 );

View File

@ -509,7 +509,7 @@
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxRadioBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="choices">&quot;Through Via&quot; &quot;Blind or Buried Via&quot;</property> <property name="choices">&quot;Through via&quot; &quot;Blind or buried via&quot;</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
@ -573,7 +573,7 @@
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxRadioBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="choices">&quot;Do Not Allow Micro Vias&quot; &quot;Allow Micro Vias&quot;</property> <property name="choices">&quot;Do not allow micro vias&quot; &quot;Allow micro vias&quot;</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>

View File

@ -1,7 +1,7 @@
/***************************************************************/ /***************************************************************
/* Edition des pistes: Routines de modification de dimensions: */ * Tracks and Vias size edition:
/* Modif de largeurs de segment, piste, net , zone et diam Via */ * Functions to modify sizes of segment, track, net , all vias and/or all tracks
/***************************************************************/ ***************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -13,29 +13,46 @@
#include "protos.h" #include "protos.h"
/** Function SetTrackSegmentWidth /** Function SetTrackSegmentWidth
* Modify one track segment width or one via diameter (using DRC control). * Modify one track segment width or one via diameter (using DRC control).
* Basic routine used by other routines when editing tracks or vias * Basic routine used by other routines when editing tracks or vias
* @param aTrackItem = the track segment or via to modify * @param aTrackItem = the track segment or via to modify
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL) * @param aItemsListPicker = the list picker to use for an undo command (can be NULL)
* @param aUseNetclassValue = true to use NetClass value, false to use g_DesignSettings value
* @return true if done, false if no not change (because DRC error) * @return true if done, false if no not change (because DRC error)
*/ */
bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem, bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
PICKED_ITEMS_LIST* aItemsListPicker ) PICKED_ITEMS_LIST* aItemsListPicker,
bool aUseNetclassValue )
{ {
int initial_width, new_width; int initial_width, new_width;
bool change_ok = false; bool change_ok = false;
NETINFO_ITEM* net = NULL;
if( aUseNetclassValue )
net = GetBoard()->FindNet( aTrackItem->GetNet() );
initial_width = aTrackItem->m_Width; initial_width = aTrackItem->m_Width;
new_width = aTrackItem->m_Width = g_DesignSettings.m_CurrentTrackWidth; if( net )
new_width = net->GetTrackWidth();
else
new_width = g_DesignSettings.m_CurrentTrackWidth;
if( aTrackItem->Type() == TYPE_VIA ) if( aTrackItem->Type() == TYPE_VIA )
{ {
if( net )
new_width = net->GetViaSize();
else
new_width = aTrackItem->m_Width = g_DesignSettings.m_CurrentViaSize; new_width = aTrackItem->m_Width = g_DesignSettings.m_CurrentViaSize;
if( aTrackItem->m_Shape == VIA_MICROVIA ) if( aTrackItem->m_Shape == VIA_MICROVIA )
{
if( net )
new_width = net->GetViaSize();
else
new_width = aTrackItem->m_Width = g_DesignSettings.m_CurrentMicroViaSize; new_width = aTrackItem->m_Width = g_DesignSettings.m_CurrentMicroViaSize;
} }
}
aTrackItem->m_Width = new_width;
if( initial_width < new_width ) /* make a DRC test because the new size is bigger than the old size */ if( initial_width < new_width ) /* make a DRC test because the new size is bigger than the old size */
{ {
int diagdrc = OK_DRC; int diagdrc = OK_DRC;
@ -46,6 +63,7 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
} }
else if( initial_width > new_width ) else if( initial_width > new_width )
change_ok = true; change_ok = true;
// if new width == initial_width: do nothing // if new width == initial_width: do nothing
if( change_ok ) if( change_ok )
@ -75,7 +93,7 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
void WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* DC, TRACK* aTrackItem ) void WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* DC, TRACK* aTrackItem )
{ {
PICKED_ITEMS_LIST itemsListPicker; PICKED_ITEMS_LIST itemsListPicker;
bool change = SetTrackSegmentWidth( aTrackItem, &itemsListPicker ); bool change = SetTrackSegmentWidth( aTrackItem, &itemsListPicker, false );
if( change == 0 || aTrackItem->m_Flags ) if( change == 0 || aTrackItem->m_Flags )
return; // No change return; // No change
@ -84,7 +102,7 @@ void WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* DC, TRACK* aTrackItem )
if( DC ) if( DC )
{ {
TRACK* oldsegm = (TRACK*) itemsListPicker.GetPickedItemLink( 0 ); TRACK* oldsegm = (TRACK*) itemsListPicker.GetPickedItemLink( 0 );
wxASSERT(oldsegm); wxASSERT( oldsegm );
DrawPanel->CursorOff( DC ); // Erase cursor shape DrawPanel->CursorOff( DC ); // Erase cursor shape
oldsegm->Draw( DrawPanel, DC, GR_XOR ); // Erase old track shape oldsegm->Draw( DrawPanel, DC, GR_XOR ); // Erase old track shape
aTrackItem->Draw( DrawPanel, DC, GR_OR ); // Display new track shape aTrackItem->Draw( DrawPanel, DC, GR_OR ); // Display new track shape
@ -93,6 +111,7 @@ void WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* DC, TRACK* aTrackItem )
SaveCopyInUndoList( itemsListPicker, UR_CHANGED ); SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
} }
/** Function Edit_Track_Width /** Function Edit_Track_Width
* Modify a full track width (using DRC control). * Modify a full track width (using DRC control).
* a full track is the set of track segments between 2 ends: pads or a point that has more than 2 segments ends connected * a full track is the set of track segments between 2 ends: pads or a point that has more than 2 segments ends connected
@ -108,14 +127,14 @@ void WinEDA_PcbFrame::Edit_Track_Width( wxDC* DC, TRACK* aTrackSegment )
if( aTrackSegment == NULL ) if( aTrackSegment == NULL )
return; return;
pt_track = Marque_Une_Piste( this, DC, aTrackSegment, &nb_segm, 0 ); pt_track = Marque_Une_Piste( GetBoard(), aTrackSegment, &nb_segm, NULL, true );
PICKED_ITEMS_LIST itemsListPicker; PICKED_ITEMS_LIST itemsListPicker;
bool change = false; bool change = false;
for( int ii = 0; ii < nb_segm; ii++, pt_track = pt_track->Next() ) for( int ii = 0; ii < nb_segm; ii++, pt_track = pt_track->Next() )
{ {
pt_track->SetState( BUSY, OFF ); pt_track->SetState( BUSY, OFF );
if( SetTrackSegmentWidth( pt_track, &itemsListPicker ) ) if( SetTrackSegmentWidth( pt_track, &itemsListPicker, false ) )
change = true; change = true;
} }
@ -142,26 +161,36 @@ void WinEDA_PcbFrame::Edit_Track_Width( wxDC* DC, TRACK* aTrackSegment )
/***********************************************************/ /***********************************************************/
void WinEDA_PcbFrame::Edit_Net_Width( wxDC* DC, int Netcode ) void WinEDA_PcbFrame::Edit_Net_Width( wxDC* DC, int aNetcode )
/***********************************************************/ /***********************************************************/
{ {
TRACK* pt_segm; TRACK* pt_segm;
if( Netcode <= 0 ) if( aNetcode <= 0 )
return; return;
if( !IsOK( this, _( "Change track width (entire NET) ?" ) ) ) NETINFO_ITEM* net = GetBoard()->FindNet( aNetcode );
wxASSERT( net );
wxString netName = net->GetNetname();
wxString msg;
NETCLASS* netClass = net->GetNetClass();
wxASSERT( netClass );
wxString netClassName = netClass->GetName();
msg.Printf( _(
"Set tracks and vias sizes to the Netclass \"%s\"default value (entire NET \"%s\") ?" ),
netClassName.c_str(), netName.c_str() );
if( !IsOK( this, msg ) )
return; return;
/* balayage des segments */ /* Examine segments */
PICKED_ITEMS_LIST itemsListPicker; PICKED_ITEMS_LIST itemsListPicker;
bool change = false; bool change = false;
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() ) for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
{ {
if( Netcode != pt_segm->GetNet() ) /* mauvaise piste */ if( aNetcode != pt_segm->GetNet() ) /* not in net */
continue; continue;
/* piste d'un net trouvee */ /* we have found a item member of the net */
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker ) ) if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, true ) )
change = true; change = true;
} }
@ -200,17 +229,17 @@ bool WinEDA_PcbFrame::Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via )
if( Track && Via ) if( Track && Via )
{ {
if( !IsOK( this, _( "Edit All Tracks and Vias Sizes" ) ) ) if( !IsOK( this, _( "Set All Tracks and Vias to Netclass value" ) ) )
return FALSE; return FALSE;
} }
else if( Via ) else if( Via )
{ {
if( !IsOK( this, _( "Edit All Via Sizes" ) ) ) if( !IsOK( this, _( "Set All Via to Netclass value" ) ) )
return FALSE; return FALSE;
} }
else if( Track ) else if( Track )
{ {
if( !IsOK( this, _( "Edit All Track Sizes" ) ) ) if( !IsOK( this, _( "Set All Track to Netclass value" ) ) )
return FALSE; return FALSE;
} }
@ -221,16 +250,17 @@ bool WinEDA_PcbFrame::Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via )
{ {
if( (pt_segm->Type() == TYPE_VIA ) && Via ) if( (pt_segm->Type() == TYPE_VIA ) && Via )
{ {
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker ) ) if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, true ) )
change = true; change = true;
} }
}
if( (pt_segm->Type() == TYPE_TRACK ) && Track ) if( (pt_segm->Type() == TYPE_TRACK ) && Track )
{ {
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker ) ) if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, true ) )
change = true;; change = true;;
} }
}
if( !change ) if( !change )
return false; return false;

View File

@ -73,7 +73,8 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
l1 = Route_Layer_TOP; l2 = Route_Layer_BOTTOM; l1 = Route_Layer_TOP; l2 = Route_Layer_BOTTOM;
pt_track = Marque_Une_Piste( this, DC, pt_segm, &nb_segm, GR_XOR ); pt_track = Marque_Une_Piste( GetBoard(), pt_segm, &nb_segm, NULL, true );
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_XOR );
/* effacement du flag BUSY et sauvegarde en membre .param de la couche /* effacement du flag BUSY et sauvegarde en membre .param de la couche
* initiale */ * initiale */

View File

@ -0,0 +1,275 @@
/********************************************************/
/* magnetic_tracks_functions.cpp */
/********************************************************/
/* functions used to controle the cursor position, when creating a track
* and when the "magnetic tracks" option is on
* (the current created track is kept near existing tracks
* the distance is the clearance between tracks)
*/
#include "fctsys.h"
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "protos.h"
#include "pcbnew_id.h"
/**
* Function Join
* finds the point where line segment (b1,b0) intersects with segment (a1,a0).
* If that point would be outside of (a0,a1), the respective endpoint is used.
* Join returns the point in "res" and "true" if a suitable point was found,
* "false" if both lines are parallel or if the length of either segment is zero.
*/
static bool Join( wxPoint* res, wxPoint a0, wxPoint a1, wxPoint b0, wxPoint b1 )
{
/* References:
http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/
http://www.gekkou.co.uk/blogs/monologues/2007/12/13/1197586800000.html
*/
double denom;
double t;
// if either segment is zero length
if( a1.x==a0.x && a1.y==a0.y )
return false;
if( b1.x==b0.x && b1.y==b0.y )
return false;
a1 -= a0;
b1 -= b0;
b0 -= a0;
denom = (double) b1.y * a1.x - (double) b1.x * a1.y;
if( !denom )
{
return false; // parallel
}
t = ((double) b1.y * b0.x - (double) b1.x * b0.y ) / denom;
t = min( max( t, 0.0 ), 1.0 );
res->x = wxRound( a0.x + t * a1.x );
res->y = wxRound( a0.y + t * a1.y );
return true;
}
/*
* "Project" finds the projection of a grid point on a track. This is the point
* from where we want to draw new orthogonal tracks when starting on a track.
*/
bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track )
{
if( track->m_Start == track->m_End )
return false;
wxPoint vec = track->m_End - track->m_Start;
double t = double( on_grid.x - track->m_Start.x ) * vec.x +
double( on_grid.y - track->m_Start.y ) * vec.y;
t /= (double) vec.x * vec.x + (double) vec.y * vec.y;
t = min( max( t, 0.0 ), 1.0 );
res->x = wxRound( track->m_Start.x + t * vec.x );
res->y = wxRound( track->m_Start.y + t * vec.y );
return true;
}
/**
* Function Magnetize
* tests to see if there are any magnetic items within near reach of the given
* "curpos". If yes, then curpos is adjusted appropriately according to that
* near magnetic item and true is returned.
* @param curpos The initial position, and what to adjust if a change is needed.
* @return bool - true if the position was adjusted magnetically, else false.
*/
bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
int aCurrentTool, wxSize grid, wxPoint on_grid, wxPoint* curpos )
{
bool doCheckNet = g_MagneticPadOption != capture_always && Drc_On;
bool doTrack = false;
bool doPad = false;
bool amMovingVia = false;
TRACK* currTrack = g_CurrentTrackSegment;
BOARD_ITEM* currItem = frame->GetCurItem();
// D( printf( "currTrack=%p currItem=%p currTrack->Type()=%d currItem->Type()=%d\n", currTrack, currItem, currTrack ? currTrack->Type() : 0, currItem ? currItem->Type() : 0 ); )
if( !currTrack && currItem && currItem->Type()==TYPE_VIA && currItem->m_Flags )
{
// moving a VIA
currTrack = (TRACK*) currItem;
amMovingVia = true;
return false; // comment this return out and play with it.
}
else if( currItem != currTrack )
{
currTrack = NULL;
}
if( g_MagneticPadOption == capture_always )
doPad = true;
if( g_MagneticTrackOption == capture_always )
doTrack = true;
if( aCurrentTool == ID_TRACK_BUTT || amMovingVia )
{
int q = capture_cursor_in_track_tool;
if( g_MagneticPadOption == q )
doPad = true;
if( g_MagneticTrackOption == q )
doTrack = true;
}
// D(printf("doPad=%d doTrack=%d aCurrentTool=%d amMovingVia=%d\n", doPad, doTrack, aCurrentTool, amMovingVia );)
// The search precedence order is pads, then tracks/vias
if( doPad )
{
D_PAD* pad = Locate_Any_Pad( m_Pcb, CURSEUR_OFF_GRILLE, TRUE );
if( pad )
{
if( doCheckNet && currTrack && currTrack->GetNet() != pad->GetNet() )
return false;
*curpos = pad->m_Pos;
return true;
}
}
// after pads, only track & via tests remain, skip them if not desired
if( doTrack )
{
int layer = ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer;
for( TRACK* via = m_Pcb->m_Track;
via && (via = Locate_Via_Area( via, *curpos, layer )) != NULL;
via = via->Next() )
{
if( via != currTrack ) // a via cannot influence itself
{
if( !doCheckNet || !currTrack || currTrack->GetNet() == via->GetNet() )
{
*curpos = via->m_Start;
// D(printf("via hit\n");)
return true;
}
}
else
{
//D( printf( "skipping self\n" ); )
}
}
if( !currTrack )
{
int layer_mask = g_TabOneLayerMask[layer];
TRACK* track = Locate_Pistes( m_Pcb->m_Track, layer_mask, CURSEUR_OFF_GRILLE );
if( !track || track->Type() != TYPE_TRACK )
{
// D(printf("!currTrack and track=%p not found, layer_mask=0x%X\n", track, layer_mask );)
return false;
}
// D( printf( "Project\n" ); )
return Project( curpos, on_grid, track );
}
/*
* In two segment mode, ignore the final segment if it's inside a grid
* square.
*/
if( !amMovingVia && currTrack && g_TwoSegmentTrackBuild && currTrack->Back()
&& currTrack->m_Start.x - grid.x < currTrack->m_End.x
&& currTrack->m_Start.x + grid.x > currTrack->m_End.x
&& currTrack->m_Start.y - grid.y < currTrack->m_End.y
&& currTrack->m_Start.y + grid.y > currTrack->m_End.y )
{
currTrack = currTrack->Back();
}
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{
if( track->Type() != TYPE_TRACK )
continue;
if( doCheckNet && currTrack && currTrack->GetNet() != track->GetNet() )
continue;
if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false )
continue;
// omit the layer check if moving a via
if( !amMovingVia && !track->IsOnLayer( layer ) )
continue;
if( !track->HitTest( *curpos ) )
continue;
D(printf( "have track prospect\n");)
if( Join( curpos, track->m_Start, track->m_End, currTrack->m_Start, currTrack->m_End ) )
{
// D(printf( "join currTrack->Type()=%d\n", currTrack->Type() );)
return true;
}
if( aCurrentTool == ID_TRACK_BUTT || amMovingVia )
{
// At this point we have a drawing mouse on a track, we are drawing
// a new track and that new track is parallel to the track the
// mouse is on. Find the nearest end point of the track under mouse
// to the mouse and return that.
double distStart = hypot( double( curpos->x - track->m_Start.x ),
double( curpos->y - track->m_Start.y ));
double distEnd = hypot( double( curpos->x - track->m_End.x ),
double( curpos->y - track->m_End.y ));
// if track not via, or if its a via dragging but not with its adjacent track
if( currTrack->Type() != TYPE_VIA
|| ( currTrack->m_Start != track->m_Start && currTrack->m_Start != track->m_End ))
{
if( distStart <= currTrack->m_Width/2 )
{
// D(printf("nearest end is start\n");)
*curpos = track->m_Start;
return true;
}
if( distEnd <= currTrack->m_Width/2 )
{
// D(printf("nearest end is end\n");)
*curpos = track->m_End;
return true;
}
// @todo otherwise confine curpos such that it stays centered
// within "track"
}
}
}
}
return false;
}

View File

@ -506,7 +506,7 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
track_mnu = new wxMenu; track_mnu = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu, ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
ID_POPUP_PCB_EDIT_TRACK_MNU, _( ID_POPUP_PCB_EDIT_TRACK_MNU, _(
"Change Width" ), width_track_xpm ); "Change Tracks and Vias Sizes" ), width_track_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG, ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG,
Track->Type()==TYPE_VIA ? _( "Change Via Size" ) : _( Track->Type()==TYPE_VIA ? _( "Change Via Size" ) : _(
"Change Segment Width" ), width_segment_xpm ); "Change Segment Width" ), width_segment_xpm );
@ -514,13 +514,13 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK, ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK,
_( "Change Track Width" ), width_track_xpm ); _( "Change Track Width" ), width_track_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_NET, ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_NET,
_( "Change Net" ), width_net_xpm ); _( "Set Net to NetClass values" ), width_net_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
_( "Change ALL Tracks and Vias" ), width_track_via_xpm ); _( "Set ALL Tracks and Vias to NetClass Values" ), width_track_via_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE, ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE,
_( "Change ALL Vias (No Track)" ), width_vias_xpm ); _( "Set ALL Vias (No Track)to NetClass Values" ), width_vias_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE, ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE,
_( "Change ALL Tracks (No Via)" ), width_track_xpm ); _( "Set ALL Tracks (No Via)to NetClass Values" ), width_track_xpm );
} }
// Delete control: // Delete control:

View File

@ -262,17 +262,24 @@ void Calcule_Coord_Extremite_45( int ox, int oy, int* fx, int* fy );
/*****************/ /*****************/
/* TRACK.CPP : */ /* TRACK.CPP : */
/*****************/ /*****************/
TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC, /**
TRACK* pt_segm, int* nb_segm, int flagcolor ); * Function Marque_Une_Piste
* marks a chain of track segments, connected to aTrackList.
/* Routine de Marquage de 1 piste, a partir du segment pointe par pt_segm. * Each segment is marked by setting the BUSY bit into m_Flags. Electrical continuity
* le segment pointe est marque puis les segments adjacents * is detected by walking each segment, and finally the segments are rearranged
* jusqu'a un pad ou un point de jonction de plus de 2 segments * into a contiguous chain within the given list.
* le marquage est la mise a 1 du bit BUSY du parametre .status * @param aPcb = the board to analyse
* Les segments sont ensuite reclasses pour etre contigus en memoire * @param aStartSegm The first interesting segment within a list of track segment of aPcb
* Retourne: * @param aSegmCount = a pointer to an integer where to return the number of interesting segments
* adresse du 1er segment de la chaine creee * @param aTrackLen = a pointer to an integer where to return the lenght of the track
* nombre de segments */ * @param aReorder =
* true for reorder the interesting segments (useful for track edition/deletion)
* in this case the flag BUSY is set (the user is responsible of flag clearing)
* false for no reorder : useful when we want just calculate the track lenght
* in this case, flags are reset
* @return TRACK* the first in the chain of interesting segments.
*/
TRACK* Marque_Une_Piste( BOARD * aPcb, TRACK* aStartSegm, int* aSegmCount, int * aTrackLen, bool aReorder );
int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
TRACK** StartTrack, TRACK** EndTrack ); TRACK** StartTrack, TRACK** EndTrack );

View File

@ -49,7 +49,7 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
if( aNewTrack->Type() == TYPE_VIA && (aNewTrackSegmentsCount > 1 ) ) if( aNewTrack->Type() == TYPE_VIA && (aNewTrackSegmentsCount > 1 ) )
aNewTrack = aNewTrack->Next(); aNewTrack = aNewTrack->Next();
aNewTrack = Marque_Une_Piste( this, aDC, aNewTrack, &aNewTrackSegmentsCount, 0 ); aNewTrack = Marque_Une_Piste( GetBoard(), aNewTrack, &aNewTrackSegmentsCount, NULL, true );
wxASSERT( aNewTrack ); wxASSERT( aNewTrack );
#if 0 && defined(DEBUG) #if 0 && defined(DEBUG)
@ -204,7 +204,7 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
nbconnect--; nbconnect--;
pt_del->SetState( CHAIN, OFF ); pt_del->SetState( CHAIN, OFF );
pt_del = Marque_Une_Piste( this, aDC, pt_del, &nb_segm, 0 ); pt_del = Marque_Une_Piste( GetBoard(), pt_del, &nb_segm, NULL, true );
/* Test si La piste marquee est redondante, c'est a dire si l'un des /* Test si La piste marquee est redondante, c'est a dire si l'un des
* segments marques est connecte au point de depart de la piste nouvelle * segments marques est connecte au point de depart de la piste nouvelle

View File

@ -1,7 +1,6 @@
/*********************************************/ /*********************************************
/* Edition des pistes: Routines d'effacement */ * track.cpp
/* Effacement de segment, piste, net et zone */ *********************************************/
/*********************************************/
#include "fctsys.h" #include "fctsys.h"
@ -10,63 +9,63 @@
#include "protos.h" #include "protos.h"
/* Functions to reconize a track.
* A track is a list of connected segments (or/and vias)
* from a starting to an ending point
* starting and ending points are a pad or a point with more than 2 segments connected
* (and obviouly a dangling segment end)
*/
typedef std::vector<TRACK*> TRACK_PTRS; typedef std::vector<TRACK*> TRACK_PTRS; // buffer of item candidates when search for items on the same track
/* Routines externes : */ /* Local functions */
void Montre_Position_New_Piste( int flag );/* defini dans editrack.cc */
/* Routines Locales */
static void Marque_Chaine_segments( BOARD* Pcb, wxPoint ref_pos, int masklayer, TRACK_PTRS* aList ); static void Marque_Chaine_segments( BOARD* Pcb, wxPoint ref_pos, int masklayer, TRACK_PTRS* aList );
/* Variables locales */
/* Routine de Marquage de 1 piste, a partir du segment pointe par pt_segm.
* le segment pointe est marque puis les segments connectes
* jusqu'a un pad ou un point de jonction de plus de 2 segments
* le marquage est la mise a 1 du bit BUSY
* Les segments sont ensuite reclasses pour etre contigus en liste chainee
* Retourne:
* adresse du 1er segment de la chaine creee
* nombre de segments
*/
/** /**
* Function Marque_Une_Piste * Function Marque_Une_Piste
* marks a chain of track segments, starting at aTrackList. * marks a chain of track segments, connected to aTrackList.
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical continuity * Each segment is marked by setting the BUSY bit into m_Flags. Electrical continuity
* is detected by walking each segment, and finally the segments are rearranged * is detected by walking each segment, and finally the segments are rearranged
* into a contiguous chain within the given list. * into a contiguous chain within the given list.
* @param aTrackList The first interesting segment within a list of many * @param aPcb = the board to analyse
* interesting and uninteresting segments. * @param aStartSegm The first interesting segment within a list of track segment of aPcb
* @param aSegmCount = a pointer to an integer where to return the number of interesting segments
* @param aTrackLen = a pointer to an integer where to return the lenght of the track
* @param aReorder = bool:
* true for reorder the interesting segments (useful for track edition/deletion)
* in this case the flag BUSY is set (the user is responsible of flag clearing)
* false for no reorder : useful when we want just calculate the track lenght
* in this case, flags are reset
* @return TRACK* the first in the chain of interesting segments. * @return TRACK* the first in the chain of interesting segments.
*/ */
TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* Marque_Une_Piste( BOARD* aPcb,
TRACK* aTrackList, int* nb_segm, int flagcolor ) TRACK* aStartSegm,
int* aSegmCount,
int* aTrackLen,
bool aReorder )
{ {
int NbSegmBusy; int NbSegmBusy;
TRACK_PTRS trackList; TRACK_PTRS trackList;
*nb_segm = 0; if( aSegmCount )
if( aTrackList == NULL ) *aSegmCount = 0;
if( aStartSegm == NULL )
return NULL; return NULL;
if( flagcolor ) // Ensure the flag BUSY of all tracks of the board is cleared
aTrackList->Draw( frame->DrawPanel, DC, flagcolor ); // because we use it to mark segments of the track
for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
// Ensure the flag BUSY is cleared because we use it to mark segments of the track track->SetState( BUSY, OFF );
for( TRACK* track = frame->GetBoard()->m_Track; track; track = track->Next() )
track->SetState( BUSY , OFF );
/* Set flags of the initial track segment */ /* Set flags of the initial track segment */
aTrackList->SetState( BUSY, ON ); aStartSegm->SetState( BUSY, ON );
int masque_layer = aTrackList->ReturnMaskLayer(); int masque_layer = aStartSegm->ReturnMaskLayer();
trackList.push_back( aTrackList ); trackList.push_back( aStartSegm );
/* Examine the initial track segment : if it is really a segment, this is easy. /* Examine the initial track segment : if it is really a segment, this is easy.
* If it is a via, one must search for connected segments. * If it is a via, one must search for connected segments.
@ -74,66 +73,81 @@ TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC,
* and this via and these 2 segments are a part of a track. * and this via and these 2 segments are a part of a track.
* If > 2 only this via is flagged (the track has only this via) * If > 2 only this via is flagged (the track has only this via)
*/ */
if( aTrackList->Type() == TYPE_VIA ) if( aStartSegm->Type() == TYPE_VIA )
{ {
TRACK* Segm1, * Segm2 = NULL, * Segm3 = NULL; TRACK* Segm1, * Segm2 = NULL, * Segm3 = NULL;
Segm1 = Fast_Locate_Piste( frame->GetBoard()->m_Track, NULL, Segm1 = Fast_Locate_Piste( aPcb->m_Track, NULL,
aTrackList->m_Start, masque_layer ); aStartSegm->m_Start, masque_layer );
if( Segm1 ) if( Segm1 )
{ {
Segm2 = Fast_Locate_Piste( Segm1->Next(), NULL, Segm2 = Fast_Locate_Piste( Segm1->Next(), NULL,
aTrackList->m_Start, masque_layer ); aStartSegm->m_Start, masque_layer );
} }
if( Segm2 ) if( Segm2 )
{ {
Segm3 = Fast_Locate_Piste( Segm2->Next(), NULL, Segm3 = Fast_Locate_Piste( Segm2->Next(), NULL,
aTrackList->m_Start, masque_layer ); aStartSegm->m_Start, masque_layer );
} }
if( Segm3 ) // More than 2 segments are connected to this via. the "track" is only this via if( Segm3 ) // More than 2 segments are connected to this via. the "track" is only this via
{ {
*nb_segm = 1; if( aSegmCount )
return aTrackList; *aSegmCount = 1;
return aStartSegm;
} }
if( Segm1 ) // search for others segments connected to the initial segment start point if( Segm1 ) // search for others segments connected to the initial segment start point
{ {
masque_layer = Segm1->ReturnMaskLayer(); masque_layer = Segm1->ReturnMaskLayer();
Marque_Chaine_segments( frame->GetBoard(), aTrackList->m_Start, masque_layer, &trackList ); Marque_Chaine_segments(
aPcb, aStartSegm->m_Start, masque_layer, &trackList );
} }
if( Segm2 ) // search for others segments connected to the initial segment end point if( Segm2 ) // search for others segments connected to the initial segment end point
{ {
masque_layer = Segm2->ReturnMaskLayer(); masque_layer = Segm2->ReturnMaskLayer();
Marque_Chaine_segments( frame->GetBoard(), aTrackList->m_Start, masque_layer, &trackList ); Marque_Chaine_segments(
aPcb, aStartSegm->m_Start, masque_layer, &trackList );
} }
} }
else // mark the chain using both ends of the initial segment else // mark the chain using both ends of the initial segment
{ {
Marque_Chaine_segments( frame->GetBoard(), aTrackList->m_Start, masque_layer, &trackList ); Marque_Chaine_segments( aPcb, aStartSegm->m_Start, masque_layer, &trackList );
Marque_Chaine_segments( frame->GetBoard(), aTrackList->m_End, masque_layer, &trackList ); Marque_Chaine_segments( aPcb, aStartSegm->m_End, masque_layer, &trackList );
} }
// marquage des vias (vias non connectees ou inutiles // Now we examine selected vias and flag them if they are on the track
// If a via is connected to only one or 2 segments, it is flagged (is on the track)
// If a via is connected to more than 2 segments, it is a track end, and it is removed from the list
// go through the list backwards. // go through the list backwards.
for( int i = trackList.size()-1; i>=0; --i ) for( int i = trackList.size() - 1; i>=0; --i )
{ {
TRACK* via = trackList[i]; TRACK* via = trackList[i];
if( via->Type() != TYPE_VIA ) if( via->Type() != TYPE_VIA )
continue; continue;
if( via == aTrackList ) if( via == aStartSegm )
continue; continue;
via->SetState( BUSY, ON ); via->SetState( BUSY, ON ); // Try to flag it. the flag will be cleared later if needed
masque_layer = via->ReturnMaskLayer(); masque_layer = via->ReturnMaskLayer();
TRACK* track = Fast_Locate_Piste( frame->GetBoard()->m_Track, TRACK* track = Fast_Locate_Piste( aPcb->m_Track, NULL, via->m_Start, masque_layer );
NULL, via->m_Start, masque_layer );
// Fast_Locate_Piste does not consider tracks flagged BUSY.
// So if no connected track found, this via is on the current track only: keep it
if( track == NULL ) if( track == NULL )
continue; continue;
/* Test des connexions: si via utile: suppression marquage */ /* if a track is found, this via connects also others segments of an other track
* This case happens when the vias ends the selected track.
* But must we consider this via is on the selected track, or on an other track.
* (this is important when selecting a track for deletion: must this via be deleted or not?)
* We consider here this via on the track if others segment connected to this via
* remain connected when removing this via.
* We search for all others segment connected together:
* if there are on the same layer, the via is on the selected track
* if there are on different layers, the via is on an other track
*/
int layer = track->GetLayer(); int layer = track->GetLayer();
while( ( track = Fast_Locate_Piste( track->Next(), NULL, while( ( track = Fast_Locate_Piste( track->Next(), NULL,
@ -141,18 +155,24 @@ TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC,
{ {
if( layer != track->GetLayer() ) if( layer != track->GetLayer() )
{ {
// The via connects segments of an other track: it is removed from list
// because it is member of an other track
via->SetState( BUSY, OFF ); via->SetState( BUSY, OFF );
break; break;
} }
} }
} }
/* Reclassement des segments marques en une chaine */ /* Rearrange the track list in order to have flagged segments linked from firstTrack
* So the NbSegmBusy segments are consecutive segments in list, the first item
* in the full track list is firstTrack, and the NbSegmBusy-1 next items
* (NbSegmBusy when including firstTrack) are the flagged segments
*/
NbSegmBusy = 0; NbSegmBusy = 0;
TRACK* firstTrack; TRACK* firstTrack;
for( firstTrack = frame->GetBoard()->m_Track; firstTrack; firstTrack = firstTrack->Next() ) for( firstTrack = aPcb->m_Track; firstTrack; firstTrack = firstTrack->Next() )
{ {
// recherche du debut de la liste des segments marques a BUSY // Search for the first flagged BUSY segments
if( firstTrack->GetState( BUSY ) ) if( firstTrack->GetState( BUSY ) )
{ {
NbSegmBusy = 1; NbSegmBusy = 1;
@ -160,133 +180,176 @@ TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC,
} }
} }
wxASSERT( firstTrack ); if( firstTrack == NULL )
return NULL;
if( firstTrack ) double full_len = 0;
if( aReorder )
{ {
DLIST<TRACK>* list = (DLIST<TRACK>*)firstTrack->GetList(); DLIST<TRACK>* list = (DLIST<TRACK>*)firstTrack->GetList();
wxASSERT(list); wxASSERT( list );
/* Reclassement de la chaine debutant a FirstTrack et finissant /* Rearrange the chain starting at firstTrack
* au dernier segment marque. FirstTrack n'est pas modifie * All others flagged items are moved from their position to the end
* of the flagged list
*/ */
TRACK* next; TRACK* next;
for( TRACK* track = firstTrack->Next(); track; track = next ) for( TRACK* track = firstTrack->Next(); track; track = next )
{ {
next = track->Next(); next = track->Next();
if( track->GetState( BUSY ) ) if( track->GetState( BUSY ) ) // move it!
{ {
NbSegmBusy++; NbSegmBusy++;
track->UnLink(); track->UnLink();
list->Insert( track, firstTrack->Next() ); list->Insert( track, firstTrack->Next() );
if( aTrackLen )
full_len += track->GetLength();
}
}
}
else if( aTrackLen )
{
NbSegmBusy = 0;
for( TRACK* track = firstTrack; track; track = track->Next() )
{
if( track->GetState( BUSY ) )
{
NbSegmBusy++;
track->SetState( BUSY, OFF );
full_len += track->GetLength();
} }
} }
} }
*nb_segm = NbSegmBusy; if( aTrackLen )
*aTrackLen = wxRound( full_len );
if( flagcolor ) if( aSegmCount )
Trace_Une_Piste( frame->DrawPanel, DC, firstTrack, NbSegmBusy, flagcolor ); *aSegmCount = NbSegmBusy;
return firstTrack; return firstTrack;
} }
/********************************************************************************/ /********************************************************************************/
static void Marque_Chaine_segments( BOARD* Pcb, wxPoint ref_pos, int masque_layer, TRACK_PTRS* aList ) static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMask,
TRACK_PTRS* aList )
/********************************************************************************/ /********************************************************************************/
/* /**
* routine utilisee par Supprime_1_Piste() * Function used by Marque_Une_Piste()
* Positionne le bit BUSY dans la chaine de segments commencant * - Set the BUSY flag of connected segments, the first search point is
* au point ox, oy sur la couche layer * ref_pos on layers allowed in masque_layer
* * - Put segments fount in aList
* Les vias sont mises en liste des segments traites mais ne sont pas * Vias are put in list but their flags BUSY is not set
* marquees. * @param Pcb = the board
* @param aRef_pos = the reference coordinate of the starting search
* @param aLayerMask = the allowed layers for segments to search
* (1 layer when starting point is on a segment, but more than one when starting point is on a via)
* @param aList = the track list to fill with points of segments flagged
*/ */
{ {
TRACK* pt_segm, // Pointe le segment courant analyse TRACK* pt_segm, // Pointe le segment courant analyse
* pt_via, // pointe la via reperee, eventuellement a detruire * pt_via, // pointe la via reperee, eventuellement a detruire
* MarqSegm; // pointe le segment a detruire (= NULL ou pt_segm * SegmentCandidate; // pointe le segment a detruire (= NULL ou pt_segm
int NbSegm; int NbSegm;
if( Pcb->m_Track == NULL ) if( aPcb->m_Track == NULL )
return; return;
/* Marquage de la chaine */ /* Set the BUSY flag of all connected segments, first search starting at aRef_pos
* Search ends when:
* - a pad is found (end of a track)
* - a segment found is flagged "EDIT"
* - a segment end has more than one other segment end connected
* - and obviously when no connected item found
* Vias are a special case, because we must see others segment connected on others layers
* and they change the layer mask. They can be a track end or not
* They will be analyser later, and vias on terminal points of the track will be
* considered as part of this track if they do not connect segments of an other track together
* and will be considered as part of an other track
* if when removing the via, the segments of taht other track are disconnected
*/
for( ; ; ) for( ; ; )
{ {
if( Fast_Locate_Pad_Connecte( Pcb, ref_pos, masque_layer ) != NULL ) if( Fast_Locate_Pad_Connecte( aPcb, aRef_pos, aLayerMask ) != NULL )
return; return;
/* Localisation d'une via (car elle connecte plusieurs segments) */ /* Test for a via: a via changes the layer mask and can connect a lot of segments
pt_via = Fast_Locate_Via( Pcb->m_Track, NULL, ref_pos, masque_layer ); * at location aRef_pos
* When found, the via is just pushed in list.
* Vias will be examined later, when all connected segment are found and push in list
* This is because whena via is found we do not know at this time the number of connected items
* and we do not know if this via is on the track or finish the track
*/
pt_via = Fast_Locate_Via( aPcb->m_Track, NULL, aRef_pos, aLayerMask );
if( pt_via ) if( pt_via )
{ {
if( pt_via->GetState( EDIT ) ) if( pt_via->GetState( EDIT ) )
return; return;
masque_layer = pt_via->ReturnMaskLayer(); aLayerMask = pt_via->ReturnMaskLayer();
aList->push_back( pt_via ); aList->push_back( pt_via );
} }
/* Recherche des segments connectes au point ref_pos /* Now we search all segments connected to point aRef_pos
* si 1 segment: peut etre marque * if only 1 segment: this segment is candidate
* si > 1 segment: * if > 1 segment:
* le segment ne peut etre marque * end of track (more than 2 segment connected at this location)
*/ */
pt_segm = Pcb->m_Track; MarqSegm = NULL; pt_segm = aPcb->m_Track; SegmentCandidate = NULL;
NbSegm = 0; NbSegm = 0;
while( ( pt_segm = Fast_Locate_Piste( pt_segm, NULL, while( ( pt_segm = Fast_Locate_Piste( pt_segm, NULL,
ref_pos, masque_layer ) ) != NULL ) aRef_pos, aLayerMask ) ) != NULL )
{ {
if( pt_segm->GetState( EDIT ) ) /* Fin de piste */ if( pt_segm->GetState( EDIT ) ) // End of track
return; return;
if( pt_segm->GetState( BUSY ) ) if( pt_segm->GetState( BUSY ) ) // already found and selected: skip it
{ {
pt_segm = pt_segm->Next(); pt_segm = pt_segm->Next();
continue; continue;
} }
if( pt_segm == pt_via ) /* deja traite */ if( pt_segm == pt_via ) // just previously found: skip it
{ {
pt_segm = pt_segm->Next(); pt_segm = pt_segm->Next();
continue; continue;
} }
NbSegm++; NbSegm++;
if( NbSegm == 1 ) /* 1ere detection de segment de piste */ if( NbSegm == 1 ) /* First time we found a connected item: pt_segm is candidate */
{ {
MarqSegm = pt_segm; SegmentCandidate = pt_segm;
pt_segm = pt_segm->Next(); pt_segm = pt_segm->Next();
} }
else /* 2eme detection de segment -> fin de piste */ else /* More than 1 segment connected -> this location is an end of the track */
{ {
return; return;
} }
} }
if( MarqSegm ) if( SegmentCandidate ) // A candidate is found: flag it an push it in list
{ {
/* preparation de la nouvelle recherche */ /* Initialize parameters to search items connected to this candidate:
masque_layer = MarqSegm->ReturnMaskLayer(); * we must analyse connections to its other end
*/
aLayerMask = SegmentCandidate->ReturnMaskLayer();
if( ref_pos == MarqSegm->m_Start ) if( aRef_pos == SegmentCandidate->m_Start )
{ {
ref_pos = MarqSegm->m_End; aRef_pos = SegmentCandidate->m_End;
} }
else else
{ {
ref_pos = MarqSegm->m_Start; aRef_pos = SegmentCandidate->m_Start;
} }
pt_segm = Pcb->m_Track; /* reinit recherche des segments */ pt_segm = aPcb->m_Track; /* restart list of tracks to analyse */
/* Marquage et mise en liste du segment */ /* flag this item an push it in list of selected items */
aList->push_back( MarqSegm ); aList->push_back( SegmentCandidate );
MarqSegm->SetState( BUSY, ON ); SegmentCandidate->SetState( BUSY, ON );
} }
else else
return; return;
@ -299,12 +362,14 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
TRACK** StartTrack, TRACK** EndTrack ) TRACK** StartTrack, TRACK** EndTrack )
/**********************************************************/ /**********************************************************/
/* Calcule les coordonnes des extremites d'une piste /* Calculate the end points coordinates of a track (a list of connected segments)
* retourne 1 si OK, 0 si piste bouclee * RefTrack is a segment of the track
* Retourne dans *StartTrack en *EndTrack les segments de debut et fin * return 1 if OK, 0 when a track is a closed loop
* Les coord StartTrack->m_Start.x, m_Start.y contiennent le debut de la piste * and the beginning and the end of the track in *StartTrack and *EndTrack
* Les coord EndTrack->m_End.x, m_End.y contiennent le debut de la piste * Modify *StartTrack en *EndTrack :
* Les segments sont supposes chaines de facon consecutive * (*StartTrack)->m_Start coordinate is the beginning of the track
* (*EndTrack)->m_End coordinate is the end of the track
* Segments connected must be consecutives in list
*/ */
{ {
TRACK* Track, * via, * segm, * TrackListEnd; TRACK* Track, * via, * segm, * TrackListEnd;
@ -433,7 +498,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
void ListSetState( EDA_BaseStruct* Start, int NbItem, int State, int onoff ) void ListSetState( EDA_BaseStruct* Start, int NbItem, int State, int onoff )
/***************************************************************************/ /***************************************************************************/
/* Met a jour le membre .state d'une chaine de structures /* Set to onoff the .m_State member, bit mask State of a list of items
*/ */
{ {
if( Start == NULL ) if( Start == NULL )