Commit ff68ae0b authored by charras's avatar charras

Added: handling multiple user paths in library path list (currently, only in Eeschema)

parent bb5832c8
This diff is collapsed.
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include "fctsys.h" #include "fctsys.h"
#include <wx/tokenzr.h>
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
...@@ -30,6 +31,8 @@ class DIALOG_EESCHEMA_CONFIG : public DIALOG_EESCHEMA_CONFIG_FBP ...@@ -30,6 +31,8 @@ class DIALOG_EESCHEMA_CONFIG : public DIALOG_EESCHEMA_CONFIG_FBP
private: private:
WinEDA_SchematicFrame* m_Parent; WinEDA_SchematicFrame* m_Parent;
bool m_LibListChanged; bool m_LibListChanged;
bool m_LibPathChanged;
wxString m_UserLibDirBufferImg; // Copy of original g_UserLibDirBuffer
private: private:
...@@ -39,7 +42,7 @@ private: ...@@ -39,7 +42,7 @@ private:
void OnSaveCfgClick( wxCommandEvent& event ); void OnSaveCfgClick( wxCommandEvent& event );
void OnRemoveLibClick( wxCommandEvent& event ); void OnRemoveLibClick( wxCommandEvent& event );
void OnAddOrInsertLibClick( wxCommandEvent& event ); void OnAddOrInsertLibClick( wxCommandEvent& event );
void OnLibPathSelClick( wxCommandEvent& event ); void OnAddOrInsertPath( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void OnRemoveUserPath( wxCommandEvent& event ); void OnRemoveUserPath( wxCommandEvent& event );
...@@ -69,7 +72,6 @@ DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( WinEDA_SchematicFrame* parent ) ...@@ -69,7 +72,6 @@ DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( WinEDA_SchematicFrame* parent )
wxString msg; wxString msg;
m_Parent = parent; m_Parent = parent;
m_LibListChanged = false;
Init(); Init();
...@@ -88,6 +90,10 @@ void DIALOG_EESCHEMA_CONFIG::Init() ...@@ -88,6 +90,10 @@ void DIALOG_EESCHEMA_CONFIG::Init()
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
SetFocus(); SetFocus();
m_LibListChanged = false;
m_LibPathChanged = false;
m_UserLibDirBufferImg = g_UserLibDirBuffer; // Save the original lib path
// Display current files extension (info) // Display current files extension (info)
wxString msg = m_InfoCmpFileExt->GetLabel() + g_NetCmpExtBuffer; wxString msg = m_InfoCmpFileExt->GetLabel() + g_NetCmpExtBuffer;
m_InfoCmpFileExt->SetLabel( msg ); m_InfoCmpFileExt->SetLabel( msg );
...@@ -126,7 +132,15 @@ void DIALOG_EESCHEMA_CONFIG::Init() ...@@ -126,7 +132,15 @@ void DIALOG_EESCHEMA_CONFIG::Init()
m_NetFormatBox->SetSelection( g_NetFormat - NET_TYPE_PCBNEW ); m_NetFormatBox->SetSelection( g_NetFormat - NET_TYPE_PCBNEW );
m_ListLibr->InsertItems( g_LibName_List, 0 ); m_ListLibr->InsertItems( g_LibName_List, 0 );
m_LibDirCtrl->SetValue( g_UserLibDirBuffer );
// Load user libs paths:
wxStringTokenizer Token( m_UserLibDirBufferImg, wxT( ";\n\r" ) );
while( Token.HasMoreTokens() )
{
wxString path = Token.GetNextToken();
if( wxFileName::DirExists( path ) )
m_listUserPaths->Append(path);
}
// Display actual libraries paths: // Display actual libraries paths:
wxPathList libpaths = wxGetApp().GetLibraryPathList(); wxPathList libpaths = wxGetApp().GetLibraryPathList();
...@@ -134,6 +148,10 @@ void DIALOG_EESCHEMA_CONFIG::Init() ...@@ -134,6 +148,10 @@ void DIALOG_EESCHEMA_CONFIG::Init()
{ {
m_DefaultLibraryPathslistBox->Append( libpaths[ii]); m_DefaultLibraryPathslistBox->Append( libpaths[ii]);
} }
// select the first path afer the current path project
if ( libpaths.GetCount() > 1 )
m_DefaultLibraryPathslistBox->Select( 1 );
} }
...@@ -141,6 +159,13 @@ void DIALOG_EESCHEMA_CONFIG::Init() ...@@ -141,6 +159,13 @@ void DIALOG_EESCHEMA_CONFIG::Init()
void DIALOG_EESCHEMA_CONFIG::OnCancelClick( wxCommandEvent& event ) void DIALOG_EESCHEMA_CONFIG::OnCancelClick( wxCommandEvent& event )
/******************************************************************/ /******************************************************************/
{ {
// Recreate the user lib path
if ( m_LibPathChanged )
{
for ( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii ++ )
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetString(ii)) ;
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1);
}
EndModal( -1 ); EndModal( -1 );
} }
...@@ -152,17 +177,21 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event ) ...@@ -152,17 +177,21 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event )
// Set new netlist format // Set new netlist format
g_NetFormat = m_NetFormatBox->GetSelection() + NET_TYPE_PCBNEW; g_NetFormat = m_NetFormatBox->GetSelection() + NET_TYPE_PCBNEW;
// Set new default path lib // Recreate the user lib path
if ( g_UserLibDirBuffer != m_LibDirCtrl->GetValue() ) if ( m_LibPathChanged )
{ {
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer ); g_UserLibDirBuffer.Empty();
g_UserLibDirBuffer = m_LibDirCtrl->GetValue(); for ( unsigned ii = 0; ii < m_listUserPaths->GetCount(); ii ++ )
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 ); {
m_LibListChanged = true; if ( ii > 0 )
g_UserLibDirBuffer << wxT(";");
g_UserLibDirBuffer << m_listUserPaths->GetString(ii);
}
} }
// Set new active library list if the list of default path was modified
if( m_LibListChanged ) // Set new active library list if the lib list of if default path list was modified
if( m_LibListChanged || m_LibPathChanged )
{ {
// Recreate lib list // Recreate lib list
g_LibName_List.Clear(); g_LibName_List.Clear();
...@@ -223,7 +252,8 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event ) ...@@ -223,7 +252,8 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
if( ii == wxNOT_FOUND && event.GetId() != ID_ADD_LIB ) if( ii == wxNOT_FOUND && event.GetId() != ID_ADD_LIB )
ii = 0; ii = 0;
wxString libpath = m_LibDirCtrl->GetValue(); wxString libpath;
libpath = m_DefaultLibraryPathslistBox->GetStringSelection();
if ( libpath.IsEmpty() ) if ( libpath.IsEmpty() )
libpath = wxGetApp().ReturnLastVisitedLibraryPath(); libpath = wxGetApp().ReturnLastVisitedLibraryPath();
...@@ -295,14 +325,12 @@ void DIALOG_EESCHEMA_CONFIG::OnSaveCfgClick( wxCommandEvent& event ) ...@@ -295,14 +325,12 @@ void DIALOG_EESCHEMA_CONFIG::OnSaveCfgClick( wxCommandEvent& event )
/***********************************************************************/ /***********************************************************************/
void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event ) void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
/***********************************************************************/ /***********************************************************************/
{ {
wxString path = m_LibDirCtrl->GetValue(); wxString path = wxGetApp().ReturnLastVisitedLibraryPath();
if ( path.IsEmpty() )
path = wxGetApp().ReturnLastVisitedLibraryPath();
bool select = EDA_DirectorySelector( _( " Default Path for libraries" ), /* Titre de la fenetre */ bool select = EDA_DirectorySelector( _( "Default Path for Libraries" ), /* Titre de la fenetre */
path, /* Chemin par defaut */ path, /* Chemin par defaut */
wxDD_DEFAULT_STYLE, wxDD_DEFAULT_STYLE,
this, /* parent frame */ this, /* parent frame */
...@@ -311,7 +339,36 @@ void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event ) ...@@ -311,7 +339,36 @@ void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event )
if( !select ) if( !select )
return; return;
m_LibDirCtrl->SetValue( path ); if( ! wxFileName::DirExists( path ) ) // Should not occurs
return;
// Add or insert path if not already in list
if( m_listUserPaths->FindString( path ) == wxNOT_FOUND )
{
int ipos = m_listUserPaths->GetCount();
if ( event.GetId() == wxID_INSERT_PATH )
{
if ( ipos ) ipos--;
int jj = m_listUserPaths->GetSelection();
if ( jj >= 0 )
ipos = jj;
}
m_listUserPaths->Insert(path, ipos);
m_LibPathChanged = true;
wxGetApp().InsertLibraryPath( path, ipos+1 );
// Display actual libraries paths:
wxPathList libpaths = wxGetApp().GetLibraryPathList();
m_DefaultLibraryPathslistBox->Clear();
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
{
m_DefaultLibraryPathslistBox->Append( libpaths[ii]);
}
}
else
DisplayError(this, _("Path already in use") );
wxGetApp().SaveLastVisitedLibraryPath( path ); wxGetApp().SaveLastVisitedLibraryPath( path );
} }
...@@ -321,5 +378,21 @@ void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event ) ...@@ -321,5 +378,21 @@ void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event )
void DIALOG_EESCHEMA_CONFIG::OnRemoveUserPath( wxCommandEvent& event ) void DIALOG_EESCHEMA_CONFIG::OnRemoveUserPath( wxCommandEvent& event )
/***********************************************************************/ /***********************************************************************/
{ {
m_LibDirCtrl->Clear( ); int ii = m_listUserPaths->GetSelection();
} if ( ii < 0 )
ii = m_listUserPaths->GetCount()-1;
if ( ii >= 0 )
{
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetStringSelection() );
m_listUserPaths->Delete( ii );
m_LibPathChanged = true;
}
// Display actual libraries paths:
wxPathList libpaths = wxGetApp().GetLibraryPathList();
m_DefaultLibraryPathslistBox->Clear();
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
{
m_DefaultLibraryPathslistBox->Append( libpaths[ii]);
}
}
...@@ -83,38 +83,33 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind ...@@ -83,38 +83,33 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
bRightSizer = new wxBoxSizer( wxVERTICAL ); bRightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonRemoveLib = new wxButton( this, ID_REMOVE_LIB, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonRemoveLib = new wxButton( this, ID_REMOVE_LIB, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRemoveLib->SetForegroundColour( wxColour( 186, 1, 38 ) );
m_buttonRemoveLib->SetToolTip( _("Unload the selected library") ); m_buttonRemoveLib->SetToolTip( _("Unload the selected library") );
bRightSizer->Add( m_buttonRemoveLib, 0, wxALL, 5 ); bRightSizer->Add( m_buttonRemoveLib, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonAdd = new wxButton( this, ID_ADD_LIB, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonAddLib = new wxButton( this, ID_ADD_LIB, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonAdd->SetForegroundColour( wxColour( 13, 118, 1 ) ); m_buttonAddLib->SetToolTip( _("Add a new library after the selected library, and load it") );
m_buttonAdd->SetToolTip( _("Add a new library after the selected library, and load it") );
bRightSizer->Add( m_buttonAdd, 0, wxRIGHT|wxLEFT, 5 ); bRightSizer->Add( m_buttonAddLib, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonIns = new wxButton( this, wxID_ANY, _("Ins"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonIns = new wxButton( this, wxID_ANY, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonIns->SetForegroundColour( wxColour( 0, 65, 130 ) );
m_buttonIns->SetToolTip( _("Add a new library before the selected library, and load it") ); m_buttonIns->SetToolTip( _("Add a new library before the selected library, and load it") );
bRightSizer->Add( m_buttonIns, 0, wxALL, 5 ); bRightSizer->Add( m_buttonIns, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bRightSizer->Add( 0, 20, 1, wxEXPAND, 5 ); bRightSizer->Add( 0, 20, 1, wxEXPAND, 5 );
m_buttonOk = new wxButton( this, wxID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonOk = new wxButton( this, wxID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonOk, 0, wxALL, 5 ); bRightSizer->Add( m_buttonOk, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonCancel->SetForegroundColour( wxColour( 14, 0, 179 ) ); bRightSizer->Add( m_buttonCancel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 );
bRightSizer->Add( m_buttonCancel, 0, wxRIGHT|wxLEFT, 5 );
m_buttonSave = new wxButton( this, ID_SAVE_CFG, _("Save Cfg"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonSave = new wxButton( this, ID_SAVE_CFG, _("Save Cfg"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonSave->SetToolTip( _("Accept and save current configuration setting in the local .pro file") ); m_buttonSave->SetToolTip( _("Accept and save current configuration setting in the local .pro file") );
bRightSizer->Add( m_buttonSave, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); bRightSizer->Add( m_buttonSave, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bUpperSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); bUpperSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
...@@ -135,21 +130,22 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind ...@@ -135,21 +130,22 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
wxBoxSizer* bUserListSizer; wxBoxSizer* bUserListSizer;
bUserListSizer = new wxBoxSizer( wxVERTICAL ); bUserListSizer = new wxBoxSizer( wxVERTICAL );
m_LibDirCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_listUserPaths = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_LibDirCtrl->SetToolTip( _("Default path to search libraries which have no absolute path in name,\nor a name which does not start by ./ or ../\nIf void, the default path is kicad/share/library") ); bUserListSizer->Add( m_listUserPaths, 1, wxALL|wxEXPAND, 5 );
bUserListSizer->Add( m_LibDirCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
sbSizer4->Add( bUserListSizer, 1, wxALIGN_CENTER_VERTICAL, 5 ); sbSizer4->Add( bUserListSizer, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
wxBoxSizer* bUserPathsButtonsSizer; wxBoxSizer* bUserPathsButtonsSizer;
bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL ); bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonBrowse = new wxButton( this, ID_LIB_PATH_SEL, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonRemovePath = new wxButton( this, wxID_REMOVE_PATH, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
bUserPathsButtonsSizer->Add( m_buttonBrowse, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); bUserPathsButtonsSizer->Add( m_buttonRemovePath, 0, wxRIGHT|wxLEFT, 5 );
m_buttonAddPath = new wxButton( this, ID_LIB_PATH_SEL, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bUserPathsButtonsSizer->Add( m_buttonAddPath, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_buttonRemovePath = new wxButton( this, wxID_ANY, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonInsPath = new wxButton( this, wxID_INSERT_PATH, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
bUserPathsButtonsSizer->Add( m_buttonRemovePath, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bUserPathsButtonsSizer->Add( m_buttonInsPath, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizer4->Add( bUserPathsButtonsSizer, 0, wxEXPAND, 5 ); sbSizer4->Add( bUserPathsButtonsSizer, 0, wxEXPAND, 5 );
...@@ -175,13 +171,14 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind ...@@ -175,13 +171,14 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCloseWindow ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCloseWindow ) );
m_buttonRemoveLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveLibClick ), NULL, this ); m_buttonRemoveLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveLibClick ), NULL, this );
m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this ); m_buttonAddLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonIns->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this ); m_buttonIns->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonOk->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnOkClick ), NULL, this ); m_buttonOk->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnOkClick ), NULL, this );
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCancelClick ), NULL, this ); m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCancelClick ), NULL, this );
m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnSaveCfgClick ), NULL, this ); m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnSaveCfgClick ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnLibPathSelClick ), NULL, this );
m_buttonRemovePath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveUserPath ), NULL, this ); m_buttonRemovePath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveUserPath ), NULL, this );
m_buttonAddPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
m_buttonInsPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
} }
DIALOG_EESCHEMA_CONFIG_FBP::~DIALOG_EESCHEMA_CONFIG_FBP() DIALOG_EESCHEMA_CONFIG_FBP::~DIALOG_EESCHEMA_CONFIG_FBP()
...@@ -189,11 +186,12 @@ DIALOG_EESCHEMA_CONFIG_FBP::~DIALOG_EESCHEMA_CONFIG_FBP() ...@@ -189,11 +186,12 @@ DIALOG_EESCHEMA_CONFIG_FBP::~DIALOG_EESCHEMA_CONFIG_FBP()
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCloseWindow ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCloseWindow ) );
m_buttonRemoveLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveLibClick ), NULL, this ); m_buttonRemoveLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveLibClick ), NULL, this );
m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this ); m_buttonAddLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonIns->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this ); m_buttonIns->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonOk->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnOkClick ), NULL, this ); m_buttonOk->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnOkClick ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCancelClick ), NULL, this ); m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCancelClick ), NULL, this );
m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnSaveCfgClick ), NULL, this ); m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnSaveCfgClick ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnLibPathSelClick ), NULL, this );
m_buttonRemovePath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveUserPath ), NULL, this ); m_buttonRemovePath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveUserPath ), NULL, this );
m_buttonAddPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
m_buttonInsPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
} }
This diff is collapsed.
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/textctrl.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -39,7 +38,9 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog ...@@ -39,7 +38,9 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
ID_REMOVE_LIB = 1000, ID_REMOVE_LIB = 1000,
ID_ADD_LIB, ID_ADD_LIB,
ID_SAVE_CFG, ID_SAVE_CFG,
wxID_REMOVE_PATH,
ID_LIB_PATH_SEL, ID_LIB_PATH_SEL,
wxID_INSERT_PATH,
}; };
wxStaticText* m_staticTextNetListFormats; wxStaticText* m_staticTextNetListFormats;
...@@ -53,16 +54,17 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog ...@@ -53,16 +54,17 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
wxStaticText* m_staticTextlibList; wxStaticText* m_staticTextlibList;
wxListBox* m_ListLibr; wxListBox* m_ListLibr;
wxButton* m_buttonRemoveLib; wxButton* m_buttonRemoveLib;
wxButton* m_buttonAdd; wxButton* m_buttonAddLib;
wxButton* m_buttonIns; wxButton* m_buttonIns;
wxButton* m_buttonOk; wxButton* m_buttonOk;
wxButton* m_buttonCancel; wxButton* m_buttonCancel;
wxButton* m_buttonSave; wxButton* m_buttonSave;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxTextCtrl* m_LibDirCtrl; wxListBox* m_listUserPaths;
wxButton* m_buttonBrowse;
wxButton* m_buttonRemovePath; wxButton* m_buttonRemovePath;
wxButton* m_buttonAddPath;
wxButton* m_buttonInsPath;
wxStaticText* m_staticTextcurrenpaths; wxStaticText* m_staticTextcurrenpaths;
wxListBox* m_DefaultLibraryPathslistBox; wxListBox* m_DefaultLibraryPathslistBox;
...@@ -73,12 +75,12 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog ...@@ -73,12 +75,12 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnSaveCfgClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnSaveCfgClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLibPathSelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRemoveUserPath( wxCommandEvent& event ){ event.Skip(); } virtual void OnRemoveUserPath( wxCommandEvent& event ){ event.Skip(); }
virtual void OnAddOrInsertPath( wxCommandEvent& event ){ event.Skip(); }
public: public:
DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 593,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 593,559 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EESCHEMA_CONFIG_FBP(); ~DIALOG_EESCHEMA_CONFIG_FBP();
}; };
......
...@@ -185,13 +185,19 @@ public: ...@@ -185,13 +185,19 @@ public:
* @param aFullFilename = filename with path and extension. * @param aFullFilename = filename with path and extension.
*/ */
wxString ReturnFilenameWithRelativePathInLibPath(const wxString & aFullFilename); wxString ReturnFilenameWithRelativePathInLibPath(const wxString & aFullFilename);
/** Function RemoveLibraryPath /** Function RemoveLibraryPath
* Removes the given ptah from the libary path list * Removes the given path(s) from the library path list
* @param path = the path to remove * @param aPaths = path or path list to remove. paths must be separated by ";"
*/
void RemoveLibraryPath( const wxString& aPaths );
/** Function InsertLibraryPath
* insert path(s) int lib paths list.
* @param aPaths = path or path list to add. paths must be separated by ";"
* @param aIndex = insertion point
*/ */
void RemoveLibraryPath( const wxString& path ); void InsertLibraryPath( const wxString& aPaths, size_t aIndex );
void InsertLibraryPath( const wxString& path, size_t index );
}; };
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment