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.h>
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
#include <cvstruct.h>
|
#include <listview_classes.h>
|
||||||
#include <autosel.h>
|
#include <autosel.h>
|
||||||
|
|
||||||
#define QUOTE '\''
|
#define QUOTE '\''
|
||||||
|
@ -215,7 +215,7 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
|
||||||
if( equivItem.m_ComponentValue.CmpNoCase( component->GetValue() ) != 0 )
|
if( equivItem.m_ComponentValue.CmpNoCase( component->GetValue() ) != 0 )
|
||||||
continue;
|
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;
|
bool equ_is_unique = true;
|
||||||
unsigned next = idx+1;
|
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
|
// we do not need to analyze wildcards: single footprint do not
|
||||||
// contain them and if there are wildcards it just will not match any
|
// 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 )
|
if( module )
|
||||||
SetNewPkg( component->GetFootprintFilters()[0] );
|
SetNewPkg( component->GetFootprintFilters()[0] );
|
||||||
|
|
|
@ -52,9 +52,6 @@ PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters()
|
||||||
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
|
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
|
||||||
wxT( "EquName" ), &m_EquFilesNames, GROUP_CVP_EQU ) );
|
wxT( "EquName" ), &m_EquFilesNames, GROUP_CVP_EQU ) );
|
||||||
|
|
||||||
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING(
|
|
||||||
wxT( "NetIExt" ), &m_NetlistFileExtension ) );
|
|
||||||
|
|
||||||
return m_projectFileParams;
|
return m_projectFileParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,16 +64,12 @@ void CVPCB_MAINFRAME::LoadProjectFile()
|
||||||
m_EquFilesNames.Clear();
|
m_EquFilesNames.Clear();
|
||||||
|
|
||||||
prj.ConfigLoad( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters() );
|
prj.ConfigLoad( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters() );
|
||||||
|
|
||||||
if( m_NetlistFileExtension.IsEmpty() )
|
|
||||||
m_NetlistFileExtension = wxT( "net" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent )
|
void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
PROJECT& prj = Prj();
|
PROJECT& prj = Prj();
|
||||||
SetTitle( wxString::Format( _( "Project file: '%s'" ), GetChars( prj.GetProjectFullName() ) ) );
|
|
||||||
wxFileName fn = prj.GetProjectFullName();
|
wxFileName fn = prj.GetProjectFullName();
|
||||||
|
|
||||||
if( !IsWritable( fn ) )
|
if( !IsWritable( fn ) )
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
#include <class_DisplayFootprintsFrame.h>
|
#include <class_DisplayFootprintsFrame.h>
|
||||||
#include <cvpcb_id.h>
|
#include <cvpcb_id.h>
|
||||||
#include <cvstruct.h>
|
#include <listview_classes.h>
|
||||||
|
|
||||||
#include <3d_viewer.h>
|
#include <3d_viewer.h>
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
||||||
|
|
||||||
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
|
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
|
||||||
|
|
||||||
wxString footprintName = parentframe->m_footprintListBox->GetSelectedFootprint();
|
wxString footprintName = parentframe->GetSelectedFootprint();
|
||||||
|
|
||||||
if( !footprintName.IsEmpty() )
|
if( !footprintName.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -495,7 +495,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
||||||
|
|
||||||
SetTitle( msg );
|
SetTitle( msg );
|
||||||
const FOOTPRINT_INFO* module_info =
|
const FOOTPRINT_INFO* module_info =
|
||||||
parentframe->m_footprints.GetModuleInfo( footprintName );
|
parentframe->m_FootprintsList.GetModuleInfo( footprintName );
|
||||||
|
|
||||||
const wxChar* libname;
|
const wxChar* libname;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
#include <cvstruct.h>
|
#include <listview_classes.h>
|
||||||
#include <cvpcb_id.h>
|
#include <cvpcb_id.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,10 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
#include <macros.h>
|
|
||||||
#include <pgm_base.h>
|
|
||||||
#include <wildcards_and_files_ext.h>
|
|
||||||
|
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
#include <cvstruct.h>
|
#include <listview_classes.h>
|
||||||
#include <cvpcb_id.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++ )
|
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 ),
|
msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ),
|
||||||
GetChars( aList.GetItem( ii ).GetNickname() ),
|
GetChars( aList.GetItem( ii ).GetNickname() ),
|
||||||
|
@ -147,22 +144,22 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (aFilterType & BY_LIBRARY) && !aLibName.IsEmpty()
|
if( (aFilterType & FILTERING_BY_LIBRARY) && !aLibName.IsEmpty()
|
||||||
&& !aList.GetItem( ii ).InLibrary( aLibName ) )
|
&& !aList.GetItem( ii ).InLibrary( aLibName ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( (aFilterType & BY_COMPONENT) && aComponent
|
if( (aFilterType & FILTERING_BY_COMPONENT_KEYWORD) && aComponent
|
||||||
&& !aComponent->MatchesFootprintFilters( aList.GetItem( ii ).GetFootprintName() ) )
|
&& !aComponent->MatchesFootprintFilters( aList.GetItem( ii ).GetFootprintName() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( (aFilterType & BY_PIN_COUNT) && aComponent
|
if( (aFilterType & FILTERING_BY_PIN_COUNT) && aComponent
|
||||||
&& aComponent->GetNetCount() != aList.GetItem( ii ).GetUniquePadCount() )
|
&& aComponent->GetNetCount() != aList.GetItem( ii ).GetUniquePadCount() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wxString itemsName = aList.GetItem( ii ).GetNickname().Lower () +
|
wxString itemsName = aList.GetItem( ii ).GetNickname().Lower () +
|
||||||
aList.GetItem (ii).GetFootprintName().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)
|
&& itemsName.Find (footPrintName.Lower ()) == wxNOT_FOUND)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
#include <cvstruct.h>
|
#include <listview_classes.h>
|
||||||
#include <cvpcb_id.h>
|
#include <cvpcb_id.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
#include <cvstruct.h>
|
#include <listview_classes.h>
|
||||||
#include <invoke_pcb_dialog.h>
|
#include <invoke_pcb_dialog.h>
|
||||||
#include <class_DisplayFootprintsFrame.h>
|
#include <class_DisplayFootprintsFrame.h>
|
||||||
#include <cvpcb_id.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_EXIT, CVPCB_MAINFRAME::OnQuit )
|
||||||
EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
|
EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
|
||||||
EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout )
|
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_FIND_ITEMS, CVPCB_MAINFRAME::OnMenuSearch )
|
||||||
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths )
|
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths )
|
||||||
EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave )
|
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_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
|
||||||
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
|
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_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()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,11 +116,10 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
m_libListBox = NULL;
|
m_libListBox = NULL;
|
||||||
m_mainToolBar = NULL;
|
m_mainToolBar = NULL;
|
||||||
m_modified = false;
|
m_modified = false;
|
||||||
m_isEESchemaNetlist = false;
|
m_keepCvpcbOpen = false;
|
||||||
m_KeepCvpcbOpen = false;
|
|
||||||
m_undefinedComponentCnt = 0;
|
m_undefinedComponentCnt = 0;
|
||||||
m_skipComponentSelect = false;
|
m_skipComponentSelect = false;
|
||||||
m_NetlistFileExtension = wxT( "net" );
|
m_filteringOptions = 0;
|
||||||
|
|
||||||
/* Name of the document footprint list
|
/* Name of the document footprint list
|
||||||
* usually located in share/modules/footprints_doc
|
* usually located in share/modules/footprints_doc
|
||||||
|
@ -202,9 +206,10 @@ void CVPCB_MAINFRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
{
|
{
|
||||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||||
|
|
||||||
aCfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true );
|
aCfg->Read( KeepCvpcbOpenEntry, &m_keepCvpcbOpen, true );
|
||||||
aCfg->Read( FootprintDocFileEntry, &m_DocModulesFileName,
|
aCfg->Read( FootprintDocFileEntry, &m_DocModulesFileName,
|
||||||
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
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 );
|
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||||
|
|
||||||
aCfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
aCfg->Write( KeepCvpcbOpenEntry, m_keepCvpcbOpen );
|
||||||
aCfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
aCfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
||||||
|
aCfg->Write( FILTERFOOTPRINTKEY, m_filteringOptions );
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -262,7 +252,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxID_YES:
|
case wxID_YES:
|
||||||
SaveEdits();
|
SaveFootprintAssociation();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,11 +355,11 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
|
void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
SaveEdits();
|
SaveFootprintAssociation();
|
||||||
|
|
||||||
m_modified = false;
|
m_modified = false;
|
||||||
|
|
||||||
if( !m_KeepCvpcbOpen )
|
if( !m_keepCvpcbOpen )
|
||||||
Close( true );
|
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 )
|
bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -487,14 +447,14 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
||||||
if( tableChanged )
|
if( tableChanged )
|
||||||
{
|
{
|
||||||
BuildLIBRARY_LISTBOX();
|
BuildLIBRARY_LISTBOX();
|
||||||
m_footprints.ReadFootprintFiles( Prj().PcbFootprintLibs() );
|
m_FootprintsList.ReadFootprintFiles( Prj().PcbFootprintLibs() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
|
void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
m_KeepCvpcbOpen = event.IsChecked();
|
m_keepCvpcbOpen = event.IsChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -518,25 +478,31 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
||||||
|
|
||||||
wxString libraryName;
|
wxString libraryName;
|
||||||
COMPONENT* component = GetSelectedComponent();
|
COMPONENT* component = GetSelectedComponent();
|
||||||
int filter = getFilterType ();
|
|
||||||
libraryName = m_libListBox->GetSelectedLibrary();
|
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);
|
RefreshAfterComponentSearch (component);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnToolbarSearch( wxCommandEvent& aEvent )
|
void CVPCB_MAINFRAME::OnToolbarSearch( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( m_skipComponentSelect )
|
if( m_skipComponentSelect )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME ) ) {
|
if(m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME ) )
|
||||||
SearchDialogAndStore ();
|
{
|
||||||
}
|
m_filteringOptions |= FOOTPRINTS_LISTBOX::FILTERING_BY_NAME;
|
||||||
else {
|
SearchDialogAndStore ();
|
||||||
m_currentSearch = "";
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
m_filteringOptions &= ~FOOTPRINTS_LISTBOX::FILTERING_BY_NAME;
|
||||||
|
m_currentSearch = "";
|
||||||
|
}
|
||||||
|
|
||||||
OnSelectFilteringFootprint (aEvent);
|
OnSelectFilteringFootprint( aEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnMenuSearch( wxCommandEvent& aEvent )
|
void CVPCB_MAINFRAME::OnMenuSearch( wxCommandEvent& aEvent )
|
||||||
|
@ -544,105 +510,138 @@ void CVPCB_MAINFRAME::OnMenuSearch( wxCommandEvent& aEvent )
|
||||||
if( m_skipComponentSelect )
|
if( m_skipComponentSelect )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SearchDialogAndStore ();
|
m_filteringOptions |= FOOTPRINTS_LISTBOX::FILTERING_BY_NAME;
|
||||||
OnSelectFilteringFootprint (aEvent);
|
SearchDialogAndStore();
|
||||||
|
OnSelectFilteringFootprint( aEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::SearchDialogAndStore ()
|
void CVPCB_MAINFRAME::SearchDialogAndStore()
|
||||||
{
|
{
|
||||||
wxTextEntryDialog myDialog (this, _ ("Find footprint"), _ ("Find"), "");
|
wxTextEntryDialog myDialog( this, _("Find footprint"), _("Find"), "" );
|
||||||
if (myDialog.ShowModal () == wxID_OK) {
|
|
||||||
m_currentSearch = myDialog.GetValue ();
|
if( myDialog.ShowModal() == wxID_OK )
|
||||||
|
{
|
||||||
|
m_currentSearch = myDialog.GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainToolBar->ToggleTool ( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, !m_currentSearch.empty ());
|
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)
|
void CVPCB_MAINFRAME::RefreshAfterComponentSearch (COMPONENT* component)
|
||||||
{
|
{
|
||||||
// Tell AuiMgr that objects are changed !
|
// Tell AuiMgr that objects are changed !
|
||||||
if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
|
if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
|
||||||
// (could be not the case when starting CvPcb
|
// (could be not the case when starting CvPcb
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
if( component == NULL )
|
if( component == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Preview of the already assigned footprint.
|
// Preview of the already assigned footprint.
|
||||||
// Find the footprint that was already chosen for this component and select it,
|
// Find the footprint that was already chosen for this component and select it,
|
||||||
// but only if the selection is made from the component list or the library list.
|
// but only if the selection is made from the component list or the library list.
|
||||||
// If the selection is made from the footprint list, do not change the current
|
// If the selection is made from the footprint list, do not change the current
|
||||||
// selected footprint.
|
// selected footprint.
|
||||||
if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
|
if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
|
||||||
|
{
|
||||||
|
wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
|
wxString footprintName;
|
||||||
|
wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
|
||||||
|
msg.Trim( true );
|
||||||
|
msg.Trim( false );
|
||||||
|
footprintName = msg.AfterFirst( wxChar( ' ' ) );
|
||||||
|
|
||||||
bool found = false;
|
if( module.Cmp( footprintName ) == 0 )
|
||||||
|
|
||||||
for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
|
|
||||||
{
|
{
|
||||||
wxString footprintName;
|
m_footprintListBox->SetSelection( ii, true );
|
||||||
wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
|
found = true;
|
||||||
msg.Trim( true );
|
break;
|
||||||
msg.Trim( false );
|
|
||||||
footprintName = msg.AfterFirst( wxChar( ' ' ) );
|
|
||||||
|
|
||||||
if( module.Cmp( footprintName ) == 0 )
|
|
||||||
{
|
|
||||||
m_footprintListBox->SetSelection( ii, true );
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !found )
|
|
||||||
{
|
|
||||||
int ii = m_footprintListBox->GetSelection();
|
|
||||||
|
|
||||||
if ( ii >= 0 )
|
|
||||||
m_footprintListBox->SetSelection( ii, false );
|
|
||||||
|
|
||||||
if( GetFootprintViewerFrame() )
|
|
||||||
{
|
|
||||||
CreateScreenCmp();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageToEESCHEMA();
|
if( !found )
|
||||||
DisplayStatus();
|
{
|
||||||
|
int ii = m_footprintListBox->GetSelection();
|
||||||
|
|
||||||
|
if ( ii >= 0 )
|
||||||
|
m_footprintListBox->SetSelection( ii, false );
|
||||||
|
|
||||||
|
if( GetFootprintViewerFrame() )
|
||||||
|
{
|
||||||
|
CreateScreenCmp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SendMessageToEESCHEMA();
|
||||||
|
DisplayStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
|
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 );
|
OnSelectComponent( l_event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& 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
|
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
|
if( module ) // can be NULL if no netlist loaded
|
||||||
{
|
{
|
||||||
|
@ -697,10 +696,10 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
||||||
|
|
||||||
if( m_footprintListBox )
|
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" );
|
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() )
|
if( !filters.IsEmpty() )
|
||||||
filters += wxT( "+" );
|
filters += wxT( "+" );
|
||||||
|
@ -708,7 +707,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
||||||
filters += _( "pin count" );
|
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() )
|
if( !filters.IsEmpty() )
|
||||||
filters += wxT( "+" );
|
filters += wxT( "+" );
|
||||||
|
@ -716,7 +715,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
||||||
filters += _( "library" );
|
filters += _( "library" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME ) )
|
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME ) )
|
||||||
{
|
{
|
||||||
if( !filters.IsEmpty() )
|
if( !filters.IsEmpty() )
|
||||||
filters += wxT( "+" );
|
filters += wxT( "+" );
|
||||||
|
@ -748,11 +747,11 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
||||||
return false;
|
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;
|
return true;
|
||||||
|
@ -880,8 +879,8 @@ void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX()
|
||||||
wxFONTWEIGHT_NORMAL ) );
|
wxFONTWEIGHT_NORMAL ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_footprintListBox->SetFootprints( m_footprints, wxEmptyString, NULL,
|
m_footprintListBox->SetFootprints( m_FootprintsList, wxEmptyString, NULL,
|
||||||
wxEmptyString, FOOTPRINTS_LISTBOX::UNFILTERED );
|
wxEmptyString, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST );
|
||||||
DisplayStatus();
|
DisplayStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,6 +972,13 @@ DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFootprintViewerFrame()
|
||||||
( wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME ) );
|
( 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 )
|
void CVPCB_MAINFRAME::OnConfigurePaths( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,24 +59,23 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER
|
||||||
|
|
||||||
wxArrayString m_footprintListEntries;
|
wxArrayString m_footprintListEntries;
|
||||||
wxString m_currentSearch;
|
wxString m_currentSearch;
|
||||||
|
bool m_keepCvpcbOpen;
|
||||||
public:
|
NETLIST m_netlist;
|
||||||
bool m_KeepCvpcbOpen;
|
int m_filteringOptions;
|
||||||
|
wxAuiToolBar* m_mainToolBar;
|
||||||
FOOTPRINTS_LISTBOX* m_footprintListBox;
|
FOOTPRINTS_LISTBOX* m_footprintListBox;
|
||||||
LIBRARY_LISTBOX* m_libListBox;
|
LIBRARY_LISTBOX* m_libListBox;
|
||||||
COMPONENTS_LISTBOX* m_compListBox;
|
COMPONENTS_LISTBOX* m_compListBox;
|
||||||
wxAuiToolBar* m_mainToolBar;
|
|
||||||
|
public:
|
||||||
wxArrayString m_ModuleLibNames;
|
wxArrayString m_ModuleLibNames;
|
||||||
wxArrayString m_EquFilesNames;
|
wxArrayString m_EquFilesNames;
|
||||||
wxString m_NetlistFileExtension;
|
|
||||||
wxString m_DocModulesFileName;
|
wxString m_DocModulesFileName;
|
||||||
FOOTPRINT_LIST m_footprints;
|
FOOTPRINT_LIST m_FootprintsList;
|
||||||
NETLIST m_netlist;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_undefinedComponentCnt;
|
int m_undefinedComponentCnt;
|
||||||
bool m_modified;
|
bool m_modified;
|
||||||
bool m_isEESchemaNetlist;
|
|
||||||
bool m_skipComponentSelect; // true to skip OnSelectComponent event
|
bool m_skipComponentSelect; // true to skip OnSelectComponent event
|
||||||
// (in automatic selection/deletion of associations)
|
// (in automatic selection/deletion of associations)
|
||||||
PARAM_CFG_ARRAY m_projectFileParams;
|
PARAM_CFG_ARRAY m_projectFileParams;
|
||||||
|
@ -103,6 +102,7 @@ public:
|
||||||
* * Updates the footprint shown in footprint display window (if opened)
|
* * Updates the footprint shown in footprint display window (if opened)
|
||||||
*/
|
*/
|
||||||
void OnSelectComponent( wxListEvent& event );
|
void OnSelectComponent( wxListEvent& event );
|
||||||
|
|
||||||
void OnToolbarSearch (wxCommandEvent& aEvent);
|
void OnToolbarSearch (wxCommandEvent& aEvent);
|
||||||
void OnMenuSearch (wxCommandEvent& aEvent);
|
void OnMenuSearch (wxCommandEvent& aEvent);
|
||||||
|
|
||||||
|
@ -133,13 +133,6 @@ public:
|
||||||
void SaveProjectFile( wxCommandEvent& aEvent );
|
void SaveProjectFile( wxCommandEvent& aEvent );
|
||||||
void SaveQuitCvpcb( wxCommandEvent& event );
|
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
|
* Function OnEditLibraryTable
|
||||||
* envokes the footprint library table edit dialog.
|
* envokes the footprint library table edit dialog.
|
||||||
|
@ -175,6 +168,11 @@ public:
|
||||||
*/
|
*/
|
||||||
void OnSelectFilteringFootprint( wxCommandEvent& event );
|
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 );
|
void OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,11 +194,11 @@ public:
|
||||||
void CreateScreenCmp();
|
void CreateScreenCmp();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SaveEdits
|
* Function SaveFootprintAssociation
|
||||||
* saves the edits that the user has done by sending them back to eeschema
|
* saves the edits that the user has done by sending them back to eeschema
|
||||||
* via the kiway.
|
* via the kiway.
|
||||||
*/
|
*/
|
||||||
void SaveEdits();
|
void SaveFootprintAssociation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReadNetList
|
* Function ReadNetList
|
||||||
|
@ -268,10 +266,9 @@ public:
|
||||||
* Function UpdateTitle
|
* Function UpdateTitle
|
||||||
* sets the main window title bar text.
|
* sets the main window title bar text.
|
||||||
* <p>
|
* <p>
|
||||||
* If file name defined by CVPCB_MAINFRAME::m_NetlistFileName is not set, the title is
|
* If no current project open( eeschema run outside kicad manager with no schematic loaded),
|
||||||
* set to the application name appended with no file. Otherwise, the title is set to
|
* the title is set to the application name appended with "no project".
|
||||||
* the full path and file name and read only is appended to the title if the user does
|
* Otherwise, the title shows the project name.
|
||||||
* not have write access to the file.
|
|
||||||
*/
|
*/
|
||||||
void UpdateTitle();
|
void UpdateTitle();
|
||||||
|
|
||||||
|
@ -285,7 +282,18 @@ public:
|
||||||
|
|
||||||
COMPONENT* GetSelectedComponent();
|
COMPONENT* GetSelectedComponent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the FPID of the selected footprint in footprint listview
|
||||||
|
* or a empty string if no selection
|
||||||
|
*/
|
||||||
|
const wxString GetSelectedFootprint();
|
||||||
|
|
||||||
private:
|
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
|
* read the .equ files and populate the list of equvalents
|
||||||
|
@ -297,8 +305,7 @@ private:
|
||||||
int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL );
|
int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL );
|
||||||
|
|
||||||
void RefreshAfterComponentSearch (COMPONENT* component);
|
void RefreshAfterComponentSearch (COMPONENT* component);
|
||||||
int getFilterType ();
|
void SearchDialogAndStore();
|
||||||
void SearchDialogAndStore ();
|
|
||||||
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <cvstruct.h>
|
#include <listview_classes.h>
|
||||||
#include <class_DisplayFootprintsFrame.h>
|
#include <class_DisplayFootprintsFrame.h>
|
||||||
|
|
||||||
#include <dialog_display_options.h>
|
#include <dialog_display_options.h>
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
#include <cvstruct.h>
|
#include <listview_classes.h>
|
||||||
#include <cvpcb_id.h>
|
#include <cvpcb_id.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,13 +90,14 @@ private:
|
||||||
wxArrayString m_footprintList;
|
wxArrayString m_footprintList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// OR'ed mask to manage footprint filtering options
|
||||||
enum FP_FILTER_T
|
enum FP_FILTER_T
|
||||||
{
|
{
|
||||||
UNFILTERED = 0,
|
UNFILTERED_FP_LIST = 0,
|
||||||
BY_COMPONENT = 0x0001,
|
FILTERING_BY_COMPONENT_KEYWORD = 0x0001,
|
||||||
BY_PIN_COUNT = 0x0002,
|
FILTERING_BY_PIN_COUNT = 0x0002,
|
||||||
BY_LIBRARY = 0x0004,
|
FILTERING_BY_LIBRARY = 0x0004,
|
||||||
BY_NAME = 0x0008,
|
FILTERING_BY_NAME = 0x0008
|
||||||
};
|
};
|
||||||
|
|
||||||
FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
|
@ -29,8 +29,6 @@
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
#include <confirm.h>
|
|
||||||
#include <gestfich.h>
|
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
|
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
|
@ -45,8 +43,7 @@
|
||||||
*/
|
*/
|
||||||
void CVPCB_MAINFRAME::ReCreateMenuBar()
|
void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||||
{
|
{
|
||||||
// Create and try to get the current menubar
|
// Create the current menubar if it does not yet exist
|
||||||
wxMenuItem* item;
|
|
||||||
wxMenuBar* menuBar = GetMenuBar();
|
wxMenuBar* menuBar = GetMenuBar();
|
||||||
|
|
||||||
if( ! menuBar ) // Delete all menus
|
if( ! menuBar ) // Delete all menus
|
||||||
|
@ -66,7 +63,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
// Save the footprints back into eeschema
|
// Save the footprints back into eeschema
|
||||||
AddMenuItem( filesMenu, wxID_SAVE,
|
AddMenuItem( filesMenu, wxID_SAVE,
|
||||||
_( "&Save Edits\tCtrl+S" ),
|
_( "&Save Footprint Association\tCtrl+S" ),
|
||||||
_( "Save footprint association in schematic component footprint fields" ),
|
_( "Save footprint association in schematic component footprint fields" ),
|
||||||
KiBitmap( save_xpm ) );
|
KiBitmap( save_xpm ) );
|
||||||
|
|
||||||
|
@ -100,27 +97,24 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||||
_( "Edit path configuration environment variables" ),
|
_( "Edit path configuration environment variables" ),
|
||||||
KiBitmap( editor_xpm ) );
|
KiBitmap( editor_xpm ) );
|
||||||
|
|
||||||
|
preferencesMenu->AppendSeparator();
|
||||||
AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
|
AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
|
||||||
_( "Edit &Equ Files List" ),
|
_( "Edit &Equ Files List" ),
|
||||||
_( "Setup equ files list (.equ files)\n"
|
_( "Setup equ files list (.equ files)\n"
|
||||||
"They are files which give the footprint name from the component value"),
|
"They are files which give the footprint name from the component value"),
|
||||||
KiBitmap( library_table_xpm ) );
|
KiBitmap( library_table_xpm ) );
|
||||||
|
preferencesMenu->AppendSeparator();
|
||||||
|
|
||||||
// Language submenu
|
// Language submenu
|
||||||
Pgm().AddMenuLanguageList( preferencesMenu );
|
Pgm().AddMenuLanguageList( preferencesMenu );
|
||||||
|
|
||||||
// Keep open on save
|
// Keep open on save data
|
||||||
item = new wxMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
preferencesMenu->AppendSeparator();
|
||||||
|
AddMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
||||||
_( "&Keep Open On Save" ),
|
_( "&Keep Open On Save" ),
|
||||||
_( "Prevent CvPcb from exiting after saving netlist file" ),
|
_( "Prevent CvPcb from exiting after saving netlist file" ),
|
||||||
|
KiBitmap( exit_xpm ),
|
||||||
wxITEM_CHECK );
|
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:
|
// Menu Help:
|
||||||
wxMenu* helpMenu = new wxMenu;
|
wxMenu* helpMenu = new wxMenu;
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
#include <cvstruct.h>
|
#include <listview_classes.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <fp_conflict_assignment_selector.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;
|
STRING_FORMATTER sf;
|
||||||
|
|
||||||
|
@ -376,5 +376,5 @@ void CVPCB_MAINFRAME::SaveEdits()
|
||||||
|
|
||||||
Kiway().ExpressMail( FRAME_SCH, MAIL_BACKANNOTATE_FOOTPRINTS, sf.GetString() );
|
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.
|
* 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) 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -41,8 +41,6 @@
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::ReCreateHToolbar()
|
void CVPCB_MAINFRAME::ReCreateHToolbar()
|
||||||
{
|
{
|
||||||
wxConfigBase* config = Kiface().KifaceSettings();
|
|
||||||
|
|
||||||
if( m_mainToolBar != NULL )
|
if( m_mainToolBar != NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -111,16 +109,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
|
||||||
_( "Find footprint by its name\nor filter the footprint list by the partial name\n"
|
_( "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" ),
|
"Ctrl+F to call the dialog to enter the filter string" ),
|
||||||
wxEmptyString );
|
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
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
||||||
m_mainToolBar->Realize();
|
m_mainToolBar->Realize();
|
||||||
|
|
|
@ -669,7 +669,6 @@ public:
|
||||||
void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
|
void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
|
||||||
|
|
||||||
// Plot functions:
|
// Plot functions:
|
||||||
// void ToPostProcess( wxCommandEvent& event );
|
|
||||||
void PlotSchematic( wxCommandEvent& event );
|
void PlotSchematic( wxCommandEvent& event );
|
||||||
|
|
||||||
// read and save files
|
// read and save files
|
||||||
|
|
|
@ -38,20 +38,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Definition SETBITMAPS
|
* SET_BITMAP is a macro used to add a bitmap to a menu item.
|
||||||
* 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.
|
|
||||||
* @note Do not use with checked menu items.
|
* @note Do not use with checked menu items.
|
||||||
* @param aImage is the image to add the menu item.
|
* @param aImage is the image to add the menu item.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue