diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 08815687b5..e156a6c581 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -59,7 +59,6 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME int m_saveInterval; ///< Time interval in seconds for automatic saving. int m_lastSaveTime; ///< Last save time. - wxArrayString m_libraryNames; ///< List of footprint library names to load. protected: @@ -235,8 +234,6 @@ public: void SetAutoSaveTimeInterval( int aInterval ) { m_saveInterval = aInterval; } - wxArrayString& GetFootprintLibraryNames() { return m_libraryNames; } - // Configurations: void InstallConfigFrame(); void Process_Config( wxCommandEvent& event ); diff --git a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp index 95bdaaac8c..d2cfa1b5f6 100644 --- a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp +++ b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp @@ -55,7 +55,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::Init() m_LibPathChanged = false; m_UserLibDirBufferImg = g_UserLibDirBuffer; // Save the original lib path - m_ListLibr->InsertItems( GetParent()->GetFootprintLibraryNames(), 0 ); + m_ListLibr->InsertItems( g_LibraryNames, 0 ); // Display current modules doc file: m_Config->Read( wxT( "module_doc_file" ), g_DocModulesFileName ); @@ -122,10 +122,10 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnOkClick( wxCommandEvent& event ) if( m_LibListChanged || m_LibPathChanged ) { // Recreate lib list - GetParent()->GetFootprintLibraryNames().Clear(); + g_LibraryNames.Clear(); for ( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii ++ ) - GetParent()->GetFootprintLibraryNames().Add( m_ListLibr->GetString(ii) ); + g_LibraryNames.Add( m_ListLibr->GetString(ii) ); } GetParent()->SaveProjectSettings(); diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 6b61a998b7..e5afeb939e 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -705,13 +705,11 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName ) void FOOTPRINT_EDIT_FRAME::Select_Active_Library() { wxString msg; - PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent(); - if( parent->GetFootprintLibraryNames().GetCount() == 0 || parent == NULL ) + if( g_LibraryNames.GetCount() == 0 ) return; - EDA_LIST_DIALOG dlg( this, _( "Select Active Library:" ), - parent->GetFootprintLibraryNames(), m_CurrentLib ); + EDA_LIST_DIALOG dlg( this, _( "Select Active Library:" ), g_LibraryNames, m_CurrentLib ); if( dlg.ShowModal() != wxID_OK ) return; diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index db08718aee..565c05c2d6 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -195,13 +195,12 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename, bool one_lib = aLibraryFullFilename.IsEmpty() ? false : true; PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent(); - for( ii = 0; ii < parent->GetFootprintLibraryNames().GetCount(); ii++ ) + for( ii = 0; ii < g_LibraryNames.GetCount(); ii++ ) { if( one_lib ) fn = aLibraryFullFilename; else - fn = wxFileName( wxEmptyString, parent->GetFootprintLibraryNames()[ii], - ModuleFileExtension ); + fn = wxFileName( wxEmptyString, g_LibraryNames[ii], ModuleFileExtension ); tmp = wxGetApp().FindLibraryPath( fn ); @@ -252,6 +251,7 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename, if( found ) { fileReader.Rewind(); + while( reader.ReadLine() ) { char * line = reader.Line(); @@ -302,10 +302,9 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, wxString CmpName; wxString msg; wxArrayString libnames_list; - PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent(); if( aLibraryFullFilename.IsEmpty() ) - libnames_list = parent->GetFootprintLibraryNames(); + libnames_list = g_LibraryNames; else libnames_list.Add( aLibraryFullFilename ); @@ -351,7 +350,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, } else { - DisplayError( aWindow, _("No footprint found") ); + DisplayError( aWindow, _( "No footprint found" ) ); CmpName.Empty(); } diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 36d303d04c..884b26f18d 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -61,6 +61,9 @@ const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (* */ wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" ); +wxArrayString g_LibraryNames; + + IMPLEMENT_APP( EDA_APP ) diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index e28d219d38..0ffaf7115e 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -74,6 +74,7 @@ extern int g_MagneticTrackOption; extern wxPoint g_Offset_Module; /* Offset trace when moving footprint. */ +extern wxArrayString g_LibraryNames; ///< List of footprint library file names to load. enum MagneticPadOptionValues { no_effect, diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index fab3ef1837..cc19c3183b 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -145,7 +145,7 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName ) wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer ); /* Initialize default values. */ - m_libraryNames.Clear(); + g_LibraryNames.Clear(); wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); @@ -190,7 +190,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters() m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer, GROUPLIB ) ); m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), - &m_libraryNames, + &g_LibraryNames, GROUPLIB ) ); m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &g_Pad_Master.m_Drill.x, 320, 0, 0x7FFF ) );