Commit a12b80f6 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Eeschema: fix bug in algorithm which select net names, in netlist...

Eeschema: fix bug in algorithm which select net names, in netlist calculations. Named nets should now keep their names. Cvpcb:minor enhancements. Gerbview: fix an issue under W7.
parents 67894dd3 9cc346ea
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -14,6 +14,7 @@
#include "protos.h"
#include "protos.h"
#include "cvstruct.h"
#include "cvstruct.h"
#include "class_DisplayFootprintsFrame.h"
#include "class_DisplayFootprintsFrame.h"
#include "cvpcb_id.h"


/*
/*
 * NOTE: There is something in 3d_viewer.h that causes a compiler error in
 * NOTE: There is something in 3d_viewer.h that causes a compiler error in
+18 −31
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ FOOTPRINTS_LISTBOX::FOOTPRINTS_LISTBOX( WinEDA_CvpcbFrame* parent,
{
{
    m_UseFootprintFullList = true;
    m_UseFootprintFullList = true;
    m_ActiveFootprintList  = NULL;
    m_ActiveFootprintList  = NULL;
    SetActiveFootprintList( TRUE );
    SetActiveFootprintList( true );
}
}




@@ -61,8 +61,8 @@ wxString FOOTPRINTS_LISTBOX::GetSelectedFootprint()
    if( ii >= 0 )
    if( ii >= 0 )
    {
    {
        wxString msg = (*m_ActiveFootprintList)[ii];
        wxString msg = (*m_ActiveFootprintList)[ii];
        msg.Trim( TRUE );
        msg.Trim( true );
        msg.Trim( FALSE );
        msg.Trim( false );
        FootprintName = msg.AfterFirst( wxChar( ' ' ) );
        FootprintName = msg.AfterFirst( wxChar( ' ' ) );
    }
    }


@@ -121,11 +121,11 @@ void FOOTPRINTS_LISTBOX::SetFootprintFullList( FOOTPRINT_LIST& list )
        m_FullFootprintList.Add( msg );
        m_FullFootprintList.Add( msg );
    }
    }


    SetActiveFootprintList( TRUE );
    SetActiveFootprintList( true );


    if( ( GetCount() == 0 )
    if( ( GetCount() == 0 )
       || ( OldSelection < 0 ) || ( OldSelection >= GetCount() ) )
       || ( OldSelection < 0 ) || ( OldSelection >= GetCount() ) )
        SetSelection( 0, TRUE );
        SetSelection( 0, true );
    Refresh();
    Refresh();
}
}


@@ -137,7 +137,7 @@ void FOOTPRINTS_LISTBOX::SetFootprintFilteredList( COMPONENT* Component,
    wxString msg;
    wxString msg;
    unsigned jj;
    unsigned jj;
    int      OldSelection = GetSelection();
    int      OldSelection = GetSelection();
    bool     HasItem = FALSE;
    bool     HasItem = false;


    m_FilteredFootprintList.Clear();
    m_FilteredFootprintList.Clear();


@@ -150,17 +150,17 @@ void FOOTPRINTS_LISTBOX::SetFootprintFilteredList( COMPONENT* Component,
            msg.Printf( wxT( "%3d %s" ), m_FilteredFootprintList.GetCount() + 1,
            msg.Printf( wxT( "%3d %s" ), m_FilteredFootprintList.GetCount() + 1,
                       footprint.m_Module.GetData() );
                       footprint.m_Module.GetData() );
            m_FilteredFootprintList.Add( msg );
            m_FilteredFootprintList.Add( msg );
            HasItem = TRUE;
            HasItem = true;
        }
        }
    }
    }


    if( HasItem )
    if( HasItem )
        SetActiveFootprintList( FALSE );
        SetActiveFootprintList( false );
    else
    else
        SetActiveFootprintList( TRUE );
        SetActiveFootprintList( true );


    if( ( GetCount() == 0 ) || ( OldSelection >= GetCount() ) )
    if( ( GetCount() == 0 ) || ( OldSelection >= GetCount() ) )
        SetSelection( 0, TRUE );
        SetSelection( 0, true );


    Refresh();
    Refresh();
}
}
@@ -189,49 +189,35 @@ void FOOTPRINTS_LISTBOX::SetActiveFootprintList( bool FullList, bool Redraw )
    {
    {
        bool new_selection;
        bool new_selection;
        if( FullList )
        if( FullList )
            new_selection = TRUE;
            new_selection = true;
        else
        else
            new_selection = FALSE;
            new_selection = false;
        if( new_selection != old_selection )
        if( new_selection != old_selection )
            SetSelection( 0, TRUE );
            SetSelection( 0, true );
    }
    }
#endif
#endif
    if( FullList )
    if( FullList )
    {
    {
        m_UseFootprintFullList = TRUE;
        m_UseFootprintFullList = true;
        m_ActiveFootprintList  = &m_FullFootprintList;
        m_ActiveFootprintList  = &m_FullFootprintList;
        SetItemCount( m_FullFootprintList.GetCount() );
        SetItemCount( m_FullFootprintList.GetCount() );
    }
    }
    else
    else
    {
    {
        m_UseFootprintFullList = FALSE;
        m_UseFootprintFullList = false;
        m_ActiveFootprintList  = &m_FilteredFootprintList;
        m_ActiveFootprintList  = &m_FilteredFootprintList;
        SetItemCount( m_FilteredFootprintList.GetCount() );
        SetItemCount( m_FilteredFootprintList.GetCount() );
    }
    }


    if( Redraw )
    if( Redraw )
    {
    {
        if( !m_UseFootprintFullList
        if( !m_UseFootprintFullList || ( m_UseFootprintFullList != old_selection ) )
           || ( m_UseFootprintFullList != old_selection ) )
        {
        {
            Refresh();
            Refresh();
        }
        }
    }
    }


    if( !m_UseFootprintFullList || ( m_UseFootprintFullList != old_selection ) )
    GetParent()->DisplayStatus();
    {
        GetParent()->SetStatusText( wxEmptyString, 0 );
        GetParent()->SetStatusText( wxEmptyString, 1 );
    }

    wxString msg;
    if( FullList )
        msg.Printf( _( "Footprints (All): %d" ),
                   m_ActiveFootprintList->GetCount() );
    else
        msg.Printf( _( "Footprints (filtered): %d" ),
                   m_ActiveFootprintList->GetCount() );
    GetParent()->SetStatusText( msg, 2 );
}
}




@@ -253,6 +239,7 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
    wxString   FootprintName = GetSelectedFootprint();
    wxString   FootprintName = GetSelectedFootprint();


    Module = GetModuleDescrByName( FootprintName, GetParent()->m_footprints );
    Module = GetModuleDescrByName( FootprintName, GetParent()->m_footprints );
    wxASSERT(Module);
    if( GetParent()->DrawFrame )
    if( GetParent()->DrawFrame )
    {
    {
        GetParent()->CreateScreenCmp(); /* refresh general */
        GetParent()->CreateScreenCmp(); /* refresh general */
+30 −4
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@
#include "cvstruct.h"
#include "cvstruct.h"
#include "dialog_cvpcb_config.h"
#include "dialog_cvpcb_config.h"
#include "class_DisplayFootprintsFrame.h"
#include "class_DisplayFootprintsFrame.h"
#include "cvpcb_id.h"


#include "build_version.h"
#include "build_version.h"


@@ -115,7 +116,6 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
    m_KeepCvpcbOpen         = false;
    m_KeepCvpcbOpen         = false;
    m_undefinedComponentCnt = 0;
    m_undefinedComponentCnt = 0;



    /* Name of the document footprint list
    /* Name of the document footprint list
     * usually located in share/modules/footprints_doc
     * usually located in share/modules/footprints_doc
     * this is of the responsibility to users to create this file
     * this is of the responsibility to users to create this file
@@ -422,9 +422,7 @@ void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event )
        m_undefinedComponentCnt = m_components.size();
        m_undefinedComponentCnt = m_components.size();
    }
    }


    Line.Printf( _( "Components: %d (free: %d)" ), m_components.size(),
    DisplayStatus();
                 m_components.size() );
    SetStatusText( Line, 1 );
}
}




@@ -557,6 +555,7 @@ void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event )


    m_FootprintList->SetFootprintFilteredList( &m_components[ selection ],
    m_FootprintList->SetFootprintFilteredList( &m_components[ selection ],
                                               m_footprints );
                                               m_footprints );
    DisplayStatus();
}
}




@@ -585,3 +584,30 @@ void WinEDA_CvpcbFrame::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event )
{
{
    event.Check( m_KeepCvpcbOpen );
    event.Check( m_KeepCvpcbOpen );
}
}


/** DisplayStatus()
 * Displays info to the status line at bottom of the main frame
 */
