CvPcb: serious code cleanup (work in progress): Remove dead or outdated code. Fix a lot of coding style issues. Use better code in many places. No new features.
This commit is contained in:
parent
1c0a0c4bfe
commit
a28b1cefc3
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <cvstruct.h>
|
||||
#include <listview_classes.h>
|
||||
#include <autosel.h>
|
||||
|
||||
#define QUOTE '\''
|
||||
|
@ -215,7 +215,7 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
|
|||
if( equivItem.m_ComponentValue.CmpNoCase( component->GetValue() ) != 0 )
|
||||
continue;
|
||||
|
||||
const FOOTPRINT_INFO *module = m_footprints.GetModuleInfo( equivItem.m_FootprintFPID );
|
||||
const FOOTPRINT_INFO *module = m_FootprintsList.GetModuleInfo( equivItem.m_FootprintFPID );
|
||||
|
||||
bool equ_is_unique = true;
|
||||
unsigned next = idx+1;
|
||||
|
@ -277,7 +277,7 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
|
|||
{
|
||||
// we do not need to analyze wildcards: single footprint do not
|
||||
// contain them and if there are wildcards it just will not match any
|
||||
const FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( component->GetFootprintFilters()[0] );
|
||||
const FOOTPRINT_INFO* module = m_FootprintsList.GetModuleInfo( component->GetFootprintFilters()[0] );
|
||||
|
||||
if( module )
|
||||
SetNewPkg( component->GetFootprintFilters()[0] );
|
||||
|
|
|
@ -52,9 +52,6 @@ PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters()
|
|||
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
|
||||
wxT( "EquName" ), &m_EquFilesNames, GROUP_CVP_EQU ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING(
|
||||
wxT( "NetIExt" ), &m_NetlistFileExtension ) );
|
||||
|
||||
return m_projectFileParams;
|
||||
}
|
||||
|
||||
|
@ -67,16 +64,12 @@ void CVPCB_MAINFRAME::LoadProjectFile()
|
|||
m_EquFilesNames.Clear();
|
||||
|
||||
prj.ConfigLoad( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters() );
|
||||
|
||||
if( m_NetlistFileExtension.IsEmpty() )
|
||||
m_NetlistFileExtension = wxT( "net" );
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent )
|
||||
{
|
||||
PROJECT& prj = Prj();
|
||||
SetTitle( wxString::Format( _( "Project file: '%s'" ), GetChars( prj.GetProjectFullName() ) ) );
|
||||
wxFileName fn = prj.GetProjectFullName();
|
||||
|
||||
if( !IsWritable( fn ) )
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include <cvpcb_mainframe.h>
|
||||
#include <class_DisplayFootprintsFrame.h>
|
||||
#include <cvpcb_id.h>
|
||||
#include <cvstruct.h>
|
||||
#include <listview_classes.h>
|
||||
|
||||
#include <3d_viewer.h>
|
||||
|
||||
|
@ -487,7 +487,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
|||
|
||||
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
|
||||
|
||||
wxString footprintName = parentframe->m_footprintListBox->GetSelectedFootprint();
|
||||
wxString footprintName = parentframe->GetSelectedFootprint();
|
||||
|
||||
if( !footprintName.IsEmpty() )
|
||||
{
|
||||
|
@ -495,7 +495,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
|||
|
||||
SetTitle( msg );
|
||||
const FOOTPRINT_INFO* module_info =
|
||||
parentframe->m_footprints.GetModuleInfo( footprintName );
|
||||
parentframe->m_FootprintsList.GetModuleInfo( footprintName );
|
||||
|
||||
const wxChar* libname;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <cvstruct.h>
|
||||
#include <listview_classes.h>
|
||||
#include <cvpcb_id.h>
|
||||
|
||||
|
||||
|
|
|
@ -29,13 +29,10 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <wxstruct.h>
|
||||
#include <macros.h>
|
||||
#include <pgm_base.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <cvstruct.h>
|
||||
#include <listview_classes.h>
|
||||
#include <cvpcb_id.h>
|
||||
|
||||
|
||||
|
@ -138,7 +135,7 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
|
|||
|
||||
for( unsigned ii = 0; ii < aList.GetCount(); ii++ )
|
||||
{
|
||||
if( aFilterType == UNFILTERED )
|
||||
if( aFilterType == UNFILTERED_FP_LIST )
|
||||
{
|
||||
msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ),
|
||||
GetChars( aList.GetItem( ii ).GetNickname() ),
|
||||
|
@ -147,22 +144,22 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
|
|||
continue;
|
||||
}
|
||||
|
||||
if( (aFilterType & BY_LIBRARY) && !aLibName.IsEmpty()
|
||||
if( (aFilterType & FILTERING_BY_LIBRARY) && !aLibName.IsEmpty()
|
||||
&& !aList.GetItem( ii ).InLibrary( aLibName ) )
|
||||
continue;
|
||||
|
||||
if( (aFilterType & BY_COMPONENT) && aComponent
|
||||
if( (aFilterType & FILTERING_BY_COMPONENT_KEYWORD) && aComponent
|
||||
&& !aComponent->MatchesFootprintFilters( aList.GetItem( ii ).GetFootprintName() ) )
|
||||
continue;
|
||||
|
||||
if( (aFilterType & BY_PIN_COUNT) && aComponent
|
||||
if( (aFilterType & FILTERING_BY_PIN_COUNT) && aComponent
|
||||
&& aComponent->GetNetCount() != aList.GetItem( ii ).GetUniquePadCount() )
|
||||
continue;
|
||||
|
||||
wxString itemsName = aList.GetItem( ii ).GetNickname().Lower () +
|
||||
aList.GetItem (ii).GetFootprintName().Lower ();
|
||||
|
||||
if( (aFilterType & BY_NAME) && !footPrintName.IsEmpty()
|
||||
if( (aFilterType & FILTERING_BY_NAME) && !footPrintName.IsEmpty()
|
||||
&& itemsName.Find (footPrintName.Lower ()) == wxNOT_FOUND)
|
||||
{
|
||||
continue;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <cvstruct.h>
|
||||
#include <listview_classes.h>
|
||||
#include <cvpcb_id.h>
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <cvpcb.h>
|
||||
#include <cvstruct.h>
|
||||
#include <listview_classes.h>
|
||||
#include <invoke_pcb_dialog.h>
|
||||
#include <class_DisplayFootprintsFrame.h>
|
||||
#include <cvpcb_id.h>
|
||||
|
@ -66,7 +66,6 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
|
|||
EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit )
|
||||
EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
|
||||
EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout )
|
||||
EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::SaveProjectFile )
|
||||
EVT_MENU( ID_FIND_ITEMS, CVPCB_MAINFRAME::OnMenuSearch )
|
||||
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths )
|
||||
EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave )
|
||||
|
@ -95,7 +94,13 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
|
|||
EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
|
||||
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
|
||||
|
||||
// UI event handlers
|
||||
EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave )
|
||||
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, OnFilterFPbyKeywords)
|
||||
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, OnFilterFPbyPinCount )
|
||||
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, OnFilterFPbyLibrary )
|
||||
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, OnFilterFPbyKeyName )
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
@ -111,11 +116,10 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_libListBox = NULL;
|
||||
m_mainToolBar = NULL;
|
||||
m_modified = false;
|
||||
m_isEESchemaNetlist = false;
|
||||
m_KeepCvpcbOpen = false;
|
||||
m_keepCvpcbOpen = false;
|
||||
m_undefinedComponentCnt = 0;
|
||||
m_skipComponentSelect = false;
|
||||
m_NetlistFileExtension = wxT( "net" );
|
||||
m_filteringOptions = 0;
|
||||
|
||||
/* Name of the document footprint list
|
||||
* usually located in share/modules/footprints_doc
|
||||
|
@ -202,9 +206,10 @@ void CVPCB_MAINFRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
aCfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true );
|
||||
aCfg->Read( KeepCvpcbOpenEntry, &m_keepCvpcbOpen, true );
|
||||
aCfg->Read( FootprintDocFileEntry, &m_DocModulesFileName,
|
||||
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
||||
aCfg->Read( FILTERFOOTPRINTKEY, &m_filteringOptions, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST );
|
||||
}
|
||||
|
||||
|
||||
|
@ -212,24 +217,9 @@ void CVPCB_MAINFRAME::SaveSettings( wxConfigBase* aCfg )
|
|||
{
|
||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||
|
||||
aCfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
||||
aCfg->Write( KeepCvpcbOpenEntry, m_keepCvpcbOpen );
|
||||
aCfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
||||
|
||||
int state = 0;
|
||||
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
||||
state |= FOOTPRINTS_LISTBOX::BY_COMPONENT;
|
||||
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
||||
state |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT;
|
||||
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
||||
state |= FOOTPRINTS_LISTBOX::BY_LIBRARY;
|
||||
|
||||
// if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME ) )
|
||||
// state |= FOOTPRINTS_LISTBOX::BY_NAME;
|
||||
|
||||
aCfg->Write( wxT( FILTERFOOTPRINTKEY ), state );
|
||||
aCfg->Write( FILTERFOOTPRINTKEY, m_filteringOptions );
|
||||
}
|
||||
|
||||
|
||||
|
@ -262,7 +252,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
break;
|
||||
|
||||
case wxID_YES:
|
||||
SaveEdits();
|
||||
SaveFootprintAssociation();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -365,11 +355,11 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
|
|||
|
||||
void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
|
||||
{
|
||||
SaveEdits();
|
||||
SaveFootprintAssociation();
|
||||
|
||||
m_modified = false;
|
||||
|
||||
if( !m_KeepCvpcbOpen )
|
||||
if( !m_keepCvpcbOpen )
|
||||
Close( true );
|
||||
}
|
||||
|
||||
|
@ -403,36 +393,6 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/* Remove in favor of Kiway messaging method of sending netlist
|
||||
void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
wxFileName newFileName;
|
||||
|
||||
if( id >= wxID_FILE1 && id <= wxID_FILE9 )
|
||||
{
|
||||
newFileName = GetFileFromHistory( id, _( "Netlist" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFileDialog dlg( this, _( "Open Net List" ), wxGetCwd(),
|
||||
wxEmptyString, NetlistFileWildcard,
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
newFileName = dlg.GetPath();
|
||||
}
|
||||
|
||||
if( newFileName == m_NetlistFileName )
|
||||
return;
|
||||
|
||||
OpenProjectFiles( std::vector<wxString>( 1, newFileName.GetFullPath() ) );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
{
|
||||
return true;
|
||||
|
@ -487,14 +447,14 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
|||
if( tableChanged )
|
||||
{
|
||||
BuildLIBRARY_LISTBOX();
|
||||
m_footprints.ReadFootprintFiles( Prj().PcbFootprintLibs() );
|
||||
m_FootprintsList.ReadFootprintFiles( Prj().PcbFootprintLibs() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
|
||||
{
|
||||
m_KeepCvpcbOpen = event.IsChecked();
|
||||
m_keepCvpcbOpen = event.IsChecked();
|
||||
}
|
||||
|
||||
|
||||
|
@ -518,9 +478,11 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
|||
|
||||
wxString libraryName;
|
||||
COMPONENT* component = GetSelectedComponent();
|
||||
int filter = getFilterType ();
|
||||
libraryName = m_libListBox->GetSelectedLibrary();
|
||||
m_footprintListBox->SetFootprints( m_footprints, libraryName, component, m_currentSearch, filter);
|
||||
|
||||
m_footprintListBox->SetFootprints( m_FootprintsList, libraryName, component,
|
||||
m_currentSearch, m_filteringOptions);
|
||||
|
||||
RefreshAfterComponentSearch (component);
|
||||
}
|
||||
|
||||
|
@ -529,10 +491,14 @@ void CVPCB_MAINFRAME::OnToolbarSearch( wxCommandEvent& aEvent )
|
|||
if( m_skipComponentSelect )
|
||||
return;
|
||||
|
||||
if(m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME ) ) {
|
||||
if(m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME ) )
|
||||
{
|
||||
m_filteringOptions |= FOOTPRINTS_LISTBOX::FILTERING_BY_NAME;
|
||||
SearchDialogAndStore ();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
m_filteringOptions &= ~FOOTPRINTS_LISTBOX::FILTERING_BY_NAME;
|
||||
m_currentSearch = "";
|
||||
}
|
||||
|
||||
|
@ -544,6 +510,7 @@ void CVPCB_MAINFRAME::OnMenuSearch( wxCommandEvent& aEvent )
|
|||
if( m_skipComponentSelect )
|
||||
return;
|
||||
|
||||
m_filteringOptions |= FOOTPRINTS_LISTBOX::FILTERING_BY_NAME;
|
||||
SearchDialogAndStore();
|
||||
OnSelectFilteringFootprint( aEvent );
|
||||
}
|
||||
|
@ -551,31 +518,15 @@ void CVPCB_MAINFRAME::OnMenuSearch( wxCommandEvent& aEvent )
|
|||
void CVPCB_MAINFRAME::SearchDialogAndStore()
|
||||
{
|
||||
wxTextEntryDialog myDialog( this, _("Find footprint"), _("Find"), "" );
|
||||
if (myDialog.ShowModal () == wxID_OK) {
|
||||
|
||||
if( myDialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
m_currentSearch = myDialog.GetValue();
|
||||
}
|
||||
|
||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, !m_currentSearch.empty() );
|
||||
}
|
||||
|
||||
int CVPCB_MAINFRAME::getFilterType ()
|
||||
{
|
||||
int filter = FOOTPRINTS_LISTBOX::UNFILTERED;
|
||||
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
||||
filter |= FOOTPRINTS_LISTBOX::BY_COMPONENT;
|
||||
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
||||
filter |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT;
|
||||
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
||||
filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY;
|
||||
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME) )
|
||||
filter |= FOOTPRINTS_LISTBOX::BY_NAME;
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
void CVPCB_MAINFRAME::RefreshAfterComponentSearch (COMPONENT* component)
|
||||
{
|
||||
|
@ -634,15 +585,63 @@ void CVPCB_MAINFRAME::RefreshAfterComponentSearch (COMPONENT* component)
|
|||
|
||||
void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
|
||||
{
|
||||
wxListEvent l_event;
|
||||
int option = 0;
|
||||
|
||||
switch( event.GetId() )
|
||||
{
|
||||
case ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST:
|
||||
option = FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD;
|
||||
break;
|
||||
|
||||
case ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST:
|
||||
option = FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT;
|
||||
break;
|
||||
|
||||
case ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST:
|
||||
option = FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY;
|
||||
break;
|
||||
|
||||
case ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME:
|
||||
option = FOOTPRINTS_LISTBOX::FILTERING_BY_NAME;
|
||||
break;
|
||||
}
|
||||
|
||||
if( event.IsChecked() )
|
||||
m_filteringOptions |= option;
|
||||
else
|
||||
m_filteringOptions &= ~option;
|
||||
|
||||
wxListEvent l_event;
|
||||
OnSelectComponent( l_event );
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Check( m_KeepCvpcbOpen );
|
||||
event.Check( m_keepCvpcbOpen );
|
||||
}
|
||||
|
||||
void CVPCB_MAINFRAME::OnFilterFPbyKeywords( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD );
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::OnFilterFPbyPinCount( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT );
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::OnFilterFPbyLibrary( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY );
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::OnFilterFPbyKeyName( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME );
|
||||
}
|
||||
|
||||
|
||||
|
@ -678,9 +677,9 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
|||
}
|
||||
else
|
||||
{
|
||||
wxString footprintName = m_footprintListBox->GetSelectedFootprint();
|
||||
wxString footprintName = GetSelectedFootprint();
|
||||
|
||||
FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName );
|
||||
FOOTPRINT_INFO* module = m_FootprintsList.GetModuleInfo( footprintName );
|
||||
|
||||
if( module ) // can be NULL if no netlist loaded
|
||||
{
|
||||
|
@ -697,10 +696,10 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
|||
|
||||
if( m_footprintListBox )
|
||||
{
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
||||
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD ) )
|
||||
filters = _( "key words" );
|
||||
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
||||
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) )
|
||||
{
|
||||
if( !filters.IsEmpty() )
|
||||
filters += wxT( "+" );
|
||||
|
@ -708,7 +707,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
|||
filters += _( "pin count" );
|
||||
}
|
||||
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
||||
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) )
|
||||
{
|
||||
if( !filters.IsEmpty() )
|
||||
filters += wxT( "+" );
|
||||
|
@ -716,7 +715,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
|||
filters += _( "library" );
|
||||
}
|
||||
|
||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME ) )
|
||||
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME ) )
|
||||
{
|
||||
if( !filters.IsEmpty() )
|
||||
filters += wxT( "+" );
|
||||
|
@ -748,11 +747,11 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
|||
return false;
|
||||
}
|
||||
|
||||
m_footprints.ReadFootprintFiles( fptbl );
|
||||
m_FootprintsList.ReadFootprintFiles( fptbl );
|
||||
|
||||
if( m_footprints.GetErrorCount() )
|
||||
if( m_FootprintsList.GetErrorCount() )
|
||||
{
|
||||
m_footprints.DisplayErrors( this );
|
||||
m_FootprintsList.DisplayErrors( this );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -880,8 +879,8 @@ void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX()
|
|||
wxFONTWEIGHT_NORMAL ) );
|
||||
}
|
||||
|
||||
m_footprintListBox->SetFootprints( m_footprints, wxEmptyString, NULL,
|
||||
wxEmptyString, FOOTPRINTS_LISTBOX::UNFILTERED );
|
||||
m_footprintListBox->SetFootprints( m_FootprintsList, wxEmptyString, NULL,
|
||||
wxEmptyString, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST );
|
||||
DisplayStatus();
|
||||
}
|
||||
|
||||
|
@ -973,6 +972,13 @@ DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFootprintViewerFrame()
|
|||
( wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME ) );
|
||||
}
|
||||
|
||||
const wxString CVPCB_MAINFRAME::GetSelectedFootprint()
|
||||
{
|
||||
// returns the FPID of the selected footprint in footprint listview
|
||||
// or a empty string
|
||||
return m_footprintListBox->GetSelectedFootprint();
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::OnConfigurePaths( wxCommandEvent& aEvent )
|
||||
{
|
||||
|
|
|
@ -59,24 +59,23 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER
|
|||
|
||||
wxArrayString m_footprintListEntries;
|
||||
wxString m_currentSearch;
|
||||
|
||||
public:
|
||||
bool m_KeepCvpcbOpen;
|
||||
bool m_keepCvpcbOpen;
|
||||
NETLIST m_netlist;
|
||||
int m_filteringOptions;
|
||||
wxAuiToolBar* m_mainToolBar;
|
||||
FOOTPRINTS_LISTBOX* m_footprintListBox;
|
||||
LIBRARY_LISTBOX* m_libListBox;
|
||||
COMPONENTS_LISTBOX* m_compListBox;
|
||||
wxAuiToolBar* m_mainToolBar;
|
||||
|
||||
public:
|
||||
wxArrayString m_ModuleLibNames;
|
||||
wxArrayString m_EquFilesNames;
|
||||
wxString m_NetlistFileExtension;
|
||||
wxString m_DocModulesFileName;
|
||||
FOOTPRINT_LIST m_footprints;
|
||||
NETLIST m_netlist;
|
||||
FOOTPRINT_LIST m_FootprintsList;
|
||||
|
||||
protected:
|
||||
int m_undefinedComponentCnt;
|
||||
bool m_modified;
|
||||
bool m_isEESchemaNetlist;
|
||||
bool m_skipComponentSelect; // true to skip OnSelectComponent event
|
||||
// (in automatic selection/deletion of associations)
|
||||
PARAM_CFG_ARRAY m_projectFileParams;
|
||||
|
@ -103,6 +102,7 @@ public:
|
|||
* * Updates the footprint shown in footprint display window (if opened)
|
||||
*/
|
||||
void OnSelectComponent( wxListEvent& event );
|
||||
|
||||
void OnToolbarSearch (wxCommandEvent& aEvent);
|
||||
void OnMenuSearch (wxCommandEvent& aEvent);
|
||||
|
||||
|
@ -133,13 +133,6 @@ public:
|
|||
void SaveProjectFile( wxCommandEvent& aEvent );
|
||||
void SaveQuitCvpcb( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function LoadNetList
|
||||
* reads a netlist selected by user when clicking on load netlist button or any entry
|
||||
* in the file history menu.
|
||||
*/
|
||||
void LoadNetList( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnEditLibraryTable
|
||||
* envokes the footprint library table edit dialog.
|
||||
|
@ -175,6 +168,11 @@ public:
|
|||
*/
|
||||
void OnSelectFilteringFootprint( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnUpdateKeepOpenOnSave
|
||||
* Command event handler to choose if CvPcb will be closed as soon as the footprint
|
||||
* association is saved, or if it is left open.
|
||||
*/
|
||||
void OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event );
|
||||
|
||||
/**
|
||||
|
@ -196,11 +194,11 @@ public:
|
|||
void CreateScreenCmp();
|
||||
|
||||
/**
|
||||
* Function SaveEdits
|
||||
* Function SaveFootprintAssociation
|
||||
* saves the edits that the user has done by sending them back to eeschema
|
||||
* via the kiway.
|
||||
*/
|
||||
void SaveEdits();
|
||||
void SaveFootprintAssociation();
|
||||
|
||||
/**
|
||||
* Function ReadNetList
|
||||
|
@ -268,10 +266,9 @@ public:
|
|||
* Function UpdateTitle
|
||||
* sets the main window title bar text.
|
||||
* <p>
|
||||
* If file name defined by CVPCB_MAINFRAME::m_NetlistFileName is not set, the title is
|
||||
* set to the application name appended with no file. Otherwise, the title is set to
|
||||
* the full path and file name and read only is appended to the title if the user does
|
||||
* not have write access to the file.
|
||||
* If no current project open( eeschema run outside kicad manager with no schematic loaded),
|
||||
* the title is set to the application name appended with "no project".
|
||||
* Otherwise, the title shows the project name.
|
||||
*/
|
||||
void UpdateTitle();
|
||||
|
||||
|
@ -285,7 +282,18 @@ public:
|
|||
|
||||
COMPONENT* GetSelectedComponent();
|
||||
|
||||
/**
|
||||
* @return the FPID of the selected footprint in footprint listview
|
||||
* or a empty string if no selection
|
||||
*/
|
||||
const wxString GetSelectedFootprint();
|
||||
|
||||
private:
|
||||
// UI event handlers
|
||||
void OnFilterFPbyKeywords( wxUpdateUIEvent& event );
|
||||
void OnFilterFPbyPinCount( wxUpdateUIEvent& event );
|
||||
void OnFilterFPbyLibrary( wxUpdateUIEvent& event );
|
||||
void OnFilterFPbyKeyName( wxUpdateUIEvent& event );
|
||||
|
||||
/**
|
||||
* read the .equ files and populate the list of equvalents
|
||||
|
@ -297,7 +305,6 @@ private:
|
|||
int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL );
|
||||
|
||||
void RefreshAfterComponentSearch (COMPONENT* component);
|
||||
int getFilterType ();
|
||||
void SearchDialogAndStore();
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <common.h>
|
||||
#include <cvpcb.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <cvstruct.h>
|
||||
#include <listview_classes.h>
|
||||
#include <class_DisplayFootprintsFrame.h>
|
||||
|
||||
#include <dialog_display_options.h>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <cvstruct.h>
|
||||
#include <listview_classes.h>
|
||||
#include <cvpcb_id.h>
|
||||
|
||||
|
||||
|
|
|
@ -90,13 +90,14 @@ private:
|
|||
wxArrayString m_footprintList;
|
||||
|
||||
public:
|
||||
// OR'ed mask to manage footprint filtering options
|
||||
enum FP_FILTER_T
|
||||
{
|
||||
UNFILTERED = 0,
|
||||
BY_COMPONENT = 0x0001,
|
||||
BY_PIN_COUNT = 0x0002,
|
||||
BY_LIBRARY = 0x0004,
|
||||
BY_NAME = 0x0008,
|
||||
UNFILTERED_FP_LIST = 0,
|
||||
FILTERING_BY_COMPONENT_KEYWORD = 0x0001,
|
||||
FILTERING_BY_PIN_COUNT = 0x0002,
|
||||
FILTERING_BY_LIBRARY = 0x0004,
|
||||
FILTERING_BY_NAME = 0x0008
|
||||
};
|
||||
|
||||
FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
|
@ -29,8 +29,6 @@
|
|||
#include <fctsys.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
#include <menus_helpers.h>
|
||||
|
||||
#include <cvpcb.h>
|
||||
|
@ -45,8 +43,7 @@
|
|||
*/
|
||||
void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||
{
|
||||
// Create and try to get the current menubar
|
||||
wxMenuItem* item;
|
||||
// Create the current menubar if it does not yet exist
|
||||
wxMenuBar* menuBar = GetMenuBar();
|
||||
|
||||
if( ! menuBar ) // Delete all menus
|
||||
|
@ -66,7 +63,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
|
||||
// Save the footprints back into eeschema
|
||||
AddMenuItem( filesMenu, wxID_SAVE,
|
||||
_( "&Save Edits\tCtrl+S" ),
|
||||
_( "&Save Footprint Association\tCtrl+S" ),
|
||||
_( "Save footprint association in schematic component footprint fields" ),
|
||||
KiBitmap( save_xpm ) );
|
||||
|
||||
|
@ -100,27 +97,24 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
_( "Edit path configuration environment variables" ),
|
||||
KiBitmap( editor_xpm ) );
|
||||
|
||||
preferencesMenu->AppendSeparator();
|
||||
AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
|
||||
_( "Edit &Equ Files List" ),
|
||||
_( "Setup equ files list (.equ files)\n"
|
||||
"They are files which give the footprint name from the component value"),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
preferencesMenu->AppendSeparator();
|
||||
|
||||
// Language submenu
|
||||
Pgm().AddMenuLanguageList( preferencesMenu );
|
||||
|
||||
// Keep open on save
|
||||
item = new wxMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
||||
// Keep open on save data
|
||||
preferencesMenu->AppendSeparator();
|
||||
AddMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
||||
_( "&Keep Open On Save" ),
|
||||
_( "Prevent CvPcb from exiting after saving netlist file" ),
|
||||
KiBitmap( exit_xpm ),
|
||||
wxITEM_CHECK );
|
||||
preferencesMenu->Append( item );
|
||||
SETBITMAPS( window_close_xpm );
|
||||
|
||||
// Separator
|
||||
preferencesMenu->AppendSeparator();
|
||||
AddMenuItem( preferencesMenu, ID_SAVE_PROJECT,
|
||||
_( "&Save Project File" ), SAVE_HLP_MSG, KiBitmap( save_setup_xpm ) );
|
||||
|
||||
// Menu Help:
|
||||
wxMenu* helpMenu = new wxMenu;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <cvstruct.h>
|
||||
#include <listview_classes.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <fp_conflict_assignment_selector.h>
|
||||
|
||||
|
@ -368,7 +368,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist )
|
|||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::SaveEdits()
|
||||
void CVPCB_MAINFRAME::SaveFootprintAssociation()
|
||||
{
|
||||
STRING_FORMATTER sf;
|
||||
|
||||
|
@ -376,5 +376,5 @@ void CVPCB_MAINFRAME::SaveEdits()
|
|||
|
||||
Kiway().ExpressMail( FRAME_SCH, MAIL_BACKANNOTATE_FOOTPRINTS, sf.GetString() );
|
||||
|
||||
SetStatusText( _("Edits sent to Eeschema") );
|
||||
SetStatusText( _("Footprint association sent to Eeschema") );
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2007-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2007-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -41,8 +41,6 @@
|
|||
|
||||
void CVPCB_MAINFRAME::ReCreateHToolbar()
|
||||
{
|
||||
wxConfigBase* config = Kiface().KifaceSettings();
|
||||
|
||||
if( m_mainToolBar != NULL )
|
||||
return;
|
||||
|
||||
|
@ -111,16 +109,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
|
|||
_( "Find footprint by its name\nor filter the footprint list by the partial name\n"
|
||||
"Ctrl+F to call the dialog to enter the filter string" ),
|
||||
wxEmptyString );
|
||||
if( config )
|
||||
{
|
||||
wxString key = wxT( FILTERFOOTPRINTKEY );
|
||||
int opt = config->Read( key, (long) 1 );
|
||||
|
||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, opt & 8 );
|
||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, opt & 4 );
|
||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, opt & 2 );
|
||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt & 1 );
|
||||
}
|
||||
|
||||
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
||||
m_mainToolBar->Realize();
|
||||
|
|
|
@ -669,7 +669,6 @@ public:
|
|||
void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
|
||||
|
||||
// Plot functions:
|
||||
// void ToPostProcess( wxCommandEvent& event );
|
||||
void PlotSchematic( wxCommandEvent& event );
|
||||
|
||||
// read and save files
|
||||
|
|
|
@ -38,20 +38,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* Definition SETBITMAPS
|
||||
* is a macro use to add a bitmaps to check menu item.
|
||||
* @note Do not use with normal menu items or any platform other than Windows.
|
||||
* @param aImage is the image to add the menu item.
|
||||
*/
|
||||
#if defined( USE_IMAGES_IN_MENUS ) && defined( __WINDOWS__ )
|
||||
# define SETBITMAPS( aImage ) item->SetBitmaps( KiBitmap( checked_ok_xpm ), KiBitmap( aImage ) )
|
||||
#else
|
||||
# define SETBITMAPS( aImage )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Definition SETBITMAP
|
||||
* is a macro use to add a bitmap to a menu items.
|
||||
* SET_BITMAP is a macro used to add a bitmap to a menu item.
|
||||
* @note Do not use with checked menu items.
|
||||
* @param aImage is the image to add the menu item.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue