Commit 6617ce58 authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

Use factored SelectLibrary() from base class. Spelling and comments.

parent fe97521b
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -180,7 +180,7 @@ ExternalProject_Add( boost
    # <src>/.downloads-by-cmake$ less /tmp/product/.downloads-by-cmake/boost_1_54_0/src/boost-stamp/boost-download-out.log
    # <src>/.downloads-by-cmake$ less /tmp/product/.downloads-by-cmake/boost_1_54_0/src/boost-stamp/boost-download-out.log
    # <src>/.downloads-by-cmake$ less /tmp/product/.downloads-by-cmake/boost_1_54_0/src/boost-stamp/boost-download-err.log
    # <src>/.downloads-by-cmake$ less /tmp/product/.downloads-by-cmake/boost_1_54_0/src/boost-stamp/boost-download-err.log
    # If out.log does not show 100%, then try increasing TIMEOUT even more, or download the URL manually and put it
    # If out.log does not show 100%, then try increasing TIMEOUT even more, or download the URL manually and put it
    # into <src>/.downloads-by-cmake
    # into <src>/.downloads-by-cmake/ dir.
 #  LOG_DOWNLOAD    ON
 #  LOG_DOWNLOAD    ON


    INSTALL_DIR     "${BOOST_ROOT}"
    INSTALL_DIR     "${BOOST_ROOT}"
+48 −73
Original line number Original line Diff line number Diff line
@@ -128,6 +128,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent,
    wxAcceleratorTable table( DIM( accels ), accels );
    wxAcceleratorTable table( DIM( accels ), accels );


    m_footprintLibTable = aTable;
    m_footprintLibTable = aTable;

    m_FrameName  = GetFootprintViewerFrameName();
    m_FrameName  = GetFootprintViewerFrameName();
    m_configPath = wxT( "FootprintViewer" );
    m_configPath = wxT( "FootprintViewer" );
    m_showAxis   = true;         // true to draw axis.
    m_showAxis   = true;         // true to draw axis.
@@ -138,8 +139,19 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent,
    SetIcon( icon );
    SetIcon( icon );


    m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr;
    m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr;
    m_footprintList = NULL;

    m_libList = NULL;
    wxSize minsize(100,-1);

    m_libList = new wxListBox( this, ID_MODVIEW_LIB_LIST,
            wxDefaultPosition, minsize, 0, NULL, wxLB_HSCROLL );

    m_libList->SetMinSize( minsize );

    m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST,
            wxDefaultPosition, minsize, 0, NULL, wxLB_HSCROLL );

    m_footprintList->SetMinSize( minsize );

    m_semaphore     = aSemaphore;
    m_semaphore     = aSemaphore;
    m_selectedFootprintName.Empty();
    m_selectedFootprintName.Empty();


@@ -147,6 +159,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent,
        SetModalMode( true );
        SetModalMode( true );


    SetBoard( new BOARD() );
    SetBoard( new BOARD() );

    // Ensure all layers and items are visible:
    // Ensure all layers and items are visible:
    GetBoard()->SetVisibleAlls();
    GetBoard()->SetVisibleAlls();
    SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
    SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
@@ -159,25 +172,14 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent,
    ReCreateHToolbar();
    ReCreateHToolbar();
    ReCreateVToolbar();
    ReCreateVToolbar();


    wxSize minsize(100,-1);
     // Creates the library and footprint list
    m_libList = new wxListBox( this, ID_MODVIEW_LIB_LIST,
                               wxDefaultPosition, minsize,
                               0, NULL, wxLB_HSCROLL );
    m_libList->SetMinSize( minsize );

    m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST,
                                     wxDefaultPosition, minsize,
                                     0, NULL, wxLB_HSCROLL );
    m_footprintList->SetMinSize( minsize );

    ReCreateLibraryList();
    ReCreateLibraryList();
    DisplayLibInfos();
    UpdateTitle();


    // If a footprint was previously loaded, reload it
    // If a footprint was previously loaded, reload it
    if( !m_libraryName.IsEmpty() && !m_footprintName.IsEmpty() )
    if( !m_libraryName.IsEmpty() && !m_footprintName.IsEmpty() )
    {
    {
        FPID id;
        FPID id;

        id.SetLibNickname( m_libraryName );
        id.SetLibNickname( m_libraryName );
        id.SetFootprintName( m_footprintName );
        id.SetFootprintName( m_footprintName );
        GetBoard()->Add( loadFootprint( id ) );
        GetBoard()->Add( loadFootprint( id ) );
@@ -194,8 +196,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent,
    // most likely due to the fact that the other windows are not dockable and are preventing the
    // most likely due to the fact that the other windows are not dockable and are preventing the
    // tool bar from docking on the right and left.
    // tool bar from docking on the right and left.
    wxAuiPaneInfo toolbarPaneInfo;
    wxAuiPaneInfo toolbarPaneInfo;
    toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top()
    toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top().CloseButton( false );
                          .CloseButton( false );


    EDA_PANEINFO info;
    EDA_PANEINFO info;
    info.InfoToolbarPane();
    info.InfoToolbarPane();
@@ -311,15 +312,12 @@ void FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset( wxCommandEvent& event )


void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
{
{
    if( m_libList == NULL )
        return;

    m_libList->Clear();
    m_libList->Clear();


    std::vector< wxString > libName = m_footprintLibTable->GetLogicalLibs();
    std::vector< wxString > nicknames = m_footprintLibTable->GetLogicalLibs();


    for( unsigned ii = 0; ii < libName.size(); ii++ )
    for( unsigned ii = 0; ii < nicknames.size(); ii++ )
        m_libList->Append( libName[ii] );
        m_libList->Append( nicknames[ii] );


    // Search for a previous selection:
    // Search for a previous selection:
    int index =  m_libList->FindString( m_libraryName );
    int index =  m_libList->FindString( m_libraryName );
@@ -330,24 +328,21 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
    }
    }
    else
    else
    {
    {
        // If not found, clear current library selection because it can be deleted after
        // If not found, clear current library selection because it can be
        // a configuration change.
        // deleted after a configuration change.
        m_libraryName = wxEmptyString;
        m_libraryName = wxEmptyString;
        m_footprintName = wxEmptyString;
        m_footprintName = wxEmptyString;
    }
    }


    ReCreateFootprintList();
    ReCreateFootprintList();
    ReCreateHToolbar();
    ReCreateHToolbar();
    DisplayLibInfos();

    m_canvas->Refresh();
    m_canvas->Refresh();
}
}




void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
{
{
    if( m_footprintList == NULL )
        return;

    m_footprintList->Clear();
    m_footprintList->Clear();


    if( m_libraryName.IsEmpty() )
    if( m_libraryName.IsEmpty() )
@@ -357,7 +352,6 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
    }
    }


    FOOTPRINT_LIST fp_info_list;
    FOOTPRINT_LIST fp_info_list;
    wxArrayString  libsList;


    fp_info_list.ReadFootprintFiles( m_footprintLibTable, &m_libraryName );
    fp_info_list.ReadFootprintFiles( m_footprintLibTable, &m_libraryName );


@@ -367,15 +361,11 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
        return;
        return;
    }
    }


    wxArrayString  fpList;

    BOOST_FOREACH( const FOOTPRINT_INFO& footprint, fp_info_list.GetList() )
    BOOST_FOREACH( const FOOTPRINT_INFO& footprint, fp_info_list.GetList() )
    {
    {
        fpList.Add( footprint.GetFootprintName() );
        m_footprintList->Append( footprint.GetFootprintName() );
    }
    }


    m_footprintList->Append( fpList );

    int index = m_footprintList->FindString( m_footprintName );
    int index = m_footprintList->FindString( m_footprintName );


    if( index == wxNOT_FOUND )
    if( index == wxNOT_FOUND )
@@ -398,9 +388,9 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event )
        return;
        return;


    m_libraryName = name;
    m_libraryName = name;

    ReCreateFootprintList();
    ReCreateFootprintList();
    m_canvas->Refresh();
    UpdateTitle();
    DisplayLibInfos();
    ReCreateHToolbar();
    ReCreateHToolbar();
}
}


