Commit edb48d46 authored by charras's avatar charras
Browse files

Fixed minor bugs. Code cleaning

parent 483359b3
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -26,11 +26,6 @@ static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
/* class WinEDA_PinSheetPropertiesFrame */
/****************************************/

#define NBSHAPES 5
static wxString shape_list[NBSHAPES] =
{
    wxT( "Input" ), wxT( "Output" ), wxT( "Bidi" ), wxT( "TriState" ), wxT( "Passive" )
};


/*****************************************************/
@@ -91,7 +86,7 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(

    m_CurrentPinSheet = curr_pinsheet;

    /* Creation des boutons de commande */
    /* Create buttons: */
    Button = new wxButton( this, wxID_OK, _( "OK" ) );
    RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );

@@ -103,7 +98,12 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
                                            m_CurrentPinSheet->m_Size.x,
                                            g_UnitMetric, LeftBoxSizer, 200 );

    // Selection de la forme :
    // Display shape selection :
    #define NBSHAPES 5
    wxString shape_list[NBSHAPES] =
    {
       _( "Input" ), _( "Output" ), _( "Bidi" ), _( "TriState" ), _( "Passive" )
    };
    m_PinSheetShape = new wxRadioBox( this, -1, _( "PinSheet Shape:" ),
                                      wxDefaultPosition, wxSize( -1, -1 ),
                                      NBSHAPES, shape_list, 1 );
@@ -138,9 +138,6 @@ void WinEDA_PinSheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
/*****************************************************************/
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
/*****************************************************************/

/*  Routine de sortie du Menu d'Edition Des NETS (Labels) SHEET
 */
{
    Hierarchical_PIN_Sheet_Struct* SheetLabel = (Hierarchical_PIN_Sheet_Struct*)
                                       Panel->GetScreen()->GetCurItem();
+2 −2
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
    // Placement des PADS sur le board //
    /////////////////////////////////////

    for( unsigned i=0;  i<aPcb->m_Pads.size(); ++i )
    for( unsigned i=0;  i<aPcb->GetPadsCount(); ++i )
    {
        D_PAD* pad = aPcb->m_Pads[i];

+14 −14
Original line number Diff line number Diff line
@@ -522,7 +522,7 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
            viasCount++;
    }

    txt.Printf( wxT( "%d" ), m_Pads.size() );
    txt.Printf( wxT( "%d" ), GetPadsCount() );
    Affiche_1_Parametre( frame, POS_AFF_NBPADS, _( "Pads" ), txt, DARKGREEN );

    txt.Printf( wxT( "%d" ), viasCount );
@@ -531,7 +531,7 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
    txt.Printf( wxT( "%d" ), GetNodesCount() );
    Affiche_1_Parametre( frame, POS_AFF_NBNODES, _( "Nodes" ), txt, DARKCYAN );

    txt.Printf( wxT( "%d" ), m_NetInfo->GetCount() );
    txt.Printf( wxT( "%d" ), m_NetInfo->GetNetsCount() );
    Affiche_1_Parametre( frame, POS_AFF_NBNETS, _( "Nets" ), txt, RED );

    /* These parameters are known only if the full ratsnest is available,
@@ -822,8 +822,8 @@ NETINFO_ITEM* BOARD::FindNet( int anetcode ) const
    // zero is reserved for "no connection" and is not used.
    if( anetcode > 0 )
    {
        wxASSERT( anetcode == m_NetInfo->GetItem( anetcode )->GetNet() );
        return m_NetInfo->GetItem( anetcode );
        wxASSERT( anetcode == m_NetInfo->GetNetItem( anetcode )->GetNet() );
        return m_NetInfo->GetNetItem( anetcode );
    }
    return NULL;
}
@@ -841,10 +841,10 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
    // zero is reserved for "no connection" and is not used.
    if( !aNetname.IsEmpty() )
    {
        for( unsigned ii = 1;  ii <  m_NetInfo->GetCount();  ii++ )
        for( unsigned ii = 1;  ii <  m_NetInfo->GetNetsCount();  ii++ )
        {
            if( m_NetInfo->GetItem( ii )->GetNetname() == aNetname )
                return m_NetInfo->GetItem( ii );
            if( m_NetInfo->GetNetItem( ii )->GetNetname() == aNetname )
                return m_NetInfo->GetNetItem( ii );
        }
    }
    return NULL;
@@ -899,16 +899,16 @@ static bool s_SortByNodes( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
 */
int BOARD::ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
{
    if( m_NetInfo->GetCount() == 0 )
    if( m_NetInfo->GetNetsCount() == 0 )
        return 0;

    /* Build the list */
    std::vector <NETINFO_ITEM*> netBuffer;
    netBuffer.reserve( m_NetInfo->GetCount() );
    for( unsigned ii = 1; ii < m_NetInfo->GetCount(); ii++ )
    netBuffer.reserve( m_NetInfo->GetNetsCount() );
    for( unsigned ii = 1; ii < m_NetInfo->GetNetsCount(); ii++ )
    {
        if( m_NetInfo->GetItem( ii )->GetNet() > 0 )
            netBuffer.push_back( m_NetInfo->GetItem( ii ) );
        if( m_NetInfo->GetNetItem( ii )->GetNet() > 0 )
            netBuffer.push_back( m_NetInfo->GetNetItem( ii ) );
    }

    /* sort the list */
@@ -930,8 +930,8 @@ bool BOARD::Save( FILE* aFile ) const
    BOARD_ITEM* item;

    // save the nets
    for( unsigned ii = 0; ii < m_NetInfo->GetCount(); ii++ )
        if( !m_NetInfo->GetItem( ii )->Save( aFile ) )
    for( unsigned ii = 0; ii < m_NetInfo->GetNetsCount(); ii++ )
        if( !m_NetInfo->GetNetItem( ii )->Save( aFile ) )
            goto out;

    // save the modules
+12 −1
Original line number Diff line number Diff line
@@ -242,7 +242,18 @@ public:
        return m_FullRatsnest.size();
    }

    unsigned     GetNodesCount();        // retourne le nombre de pads a netcode > 0
    /** Function GetNodesCount
     * @return the number of pads members of nets (i.e. with netcode > 0)
    */
    unsigned     GetNodesCount();

    /** Function GetPadsCount
     * @return the number of pads in board
    */
    unsigned     GetPadsCount()
    {
        return m_Pads.size();
    }

    /** Function Build_Pads_Full_List
     *  Create the pad list
+5 −5
Original line number Diff line number Diff line
@@ -79,19 +79,19 @@ public:
     * @param aNetcode = netcode to identify a given NETINFO_ITEM
     * @return a NETINFO_ITEM pointer to the selected NETINFO_ITEM by its netcode, or NULL if not found
     */
    NETINFO_ITEM* GetItem( int aNetcode );
    NETINFO_ITEM* GetNetItem( int aNetcode );

    /** Function GetCount()
     * @return the number of nets ( always >= 1 )
     * the first net is the "not connected" net
     * becuse the first net is the "not connected" net and always exists
     */
    unsigned GetCount() { return m_NetBuffer.size(); }
    unsigned GetNetsCount() { return m_NetBuffer.size(); }

    /**
     * Function Append
     * adds \a aNewElement to the end of the list.
     */
    void Append( NETINFO_ITEM* aNewElement );
    void AppendNet( NETINFO_ITEM* aNewElement );

    /** Function DeleteData
     * delete the list of nets (and free memory)
@@ -99,7 +99,7 @@ public:
    void DeleteData();

    /** Function BuildListOfNets
     * initialize the list of NETINFO_ITEM m_NetBuffer
     * Build or rebuild the list of NETINFO_ITEM m_NetBuffer
     * The list is sorted by names.
     */
    void BuildListOfNets();
Loading