2012-02-11 09:04:26 +00:00
|
|
|
/**
|
|
|
|
* @file cvpcb/readwrite_dlgs.cpp
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras
|
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2011 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
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <fctsys.h>
|
2014-07-07 04:12:04 +00:00
|
|
|
#include <kiway.h>
|
2012-02-11 09:04:26 +00:00
|
|
|
#include <common.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <build_version.h>
|
2013-09-14 20:33:22 +00:00
|
|
|
#include <macros.h>
|
|
|
|
#include <fpid.h>
|
|
|
|
#include <fp_lib_table.h>
|
|
|
|
#include <reporter.h>
|
|
|
|
#include <html_messagebox.h>
|
2012-02-11 09:04:26 +00:00
|
|
|
|
|
|
|
#include <cvpcb.h>
|
|
|
|
#include <cvpcb_mainframe.h>
|
|
|
|
#include <cvstruct.h>
|
2012-02-16 20:03:33 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2012-02-11 09:04:26 +00:00
|
|
|
|
|
|
|
#define titleComponentLibErr _( "Component Library Error" )
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
|
|
|
{
|
2013-04-25 16:29:35 +00:00
|
|
|
COMPONENT* component;
|
2012-09-26 17:22:48 +00:00
|
|
|
bool hasFootprint = false;
|
|
|
|
int componentIndex;
|
2012-02-11 09:04:26 +00:00
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
if( m_netlist.IsEmpty() )
|
2012-02-11 09:04:26 +00:00
|
|
|
return;
|
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
// If no component is selected, select the first one
|
2014-07-05 20:42:59 +00:00
|
|
|
if( m_compListBox->GetFirstSelected() < 0 )
|
2012-02-11 09:04:26 +00:00
|
|
|
{
|
2012-09-26 17:22:48 +00:00
|
|
|
componentIndex = 0;
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetSelection( componentIndex, true );
|
2012-02-11 09:04:26 +00:00
|
|
|
}
|
|
|
|
|
2012-09-26 17:22:48 +00:00
|
|
|
// iterate over the selection
|
2014-07-05 20:42:59 +00:00
|
|
|
while( m_compListBox->GetFirstSelected() != -1 )
|
2012-09-26 15:36:48 +00:00
|
|
|
{
|
2013-04-25 16:29:35 +00:00
|
|
|
// Get the component for the current iteration
|
2014-07-05 20:42:59 +00:00
|
|
|
componentIndex = m_compListBox->GetFirstSelected();
|
2013-04-25 16:29:35 +00:00
|
|
|
component = m_netlist.GetComponent( componentIndex );
|
2012-02-11 09:04:26 +00:00
|
|
|
|
2012-09-26 17:22:48 +00:00
|
|
|
if( component == NULL )
|
|
|
|
return;
|
2012-02-11 09:04:26 +00:00
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
// Check to see if the component has already a footprint set.
|
2013-09-08 18:31:21 +00:00
|
|
|
hasFootprint = !component->GetFPID().empty();
|
2012-09-26 15:36:48 +00:00
|
|
|
|
2013-09-14 20:33:22 +00:00
|
|
|
FPID fpid;
|
|
|
|
|
2013-09-17 15:51:05 +00:00
|
|
|
if( !aFootprintName.IsEmpty() )
|
|
|
|
{
|
|
|
|
wxCHECK_RET( fpid.Parse( aFootprintName ) < 0,
|
|
|
|
wxString::Format( wxT( "<%s> is not a valid FPID." ),
|
|
|
|
GetChars( aFootprintName ) ) );
|
|
|
|
}
|
2013-09-14 20:33:22 +00:00
|
|
|
|
|
|
|
component->SetFPID( fpid );
|
2012-02-11 09:04:26 +00:00
|
|
|
|
2012-09-26 17:22:48 +00:00
|
|
|
// create the new component description
|
2014-07-05 20:42:59 +00:00
|
|
|
wxString description = wxString::Format( CMP_FORMAT, componentIndex + 1,
|
2013-04-25 16:29:35 +00:00
|
|
|
GetChars( component->GetReference() ),
|
|
|
|
GetChars( component->GetValue() ),
|
2013-09-08 18:31:21 +00:00
|
|
|
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
|
2012-09-26 17:22:48 +00:00
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
// If the component hasn't had a footprint associated with it
|
2012-09-26 17:22:48 +00:00
|
|
|
// it now has, so we decrement the count of components without
|
|
|
|
// a footprint assigned.
|
|
|
|
if( !hasFootprint )
|
|
|
|
{
|
|
|
|
hasFootprint = true;
|
|
|
|
m_undefinedComponentCnt -= 1;
|
|
|
|
}
|
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
// Set the new description and deselect the processed component
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetString( componentIndex, description );
|
|
|
|
m_compListBox->SetSelection( componentIndex, false );
|
2012-09-26 15:36:48 +00:00
|
|
|
}
|
2012-02-11 09:04:26 +00:00
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
// Mark this "session" as modified
|
2012-09-26 15:36:48 +00:00
|
|
|
m_modified = true;
|
2012-02-11 09:04:26 +00:00
|
|
|
|
2012-09-26 17:22:48 +00:00
|
|
|
// select the next component, if there is one
|
2014-07-05 20:42:59 +00:00
|
|
|
if( componentIndex < (m_compListBox->GetCount() - 1) )
|
2012-09-26 17:22:48 +00:00
|
|
|
componentIndex++;
|
2012-02-11 09:04:26 +00:00
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetSelection( componentIndex, true );
|
2012-02-11 09:04:26 +00:00
|
|
|
|
2012-09-26 17:22:48 +00:00
|
|
|
// update the statusbar
|
|
|
|
DisplayStatus();
|
2012-02-11 09:04:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-09 13:33:04 +00:00
|
|
|
/// Return true if the resultant FPID has a certain nickname. The guess
|
|
|
|
/// is only made if this footprint resides in only one library.
|
|
|
|
/// @return int - 0 on success, 1 on not found, 2 on ambiguous i.e. multiple matches
|
|
|
|
static int guessNickname( FP_LIB_TABLE* aTbl, FPID* aFootprintId )
|
|
|
|
{
|
|
|
|
if( aFootprintId->GetLibNickname().size() )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
wxString nick;
|
|
|
|
wxString fpname = aFootprintId->GetFootprintName();
|
|
|
|
|
|
|
|
std::vector<wxString> nicks = aTbl->GetLogicalLibs();
|
|
|
|
|
|
|
|
// Search each library going through libraries alphabetically.
|
|
|
|
for( unsigned libNdx = 0; libNdx<nicks.size(); ++libNdx )
|
|
|
|
{
|
|
|
|
wxArrayString fpnames = aTbl->FootprintEnumerate( nicks[libNdx] );
|
|
|
|
|
|
|
|
for( unsigned nameNdx = 0; nameNdx<fpnames.size(); ++nameNdx )
|
|
|
|
{
|
|
|
|
if( fpname == fpnames[nameNdx] )
|
|
|
|
{
|
|
|
|
if( !nick )
|
|
|
|
nick = nicks[libNdx];
|
|
|
|
else
|
|
|
|
return 2; // duplicate, the guess would not be certain
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nick.size() )
|
|
|
|
{
|
|
|
|
aFootprintId->SetLibNickname( nick );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
bool hasMissingNicks = false;
|
|
|
|
|
|
|
|
ReadSchematicNetlist();
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
if( m_compListBox == NULL )
|
2014-04-09 13:33:04 +00:00
|
|
|
return false;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LoadProjectFile();
|
2014-04-09 13:33:04 +00:00
|
|
|
LoadFootprintFiles();
|
2014-05-09 18:35:48 +00:00
|
|
|
|
2014-04-09 13:33:04 +00:00
|
|
|
BuildFOOTPRINTS_LISTBOX();
|
|
|
|
BuildLIBRARY_LISTBOX();
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->Clear();
|
2014-04-09 13:33:04 +00:00
|
|
|
m_undefinedComponentCnt = 0;
|
|
|
|
|
|
|
|
if( m_netlist.AnyFootprintsLinked() )
|
|
|
|
{
|
|
|
|
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
|
|
|
{
|
|
|
|
COMPONENT* component = m_netlist.GetComponent( i );
|
|
|
|
|
|
|
|
if( component->GetFPID().empty() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( component->GetFPID().IsLegacy() )
|
|
|
|
hasMissingNicks = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if footprint links were generated before the footprint library table was implemented.
|
|
|
|
if( hasMissingNicks )
|
|
|
|
{
|
|
|
|
msg = wxT(
|
|
|
|
"Some of the assigned footprints are legacy entries (are missing lib nicknames). "
|
|
|
|
"Would you like CvPcb to attempt to convert them to the new required FPID format? "
|
|
|
|
"(If you answer no, then these assignments will be cleared out and you will "
|
|
|
|
"have to re-assign these footprints yourself.)"
|
|
|
|
);
|
|
|
|
|
|
|
|
if( IsOK( this, msg ) )
|
|
|
|
{
|
|
|
|
msg.Clear();
|
|
|
|
|
2014-04-10 21:20:01 +00:00
|
|
|
try
|
2014-04-09 13:33:04 +00:00
|
|
|
{
|
2014-04-10 21:20:01 +00:00
|
|
|
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
2014-04-09 13:33:04 +00:00
|
|
|
{
|
2014-04-10 21:20:01 +00:00
|
|
|
COMPONENT* component = m_netlist.GetComponent( i );
|
2014-04-09 13:33:04 +00:00
|
|
|
|
2014-04-10 21:20:01 +00:00
|
|
|
if( component->GetFPID().IsLegacy() )
|
2014-04-09 13:33:04 +00:00
|
|
|
{
|
2014-05-09 18:35:48 +00:00
|
|
|
// get this first here, it's possibly obsoleted if we get it too soon.
|
|
|
|
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
|
|
|
|
|
2014-04-10 21:20:01 +00:00
|
|
|
int guess = guessNickname( tbl, (FPID*) &component->GetFPID() );
|
|
|
|
|
|
|
|
switch( guess )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
DBG(printf("%s: guessed OK ref:%s fpid:%s\n", __func__,
|
|
|
|
TO_UTF8( component->GetReference() ), component->GetFPID().Format().c_str() );)
|
|
|
|
m_modified = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
msg += wxString::Format( _(
|
|
|
|
"Component '%s' footprint '%s' was <b>not found</b> in any library.\n" ),
|
|
|
|
GetChars( component->GetReference() ),
|
|
|
|
GetChars( component->GetFPID().GetFootprintName() )
|
|
|
|
);
|
|
|
|
break;
|
2014-04-09 13:33:04 +00:00
|
|
|
|
2014-04-10 21:20:01 +00:00
|
|
|
case 2:
|
|
|
|
msg += wxString::Format( _(
|
|
|
|
"Component '%s' footprint '%s' was found in <b>multiple</b> libraries.\n" ),
|
|
|
|
GetChars( component->GetReference() ),
|
|
|
|
GetChars( component->GetFPID().GetFootprintName() )
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
}
|
2014-04-09 13:33:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-04-10 21:20:01 +00:00
|
|
|
catch( const IO_ERROR& ioe )
|
|
|
|
{
|
|
|
|
wxString msg = ioe.errorText;
|
|
|
|
msg += wxT( "\n\n" );
|
|
|
|
msg += _( "First check your fp-lib-table entries." );
|
|
|
|
|
|
|
|
wxMessageBox( msg, wxT( "Problematic fp-lib-tables" ) );
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-09 13:33:04 +00:00
|
|
|
|
|
|
|
if( msg.size() )
|
|
|
|
{
|
|
|
|
HTML_MESSAGE_BOX dlg( this, wxEmptyString );
|
|
|
|
|
|
|
|
dlg.MessageSet( wxT( "The following errors occurred attempting to convert the "
|
|
|
|
"footprint assignments:\n\n" ) );
|
|
|
|
dlg.ListSet( msg );
|
|
|
|
dlg.MessageSet( wxT( "\nYou will need to reassign them manually if you want them "
|
|
|
|
"to be updated correctly the next time you import the "
|
|
|
|
"netlist in Pcbnew." ) );
|
2014-04-10 21:20:01 +00:00
|
|
|
|
|
|
|
#if 1
|
2014-04-09 13:33:04 +00:00
|
|
|
dlg.ShowModal();
|
2014-04-10 21:20:01 +00:00
|
|
|
#else
|
|
|
|
dlg.Fit();
|
|
|
|
dlg.Show( true ); // modeless lets user watch while fixing the problems, but its not working.
|
|
|
|
#endif
|
2014-04-09 13:33:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Clear the legacy footprint assignments.
|
|
|
|
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
|
|
|
{
|
|
|
|
COMPONENT* component = m_netlist.GetComponent( i );
|
|
|
|
|
|
|
|
if( component->GetFPID().IsLegacy() )
|
|
|
|
{
|
|
|
|
component->SetFPID( FPID() /* empty */ );
|
|
|
|
m_modified = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
|
|
|
{
|
|
|
|
COMPONENT* component = m_netlist.GetComponent( i );
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
|
2014-04-09 13:33:04 +00:00
|
|
|
GetChars( component->GetReference() ),
|
|
|
|
GetChars( component->GetValue() ),
|
|
|
|
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->AppendLine( msg );
|
2014-04-09 13:33:04 +00:00
|
|
|
|
|
|
|
if( component->GetFPID().empty() )
|
|
|
|
{
|
|
|
|
m_undefinedComponentCnt += 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !m_netlist.IsEmpty() )
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetSelection( 0, true );
|
2014-04-09 13:33:04 +00:00
|
|
|
|
|
|
|
DisplayStatus();
|
|
|
|
|
|
|
|
UpdateTitle();
|
|
|
|
|
|
|
|
UpdateFileHistory( m_NetlistFileName.GetFullPath() );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-11 09:04:26 +00:00
|
|
|
int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
|
|
|
|
{
|
|
|
|
wxFileName fn;
|
|
|
|
|
|
|
|
if( !aFullFileName.IsEmpty() )
|
|
|
|
{
|
|
|
|
fn = m_NetlistFileName;
|
|
|
|
fn.SetExt( ComponentFileExtension );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-29 16:50:10 +00:00
|
|
|
wxFileDialog dlg( this, _( "Save Component Footprint Link File" ), wxEmptyString,
|
|
|
|
_( "Unnamed file" ), ComponentFileWildcard, wxFD_SAVE );
|
2012-02-11 09:04:26 +00:00
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
fn = dlg.GetPath();
|
|
|
|
|
|
|
|
if( !fn.HasExt() )
|
|
|
|
fn.SetExt( ComponentFileExtension );
|
2013-10-13 16:29:20 +00:00
|
|
|
|
2014-07-07 04:12:04 +00:00
|
|
|
#if 0 // RHH 6-Jul-14: We did not auto generate the
|
|
|
|
// footprint table. And the dialog which does suppport editing does the saving.
|
|
|
|
// Besides, this is not the place to do this, it belies the name of this
|
|
|
|
// function.
|
|
|
|
|
2013-10-13 16:29:20 +00:00
|
|
|
// Save the project specific footprint library table.
|
2014-05-09 18:35:48 +00:00
|
|
|
if( !Prj().PcbFootprintLibs()->IsEmpty( false ) )
|
2013-10-13 16:29:20 +00:00
|
|
|
{
|
2014-03-21 01:24:35 +00:00
|
|
|
wxString fp_lib_tbl = Prj().FootprintLibTblName();
|
2013-10-13 16:29:20 +00:00
|
|
|
|
2014-03-21 01:24:35 +00:00
|
|
|
if( wxFileName::FileExists( fp_lib_tbl )
|
2013-10-26 18:17:44 +00:00
|
|
|
&& IsOK( this, _( "A footprint library table already exists in this path.\n\nDo "
|
2013-10-13 16:29:20 +00:00
|
|
|
"you want to overwrite it?" ) ) )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2014-05-09 18:35:48 +00:00
|
|
|
Prj().PcbFootprintLibs()->Save( fp_lib_tbl );
|
2013-10-13 16:29:20 +00:00
|
|
|
}
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
catch( const IO_ERROR& ioe )
|
2013-10-13 16:29:20 +00:00
|
|
|
{
|
2014-03-21 01:24:35 +00:00
|
|
|
wxString msg = wxString::Format( _(
|
|
|
|
"An error occurred attempting to save the "
|
|
|
|
"footprint library table '%s'\n\n%s" ),
|
|
|
|
GetChars( fp_lib_tbl ),
|
|
|
|
GetChars( ioe.errorText )
|
|
|
|
);
|
|
|
|
DisplayError( this, msg );
|
2013-10-13 16:29:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-07 04:12:04 +00:00
|
|
|
#endif
|
|
|
|
|
2012-02-11 09:04:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !IsWritable( fn.GetFullPath() ) )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if( WriteComponentLinkFile( fn.GetFullPath() ) == 0 )
|
|
|
|
{
|
2013-04-25 16:29:35 +00:00
|
|
|
DisplayError( this, _( "Unable to create component footprint link file (.cmp)" ) );
|
2012-02-11 09:04:26 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-04-18 02:05:40 +00:00
|
|
|
wxString msg = wxString::Format( _("File %s saved"), GetChars( fn.GetFullPath() ) );
|
2014-07-07 04:12:04 +00:00
|
|
|
|
|
|
|
// Perhaps this replaces all of the above someday.
|
|
|
|
{
|
|
|
|
STRING_FORMATTER sf;
|
|
|
|
|
|
|
|
m_netlist.FormatBackAnnotation( &sf );
|
2014-07-28 12:16:14 +00:00
|
|
|
|
2014-07-07 04:12:04 +00:00
|
|
|
Kiway().ExpressMail( FRAME_SCH, MAIL_BACKANNOTATE_FOOTPRINTS, sf.GetString() );
|
|
|
|
}
|
|
|
|
|
2012-02-11 09:04:26 +00:00
|
|
|
SetStatusText( msg );
|
|
|
|
return 1;
|
|
|
|
}
|