void WinEDA_CvpcbFrame::DisplayStatus()
{
    wxString msg;
    msg.Printf( _( "Components: %d (free: %d)" ),
                 m_components.size(), m_undefinedComponentCnt );
    SetStatusText( msg, 0 );

    SetStatusText( wxEmptyString, 1 );

    if( m_FootprintList )
    {
        if( m_FootprintList->m_UseFootprintFullList )
            msg.Printf( _( "Footprints (All): %d" ),
                       m_FootprintList->m_ActiveFootprintList->GetCount() );
        else
            msg.Printf( _( "Footprints (filtered): %d" ),
                       m_FootprintList->m_ActiveFootprintList->GetCount() );
    }
    else
        msg.Empty();
    SetStatusText( msg, 2 );
}

cvpcb/cvpcb_id.h

0 → 100644
+34 −0
Original line number Original line Diff line number Diff line
/**
 * @file cvpcb_id.h
 */
/*
 * Command IDs for CvPcb.
 *
 * Please add IDs that are unique to the component library viewer here and
 * not in the global id.h file.  This will prevent the entire project from
 * being rebuilt when adding new commands to the component library viewer.
 */

// Generic IDs:
#include "id.h"

// specific IDs
enum id_cvpcb_frm
{
    ID_CVPCB_QUIT = ID_END_LIST,
    ID_CVPCB_READ_INPUT_NETLIST,
    ID_CVPCB_SAVEQUITCVPCB,
    ID_CVPCB_CREATE_CONFIGWINDOW,
    ID_CVPCB_CREATE_SCREENCMP,
    ID_CVPCB_GOTO_FIRSTNA,
    ID_CVPCB_GOTO_PREVIOUSNA,
    ID_CVPCB_DEL_ASSOCIATIONS,
    ID_CVPCB_AUTO_ASSOCIE,
    ID_CVPCB_COMPONENT_LIST,
    ID_CVPCB_FOOTPRINT_LIST,
    ID_CVPCB_CREATE_STUFF_FILE,
    ID_CVPCB_SHOW3D_FRAME,
    ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
    ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
    ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE
};
+4 −30
Original line number Original line Diff line number Diff line
@@ -16,36 +16,6 @@ class COMPONENTS_LISTBOX;
class DISPLAY_FOOTPRINTS_FRAME;
class DISPLAY_FOOTPRINTS_FRAME;




#include "id.h"


/**
 * Command IDs for the component library viewer.
 *
 * Please add IDs that are unique to the component library viewer here and
 * not in the global id.h file.  This will prevent the entire project from
 * being rebuilt when adding new commands to the component library viewer.
 */
enum id_cvpcb_frm
{
    ID_CVPCB_QUIT = ID_END_LIST,
    ID_CVPCB_READ_INPUT_NETLIST,
    ID_CVPCB_SAVEQUITCVPCB,
    ID_CVPCB_CREATE_CONFIGWINDOW,
    ID_CVPCB_CREATE_SCREENCMP,
    ID_CVPCB_GOTO_FIRSTNA,
    ID_CVPCB_GOTO_PREVIOUSNA,
    ID_CVPCB_DEL_ASSOCIATIONS,
    ID_CVPCB_AUTO_ASSOCIE,
    ID_CVPCB_COMPONENT_LIST,
    ID_CVPCB_FOOTPRINT_LIST,
    ID_CVPCB_CREATE_STUFF_FILE,
    ID_CVPCB_SHOW3D_FRAME,
    ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
    ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
    ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE
};



/**
/**
 * The CVPcb application main window.
 * The CVPcb application main window.
@@ -120,6 +90,10 @@ public:
    void             SaveProjectFile( const wxString& fileName );
    void             SaveProjectFile( const wxString& fileName );
    virtual void     LoadSettings();
    virtual void     LoadSettings();
    virtual void     SaveSettings();
    virtual void     SaveSettings();
    /** DisplayStatus()
     * Displays info to the status line at bottom of the main frame
     */
    void             DisplayStatus();


    PARAM_CFG_ARRAY& GetProjectFileParameters( void );
    PARAM_CFG_ARRAY& GetProjectFileParameters( void );


Loading