@@ -421,8 +411,10 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
    {
    {
        m_footprintName = name;
        m_footprintName = name;
        SetCurItem( NULL );
        SetCurItem( NULL );

        // Delete the current footprint
        // Delete the current footprint
        GetBoard()->m_Modules.DeleteAll();
        GetBoard()->m_Modules.DeleteAll();

        FPID id;
        FPID id;
        id.SetLibNickname( m_libraryName );
        id.SetLibNickname( m_libraryName );
        id.SetFootprintName( m_footprintName );
        id.SetFootprintName( m_footprintName );
@@ -440,7 +432,7 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
            DisplayError( this, msg );
            DisplayError( this, msg );
        }
        }


        DisplayLibInfos();
        UpdateTitle();
        Zoom_Automatique( false );
        Zoom_Automatique( false );
        m_canvas->Refresh();
        m_canvas->Refresh();
        Update3D_Frame();
        Update3D_Frame();
@@ -480,10 +472,12 @@ void FOOTPRINT_VIEWER_FRAME::LoadSettings( )
{
{
    EDA_DRAW_FRAME::LoadSettings();
    EDA_DRAW_FRAME::LoadSettings();


/*
    wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
    wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );


    // wxConfig* cfg =
    // wxConfig* cfg =
    wxGetApp().GetSettings();
    wxGetApp().GetSettings();
*/
}
}




@@ -491,10 +485,12 @@ void FOOTPRINT_VIEWER_FRAME::SaveSettings()
{
{
    EDA_DRAW_FRAME::SaveSettings();
    EDA_DRAW_FRAME::SaveSettings();


/*
    wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
    wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );


    // wxConfig* cfg =
    // wxConfig* cfg =
    wxGetApp().GetSettings();
    wxGetApp().GetSettings();
*/
}
}




@@ -527,7 +523,7 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )


    // If we are here, the library list has changed, rebuild it
    // If we are here, the library list has changed, rebuild it
    ReCreateLibraryList();
    ReCreateLibraryList();
    DisplayLibInfos();
    UpdateTitle();
}
}




@@ -703,7 +699,7 @@ bool FOOTPRINT_VIEWER_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
}
}




void FOOTPRINT_VIEWER_FRAME::DisplayLibInfos()
void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
{
{
    wxString     msg;
    wxString     msg;


@@ -723,35 +719,13 @@ void FOOTPRINT_VIEWER_FRAME::DisplayLibInfos()


void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event )
void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event )
{
{
    wxString msg;
    wxString selection = SelectLibrary( m_libraryName );

    if( g_LibraryNames.GetCount() == 0 )
        return;


    wxArrayString headers;
    if( !!selection && selection != m_libraryName )
    headers.Add( wxT( "Library" ) );
    std::vector<wxArrayString> itemsToDisplay;

    // Conversion from wxArrayString to vector of ArrayString
    for( unsigned i = 0; i < g_LibraryNames.GetCount(); i++ )
    {
    {
        wxArrayString item;
        m_libraryName = selection;
        item.Add( g_LibraryNames[i] );
        itemsToDisplay.push_back( item );
    }

    EDA_LIST_DIALOG dlg( this, _( "Select Current Library:" ),
                         headers, itemsToDisplay, m_libraryName );


    if( dlg.ShowModal() != wxID_OK )
        UpdateTitle();
        return;

    if( m_libraryName == dlg.GetTextSelection() )
        return;

    m_libraryName = dlg.GetTextSelection();
    m_footprintName.Empty();
    DisplayLibInfos();
        ReCreateFootprintList();
        ReCreateFootprintList();


        int id = m_libList->FindString( m_libraryName );
        int id = m_libList->FindString( m_libraryName );
@@ -759,6 +733,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event )
        if( id >= 0 )
        if( id >= 0 )
            m_libList->SetSelection( id );
            m_libList->SetSelection( id );
    }
    }
}




void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
@@ -834,7 +809,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
        Update3D_Frame();
        Update3D_Frame();
    }
    }


    DisplayLibInfos();
    UpdateTitle();
    Zoom_Automatique( false );
    Zoom_Automatique( false );
    m_canvas->Refresh();
    m_canvas->Refresh();
}
}
+6 −1
Original line number Original line Diff line number Diff line
@@ -103,7 +103,12 @@ private:


    void ReCreateFootprintList();
    void ReCreateFootprintList();
    void OnIterateFootprintList( wxCommandEvent& event );
    void OnIterateFootprintList( wxCommandEvent& event );
    void DisplayLibInfos();

    /**
     * Function UpdateTitle
     * updates the window title with current library information.
     */
    void UpdateTitle();


    /**
    /**
     * Function RedrawActiveWindow
     * Function RedrawActiveWindow
+1 −1

File changed.

Contains only whitespace changes.