Commit c974c42d authored by charras's avatar charras

eeschema: 2 bugs fixed

pcbnew: more about netclass work
parent e39e3d53
......@@ -115,7 +115,12 @@ static void RestoreOldWires( SCH_SCREEN* screen )
void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
/*************************************************************/
/* Create a new segment ( WIRE, BUS ).
/* Creates a new segment ( WIRE, BUS ),
* or terminates the current segment
* If the end of the current segment is on an other segment, place a junction if needed
* and terminates the command
* If the end of the current segment is on a pin, terminates the command
* In others cases starts a new segment
*/
{
EDA_DrawLineStruct* oldsegment, * newsegment, * nextsegment;
......@@ -177,7 +182,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine;
g_ItemToRepeat = NULL;
}
else /* Trace en cours: Placement d'un point supplementaire */
else /* A segment is in progress: terminates the current segment and add a new segment */
{
nextsegment = oldsegment->Next();
if( !g_HVLines )
......@@ -194,8 +199,9 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
/* Creation du segment suivant ou fin de trac� si point sur pin, jonction ...*/
if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->GetLayer() ) )
/* Creates the new segment, or terminates the command
* if the end point is on a pin, jonction or an other wire or bus */
if( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->GetLayer() ) )
{
EndSegment( DC ); return;
}
......@@ -777,15 +783,15 @@ void IncrementLabelMember( wxString& name )
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
/***************************************************************************/
/* Returne TRUE si pos est un point possible pour terminer automatiquement un
* segment, c'est a dire pour
* - type WIRE, si il y a
* - une jonction
* - ou une pin
* - ou une extr�mit� unique de fil
/* Return TRUE if pos can be a terminal point for a wire or a bus
* i.e. :
* for a WIRE, if at pos is found:
* - a junction
* - or a pin
* - or an other wire
*
* - type BUS, si il y a
* - ou une extr�mit� unique de BUS
* - for a BUS, if at pos is found:
* - a BUS
*/
{
EDA_BaseStruct* item;
......
......@@ -242,7 +242,6 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc,
{
wxString fieldText;
LibDrawField* Field;
LIB_DRAW_ITEM* drawItem;
BASE_SCREEN* screen = panel->GetScreen();
GRSetDrawMode( dc, drawMode );
......@@ -313,7 +312,7 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc,
for( Field = m_Fields; Field != NULL; Field = Field->Next() )
{
if( onlySelected && drawItem->m_Selected == 0 )
if( onlySelected && Field->m_Selected == 0 )
continue;
Field->Draw( panel, dc, offset, color, drawMode, NULL,
......
......@@ -686,13 +686,45 @@ Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet,
return NULL;
}
/* helper function used to locate graphics items in a lib component (in library space)
* to a given location given in schematic space
* in schematic space, a component is an image of the lib component, rotated and mirorred
* by its mirror/rotation matrix
* this function calculates the invert matrix of the mirror/rotation matrix
* it is used to calculate the position in in library space from
* the position in schematic space of a test point, corresponding to a given component
*/
bool InvertMatrix(int aSource[2][2], int aDest[2][2] )
{
/* for a source matrix (a,b, c,d) a, if the first line, and cd the second line
* the invert matrix is 1/det * comatrix
* det = ad-bc
* comatrix = (d,-b, -c,a)
* a = aSource[0][0]
* b = aSource[0][1]
* c = aSource[1][0]
* d = aSource[1][1]
* in eeschema, values are 1, 0 or -1 only and we can use integers only
*/
bool success = true;
int det = aSource[0][0]*aSource[1][1] - aSource[0][1]*aSource[1][0];
wxASSERT(det);
if( det == 0 ) // Should not occur with eeschema matrix transform
det = 1;
aDest[0][0] = aSource[1][1]/det;
aDest[0][1] = -aSource[0][1]/det;
aDest[1][0] = -aSource[1][0]/det;
aDest[1][1] = aSource[0][0]/det;
return success;
}
LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
SCH_COMPONENT** libpart )
{
SCH_ITEM* DrawStruct;
LIB_COMPONENT* Entry;
SCH_COMPONENT* LibItem = NULL;
SCH_COMPONENT* schItem = NULL;
LibDrawPin* Pin = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL;
......@@ -700,21 +732,36 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
{
if( DrawStruct->Type() != TYPE_SCH_COMPONENT )
continue;
LibItem = (SCH_COMPONENT*) DrawStruct;
Entry = CMP_LIBRARY::FindLibraryComponent( LibItem->m_ChipName );
schItem = (SCH_COMPONENT*) DrawStruct;
Entry = CMP_LIBRARY::FindLibraryComponent( schItem->m_ChipName );
if( Entry == NULL )
continue;
Pin = (LibDrawPin*) Entry->LocateDrawItem( LibItem->m_Multi,
LibItem->m_Convert,
/* we use LocateDrawItem to locate pns. but this function suppose a component
* at 0,0 location, in normal orientation/mirror
* So we must calculate the ref position in component space
*/
// Calculate the position relative to the component (in library space the component is at location 0,0)
wxPoint libPos = RefPos - schItem->m_Pos;
// Calculate the equivalent position of the test point for a normal orient component
int itransMat[2][2];
InvertMatrix(schItem->m_Transform, itransMat );
libPos = TransformCoordinate(itransMat, libPos);
// LocateDrawItem uses DefaultTransformMatrix as matrix orientation of the component
// so we must recalculate libPos for this orientation before calling LocateDrawItem
InvertMatrix(DefaultTransformMatrix, itransMat );
libPos = TransformCoordinate(itransMat, libPos);
wxPoint schPos = TransformCoordinate(schItem->m_Transform, libPos);
Pin = (LibDrawPin*) Entry->LocateDrawItem( schItem->m_Multi,
schItem->m_Convert,
COMPONENT_PIN_DRAW_TYPE,
RefPos );
libPos );
if( Pin )
break;
}
if( libpart )
*libpart = LibItem;
*libpart = schItem;
return Pin;
}
......
......@@ -333,7 +333,6 @@ public:
virtual void SwitchLayer( wxDC* DC, int layer );
// divers
void AddHistory( int value, KICAD_T type ); // Add value in data list history
void InstallGridFrame( const wxPoint& pos );
virtual void LoadSettings();
......
......@@ -56,9 +56,9 @@ public:
WinEDAChoiceBox* m_SelViaSizeBox; // a combo box to display and select current via diameter
wxTextCtrl* m_ClearanceBox; // a text ctrl to display the current tracks and vias clearance
wxTextCtrl* m_NetClassSelectedBox; // a text ctrl to display the current NetClass
bool m_TrackAndViasSizesList_Changed;
private:
bool m_TrackAndViasSizesList_Changed;
DRC* m_drc; ///< the DRC controller, see drc.cpp
......
......@@ -79,7 +79,7 @@ BOARD::~BOARD()
/**
* Function SetCurrentNetClass
* Must be called after a netclass selection (or after a netclass parameter change
* Initialise vias and tracks values displayed in comb boxs of the auxiliary toolbar
* Initialise vias and tracks values displayed in combo boxs of the auxiliary toolbar
* and some others parametres (netclass name ....)
* @param aNetClassName = the new netclass name
* @return true if lists of tracks and vias sizes are modified
......@@ -96,33 +96,33 @@ BOARD::~BOARD()
m_CurrentNetClassName = netClass->GetName();
// Initialize others values:
if( m_ViaSizeHistory.size() == 0 )
if( m_ViaSizeList.size() == 0 )
{
lists_sizes_modified = true;
m_ViaSizeHistory.push_back(0);
m_ViaSizeList.push_back(0);
}
if( m_TrackWidthHistory.size() == 0 )
if( m_TrackWidthList.size() == 0 )
{
lists_sizes_modified = true;
m_TrackWidthHistory.push_back(0);
m_TrackWidthList.push_back(0);
}
if( m_ViaSizeHistory[0] != netClass->GetViaDiameter() )
if( m_ViaSizeList[0] != netClass->GetViaDiameter() )
lists_sizes_modified = true;
m_ViaSizeHistory[0] = netClass->GetViaDiameter();
m_ViaSizeList[0] = netClass->GetViaDiameter();
if( m_TrackWidthHistory[0] != netClass->GetTrackWidth() )
if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
lists_sizes_modified = true;
m_TrackWidthHistory[0] = netClass->GetTrackWidth();
m_TrackWidthList[0] = netClass->GetTrackWidth();
if( m_ViaSizeSelector >= m_ViaSizeHistory.size() )
m_ViaSizeSelector = m_ViaSizeHistory.size();
if( m_TrackWidthSelector >= m_TrackWidthHistory.size() )
m_TrackWidthSelector = m_TrackWidthHistory.size();
if( m_ViaSizeSelector >= m_ViaSizeList.size() )
m_ViaSizeSelector = m_ViaSizeList.size();
if( m_TrackWidthSelector >= m_TrackWidthList.size() )
m_TrackWidthSelector = m_TrackWidthList.size();
//Initialize track and via current size:
g_DesignSettings.m_CurrentViaSize = m_ViaSizeHistory[m_ViaSizeSelector];
g_DesignSettings.m_CurrentTrackWidth = m_TrackWidthHistory[m_TrackWidthSelector];
g_DesignSettings.m_CurrentViaSize = m_ViaSizeList[m_ViaSizeSelector];
g_DesignSettings.m_CurrentTrackWidth = m_TrackWidthList[m_TrackWidthSelector];
return lists_sizes_modified;
}
......
......@@ -108,11 +108,13 @@ public:
// handling of vias and tracks size:
// the first value is always the value of the current NetClass
// The others values are extra values
std::vector <int> m_ViaSizeHistory; // Last used via sizes (max count = HISTORY_MAX_COUNT)
std::vector <int> m_TrackWidthHistory; // Last used track widths (max count = HISTORY_MAX_COUNT)
unsigned m_ViaSizeSelector; // index for m_ViaSizeHistory to select the value
// O is the selection of the default value Netclass
unsigned m_TrackWidthSelector; // index for m_TrackWidthHistory to select the value
std::vector <int> m_ViaSizeList; // vias sizes list(max count = HISTORY_MAX_COUNT)
// The first value is the current netclass via size
std::vector <int> m_TrackWidthList; // tracks widths (max count = HISTORY_MAX_COUNT)
// The first value is the current netclass track width
unsigned m_ViaSizeSelector; // index for m_ViaSizeList to select the value
// 0 is the index selection of the default value Netclass
unsigned m_TrackWidthSelector; // index for m_TrackWidthList to select the value
/**********************************/
public:
......@@ -372,7 +374,7 @@ public:
* @param aNetClassName = the new netclass name
* @return true if lists of tracks and vias sizes are modified
*/
bool SetCurrentNetClass( const wxString & aNetClassName);
bool SetCurrentNetClass( const wxString& aNetClassName );
/**
* Function Save
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_track_options.h
// Author: jean-pierre Charras
// Created: 17 feb 2009
......@@ -17,18 +18,23 @@
*/
class DIALOG_TRACKS_OPTIONS : public DIALOG_TRACKS_OPTIONS_BASE
{
public:
private:
WinEDA_PcbFrame* m_Parent;
std::vector <int> m_ViasDiameterList;
std::vector <int> m_TracksWidthList;
public:
DIALOG_TRACKS_OPTIONS( WinEDA_PcbFrame* parent );
~DIALOG_TRACKS_OPTIONS() {};
private:
void SetDisplayValue();
virtual void OnInitDialog( wxInitDialogEvent& event );
virtual void OnCheckboxAllowsMicroviaClick( wxCommandEvent& event );
void MyInit();
void InitDimensionsLists();
virtual void OnButtonOkClick( wxCommandEvent& event );
virtual void OnButtonCancelClick( wxCommandEvent& event );
virtual void OnButtonAddViaSizeClick( wxCommandEvent& event );
virtual void OnButtonDeleteViaSizeClick( wxCommandEvent& event );
virtual void OnButtonAddTrackSizeClick( wxCommandEvent& event );
virtual void OnButtonDeleteTrackSizeClick( wxCommandEvent& event );
};
#endif // _DIALOG_TRACK_OPTIONS_H_
This diff is collapsed.
This diff is collapsed.
......@@ -11,17 +11,17 @@
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/listbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/radiobox.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/radiobox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
......@@ -35,45 +35,55 @@ class DIALOG_TRACKS_OPTIONS_BASE : public wxDialog
private:
// Private event handlers
void _wxFB_OnInitDialog( wxInitDialogEvent& event ){ OnInitDialog( event ); }
void _wxFB_OnCheckboxAllowsMicroviaClick( wxCommandEvent& event ){ OnCheckboxAllowsMicroviaClick( event ); }
void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); }
void _wxFB_OnButtonAddViaSizeClick( wxCommandEvent& event ){ OnButtonAddViaSizeClick( event ); }
void _wxFB_OnButtonDeleteViaSizeClick( wxCommandEvent& event ){ OnButtonDeleteViaSizeClick( event ); }
void _wxFB_OnButtonAddTrackSizeClick( wxCommandEvent& event ){ OnButtonAddTrackSizeClick( event ); }
void _wxFB_OnButtonDeleteTrackSizeClick( wxCommandEvent& event ){ OnButtonDeleteTrackSizeClick( event ); }
void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); }
void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); }
protected:
wxStaticText* m_ViaSizeTitle;
wxTextCtrl* m_OptViaSize;
enum
{
wxID_ADD_VIA_SIZE = 1000,
wxID_DELETED_WIA_SIEZ,
wxID_ALLOW_MICROVIA,
wxID_ADD_TRACK_WIDTH,
wxID_DELETED_TRACK_WIDTH,
};
wxListBox* m_ViaSizeListCtrl;
wxButton* m_buttonAddViasSize;
wxButton* m_button4;
wxStaticText* m_ViaDefaultDrillValueTitle;
wxTextCtrl* m_OptViaDrill;
wxStaticText* m_ViaAltDrillValueTitle;
wxTextCtrl* m_OptCustomViaDrill;
wxRadioBox* m_OptViaType;
wxStaticText* m_MicroViaSizeTitle;
wxTextCtrl* m_MicroViaSizeCtrl;
wxStaticText* m_MicroViaDrillTitle;
wxTextCtrl* m_MicroViaDrillCtrl;
wxCheckBox* m_AllowMicroViaCtrl;
wxStaticText* m_TrackWidthTitle;
wxTextCtrl* m_OptTrackWidth;
wxStaticText* m_TrackClearanceTitle;
wxTextCtrl* m_OptTrackClearance;
wxRadioBox* m_AllowMicroViaCtrl;
wxListBox* m_TrackWidthListCtrl;
wxButton* m_buttonAddTrackSize;
wxButton* m_buttonDeleteTrackWidth;
wxStaticText* m_MaskClearanceTitle;
wxTextCtrl* m_OptMaskMargin;
wxButton* m_buttonOK;
wxButton* m_buttonCANCEL;
wxStdDialogButtonSizer* m_sdbButtonsSizer;
wxButton* m_sdbButtonsSizerOK;
wxButton* m_sdbButtonsSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnCheckboxAllowsMicroviaClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonAddViaSizeClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDeleteViaSizeClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonAddTrackSizeClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDeleteTrackSizeClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonOkClick( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Tracks and Vias Sizes"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Tracks and Vias Sizes"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 627,351 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_TRACKS_OPTIONS_BASE();
};
......
......@@ -33,17 +33,17 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
{
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
g_DesignSettings.m_UseConnectedTrackWidth = not g_DesignSettings.m_UseConnectedTrackWidth;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[m_SelTrackWidthBox->GetChoice()];
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[m_SelViaSizeBox->GetChoice()];
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[m_SelTrackWidthBox->GetChoice()];
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[m_SelViaSizeBox->GetChoice()];
AuxiliaryToolBar_Update_UI( );
break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
g_DesignSettings.m_UseConnectedTrackWidth = false;
GetBoard()->m_TrackWidthSelector = 0;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[0];
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[0];
GetBoard()->m_ViaSizeSelector = 0;
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[0];
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[0];
AuxiliaryToolBar_Update_UI( );
break;
......@@ -65,7 +65,7 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
g_DesignSettings.m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[ii];
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[ii];
AuxiliaryToolBar_Update_UI( );
break;
......@@ -80,20 +80,20 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
GetBoard()->m_ViaSizeSelector = ii;
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[ii];
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[ii];
AuxiliaryToolBar_Update_UI( );
break;
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
ii = m_SelTrackWidthBox->GetChoice();
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[ii];
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[ii];
GetBoard()->m_TrackWidthSelector = ii;
break;
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
ii = m_SelViaSizeBox->GetChoice();
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[ii];
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[ii];
GetBoard()->m_ViaSizeSelector = ii;
break;
......
......@@ -357,14 +357,13 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "TrackWidth" ) == 0 )
{
g_DesignSettings.m_CurrentTrackWidth = atoi( data );
AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK );
continue;
}
if( stricmp( Line, "TrackWidthHistory" ) == 0 )
if( stricmp( Line, "TrackWidthList" ) == 0 )
{
int tmp = atoi( data );
AddHistory( tmp, TYPE_TRACK );
GetBoard()->m_TrackWidthList.push_back( tmp );
continue;
}
......@@ -407,7 +406,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "ViaSize" ) == 0 )
{
g_DesignSettings.m_CurrentViaSize = atoi( data );
AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA );
continue;
}
......@@ -429,10 +427,10 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "ViaSizeHistory" ) == 0 )
if( stricmp( Line, "ViaSizeList" ) == 0 )
{
int tmp = atoi( data );
AddHistory( tmp, TYPE_VIA );
GetBoard()->m_ViaSizeList.push_back( tmp );
continue;
}
......@@ -508,9 +506,37 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
g_Pad_Master.m_Drill.y = g_Pad_Master.m_Drill.x;
continue;
}
if( stricmp( Line, "Pad2MaskClearance" ) == 0 )
{
g_DesignSettings.m_MaskMargin = atoi( data );
continue;
}
#endif
}
/* Ensure tracks and vias sizes lists are ok:
* Sort lists by by increasing value and remove duplicates
* (the first value is not tested, because it is the netclass value
*/
sort( GetBoard()->m_ViaSizeList.begin()+1, GetBoard()->m_ViaSizeList.end() );
sort( GetBoard()->m_TrackWidthList.begin()+1, GetBoard()->m_TrackWidthList.end() );
for( unsigned ii = 1; ii < GetBoard()->m_ViaSizeList.size()-1; ii++ )
{
if( GetBoard()->m_ViaSizeList[ii] == GetBoard()->m_ViaSizeList[ii+1] )
{
GetBoard()->m_ViaSizeList.erase(GetBoard()->m_ViaSizeList.begin()+ii);
ii--;
}
}
for( unsigned ii = 1; ii < GetBoard()->m_TrackWidthList.size()-1; ii++ )
{
if( GetBoard()->m_TrackWidthList[ii] == GetBoard()->m_TrackWidthList[ii+1] )
{
GetBoard()->m_TrackWidthList.erase(GetBoard()->m_TrackWidthList.begin()+ii);
ii--;
}
}
return 1;
}
......@@ -543,8 +569,9 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
}
fprintf( aFile, "TrackWidth %d\n", g_DesignSettings.m_CurrentTrackWidth );
for( unsigned ii = 0; ii < aBoard->m_TrackWidthHistory.size(); ii++ )
fprintf( aFile, "TrackWidthHistory %d\n", aBoard->m_TrackWidthHistory[ii] );
// Save custom tracks width list (the first is not saved here: this is the netclass value
for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ )
fprintf( aFile, "TrackWidthList %d\n", aBoard->m_TrackWidthList[ii] );
fprintf( aFile, "TrackClearence %d\n", g_DesignSettings.m_TrackClearance );
......@@ -558,8 +585,9 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
fprintf( aFile, "ViaAltDrill %d\n", g_DesignSettings.m_ViaDrillCustomValue );
fprintf( aFile, "ViaMinSize %d\n", g_DesignSettings.m_ViasMinSize );
for( unsigned ii = 0; ii < aBoard->m_ViaSizeHistory.size(); ii++ )
fprintf( aFile, "ViaSizeHistory %d\n", aBoard->m_ViaSizeHistory[ii] );
// Save custom vias diameters list (the first is not saved here: this is the netclass value
for( unsigned ii = 1; ii < aBoard->m_ViaSizeList.size(); ii++ )
fprintf( aFile, "ViaSizeList %d\n", aBoard->m_ViaSizeList[ii] );
fprintf( aFile, "MicroViaSize %d\n", g_DesignSettings.m_CurrentMicroViaSize);
fprintf( aFile, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill);
......@@ -575,6 +603,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
fprintf( aFile, "TextModWidth %d\n", ModuleTextWidth );
fprintf( aFile, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y );
fprintf( aFile, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
fprintf( aFile, "Pad2MaskClearance %d\n", g_DesignSettings.m_MaskMargin );
fprintf( aFile, "AuxiliaryAxisOrg %d %d\n",
aFrame->m_Auxiliary_Axis_Position.x, aFrame->m_Auxiliary_Axis_Position.y );
......@@ -966,12 +995,16 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
DateAndTime( line ) );
fprintf( aFile, "# Created by Pcbnew%s\n\n", CONV_TO_UTF8( GetBuildVersion() ) );
GetBoard()->SynchronizeNetsAndNetClasses();
// Select default Netclass. Useful to save default values in headers
GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName( ));
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
WriteGeneralDescrPcb( aFile );
WriteSheetDescr( GetScreen(), aFile );
WriteSetup( aFile, this, GetBoard() );
GetBoard()->SynchronizeNetsAndNetClasses();
rc = GetBoard()->Save( aFile );
SetLocaleTo_Default( ); // revert to the current locale
......
......@@ -861,10 +861,10 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
_( "Use track and via sizes from their Netclass values" ),
true );
for( unsigned ii = 0; ii < aBoard->m_TrackWidthHistory.size(); ii++ )
for( unsigned ii = 0; ii < aBoard->m_TrackWidthList.size(); ii++ )
{
value = To_User_Unit( g_UnitMetric,
aBoard->m_TrackWidthHistory[ii],
aBoard->m_TrackWidthList[ii],
PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES ) // Affichage en mils
msg.Printf( _( "Track %.1f" ), value * 1000 );
......@@ -881,15 +881,15 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
else
{
if( aBoard->m_TrackWidthSelector < aBoard->m_TrackWidthHistory.size() )
if( aBoard->m_TrackWidthSelector < aBoard->m_TrackWidthList.size() )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_WIDTH1 + aBoard->m_TrackWidthSelector, true );
}
trackwidth_menu->AppendSeparator();
for( unsigned ii = 0; ii < aBoard->m_ViaSizeHistory.size(); ii++ )
for( unsigned ii = 0; ii < aBoard->m_ViaSizeList.size(); ii++ )
{
value = To_User_Unit( g_UnitMetric,
aBoard->m_ViaSizeHistory[ii],
aBoard->m_ViaSizeList[ii],
PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES )
msg.Printf( _( "Via %.1f" ), value * 1000 );
......@@ -899,7 +899,7 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
msg << _(" (from NetClass)" );
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, true );
}
if( aBoard->m_ViaSizeSelector < aBoard->m_ViaSizeHistory.size() )
if( aBoard->m_ViaSizeSelector < aBoard->m_ViaSizeList.size() )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_VIASIZE1 + aBoard->m_ViaSizeSelector, true );
return trackwidth_menu;
......
......@@ -1251,9 +1251,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
pcb->library->SetViaStartIndex( pcb->library->padstacks.size()-1 );
}
for( unsigned i=0; i < aBoard->m_ViaSizeHistory.size(); ++i )
for( unsigned i=0; i < aBoard->m_ViaSizeList.size(); ++i )
{
int viaSize = aBoard->m_ViaSizeHistory[i];
int viaSize = aBoard->m_ViaSizeList[i];
if( viaSize == defaultViaSize )
continue;
......
......@@ -87,30 +87,30 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI()
if( m_SelTrackWidthBox && m_TrackAndViasSizesList_Changed )
{
m_SelTrackWidthBox->Clear();
for( unsigned ii = 0; ii < GetBoard()->m_TrackWidthHistory.size(); ii++ )
for( unsigned ii = 0; ii < GetBoard()->m_TrackWidthList.size(); ii++ )
{
msg = _( "Track" ) + ReturnStringValue( GetBoard()->m_TrackWidthHistory[ii] );
msg = _( "Track" ) + ReturnStringValue( GetBoard()->m_TrackWidthList[ii] );
if( ii == 0 )
msg << _( " *" );
m_SelTrackWidthBox->Append( msg );
}
}
if( GetBoard()->m_TrackWidthSelector >= GetBoard()->m_TrackWidthHistory.size() )
if( GetBoard()->m_TrackWidthSelector >= GetBoard()->m_TrackWidthList.size() )
GetBoard()->m_TrackWidthSelector = 0;
m_SelTrackWidthBox->SetSelection( GetBoard()->m_TrackWidthSelector );
if( m_SelViaSizeBox && m_TrackAndViasSizesList_Changed )
{
m_SelViaSizeBox->Clear();
for( unsigned ii = 0; ii < GetBoard()->m_ViaSizeHistory.size(); ii++ )
for( unsigned ii = 0; ii < GetBoard()->m_ViaSizeList.size(); ii++ )
{
msg = _( "Via" ) + ReturnStringValue( GetBoard()->m_ViaSizeHistory[ii] );
msg = _( "Via" ) + ReturnStringValue( GetBoard()->m_ViaSizeList[ii] );
if( ii == 0 )
msg << _( " *" );
m_SelViaSizeBox->Append( msg );
}
}
if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViaSizeHistory.size() )
if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViaSizeList.size() )
GetBoard()->m_ViaSizeSelector = 0;
m_SelViaSizeBox->SetSelection( GetBoard()->m_ViaSizeSelector );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment