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 ) ...@@ -115,7 +115,12 @@ static void RestoreOldWires( SCH_SCREEN* screen )
void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) 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; EDA_DrawLineStruct* oldsegment, * newsegment, * nextsegment;
...@@ -177,7 +182,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -177,7 +182,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine; DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine;
g_ItemToRepeat = NULL; 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(); nextsegment = oldsegment->Next();
if( !g_HVLines ) if( !g_HVLines )
...@@ -194,8 +199,9 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -194,8 +199,9 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
/* Creation du segment suivant ou fin de trac� si point sur pin, jonction ...*/ /* Creates the new segment, or terminates the command
if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->GetLayer() ) ) * if the end point is on a pin, jonction or an other wire or bus */
if( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->GetLayer() ) )
{ {
EndSegment( DC ); return; EndSegment( DC ); return;
} }
...@@ -777,15 +783,15 @@ void IncrementLabelMember( wxString& name ) ...@@ -777,15 +783,15 @@ void IncrementLabelMember( wxString& name )
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
/***************************************************************************/ /***************************************************************************/
/* Returne TRUE si pos est un point possible pour terminer automatiquement un /* Return TRUE if pos can be a terminal point for a wire or a bus
* segment, c'est a dire pour * i.e. :
* - type WIRE, si il y a * for a WIRE, if at pos is found:
* - une jonction * - a junction
* - ou une pin * - or a pin
* - ou une extr�mit� unique de fil * - or an other wire
* *
* - type BUS, si il y a * - for a BUS, if at pos is found:
* - ou une extr�mit� unique de BUS * - a BUS
*/ */
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;
......
...@@ -242,7 +242,6 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc, ...@@ -242,7 +242,6 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc,
{ {
wxString fieldText; wxString fieldText;
LibDrawField* Field; LibDrawField* Field;
LIB_DRAW_ITEM* drawItem;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
GRSetDrawMode( dc, drawMode ); GRSetDrawMode( dc, drawMode );
...@@ -313,7 +312,7 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc, ...@@ -313,7 +312,7 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc,
for( Field = m_Fields; Field != NULL; Field = Field->Next() ) for( Field = m_Fields; Field != NULL; Field = Field->Next() )
{ {
if( onlySelected && drawItem->m_Selected == 0 ) if( onlySelected && Field->m_Selected == 0 )
continue; continue;
Field->Draw( panel, dc, offset, color, drawMode, NULL, Field->Draw( panel, dc, offset, color, drawMode, NULL,
......
...@@ -686,13 +686,45 @@ Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet, ...@@ -686,13 +686,45 @@ Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet,
return NULL; 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, LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
SCH_COMPONENT** libpart ) SCH_COMPONENT** libpart )
{ {
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
SCH_COMPONENT* LibItem = NULL; SCH_COMPONENT* schItem = NULL;
LibDrawPin* Pin = NULL; LibDrawPin* Pin = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; for( DrawStruct = DrawList; DrawStruct != NULL;
...@@ -700,21 +732,36 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, ...@@ -700,21 +732,36 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
{ {
if( DrawStruct->Type() != TYPE_SCH_COMPONENT ) if( DrawStruct->Type() != TYPE_SCH_COMPONENT )
continue; continue;
LibItem = (SCH_COMPONENT*) DrawStruct; schItem = (SCH_COMPONENT*) DrawStruct;
Entry = CMP_LIBRARY::FindLibraryComponent( LibItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( schItem->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
continue; continue;
Pin = (LibDrawPin*) Entry->LocateDrawItem( LibItem->m_Multi, /* we use LocateDrawItem to locate pns. but this function suppose a component
LibItem->m_Convert, * 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, COMPONENT_PIN_DRAW_TYPE,
RefPos ); libPos );
if( Pin ) if( Pin )
break; break;
} }
if( libpart ) if( libpart )
*libpart = LibItem; *libpart = schItem;
return Pin; return Pin;
} }
......
...@@ -333,7 +333,6 @@ public: ...@@ -333,7 +333,6 @@ public:
virtual void SwitchLayer( wxDC* DC, int layer ); virtual void SwitchLayer( wxDC* DC, int layer );
// divers // divers
void AddHistory( int value, KICAD_T type ); // Add value in data list history
void InstallGridFrame( const wxPoint& pos ); void InstallGridFrame( const wxPoint& pos );
virtual void LoadSettings(); virtual void LoadSettings();
......
...@@ -56,10 +56,10 @@ public: ...@@ -56,10 +56,10 @@ public:
WinEDAChoiceBox* m_SelViaSizeBox; // a combo box to display and select current via diameter 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_ClearanceBox; // a text ctrl to display the current tracks and vias clearance
wxTextCtrl* m_NetClassSelectedBox; // a text ctrl to display the current NetClass wxTextCtrl* m_NetClassSelectedBox; // a text ctrl to display the current NetClass
bool m_TrackAndViasSizesList_Changed;
private: private:
bool m_TrackAndViasSizesList_Changed;
DRC* m_drc; ///< the DRC controller, see drc.cpp DRC* m_drc; ///< the DRC controller, see drc.cpp
// we'll use lower case function names for private member functions. // we'll use lower case function names for private member functions.
......
...@@ -79,7 +79,7 @@ BOARD::~BOARD() ...@@ -79,7 +79,7 @@ BOARD::~BOARD()
/** /**
* Function SetCurrentNetClass * Function SetCurrentNetClass
* Must be called after a netclass selection (or after a netclass parameter change * 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 ....) * and some others parametres (netclass name ....)
* @param aNetClassName = the new netclass name * @param aNetClassName = the new netclass name
* @return true if lists of tracks and vias sizes are modified * @return true if lists of tracks and vias sizes are modified
...@@ -96,33 +96,33 @@ BOARD::~BOARD() ...@@ -96,33 +96,33 @@ BOARD::~BOARD()
m_CurrentNetClassName = netClass->GetName(); m_CurrentNetClassName = netClass->GetName();
// Initialize others values: // Initialize others values:
if( m_ViaSizeHistory.size() == 0 ) if( m_ViaSizeList.size() == 0 )
{ {
lists_sizes_modified = true; 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; 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; 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; lists_sizes_modified = true;
m_TrackWidthHistory[0] = netClass->GetTrackWidth(); m_TrackWidthList[0] = netClass->GetTrackWidth();
if( m_ViaSizeSelector >= m_ViaSizeHistory.size() ) if( m_ViaSizeSelector >= m_ViaSizeList.size() )
m_ViaSizeSelector = m_ViaSizeHistory.size(); m_ViaSizeSelector = m_ViaSizeList.size();
if( m_TrackWidthSelector >= m_TrackWidthHistory.size() ) if( m_TrackWidthSelector >= m_TrackWidthList.size() )
m_TrackWidthSelector = m_TrackWidthHistory.size(); m_TrackWidthSelector = m_TrackWidthList.size();
//Initialize track and via current size: //Initialize track and via current size:
g_DesignSettings.m_CurrentViaSize = m_ViaSizeHistory[m_ViaSizeSelector]; g_DesignSettings.m_CurrentViaSize = m_ViaSizeList[m_ViaSizeSelector];
g_DesignSettings.m_CurrentTrackWidth = m_TrackWidthHistory[m_TrackWidthSelector]; g_DesignSettings.m_CurrentTrackWidth = m_TrackWidthList[m_TrackWidthSelector];
return lists_sizes_modified; return lists_sizes_modified;
} }
......
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
std::vector<RATSNEST_ITEM> m_LocalRatsnest; /* Rastnest list relative to a given footprint std::vector<RATSNEST_ITEM> m_LocalRatsnest; /* Rastnest list relative to a given footprint
* (used while moving a footprint) */ * (used while moving a footprint) */
ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress
NETCLASSES m_NetClasses; ///< List of current netclasses. There is always the default netclass NETCLASSES m_NetClasses; ///< List of current netclasses. There is always the default netclass
wxString m_CurrentNetClassName; /* Current net class name used to display netclass info. wxString m_CurrentNetClassName; /* Current net class name used to display netclass info.
...@@ -108,11 +108,13 @@ public: ...@@ -108,11 +108,13 @@ public:
// handling of vias and tracks size: // handling of vias and tracks size:
// the first value is always the value of the current NetClass // the first value is always the value of the current NetClass
// The others values are extra values // The others values are extra values
std::vector <int> m_ViaSizeHistory; // Last used via sizes (max count = HISTORY_MAX_COUNT) std::vector <int> m_ViaSizeList; // vias sizes list(max count = HISTORY_MAX_COUNT)
std::vector <int> m_TrackWidthHistory; // Last used track widths (max count = HISTORY_MAX_COUNT) // The first value is the current netclass via size
unsigned m_ViaSizeSelector; // index for m_ViaSizeHistory to select the value std::vector <int> m_TrackWidthList; // tracks widths (max count = HISTORY_MAX_COUNT)
// O is the selection of the default value Netclass // The first value is the current netclass track width
unsigned m_TrackWidthSelector; // index for m_TrackWidthHistory to select the value 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: public:
...@@ -372,7 +374,7 @@ public: ...@@ -372,7 +374,7 @@ public:
* @param aNetClassName = the new netclass name * @param aNetClassName = the new netclass name
* @return true if lists of tracks and vias sizes are modified * @return true if lists of tracks and vias sizes are modified
*/ */
bool SetCurrentNetClass( const wxString & aNetClassName); bool SetCurrentNetClass( const wxString& aNetClassName );
/** /**
* Function Save * Function Save
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
...@@ -25,157 +26,215 @@ DIALOG_TRACKS_OPTIONS::DIALOG_TRACKS_OPTIONS( WinEDA_PcbFrame* parent ) : ...@@ -25,157 +26,215 @@ DIALOG_TRACKS_OPTIONS::DIALOG_TRACKS_OPTIONS( WinEDA_PcbFrame* parent ) :
DIALOG_TRACKS_OPTIONS_BASE( parent ) DIALOG_TRACKS_OPTIONS_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
MyInit();
GetSizer()->SetSizeHints( this );
} }
void DIALOG_TRACKS_OPTIONS::OnInitDialog( wxInitDialogEvent& event ) void DIALOG_TRACKS_OPTIONS::MyInit()
{ {
SetFocus(); SetFocus();
// deselect the existing text, seems SetFocus() wants to emulate Microsoft, which is not desireable here.
m_OptViaSize->SetSelection( 0, 0 );
SetDisplayValue();
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
event.Skip();
}
/*************************************************/
void DIALOG_TRACKS_OPTIONS::SetDisplayValue()
/*************************************************/
{
AddUnitSymbol( *m_ViaSizeTitle );
AddUnitSymbol( *m_MicroViaSizeTitle );
AddUnitSymbol( *m_ViaDefaultDrillValueTitle );
AddUnitSymbol( *m_MicroViaDrillTitle );
AddUnitSymbol( *m_ViaAltDrillValueTitle );
AddUnitSymbol( *m_TrackWidthTitle );
AddUnitSymbol( *m_TrackClearanceTitle );
AddUnitSymbol( *m_MaskClearanceTitle ); AddUnitSymbol( *m_MaskClearanceTitle );
int Internal_Unit = m_Parent->m_InternalUnits; int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_OptViaSize, g_DesignSettings.m_CurrentViaSize, Internal_Unit );
PutValueInLocalUnits( *m_MicroViaSizeCtrl,
g_DesignSettings.m_CurrentMicroViaSize,
Internal_Unit );
PutValueInLocalUnits( *m_OptViaDrill, g_DesignSettings.m_ViaDrill, Internal_Unit ); PutValueInLocalUnits( *m_OptViaDrill, g_DesignSettings.m_ViaDrill, Internal_Unit );
PutValueInLocalUnits( *m_MicroViaDrillCtrl, g_DesignSettings.m_MicroViaDrill, Internal_Unit );
PutValueInLocalUnits( *m_OptCustomViaDrill, PutValueInLocalUnits( *m_OptCustomViaDrill,
g_DesignSettings.m_ViaDrillCustomValue, g_DesignSettings.m_ViaDrillCustomValue,
Internal_Unit ); Internal_Unit );
PutValueInLocalUnits( *m_OptTrackWidth, g_DesignSettings.m_CurrentTrackWidth, Internal_Unit );
PutValueInLocalUnits( *m_OptTrackClearance, g_DesignSettings.m_TrackClearance, Internal_Unit );
PutValueInLocalUnits( *m_OptMaskMargin, g_DesignSettings.m_MaskMargin, Internal_Unit ); PutValueInLocalUnits( *m_OptMaskMargin, g_DesignSettings.m_MaskMargin, Internal_Unit );
if( g_DesignSettings.m_CurrentViaType != VIA_THROUGH ) if( g_DesignSettings.m_CurrentViaType != VIA_THROUGH )
m_OptViaType->SetSelection( 1 ); m_OptViaType->SetSelection( 1 );
m_MicroViaSizeTitle->Enable( g_DesignSettings.m_MicroViasAllowed ); m_AllowMicroViaCtrl->SetSelection( g_DesignSettings.m_MicroViasAllowed ? 1 : 0);
m_MicroViaSizeCtrl->Enable( g_DesignSettings.m_MicroViasAllowed );
// Vias and Tracks sizes values.
// note we display only extra values, never the current netclass value.
// (the first value in histories list)
m_TracksWidthList = m_Parent->GetBoard()->m_TrackWidthList;
m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
m_ViasDiameterList = m_Parent->GetBoard()->m_ViaSizeList;
m_ViasDiameterList.erase( m_ViasDiameterList.begin() ); // remove the netclass value
// Display values:
InitDimensionsLists();
}
m_MicroViaDrillTitle->Enable( g_DesignSettings.m_MicroViasAllowed );
m_MicroViaDrillCtrl->Enable( g_DesignSettings.m_MicroViasAllowed );
m_AllowMicroViaCtrl->SetValue( g_DesignSettings.m_MicroViasAllowed ); /*******************************************************************/
void DIALOG_TRACKS_OPTIONS::OnButtonDeleteViaSizeClick( wxCommandEvent& event )
/*******************************************************************/
{
int isel = m_ViaSizeListCtrl->GetSelection();
if( isel < 0 )
return;
m_ViasDiameterList.erase( m_ViasDiameterList.begin() + isel );
InitDimensionsLists();
} }
/*******************************************************************/ /*******************************************************************/
void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event ) void DIALOG_TRACKS_OPTIONS::OnButtonAddViaSizeClick( wxCommandEvent& event )
/*******************************************************************/ /*******************************************************************/
{ {
g_DesignSettings.m_CurrentViaType = VIA_THROUGH; wxString msg = wxGetTextFromUser( wxEmptyString,
if( m_OptViaType->GetSelection() > 0 ) _( "Enter new via diameter value:" ), wxEmptyString, this );
g_DesignSettings.m_CurrentViaType = VIA_BLIND_BURIED;
g_DesignSettings.m_CurrentViaSize = if( msg.IsEmpty() )
ReturnValueFromTextCtrl( *m_OptViaSize, m_Parent->m_InternalUnits ); return;
g_DesignSettings.m_CurrentMicroViaSize =
ReturnValueFromTextCtrl( *m_MicroViaSizeCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViaDrill = bool error = false;
ReturnValueFromTextCtrl( *m_MicroViaDrillCtrl, m_Parent->m_InternalUnits ); int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
g_DesignSettings.m_ViaDrill =
ReturnValueFromTextCtrl( *m_OptViaDrill, m_Parent->m_InternalUnits );
g_DesignSettings.m_ViaDrillCustomValue =
ReturnValueFromTextCtrl( *m_OptCustomViaDrill, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->IsChecked();
g_DesignSettings.m_CurrentTrackWidth = if( value <= 0 )
ReturnValueFromTextCtrl( *m_OptTrackWidth, m_Parent->m_InternalUnits ); error = true;
g_DesignSettings.m_TrackClearance = if( value > 10000 ) // a value > 1 inch is surely a stupid value
ReturnValueFromTextCtrl( *m_OptTrackClearance, m_Parent->m_InternalUnits ); error = true;
g_DesignSettings.m_MaskMargin = if( error )
ReturnValueFromTextCtrl( *m_OptMaskMargin, m_Parent->m_InternalUnits ); {
DisplayError( this, _( "Incorrect entered value. Aborted" ) );
return;
}
m_Parent->AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA ); // values are sorted by increasing value in list, so we can use binary_search()
m_Parent->AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK ); // (see C++ Standard Template Library C++ Algorithms binary_search)
EndModal( 1 ); if( binary_search( m_ViasDiameterList.begin(), m_ViasDiameterList.end(), value ) == false ) // value not already existing
{
if( m_ViasDiameterList.size() >= HISTORY_MAX_COUNT - 1 )
{
DisplayError( this, _( "Too many values in list (max count reached). Aborted" ) );
return;
}
m_ViasDiameterList.push_back( value );
// Sort new list by by increasing value
sort( m_ViasDiameterList.begin(), m_ViasDiameterList.end() );
}
InitDimensionsLists();
} }
/*********************************************************************/ /*******************************************************************/
void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type ) void DIALOG_TRACKS_OPTIONS::OnButtonDeleteTrackSizeClick( wxCommandEvent& event )
/**********************************************************************/ /*******************************************************************/
{
int isel = m_TrackWidthListCtrl->GetSelection();
// Mise a jour des listes des dernieres epaisseurs de via et track utilisées if( isel < 0 )
return;
m_TracksWidthList.erase( m_TracksWidthList.begin() + isel );
InitDimensionsLists();
}
/*******************************************************************/
void DIALOG_TRACKS_OPTIONS::OnButtonAddTrackSizeClick( wxCommandEvent& event )
/*******************************************************************/
{ {
std::vector <int> * vlist = NULL; wxString msg = wxGetTextFromUser( wxEmptyString,
_( "Enter new track size value:" ), wxEmptyString, this );
switch( type ) if( msg.IsEmpty() )
{ return;
case TYPE_TRACK:
vlist = &GetBoard()->m_TrackWidthHistory;
break;
case TYPE_VIA: bool error = false;
vlist = &GetBoard()->m_ViaSizeHistory; int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
break;
default: if( value <= 0 )
error = true;
if( value > 10000 ) // a value > 1 inche is surely a stupid value
error = true;
if( error )
{
DisplayError( this, _( "Incorrect entered value. Aborted" ) );
return; return;
} }
// values are sorted by increasing value in list, so we can use binary_search() // values are sorted by increasing value in list, so we can use binary_search()
// (see C++ Standard Template Library C++ Algorithms binary_search) // (see C++ Standard Template Library C++ Algorithms binary_search)
if( binary_search( vlist->begin(), vlist->end(), value ) == false ) if( binary_search( m_TracksWidthList.begin(), m_TracksWidthList.end(), value ) == false ) // value not already existing
{ // value not already existing {
vlist->push_back( value ); if( m_TracksWidthList.size() >= HISTORY_MAX_COUNT - 1 )
if( vlist->size() >= HISTORY_MAX_COUNT ) {
vlist->erase( vlist->begin() ); DisplayError( this, _( "Too many values in list (max count reached). Aborted" ) );
return;
}
m_TracksWidthList.push_back( value );
// Sort new list by by increasing value // Sort new list by by increasing value
sort( vlist->begin(), vlist->end() ); sort( m_TracksWidthList.begin(), m_TracksWidthList.end() );
} }
InitDimensionsLists();
} }
/*! /***************************************************/
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL void DIALOG_TRACKS_OPTIONS::InitDimensionsLists()
/***************************************************/
/* Populates the 2 lists of sizes (Tracks width list and Vias diameters list)
*/ */
{
wxString msg;
int Internal_Unit = m_Parent->m_InternalUnits;
void DIALOG_TRACKS_OPTIONS::OnButtonCancelClick( wxCommandEvent& event ) m_TrackWidthListCtrl->Clear();
for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ )
{
msg = ReturnStringFromValue( g_UnitMetric, m_TracksWidthList[ii], Internal_Unit, true );
m_TrackWidthListCtrl->Append( msg );
}
m_ViaSizeListCtrl->Clear();
for( unsigned ii = 0; ii < m_ViasDiameterList.size(); ii++ )
{
msg = ReturnStringFromValue( g_UnitMetric, m_ViasDiameterList[ii], Internal_Unit, true );
m_ViaSizeListCtrl->Append( msg );
}
}
/*******************************************************************/
void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event )
/*******************************************************************/
{ {
EndModal( 0 ); g_DesignSettings.m_CurrentViaType = VIA_THROUGH;
if( m_OptViaType->GetSelection() > 0 )
g_DesignSettings.m_CurrentViaType = VIA_BLIND_BURIED;
g_DesignSettings.m_ViaDrill =
ReturnValueFromTextCtrl( *m_OptViaDrill, m_Parent->m_InternalUnits );
g_DesignSettings.m_ViaDrillCustomValue =
ReturnValueFromTextCtrl( *m_OptCustomViaDrill, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
g_DesignSettings.m_MaskMargin =
ReturnValueFromTextCtrl( *m_OptMaskMargin, m_Parent->m_InternalUnits );
// Reinitialize m_TrackWidthList and m_ViaSizeList
std::vector <int>* list = &m_Parent->GetBoard()->m_TrackWidthList;
list->erase( list->begin() + 1, list->end() ); // Remove old "custom" sizes
list->insert( list->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() ); //Add new "custom" sizes
list = &m_Parent->GetBoard()->m_ViaSizeList;
list->erase( list->begin() + 1, list->end() );
list->insert( list->end(), m_ViasDiameterList.begin(), m_ViasDiameterList.end() );
EndModal( 1 );
m_Parent->m_TrackAndViasSizesList_Changed = true;
m_Parent->AuxiliaryToolBar_Update_UI();
} }
/*! /*!
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_ALLOWS_MICROVIA * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/ */
void DIALOG_TRACKS_OPTIONS::OnCheckboxAllowsMicroviaClick( wxCommandEvent& event ) void DIALOG_TRACKS_OPTIONS::OnButtonCancelClick( wxCommandEvent& event )
{ {
bool state = m_AllowMicroViaCtrl->IsChecked(); EndModal( 0 );
m_MicroViaSizeTitle->Enable( state );
m_MicroViaSizeCtrl->Enable( state );
m_MicroViaDrillTitle->Enable( state );
m_MicroViaDrillCtrl->Enable( state );
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dialog_track_options.h // Name: dialog_track_options.h
// Author: jean-pierre Charras // Author: jean-pierre Charras
// Created: 17 feb 2009 // Created: 17 feb 2009
...@@ -17,18 +18,23 @@ ...@@ -17,18 +18,23 @@
*/ */
class DIALOG_TRACKS_OPTIONS : public DIALOG_TRACKS_OPTIONS_BASE class DIALOG_TRACKS_OPTIONS : public DIALOG_TRACKS_OPTIONS_BASE
{ {
public: private:
WinEDA_PcbFrame* m_Parent; WinEDA_PcbFrame* m_Parent;
std::vector <int> m_ViasDiameterList;
std::vector <int> m_TracksWidthList;
public: public:
DIALOG_TRACKS_OPTIONS( WinEDA_PcbFrame* parent ); DIALOG_TRACKS_OPTIONS( WinEDA_PcbFrame* parent );
~DIALOG_TRACKS_OPTIONS() {}; ~DIALOG_TRACKS_OPTIONS() {};
private: private:
void SetDisplayValue(); void MyInit();
virtual void OnInitDialog( wxInitDialogEvent& event ); void InitDimensionsLists();
virtual void OnCheckboxAllowsMicroviaClick( wxCommandEvent& event );
virtual void OnButtonOkClick( wxCommandEvent& event ); virtual void OnButtonOkClick( wxCommandEvent& event );
virtual void OnButtonCancelClick( 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_ #endif // _DIALOG_TRACK_OPTIONS_H_
...@@ -10,10 +10,12 @@ ...@@ -10,10 +10,12 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_TRACKS_OPTIONS_BASE, wxDialog ) BEGIN_EVENT_TABLE( DIALOG_TRACKS_OPTIONS_BASE, wxDialog )
EVT_INIT_DIALOG( DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnInitDialog ) EVT_BUTTON( wxID_ADD_VIA_SIZE, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonAddViaSizeClick )
EVT_CHECKBOX( wxID_ANY, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnCheckboxAllowsMicroviaClick ) EVT_BUTTON( wxID_DELETED_WIA_SIEZ, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonDeleteViaSizeClick )
EVT_BUTTON( wxID_OK, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonOkClick ) EVT_BUTTON( wxID_ADD_TRACK_WIDTH, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonAddTrackSizeClick )
EVT_BUTTON( wxID_DELETED_TRACK_WIDTH, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonDeleteTrackSizeClick )
EVT_BUTTON( wxID_CANCEL, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonCancelClick ) EVT_BUTTON( wxID_CANCEL, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonCancelClick )
EVT_BUTTON( wxID_OK, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonOkClick )
END_EVENT_TABLE() END_EVENT_TABLE()
DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
...@@ -21,19 +23,32 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind ...@@ -21,19 +23,32 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer; wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL ); bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bMainUpperSizer;
bMainUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbLeftSizer; wxStaticBoxSizer* sbLeftSizer;
sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias:") ), wxVERTICAL ); sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias:") ), wxVERTICAL );
m_ViaSizeTitle = new wxStaticText( this, wxID_ANY, _("Via size"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticBoxSizer* sViaSizeBox;
m_ViaSizeTitle->Wrap( -1 ); sViaSizeBox = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias Custom Sizes List:") ), wxHORIZONTAL );
sbLeftSizer->Add( m_ViaSizeTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ViaSizeListCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
sViaSizeBox->Add( m_ViaSizeListCtrl, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizeViasListButtons;
bSizeViasListButtons = new wxBoxSizer( wxVERTICAL );
m_buttonAddViasSize = new wxButton( this, wxID_ADD_VIA_SIZE, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bSizeViasListButtons->Add( m_buttonAddViasSize, 1, wxALL, 5 );
m_OptViaSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_button4 = new wxButton( this, wxID_DELETED_WIA_SIEZ, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptViaSize->SetToolTip( _("Enter the current via diameter.") ); bSizeViasListButtons->Add( m_button4, 1, wxALL, 5 );
sbLeftSizer->Add( m_OptViaSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); sViaSizeBox->Add( bSizeViasListButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
sbLeftSizer->Add( sViaSizeBox, 1, wxEXPAND, 5 );
m_ViaDefaultDrillValueTitle = new wxStaticText( this, wxID_ANY, _("Default Via Drill"), wxDefaultPosition, wxDefaultSize, 0 ); m_ViaDefaultDrillValueTitle = new wxStaticText( this, wxID_ANY, _("Default Via Drill"), wxDefaultPosition, wxDefaultSize, 0 );
m_ViaDefaultDrillValueTitle->Wrap( -1 ); m_ViaDefaultDrillValueTitle->Wrap( -1 );
...@@ -53,69 +68,58 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind ...@@ -53,69 +68,58 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
sbLeftSizer->Add( m_OptCustomViaDrill, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); sbLeftSizer->Add( m_OptCustomViaDrill, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bMainUpperSizer->Add( sbLeftSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbMiddleLeftSizer;
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 );
m_OptViaType->SetToolTip( _("Select the current via type.\nTrough via is the usual selection") ); m_OptViaType->SetToolTip( _("Select the current via type.\nTrough via is the usual selection") );
sbLeftSizer->Add( m_OptViaType, 0, wxALL, 5 ); sbMiddleLeftSizer->Add( m_OptViaType, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( sbLeftSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbMiddleLeftSizer;
sbMiddleLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Micro Vias:") ), wxVERTICAL );
m_MicroViaSizeTitle = new wxStaticText( this, wxID_ANY, _("Micro Via Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_MicroViaSizeTitle->Wrap( -1 );
sbMiddleLeftSizer->Add( m_MicroViaSizeTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MicroViaSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbMiddleLeftSizer->Add( m_MicroViaSizeCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_MicroViaDrillTitle = new wxStaticText( this, wxID_ANY, _("Micro Via Drill"), wxDefaultPosition, wxDefaultSize, 0 );
m_MicroViaDrillTitle->Wrap( -1 );
sbMiddleLeftSizer->Add( m_MicroViaDrillTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MicroViaDrillCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbMiddleLeftSizer->Add( m_MicroViaDrillCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
sbMiddleLeftSizer->Add( 10, 10, 0, 0, 5 ); sbMiddleLeftSizer->Add( 10, 10, 0, 0, 5 );
m_AllowMicroViaCtrl = new wxCheckBox( this, wxID_ANY, _("Allows Micro Vias"), wxDefaultPosition, wxDefaultSize, 0 ); wxString m_AllowMicroViaCtrlChoices[] = { _("Do Not Allow Micro Vias"), _("Allow Micro Vias") };
int m_AllowMicroViaCtrlNChoices = sizeof( m_AllowMicroViaCtrlChoices ) / sizeof( wxString );
m_AllowMicroViaCtrl->SetToolTip( _("Allows use of micro vias\nThey are very small vias only from an external copper layer to its near neightbour\n") ); 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->SetToolTip( _("Allows or do not allow use of micro vias\nThey are very small vias only from an external copper layer to its near neightbour") );
sbMiddleLeftSizer->Add( m_AllowMicroViaCtrl, 0, wxALL, 5 ); sbMiddleLeftSizer->Add( m_AllowMicroViaCtrl, 0, wxALL, 5 );
bMainSizer->Add( sbMiddleLeftSizer, 1, wxEXPAND, 5 ); bMainUpperSizer->Add( sbMiddleLeftSizer, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbMiddleRightSizer; wxStaticBoxSizer* sbMiddleRightSizer;
sbMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions:") ), wxVERTICAL ); sbMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions:") ), wxVERTICAL );
m_TrackWidthTitle = new wxStaticText( this, wxID_ANY, _("Track Width"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticBoxSizer* sbTracksListSizer;
m_TrackWidthTitle->Wrap( -1 ); sbTracksListSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks Custom Widths List:") ), wxHORIZONTAL );
sbMiddleRightSizer->Add( m_TrackWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TrackWidthListCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
sbTracksListSizer->Add( m_TrackWidthListCtrl, 1, wxALL|wxEXPAND, 5 );
m_OptTrackWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); wxBoxSizer* bSizerTacksButtSizer;
m_OptTrackWidth->SetToolTip( _("Enter the current track width") ); bSizerTacksButtSizer = new wxBoxSizer( wxVERTICAL );
sbMiddleRightSizer->Add( m_OptTrackWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); m_buttonAddTrackSize = new wxButton( this, wxID_ADD_TRACK_WIDTH, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerTacksButtSizer->Add( m_buttonAddTrackSize, 0, wxALL|wxEXPAND, 5 );
m_TrackClearanceTitle = new wxStaticText( this, wxID_ANY, _("Clearance"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonDeleteTrackWidth = new wxButton( this, wxID_DELETED_TRACK_WIDTH, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
m_TrackClearanceTitle->Wrap( -1 ); bSizerTacksButtSizer->Add( m_buttonDeleteTrackWidth, 0, wxALL|wxEXPAND, 5 );
sbMiddleRightSizer->Add( m_TrackClearanceTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptTrackClearance = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); sbTracksListSizer->Add( bSizerTacksButtSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_OptTrackClearance->SetToolTip( _("This is the clearance between tracks, vias and pads for DRC.") );
sbMiddleRightSizer->Add( m_OptTrackClearance, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); sbMiddleRightSizer->Add( sbTracksListSizer, 1, wxEXPAND, 5 );
sbMiddleRightSizer->Add( 10, 10, 0, 0, 5 ); sbMiddleRightSizer->Add( 10, 10, 0, 0, 5 );
m_MaskClearanceTitle = new wxStaticText( this, wxID_ANY, _("Mask clearance"), wxDefaultPosition, wxDefaultSize, 0 ); m_MaskClearanceTitle = new wxStaticText( this, wxID_ANY, _("Pads Mask Clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MaskClearanceTitle->Wrap( -1 ); m_MaskClearanceTitle->Wrap( -1 );
sbMiddleRightSizer->Add( m_MaskClearanceTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); sbMiddleRightSizer->Add( m_MaskClearanceTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
...@@ -124,23 +128,20 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind ...@@ -124,23 +128,20 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
sbMiddleRightSizer->Add( m_OptMaskMargin, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); sbMiddleRightSizer->Add( m_OptMaskMargin, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bMainSizer->Add( sbMiddleRightSizer, 1, wxEXPAND, 5 ); bMainUpperSizer->Add( sbMiddleRightSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOK->SetDefault();
bRightSizer->Add( m_buttonOK, 0, wxALL, 5 );
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); bMainSizer->Add( bMainUpperSizer, 1, wxEXPAND, 5 );
bRightSizer->Add( m_buttonCANCEL, 0, wxALL, 5 );
bMainSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_sdbButtonsSizer = new wxStdDialogButtonSizer();
m_sdbButtonsSizerOK = new wxButton( this, wxID_OK );
m_sdbButtonsSizer->AddButton( m_sdbButtonsSizerOK );
m_sdbButtonsSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbButtonsSizer->AddButton( m_sdbButtonsSizerCancel );
m_sdbButtonsSizer->Realize();
bMainSizer->Add( m_sdbButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this );
} }
DIALOG_TRACKS_OPTIONS_BASE::~DIALOG_TRACKS_OPTIONS_BASE() DIALOG_TRACKS_OPTIONS_BASE::~DIALOG_TRACKS_OPTIONS_BASE()
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -11,17 +11,17 @@ ...@@ -11,17 +11,17 @@
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/listbox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/textctrl.h> #include <wx/button.h>
#include <wx/radiobox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/checkbox.h> #include <wx/stattext.h>
#include <wx/button.h> #include <wx/textctrl.h>
#include <wx/radiobox.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -35,45 +35,55 @@ class DIALOG_TRACKS_OPTIONS_BASE : public wxDialog ...@@ -35,45 +35,55 @@ class DIALOG_TRACKS_OPTIONS_BASE : public wxDialog
private: private:
// Private event handlers // Private event handlers
void _wxFB_OnInitDialog( wxInitDialogEvent& event ){ OnInitDialog( event ); } void _wxFB_OnButtonAddViaSizeClick( wxCommandEvent& event ){ OnButtonAddViaSizeClick( event ); }
void _wxFB_OnCheckboxAllowsMicroviaClick( wxCommandEvent& event ){ OnCheckboxAllowsMicroviaClick( event ); } void _wxFB_OnButtonDeleteViaSizeClick( wxCommandEvent& event ){ OnButtonDeleteViaSizeClick( event ); }
void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); } void _wxFB_OnButtonAddTrackSizeClick( wxCommandEvent& event ){ OnButtonAddTrackSizeClick( event ); }
void _wxFB_OnButtonDeleteTrackSizeClick( wxCommandEvent& event ){ OnButtonDeleteTrackSizeClick( event ); }
void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); } void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); }
void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); }
protected: protected:
wxStaticText* m_ViaSizeTitle; enum
wxTextCtrl* m_OptViaSize; {
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; wxStaticText* m_ViaDefaultDrillValueTitle;
wxTextCtrl* m_OptViaDrill; wxTextCtrl* m_OptViaDrill;
wxStaticText* m_ViaAltDrillValueTitle; wxStaticText* m_ViaAltDrillValueTitle;
wxTextCtrl* m_OptCustomViaDrill; wxTextCtrl* m_OptCustomViaDrill;
wxRadioBox* m_OptViaType; wxRadioBox* m_OptViaType;
wxStaticText* m_MicroViaSizeTitle;
wxTextCtrl* m_MicroViaSizeCtrl;
wxStaticText* m_MicroViaDrillTitle;
wxTextCtrl* m_MicroViaDrillCtrl;
wxCheckBox* m_AllowMicroViaCtrl; wxRadioBox* m_AllowMicroViaCtrl;
wxStaticText* m_TrackWidthTitle; wxListBox* m_TrackWidthListCtrl;
wxTextCtrl* m_OptTrackWidth; wxButton* m_buttonAddTrackSize;
wxStaticText* m_TrackClearanceTitle; wxButton* m_buttonDeleteTrackWidth;
wxTextCtrl* m_OptTrackClearance;
wxStaticText* m_MaskClearanceTitle; wxStaticText* m_MaskClearanceTitle;
wxTextCtrl* m_OptMaskMargin; wxTextCtrl* m_OptMaskMargin;
wxButton* m_buttonOK; wxStdDialogButtonSizer* m_sdbButtonsSizer;
wxButton* m_buttonCANCEL; wxButton* m_sdbButtonsSizerOK;
wxButton* m_sdbButtonsSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); } virtual void OnButtonAddViaSizeClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCheckboxAllowsMicroviaClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonDeleteViaSizeClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonOkClick( 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 OnButtonCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonOkClick( wxCommandEvent& event ){ event.Skip(); }
public: 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(); ~DIALOG_TRACKS_OPTIONS_BASE();
}; };
......
...@@ -33,17 +33,17 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -33,17 +33,17 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
{ {
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH: case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
g_DesignSettings.m_UseConnectedTrackWidth = not g_DesignSettings.m_UseConnectedTrackWidth; g_DesignSettings.m_UseConnectedTrackWidth = not g_DesignSettings.m_UseConnectedTrackWidth;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[m_SelTrackWidthBox->GetChoice()]; g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[m_SelTrackWidthBox->GetChoice()];
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[m_SelViaSizeBox->GetChoice()]; g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[m_SelViaSizeBox->GetChoice()];
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );
break; break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES: case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
g_DesignSettings.m_UseConnectedTrackWidth = false; g_DesignSettings.m_UseConnectedTrackWidth = false;
GetBoard()->m_TrackWidthSelector = 0; GetBoard()->m_TrackWidthSelector = 0;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[0]; g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[0];
GetBoard()->m_ViaSizeSelector = 0; GetBoard()->m_ViaSizeSelector = 0;
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[0]; g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[0];
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );
break; break;
...@@ -65,7 +65,7 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -65,7 +65,7 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
g_DesignSettings.m_UseConnectedTrackWidth = false; g_DesignSettings.m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1; ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii; GetBoard()->m_TrackWidthSelector = ii;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[ii]; g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[ii];
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );
break; break;
...@@ -80,20 +80,20 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -80,20 +80,20 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1; ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
GetBoard()->m_ViaSizeSelector = ii; GetBoard()->m_ViaSizeSelector = ii;
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[ii]; g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[ii];
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );
break; break;
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH: case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
ii = m_SelTrackWidthBox->GetChoice(); ii = m_SelTrackWidthBox->GetChoice();
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[ii]; g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[ii];
GetBoard()->m_TrackWidthSelector = ii; GetBoard()->m_TrackWidthSelector = ii;
break; break;
case ID_AUX_TOOLBAR_PCB_VIA_SIZE: case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
ii = m_SelViaSizeBox->GetChoice(); ii = m_SelViaSizeBox->GetChoice();
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[ii]; g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[ii];
GetBoard()->m_ViaSizeSelector = ii; GetBoard()->m_ViaSizeSelector = ii;
break; break;
......
...@@ -357,14 +357,13 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -357,14 +357,13 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "TrackWidth" ) == 0 ) if( stricmp( Line, "TrackWidth" ) == 0 )
{ {
g_DesignSettings.m_CurrentTrackWidth = atoi( data ); g_DesignSettings.m_CurrentTrackWidth = atoi( data );
AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK );
continue; continue;
} }
if( stricmp( Line, "TrackWidthHistory" ) == 0 ) if( stricmp( Line, "TrackWidthList" ) == 0 )
{ {
int tmp = atoi( data ); int tmp = atoi( data );
AddHistory( tmp, TYPE_TRACK ); GetBoard()->m_TrackWidthList.push_back( tmp );
continue; continue;
} }
...@@ -407,7 +406,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -407,7 +406,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "ViaSize" ) == 0 ) if( stricmp( Line, "ViaSize" ) == 0 )
{ {
g_DesignSettings.m_CurrentViaSize = atoi( data ); g_DesignSettings.m_CurrentViaSize = atoi( data );
AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA );
continue; continue;
} }
...@@ -429,10 +427,10 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -429,10 +427,10 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue; continue;
} }
if( stricmp( Line, "ViaSizeHistory" ) == 0 ) if( stricmp( Line, "ViaSizeList" ) == 0 )
{ {
int tmp = atoi( data ); int tmp = atoi( data );
AddHistory( tmp, TYPE_VIA ); GetBoard()->m_ViaSizeList.push_back( tmp );
continue; continue;
} }
...@@ -508,9 +506,37 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -508,9 +506,37 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
g_Pad_Master.m_Drill.y = g_Pad_Master.m_Drill.x; g_Pad_Master.m_Drill.y = g_Pad_Master.m_Drill.x;
continue; continue;
} }
if( stricmp( Line, "Pad2MaskClearance" ) == 0 )
{
g_DesignSettings.m_MaskMargin = atoi( data );
continue;
}
#endif #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; return 1;
} }
...@@ -543,8 +569,9 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard ) ...@@ -543,8 +569,9 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
} }
fprintf( aFile, "TrackWidth %d\n", g_DesignSettings.m_CurrentTrackWidth ); fprintf( aFile, "TrackWidth %d\n", g_DesignSettings.m_CurrentTrackWidth );
for( unsigned ii = 0; ii < aBoard->m_TrackWidthHistory.size(); ii++ ) // Save custom tracks width list (the first is not saved here: this is the netclass value
fprintf( aFile, "TrackWidthHistory %d\n", aBoard->m_TrackWidthHistory[ii] ); 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 ); fprintf( aFile, "TrackClearence %d\n", g_DesignSettings.m_TrackClearance );
...@@ -558,8 +585,9 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard ) ...@@ -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, "ViaAltDrill %d\n", g_DesignSettings.m_ViaDrillCustomValue );
fprintf( aFile, "ViaMinSize %d\n", g_DesignSettings.m_ViasMinSize ); fprintf( aFile, "ViaMinSize %d\n", g_DesignSettings.m_ViasMinSize );
for( unsigned ii = 0; ii < aBoard->m_ViaSizeHistory.size(); ii++ ) // Save custom vias diameters list (the first is not saved here: this is the netclass value
fprintf( aFile, "ViaSizeHistory %d\n", aBoard->m_ViaSizeHistory[ii] ); 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, "MicroViaSize %d\n", g_DesignSettings.m_CurrentMicroViaSize);
fprintf( aFile, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill); fprintf( aFile, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill);
...@@ -575,6 +603,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard ) ...@@ -575,6 +603,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
fprintf( aFile, "TextModWidth %d\n", ModuleTextWidth ); 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, "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, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
fprintf( aFile, "Pad2MaskClearance %d\n", g_DesignSettings.m_MaskMargin );
fprintf( aFile, "AuxiliaryAxisOrg %d %d\n", fprintf( aFile, "AuxiliaryAxisOrg %d %d\n",
aFrame->m_Auxiliary_Axis_Position.x, aFrame->m_Auxiliary_Axis_Position.y ); aFrame->m_Auxiliary_Axis_Position.x, aFrame->m_Auxiliary_Axis_Position.y );
...@@ -966,12 +995,16 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile ) ...@@ -966,12 +995,16 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
DateAndTime( line ) ); DateAndTime( line ) );
fprintf( aFile, "# Created by Pcbnew%s\n\n", CONV_TO_UTF8( GetBuildVersion() ) ); 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 ); WriteGeneralDescrPcb( aFile );
WriteSheetDescr( GetScreen(), aFile ); WriteSheetDescr( GetScreen(), aFile );
WriteSetup( aFile, this, GetBoard() ); WriteSetup( aFile, this, GetBoard() );
GetBoard()->SynchronizeNetsAndNetClasses();
rc = GetBoard()->Save( aFile ); rc = GetBoard()->Save( aFile );
SetLocaleTo_Default( ); // revert to the current locale SetLocaleTo_Default( ); // revert to the current locale
......
...@@ -861,10 +861,10 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard ) ...@@ -861,10 +861,10 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
_( "Use track and via sizes from their Netclass values" ), _( "Use track and via sizes from their Netclass values" ),
true ); 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, value = To_User_Unit( g_UnitMetric,
aBoard->m_TrackWidthHistory[ii], aBoard->m_TrackWidthList[ii],
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES ) // Affichage en mils if( g_UnitMetric == INCHES ) // Affichage en mils
msg.Printf( _( "Track %.1f" ), value * 1000 ); msg.Printf( _( "Track %.1f" ), value * 1000 );
...@@ -881,15 +881,15 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard ) ...@@ -881,15 +881,15 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true ); trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
else 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->Check( ID_POPUP_PCB_SELECT_WIDTH1 + aBoard->m_TrackWidthSelector, true );
} }
trackwidth_menu->AppendSeparator(); 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, value = To_User_Unit( g_UnitMetric,
aBoard->m_ViaSizeHistory[ii], aBoard->m_ViaSizeList[ii],
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES ) if( g_UnitMetric == INCHES )
msg.Printf( _( "Via %.1f" ), value * 1000 ); msg.Printf( _( "Via %.1f" ), value * 1000 );
...@@ -899,7 +899,7 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard ) ...@@ -899,7 +899,7 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
msg << _(" (from NetClass)" ); msg << _(" (from NetClass)" );
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, true ); 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 ); trackwidth_menu->Check( ID_POPUP_PCB_SELECT_VIASIZE1 + aBoard->m_ViaSizeSelector, true );
return trackwidth_menu; return trackwidth_menu;
......
...@@ -1251,9 +1251,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) ...@@ -1251,9 +1251,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
pcb->library->SetViaStartIndex( pcb->library->padstacks.size()-1 ); 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 ) if( viaSize == defaultViaSize )
continue; continue;
......
...@@ -87,30 +87,30 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI() ...@@ -87,30 +87,30 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI()
if( m_SelTrackWidthBox && m_TrackAndViasSizesList_Changed ) if( m_SelTrackWidthBox && m_TrackAndViasSizesList_Changed )
{ {
m_SelTrackWidthBox->Clear(); 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 ) if( ii == 0 )
msg << _( " *" ); msg << _( " *" );
m_SelTrackWidthBox->Append( 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; GetBoard()->m_TrackWidthSelector = 0;
m_SelTrackWidthBox->SetSelection( GetBoard()->m_TrackWidthSelector ); m_SelTrackWidthBox->SetSelection( GetBoard()->m_TrackWidthSelector );
if( m_SelViaSizeBox && m_TrackAndViasSizesList_Changed ) if( m_SelViaSizeBox && m_TrackAndViasSizesList_Changed )
{ {
m_SelViaSizeBox->Clear(); 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 ) if( ii == 0 )
msg << _( " *" ); msg << _( " *" );
m_SelViaSizeBox->Append( 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; GetBoard()->m_ViaSizeSelector = 0;
m_SelViaSizeBox->SetSelection( GetBoard()->m_ViaSizeSelector ); 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