Commit 59782e2f authored by charras's avatar charras
Browse files

Enhancements in Pcbnew libraries config dialog

parent ecab9f8b
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -294,10 +294,10 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
    m_ListLibr->GetSelections(selections);
    m_ListLibr->GetSelections(selections);


    ii = selections.GetCount();
    ii = selections.GetCount();
    if( ii <= 0 && event.GetId() != ID_ADD_LIB )
    if( ii > 0 )
        ii = 0;
    else
        ii = selections[0];
        ii = selections[0];
    else
        ii = 0;


    wxString libpath;
    wxString libpath;
    libpath = m_DefaultLibraryPathslistBox->GetStringSelection();
    libpath = m_DefaultLibraryPathslistBox->GetStringSelection();
+5 −5
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
	m_ListLibr->SetToolTip( _("List of active library files.\nOnly library files in this list are loaded by Eeschema.\nThe order of this list is important:\nEeschema searchs for a given component using this list order priority.") );
	m_ListLibr->SetToolTip( _("List of active library files.\nOnly library files in this list are loaded by Eeschema.\nThe order of this list is important:\nEeschema searchs for a given component using this list order priority.") );
	m_ListLibr->SetMinSize( wxSize( 400,250 ) );
	m_ListLibr->SetMinSize( wxSize( 400,250 ) );
	
	
	sbLibsChoiceSizer->Add( m_ListLibr, 1, wxALL|wxEXPAND, 5 );
	sbLibsChoiceSizer->Add( m_ListLibr, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	
	
	wxBoxSizer* bRightSizer;
	wxBoxSizer* bRightSizer;
	bRightSizer = new wxBoxSizer( wxVERTICAL );
	bRightSizer = new wxBoxSizer( wxVERTICAL );
@@ -60,7 +60,7 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
	m_listUserPaths->SetToolTip( _("Additional paths used in this project. The priority is highter than default Kicad paths.") );
	m_listUserPaths->SetToolTip( _("Additional paths used in this project. The priority is highter than default Kicad paths.") );
	m_listUserPaths->SetMinSize( wxSize( 400,90 ) );
	m_listUserPaths->SetMinSize( wxSize( 400,90 ) );
	
	
	sbSizer4->Add( m_listUserPaths, 1, wxALL|wxEXPAND, 5 );
	sbSizer4->Add( m_listUserPaths, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	
	
	wxBoxSizer* bUserPathsButtonsSizer;
	wxBoxSizer* bUserPathsButtonsSizer;
	bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL );
	bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL );
@@ -76,7 +76,7 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
	
	
	sbSizer4->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	sbSizer4->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	
	
	bMainSizer->Add( sbSizer4, 0, wxALL|wxEXPAND, 5 );
	bMainSizer->Add( sbSizer4, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	
	
	wxStaticBoxSizer* sbLibPathSizer;
	wxStaticBoxSizer* sbLibPathSizer;
	sbLibPathSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current search path list") ), wxVERTICAL );
	sbLibPathSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current search path list") ), wxVERTICAL );
@@ -87,10 +87,10 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
	
	
	sbLibPathSizer->Add( m_DefaultLibraryPathslistBox, 0, wxALL|wxEXPAND, 5 );
	sbLibPathSizer->Add( m_DefaultLibraryPathslistBox, 0, wxALL|wxEXPAND, 5 );
	
	
	bMainSizer->Add( sbLibPathSizer, 0, wxALL|wxEXPAND, 5 );
	bMainSizer->Add( sbLibPathSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	
	
	m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	bMainSizer->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
	bMainSizer->Add( m_staticline3, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
	
	
	m_sdbSizer1 = new wxStdDialogButtonSizer();
	m_sdbSizer1 = new wxStdDialogButtonSizer();
	m_sdbSizer1OK = new wxButton( this, wxID_OK );
	m_sdbSizer1OK = new wxButton( this, wxID_OK );
+5 −5
Original line number Original line Diff line number Diff line
@@ -89,7 +89,7 @@
                        <event name="OnUpdateUI"></event>
                        <event name="OnUpdateUI"></event>
                        <object class="sizeritem" expanded="1">
                        <object class="sizeritem" expanded="1">
                            <property name="border">5</property>
                            <property name="border">5</property>
                            <property name="flag">wxALL|wxEXPAND</property>
                            <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
                            <property name="proportion">1</property>
                            <property name="proportion">1</property>
                            <object class="wxListBox" expanded="1">
                            <object class="wxListBox" expanded="1">
                                <property name="bg"></property>
                                <property name="bg"></property>
@@ -414,7 +414,7 @@
                </object>
                </object>
                <object class="sizeritem" expanded="1">
                <object class="sizeritem" expanded="1">
                    <property name="border">5</property>
                    <property name="border">5</property>
                    <property name="flag">wxALL|wxEXPAND</property>
                    <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
                    <property name="proportion">0</property>
                    <property name="proportion">0</property>
                    <object class="wxStaticBoxSizer" expanded="1">
                    <object class="wxStaticBoxSizer" expanded="1">
                        <property name="id">wxID_ANY</property>
                        <property name="id">wxID_ANY</property>
@@ -426,7 +426,7 @@
                        <event name="OnUpdateUI"></event>
                        <event name="OnUpdateUI"></event>
                        <object class="sizeritem" expanded="1">
                        <object class="sizeritem" expanded="1">
                            <property name="border">5</property>
                            <property name="border">5</property>
                            <property name="flag">wxALL|wxEXPAND</property>
                            <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
                            <property name="proportion">1</property>
                            <property name="proportion">1</property>
                            <object class="wxListBox" expanded="1">
                            <object class="wxListBox" expanded="1">
                                <property name="bg"></property>
                                <property name="bg"></property>
@@ -647,7 +647,7 @@
                </object>
                </object>
                <object class="sizeritem" expanded="1">
                <object class="sizeritem" expanded="1">
                    <property name="border">5</property>
                    <property name="border">5</property>
                    <property name="flag">wxALL|wxEXPAND</property>
                    <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
                    <property name="proportion">0</property>
                    <property name="proportion">0</property>
                    <object class="wxStaticBoxSizer" expanded="1">
                    <object class="wxStaticBoxSizer" expanded="1">
                        <property name="id">wxID_ANY</property>
                        <property name="id">wxID_ANY</property>
@@ -713,7 +713,7 @@
                </object>
                </object>
                <object class="sizeritem" expanded="1">
                <object class="sizeritem" expanded="1">
                    <property name="border">5</property>
                    <property name="border">5</property>
                    <property name="flag">wxEXPAND | wxALL</property>
                    <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
                    <property name="proportion">0</property>
                    <property name="proportion">0</property>
                    <object class="wxStaticLine" expanded="1">
                    <object class="wxStaticLine" expanded="1">
                        <property name="bg"></property>
                        <property name="bg"></property>
+80 −10
Original line number Original line Diff line number Diff line
@@ -141,6 +141,71 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnCloseWindow( wxCloseEvent& event )
}
}




/********************************************************************/
void DIALOG_PCBNEW_CONFIG_LIBS::OnButtonUpClick( wxCommandEvent& event )
/********************************************************************/
{
    wxArrayInt selections;

    m_ListLibr->GetSelections(selections);
    if ( selections.GetCount() <= 0 )   // No selection.
        return;

    if( selections[0] == 0 )            // The first lib is selected. cannot move up it
        return;

    wxArrayString libnames = m_ListLibr->GetStrings();

    for( size_t ii = 0; ii < selections.GetCount(); ii++ )
    {
        int jj = selections[ii];
        EXCHG( libnames[jj],  libnames[jj-1]);
    }
    m_ListLibr->Set(libnames);

    // Reselect previously selected names
    for( size_t ii = 0; ii < selections.GetCount(); ii++ )
    {
        int jj = selections[ii];
        m_ListLibr->SetSelection(jj-1);
    }

    m_LibListChanged = TRUE;
}


/*********************************************************************/
void DIALOG_PCBNEW_CONFIG_LIBS::OnButtonDownClick( wxCommandEvent& event )
/*********************************************************************/
{
    wxArrayInt selections;

    m_ListLibr->GetSelections(selections);
    if ( selections.GetCount() <= 0 )   // No selection.
        return;

    // The last lib is selected. cannot move down it
    if( selections.Last() == (int)(m_ListLibr->GetCount()-1) )
        return;

    wxArrayString libnames = m_ListLibr->GetStrings();

    for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
    {
        int jj = selections[ii];
        EXCHG( libnames[jj],  libnames[jj+1]);
    }
    m_ListLibr->Set(libnames);

    // Reselect previously selected names
    for( size_t ii = 0; ii < selections.GetCount(); ii++ )
    {
        int jj = selections[ii];
        m_ListLibr->SetSelection(jj+1);
    }
    m_LibListChanged = TRUE;
}



/*********************************************************************/
/*********************************************************************/
void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveLibClick( wxCommandEvent& event )
void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveLibClick( wxCommandEvent& event )
@@ -149,15 +214,15 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveLibClick( wxCommandEvent& event )
 * The real list (g_LibName_List) is not changed, so the change can be canceled
 * The real list (g_LibName_List) is not changed, so the change can be canceled
 */
 */
{
{
    int ii;
    wxArrayInt selections;

    ii = m_ListLibr->GetSelection();
    if( ii < 0 )
        return;


    m_ListLibr->Delete(ii);
    m_ListLibr->GetSelections(selections);
    for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
    {
        m_ListLibr->Delete(selections[ii] );
        m_LibListChanged = TRUE;
        m_LibListChanged = TRUE;
    }
    }
}




/**************************************************************************/
/**************************************************************************/
@@ -170,12 +235,17 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
 * The real list (g_LibName_List) is not changed, so the change can be canceled
 * The real list (g_LibName_List) is not changed, so the change can be canceled
 */
 */
{
{
    int        ii;
    int        ii = 0;
    wxString   libfilename;
    wxString   libfilename;
    wxFileName fn;
    wxFileName fn;


    ii = m_ListLibr->GetSelection();
    wxArrayInt selections;
    if( ii == wxNOT_FOUND )
    m_ListLibr->GetSelections(selections);

    ii = selections.GetCount();
    if( ii > 0 )
        ii = selections[0];
    else
        ii = 0;
        ii = 0;


    wxString libpath;
    wxString libpath;
+2 −0
Original line number Original line Diff line number Diff line
@@ -31,6 +31,8 @@ private:
	void OnCancelClick( wxCommandEvent& event );
	void OnCancelClick( wxCommandEvent& event );
    void OnRemoveUserPath( wxCommandEvent& event );
    void OnRemoveUserPath( wxCommandEvent& event );
	void OnBrowseModDocFile( wxCommandEvent& event );
	void OnBrowseModDocFile( wxCommandEvent& event );
	void OnButtonUpClick( wxCommandEvent& event );
	void OnButtonDownClick( wxCommandEvent& event );




public:
public:
Loading