diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 171088c0d1..7a570a020b 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -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; diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 5a43f8a574..90a3cef73e 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -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, diff --git a/eeschema/locate.cpp b/eeschema/locate.cpp index 29ea232f70..294290f1d3 100644 --- a/eeschema/locate.cpp +++ b/eeschema/locate.cpp @@ -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 pîns. 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; } diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index c86f1d0056..84f36dc99b 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -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(); diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 05ee60aa71..bf51dc2f0b 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -56,10 +56,10 @@ 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 // we'll use lower case function names for private member functions. diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 7f17db9ca5..ccb568cd76 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.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; } diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index a1153ac982..4f442fd7ef 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -97,7 +97,7 @@ public: std::vector m_LocalRatsnest; /* Rastnest list relative to a given 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 wxString m_CurrentNetClassName; /* Current net class name used to display netclass info. @@ -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 m_ViaSizeHistory; // Last used via sizes (max count = HISTORY_MAX_COUNT) - std::vector 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 m_ViaSizeList; // vias sizes list(max count = HISTORY_MAX_COUNT) + // The first value is the current netclass via size + std::vector 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 diff --git a/pcbnew/dialog_track_options.cpp b/pcbnew/dialog_track_options.cpp index 1350d36ff2..e3920bbf7e 100644 --- a/pcbnew/dialog_track_options.cpp +++ b/pcbnew/dialog_track_options.cpp @@ -9,6 +9,7 @@ #include "fctsys.h" #include "common.h" +#include "confirm.h" #include "pcbnew.h" #include "wxPcbStruct.h" @@ -25,63 +26,173 @@ DIALOG_TRACKS_OPTIONS::DIALOG_TRACKS_OPTIONS( WinEDA_PcbFrame* parent ) : DIALOG_TRACKS_OPTIONS_BASE( parent ) { m_Parent = parent; + MyInit(); + GetSizer()->SetSizeHints( this ); } -void DIALOG_TRACKS_OPTIONS::OnInitDialog( wxInitDialogEvent& event ) +void DIALOG_TRACKS_OPTIONS::MyInit() { 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 ); 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_MicroViaDrillCtrl, g_DesignSettings.m_MicroViaDrill, Internal_Unit ); PutValueInLocalUnits( *m_OptCustomViaDrill, g_DesignSettings.m_ViaDrillCustomValue, 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 ); if( g_DesignSettings.m_CurrentViaType != VIA_THROUGH ) m_OptViaType->SetSelection( 1 ); - m_MicroViaSizeTitle->Enable( g_DesignSettings.m_MicroViasAllowed ); - m_MicroViaSizeCtrl->Enable( g_DesignSettings.m_MicroViasAllowed ); + m_AllowMicroViaCtrl->SetSelection( g_DesignSettings.m_MicroViasAllowed ? 1 : 0); - m_MicroViaDrillTitle->Enable( g_DesignSettings.m_MicroViasAllowed ); - m_MicroViaDrillCtrl->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_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::OnButtonAddViaSizeClick( wxCommandEvent& event ) +/*******************************************************************/ +{ + wxString msg = wxGetTextFromUser( wxEmptyString, + _( "Enter new via diameter value:" ), wxEmptyString, this ); + + if( msg.IsEmpty() ) + return; + + bool error = false; + int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); + + if( value <= 0 ) + error = true; + if( value > 10000 ) // a value > 1 inch is surely a stupid value + error = true; + + if( error ) + { + DisplayError( this, _( "Incorrect entered value. Aborted" ) ); + return; + } + + // values are sorted by increasing value in list, so we can use binary_search() + // (see C++ Standard Template Library » C++ Algorithms » binary_search) + 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 DIALOG_TRACKS_OPTIONS::OnButtonDeleteTrackSizeClick( wxCommandEvent& event ) +/*******************************************************************/ +{ + int isel = m_TrackWidthListCtrl->GetSelection(); + + if( isel < 0 ) + return; + m_TracksWidthList.erase( m_TracksWidthList.begin() + isel ); + InitDimensionsLists(); +} + + +/*******************************************************************/ +void DIALOG_TRACKS_OPTIONS::OnButtonAddTrackSizeClick( wxCommandEvent& event ) +/*******************************************************************/ +{ + wxString msg = wxGetTextFromUser( wxEmptyString, + _( "Enter new track size value:" ), wxEmptyString, this ); + + if( msg.IsEmpty() ) + return; + + bool error = false; + int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); + + 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; + } + + // values are sorted by increasing value in list, so we can use binary_search() + // (see C++ Standard Template Library » C++ Algorithms » binary_search) + if( binary_search( m_TracksWidthList.begin(), m_TracksWidthList.end(), value ) == false ) // value not already existing + { + if( m_TracksWidthList.size() >= HISTORY_MAX_COUNT - 1 ) + { + 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( m_TracksWidthList.begin(), m_TracksWidthList.end() ); + } + InitDimensionsLists(); +} + + +/***************************************************/ +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; + + 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 ); + } } @@ -93,66 +204,28 @@ void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event ) if( m_OptViaType->GetSelection() > 0 ) g_DesignSettings.m_CurrentViaType = VIA_BLIND_BURIED; - g_DesignSettings.m_CurrentViaSize = - ReturnValueFromTextCtrl( *m_OptViaSize, m_Parent->m_InternalUnits ); - g_DesignSettings.m_CurrentMicroViaSize = - ReturnValueFromTextCtrl( *m_MicroViaSizeCtrl, m_Parent->m_InternalUnits ); - - g_DesignSettings.m_MicroViaDrill = - ReturnValueFromTextCtrl( *m_MicroViaDrillCtrl, 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 = - ReturnValueFromTextCtrl( *m_OptTrackWidth, m_Parent->m_InternalUnits ); - g_DesignSettings.m_TrackClearance = - ReturnValueFromTextCtrl( *m_OptTrackClearance, m_Parent->m_InternalUnits ); + g_DesignSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1; g_DesignSettings.m_MaskMargin = ReturnValueFromTextCtrl( *m_OptMaskMargin, m_Parent->m_InternalUnits ); - m_Parent->AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA ); - m_Parent->AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK ); + // Reinitialize m_TrackWidthList and m_ViaSizeList + std::vector * 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 ); -} - -/*********************************************************************/ -void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type ) -/**********************************************************************/ - -// Mise a jour des listes des dernieres epaisseurs de via et track utilisées -{ - std::vector * vlist = NULL; - - switch( type ) - { - case TYPE_TRACK: - vlist = &GetBoard()->m_TrackWidthHistory; - break; - - case TYPE_VIA: - vlist = &GetBoard()->m_ViaSizeHistory; - break; - - default: - return; - } - - // values are sorted by increasing value in list, so we can use binary_search() - // (see C++ Standard Template Library » C++ Algorithms » binary_search) - if( binary_search( vlist->begin(), vlist->end(), value ) == false ) - { // value not already existing - vlist->push_back( value ); - if( vlist->size() >= HISTORY_MAX_COUNT ) - vlist->erase( vlist->begin() ); - - // Sort new list by by increasing value - sort( vlist->begin(), vlist->end() ); - } + m_Parent->m_TrackAndViasSizesList_Changed = true; + m_Parent->AuxiliaryToolBar_Update_UI(); } @@ -165,17 +238,3 @@ void DIALOG_TRACKS_OPTIONS::OnButtonCancelClick( wxCommandEvent& event ) EndModal( 0 ); } - -/*! - * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_ALLOWS_MICROVIA - */ - -void DIALOG_TRACKS_OPTIONS::OnCheckboxAllowsMicroviaClick( wxCommandEvent& event ) -{ - bool state = m_AllowMicroViaCtrl->IsChecked(); - - m_MicroViaSizeTitle->Enable( state ); - m_MicroViaSizeCtrl->Enable( state ); - m_MicroViaDrillTitle->Enable( state ); - m_MicroViaDrillCtrl->Enable( state ); -} diff --git a/pcbnew/dialog_track_options.h b/pcbnew/dialog_track_options.h index 13a1fca81f..dff845b122 100644 --- a/pcbnew/dialog_track_options.h +++ b/pcbnew/dialog_track_options.h @@ -1,4 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// + // 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: - WinEDA_PcbFrame* m_Parent; +private: + WinEDA_PcbFrame* m_Parent; + std::vector m_ViasDiameterList; + std::vector 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_ diff --git a/pcbnew/dialog_track_options_base.cpp b/pcbnew/dialog_track_options_base.cpp index 44ac60f5cd..006d7ab483 100644 --- a/pcbnew/dialog_track_options_base.cpp +++ b/pcbnew/dialog_track_options_base.cpp @@ -10,10 +10,12 @@ /////////////////////////////////////////////////////////////////////////// BEGIN_EVENT_TABLE( DIALOG_TRACKS_OPTIONS_BASE, wxDialog ) - EVT_INIT_DIALOG( DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnInitDialog ) - EVT_CHECKBOX( wxID_ANY, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnCheckboxAllowsMicroviaClick ) - EVT_BUTTON( wxID_OK, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonOkClick ) + EVT_BUTTON( wxID_ADD_VIA_SIZE, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonAddViaSizeClick ) + EVT_BUTTON( wxID_DELETED_WIA_SIEZ, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonDeleteViaSizeClick ) + 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_OK, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonOkClick ) 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 ) @@ -21,19 +23,32 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind this->SetSizeHints( wxDefaultSize, wxDefaultSize ); wxBoxSizer* bMainSizer; - bMainSizer = new wxBoxSizer( wxHORIZONTAL ); + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bMainUpperSizer; + bMainUpperSizer = new wxBoxSizer( wxHORIZONTAL ); wxStaticBoxSizer* sbLeftSizer; sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias:") ), wxVERTICAL ); - m_ViaSizeTitle = new wxStaticText( this, wxID_ANY, _("Via size"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ViaSizeTitle->Wrap( -1 ); - sbLeftSizer->Add( m_ViaSizeTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + wxStaticBoxSizer* sViaSizeBox; + sViaSizeBox = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias Custom Sizes List:") ), wxHORIZONTAL ); - m_OptViaSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_OptViaSize->SetToolTip( _("Enter the current via diameter.") ); + m_ViaSizeListCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + sViaSizeBox->Add( m_ViaSizeListCtrl, 1, wxALL|wxEXPAND, 5 ); - sbLeftSizer->Add( m_OptViaSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|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_button4 = new wxButton( this, wxID_DELETED_WIA_SIEZ, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizeViasListButtons->Add( m_button4, 1, wxALL, 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->Wrap( -1 ); @@ -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 ); + 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") }; 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->SetSelection( 0 ); m_OptViaType->SetToolTip( _("Select the current via type.\nTrough via is the usual selection") ); - sbLeftSizer->Add( m_OptViaType, 0, wxALL, 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( m_OptViaType, 0, wxALL|wxEXPAND, 5 ); sbMiddleLeftSizer->Add( 10, 10, 0, 0, 5 ); - m_AllowMicroViaCtrl = new wxCheckBox( this, wxID_ANY, _("Allows Micro Vias"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_AllowMicroViaCtrl->SetToolTip( _("Allows use of micro vias\nThey are very small vias only from an external copper layer to its near neightbour\n") ); + wxString m_AllowMicroViaCtrlChoices[] = { _("Do Not Allow Micro Vias"), _("Allow Micro Vias") }; + 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->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 ); - bMainSizer->Add( sbMiddleLeftSizer, 1, wxEXPAND, 5 ); + bMainUpperSizer->Add( sbMiddleLeftSizer, 0, wxEXPAND, 5 ); wxStaticBoxSizer* sbMiddleRightSizer; sbMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions:") ), wxVERTICAL ); - m_TrackWidthTitle = new wxStaticText( this, wxID_ANY, _("Track Width"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TrackWidthTitle->Wrap( -1 ); - sbMiddleRightSizer->Add( m_TrackWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + wxStaticBoxSizer* sbTracksListSizer; + sbTracksListSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks Custom Widths List:") ), wxHORIZONTAL ); - m_OptTrackWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_OptTrackWidth->SetToolTip( _("Enter the current track width") ); + m_TrackWidthListCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + sbTracksListSizer->Add( m_TrackWidthListCtrl, 1, wxALL|wxEXPAND, 5 ); - sbMiddleRightSizer->Add( m_OptTrackWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + wxBoxSizer* bSizerTacksButtSizer; + bSizerTacksButtSizer = new wxBoxSizer( wxVERTICAL ); - m_TrackClearanceTitle = new wxStaticText( this, wxID_ANY, _("Clearance"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TrackClearanceTitle->Wrap( -1 ); - sbMiddleRightSizer->Add( m_TrackClearanceTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + m_buttonAddTrackSize = new wxButton( this, wxID_ADD_TRACK_WIDTH, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerTacksButtSizer->Add( m_buttonAddTrackSize, 0, wxALL|wxEXPAND, 5 ); - m_OptTrackClearance = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_OptTrackClearance->SetToolTip( _("This is the clearance between tracks, vias and pads for DRC.") ); + m_buttonDeleteTrackWidth = new wxButton( this, wxID_DELETED_TRACK_WIDTH, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerTacksButtSizer->Add( m_buttonDeleteTrackWidth, 0, wxALL|wxEXPAND, 5 ); - sbMiddleRightSizer->Add( m_OptTrackClearance, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + sbTracksListSizer->Add( bSizerTacksButtSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + sbMiddleRightSizer->Add( sbTracksListSizer, 1, wxEXPAND, 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 ); sbMiddleRightSizer->Add( m_MaskClearanceTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); @@ -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 ); - bMainSizer->Add( sbMiddleRightSizer, 1, wxEXPAND, 5 ); + bMainUpperSizer->Add( sbMiddleRightSizer, 1, wxEXPAND, 5 ); - wxBoxSizer* bRightSizer; - bRightSizer = new wxBoxSizer( wxVERTICAL ); + bMainSizer->Add( bMainUpperSizer, 1, wxEXPAND, 5 ); - 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 ); - 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->Layout(); - bMainSizer->Fit( this ); } DIALOG_TRACKS_OPTIONS_BASE::~DIALOG_TRACKS_OPTIONS_BASE() diff --git a/pcbnew/dialog_track_options_base.fbp b/pcbnew/dialog_track_options_base.fbp index 1cbdcbe506..24ccaa992f 100644 --- a/pcbnew/dialog_track_options_base.fbp +++ b/pcbnew/dialog_track_options_base.fbp @@ -32,7 +32,7 @@ DIALOG_TRACKS_OPTIONS_BASE - + 627,351 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Tracks and Vias Sizes @@ -49,7 +49,7 @@ - OnInitDialog + @@ -73,1137 +73,893 @@ bMainSizer - wxHORIZONTAL + wxVERTICAL none 5 wxEXPAND 1 - - wxID_ANY - Vias: - - sbLeftSizer - wxVERTICAL - none - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Via size - - - m_ViaSizeTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_OptViaSize - protected - - - - - Enter the current via diameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Default Via Drill - - - m_ViaDefaultDrillValueTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_OptViaDrill - protected - - - - - Enter the default via drill diameter All vias drills not set to a specific drill value will have this drill value. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Specific Via Drill - - - m_ViaAltDrillValueTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_OptCustomViaDrill - protected - - - - - Use a specific drill value for all vias that must have a given drill value, and set the via hole to this specific drill value using the pop up menu. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - - "Through Via" "Blind or Buried Via" - - 1 - - - 0 - wxID_ANY - Default Via Type - 1 - - - m_OptViaType - protected - - 0 - - wxRA_SPECIFY_COLS - - Select the current via type. Trough via is the usual selection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - wxID_ANY - Micro Vias: - - sbMiddleLeftSizer - wxVERTICAL - none - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Micro Via Size - - - m_MicroViaSizeTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_MicroViaSizeCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Micro Via Drill - - - m_MicroViaDrillTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_MicroViaDrillCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 10 - protected - 10 - - - - 5 - wxALL - 0 - - - 0 - - 1 - - - 0 - wxID_ANY - Allows Micro Vias - - - m_AllowMicroViaCtrl - protected - - - - - Allows use of micro vias They are very small vias only from an external copper layer to its near neightbour - - - - - OnCheckboxAllowsMicroviaClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - wxID_ANY - Dimensions: - - sbMiddleRightSizer - wxVERTICAL - none - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Track Width - - - m_TrackWidthTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_OptTrackWidth - protected - - - - - Enter the current track width - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Clearance - - - m_TrackClearanceTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_OptTrackClearance - protected - - - - - This is the clearance between tracks, vias and pads for DRC. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 10 - protected - 10 - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Mask clearance - - - m_MaskClearanceTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_OptMaskMargin - protected - - - - - This is the clearance between pads and the mask - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - bRightSizer - wxVERTICAL + bMainUpperSizer + wxHORIZONTAL none 5 - wxALL - 0 - - - - 1 - 1 - - - 0 - wxID_OK - OK - + wxEXPAND + 1 + + wxID_ANY + Vias: - m_buttonOK - protected - - - - - - - - - OnButtonOkClick - - - - - - - - - - - - - - - - - - - - - - + sbLeftSizer + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + wxID_ANY + Vias Custom Sizes List: + + sViaSizeBox + wxHORIZONTAL + none + + + 5 + wxALL|wxEXPAND + 1 + + + + + 1 + + + 0 + wxID_ANY + + + m_ViaSizeListCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + + bSizeViasListButtons + wxVERTICAL + none + + 5 + wxALL + 1 + + + + 0 + 1 + + + 0 + wxID_ADD_VIA_SIZE + Add + + + m_buttonAddViasSize + protected + + + + + + + + + OnButtonAddViaSizeClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 1 + + + + 0 + 1 + + + 0 + wxID_DELETED_WIA_SIEZ + Delete + + + m_button4 + protected + + + + + + + + + OnButtonDeleteViaSizeClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Default Via Drill + + + m_ViaDefaultDrillValueTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_OptViaDrill + protected + + + + + Enter the default via drill diameter All vias drills not set to a specific drill value will have this drill value. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Specific Via Drill + + + m_ViaAltDrillValueTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_OptCustomViaDrill + protected + + + + + Use a specific drill value for all vias that must have a given drill value, and set the via hole to this specific drill value using the pop up menu. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL + wxEXPAND 0 - - - - 0 - 1 - - - 0 - wxID_CANCEL - Cancel - + + wxID_ANY + Vias Options: - m_buttonCANCEL - protected - - - - - - - - - OnButtonCancelClick - - - - - - - - - - - - - - - - - - - - - - + sbMiddleLeftSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + + "Through Via" "Blind or Buried Via" + + 1 + + + 0 + wxID_ANY + Default Via Type + 1 + + + m_OptViaType + protected + + 0 + + wxRA_SPECIFY_COLS + + Select the current via type. Trough via is the usual selection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + 10 + protected + 10 + + + + 5 + wxALL + 0 + + + "Do Not Allow Micro Vias" "Allow Micro Vias" + + 1 + + + 0 + wxID_ALLOW_MICROVIA + Micro Vias: + 1 + + + m_AllowMicroViaCtrl + protected + + 0 + + wxRA_SPECIFY_COLS + + Allows or do not allow use of micro vias They are very small vias only from an external copper layer to its near neightbour + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + wxID_ANY + Dimensions: + + sbMiddleRightSizer + wxVERTICAL + none + + + 5 + wxEXPAND + 1 + + wxID_ANY + Tracks Custom Widths List: + + sbTracksListSizer + wxHORIZONTAL + none + + + 5 + wxALL|wxEXPAND + 1 + + + + + 1 + + + 0 + wxID_ANY + + + m_TrackWidthListCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + + bSizerTacksButtSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_ADD_TRACK_WIDTH + Add + + + m_buttonAddTrackSize + protected + + + + + + + + + OnButtonAddTrackSizeClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_DELETED_TRACK_WIDTH + Delete + + + m_buttonDeleteTrackWidth + protected + + + + + + + + + OnButtonDeleteTrackSizeClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + 10 + protected + 10 + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Pads Mask Clearance: + + + m_MaskClearanceTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_OptMaskMargin + protected + + + + + This is the clearance between pads and the mask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbButtonsSizer + protected + + OnButtonCancelClick + + + + OnButtonOkClick + + diff --git a/pcbnew/dialog_track_options_base.h b/pcbnew/dialog_track_options_base.h index cab59e7cbd..94a17d80d8 100644 --- a/pcbnew/dialog_track_options_base.h +++ b/pcbnew/dialog_track_options_base.h @@ -11,17 +11,17 @@ #include #include -#include +#include #include #include #include #include -#include -#include +#include #include #include -#include -#include +#include +#include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -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(); }; diff --git a/pcbnew/event_handlers_tracks_vias_sizes.cpp b/pcbnew/event_handlers_tracks_vias_sizes.cpp index 6458204d8f..3dc1b79010 100644 --- a/pcbnew/event_handlers_tracks_vias_sizes.cpp +++ b/pcbnew/event_handlers_tracks_vias_sizes.cpp @@ -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; diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 7ae268f954..2be3a22c37 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -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 diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 46b3400bc6..d461c15396 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -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; diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index aed6d81266..4402a544a7 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -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; diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index d5de6e1d90..cdf9152d7e 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -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 );