Add text item property options when updating footprints.

Fixes: lp:1753286
* https://bugs.launchpad.net/kicad/+bug/1753286

(cherry picked from commit b94dd87)
This commit is contained in:
Jeff Young 2018-04-18 10:31:33 +01:00
parent bbc25cd694
commit 2283bcda4c
8 changed files with 591 additions and 651 deletions

View File

@ -176,6 +176,7 @@ set( PCBNEW_IMPORT_DXF
set( PCBNEW_EXPORTERS set( PCBNEW_EXPORTERS
exporters/export_d356.cpp exporters/export_d356.cpp
exporters/export_footprint_associations.cpp
exporters/export_gencad.cpp exporters/export_gencad.cpp
exporters/export_idf.cpp exporters/export_idf.cpp
exporters/export_vrml.cpp exporters/export_vrml.cpp

View File

@ -26,26 +26,17 @@
#include <fctsys.h> #include <fctsys.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <class_draw_panel_gal.h>
#include <confirm.h>
#include <kicad_string.h>
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <macros.h> #include <macros.h>
#include <board_commit.h> #include <board_commit.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <project.h> #include <project.h>
#include <wx_html_report_panel.h> #include <wx_html_report_panel.h>
#include <pcbnew.h>
#include <dialog_exchange_footprints.h>
#include <wildcards_and_files_ext.h>
#include <kiway.h> #include <kiway.h>
#include <dialog_exchange_footprints.h>
static bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName );
#define ID_MATCH_FP_ALL 4200 #define ID_MATCH_FP_ALL 4200
@ -59,59 +50,38 @@ int DIALOG_EXCHANGE_FOOTPRINTS::m_matchModeForUpdateSelected = ID_MATCH_FP_REF
int DIALOG_EXCHANGE_FOOTPRINTS::m_matchModeForExchangeSelected = ID_MATCH_FP_REF; int DIALOG_EXCHANGE_FOOTPRINTS::m_matchModeForExchangeSelected = ID_MATCH_FP_REF;
DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* parent, MODULE* Module, DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, MODULE* aModule,
bool updateMode ) : bool updateMode ) :
DIALOG_EXCHANGE_FOOTPRINTS_BASE( parent ), m_commit( parent ) DIALOG_EXCHANGE_FOOTPRINTS_BASE( aParent ),
m_commit( aParent ),
m_parent( aParent ),
m_currentModule( aModule ),
m_updateMode( updateMode )
{ {
m_parent = parent;
m_currentModule = Module;
m_updateMode = updateMode;
init( m_updateMode );
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
// because the update and change versions of this dialog have different controls.
m_hash_key = TO_UTF8( GetTitle() );
// Ensure m_closeButton (with id = wxID_CANCEL) has the right label
// (to fix automatic renaming of button label )
m_closeButton->SetLabel( _( "Close" ) );
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
void DIALOG_EXCHANGE_FOOTPRINTS::OnQuit( wxCommandEvent& event )
{
Show( false );
EndQuasiModal( wxID_CANCEL );
}
void DIALOG_EXCHANGE_FOOTPRINTS::init( bool updateMode )
{
SetFocus();
wxString title = updateMode ? _( "Update Footprints from Library" ) : _( "Change Footprints" ); wxString title = updateMode ? _( "Update Footprints from Library" ) : _( "Change Footprints" );
wxString verb = updateMode ? _( "Update" ) : _( "Change" ); wxString verb = updateMode ? _( "Update" ) : _( "Change" );
wxString label; wxString label;
SetTitle( title ); SetTitle( title );
if( updateMode ) if( m_updateMode )
{ {
label.Printf( m_matchAll->GetLabel(), verb ); label.Printf( m_matchAll->GetLabel(), verb );
m_matchAll->SetLabel( label ); m_matchAll->SetLabel( label );
m_changeSizer->Show( false );
m_middleSizer->Show( false );
} }
else else
{ {
m_upperSizer->FindItem( m_matchAll )->Show( false ); m_upperSizer->FindItem( m_matchAll )->Show( false );
if( m_currentModule ) if( m_currentModule )
{
m_newID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) ); m_newID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
SetInitialFocus( m_newID );
}
else
SetInitialFocus( m_specifiedRef );
m_newIDBrowseButton->SetBitmap( KiBitmap( library_browse_xpm ) ); m_newIDBrowseButton->SetBitmap( KiBitmap( library_browse_xpm ) );
} }
@ -171,6 +141,19 @@ void DIALOG_EXCHANGE_FOOTPRINTS::init( bool updateMode )
case ID_MATCH_FP_ID: case ID_MATCH_FP_ID:
OnMatchIDClicked( event ); OnMatchIDClicked( event );
} }
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
// because the update and change versions of this dialog have different controls.
m_hash_key = TO_UTF8( GetTitle() );
// Ensure m_closeButton (with id = wxID_CANCEL) has the right label
// (to fix automatic renaming of button label )
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizer1Apply->SetDefault();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
} }
@ -209,15 +192,14 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::isMatch( MODULE* aModule )
case ID_MATCH_FP_ALL: case ID_MATCH_FP_ALL:
return true; return true;
case ID_MATCH_FP_REF: case ID_MATCH_FP_REF:
// currentModule case goes through changeCurrentFootprint, so we only have // currentModule case goes through processCurrentModule, so we only have
// to handle specifiedRef case // to handle specifiedRef case
return aModule->GetReference() == m_specifiedRef->GetValue(); return aModule->GetReference() == m_specifiedRef->GetValue();
case ID_MATCH_FP_VAL: case ID_MATCH_FP_VAL:
// currentValue must also check FPID so we don't get accidental matches that // currentValue must also check FPID so we don't get accidental matches that
// the user didn't intend // the user didn't intend
if( m_currentModule ) if( m_currentModule )
return aModule->GetValue() == m_currentModule->GetValue() return aModule->GetValue() == m_currentModule->GetValue() && aModule->GetFPID() == m_currentModule->GetFPID();
&& aModule->GetFPID() == m_currentModule->GetFPID();
else else
return aModule->GetValue() == m_specifiedValue->GetValue(); return aModule->GetValue() == m_specifiedValue->GetValue();
case ID_MATCH_FP_ID: case ID_MATCH_FP_ID:
@ -305,17 +287,18 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked( wxCommandEvent& event )
} }
void DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClick( wxCommandEvent& event ) void DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClicked( wxCommandEvent& event )
{ {
bool result = false; bool result = false;
wxBusyCursor dummy;
m_MessageWindow->Clear(); m_MessageWindow->Clear();
m_MessageWindow->Flush( true ); m_MessageWindow->Flush( true );
if( getMatchMode() == ID_MATCH_FP_REF && m_currentModule ) if( getMatchMode() == ID_MATCH_FP_REF && m_currentModule )
result = changeCurrentFootprint(); result = processCurrentModule();
else else
result = changeSameFootprints(); result = processMatchingModules();
if( result ) if( result )
{ {
@ -329,126 +312,100 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClick( wxCommandEvent& event )
} }
void DIALOG_EXCHANGE_FOOTPRINTS::RebuildCmpList( wxCommandEvent& event ) bool DIALOG_EXCHANGE_FOOTPRINTS::processCurrentModule()
{ {
wxString msg; LIB_ID newFPID;
REPORTER& reporter = m_MessageWindow->Reporter();
m_MessageWindow->Clear();
m_MessageWindow->Flush( true );
// Build the .cmp file name from the board name if( m_updateMode )
wxFileName fn = m_parent->GetBoard()->GetFileName(); newFPID = m_currentModule->GetFPID();
fn.SetExt( ComponentFileExtension );
if( RecreateCmpFile( m_parent->GetBoard(), fn.GetFullPath() ) )
{
msg.Printf( _( "File \"%s\" created\n" ), GetChars( fn.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_INFO );
}
else else
{ {
msg.Printf( _( "** Could not create file \"%s\" ***\n" ), wxString newFPIDStr = m_newID->GetValue();
GetChars( fn.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ERROR ); if( newFPIDStr.IsEmpty() )
return false;
newFPID = LIB_ID( newFPIDStr );
} }
return processModule( m_currentModule, newFPID );
} }
bool DIALOG_EXCHANGE_FOOTPRINTS::changeCurrentFootprint() bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules()
{
if( m_updateMode )
return change_1_Module( m_currentModule, m_currentModule->GetFPID(), true );
wxString newFPID = m_newID->GetValue();
if( newFPID == wxEmptyString )
return false;
return change_1_Module( m_currentModule, newFPID, true );
}
bool DIALOG_EXCHANGE_FOOTPRINTS::changeSameFootprints()
{ {
MODULE* Module; MODULE* Module;
MODULE* PtBack; MODULE* PtBack;
bool change = false; bool change = false;
wxString newFPID = m_newID->GetValue(); wxString newFPID = m_newID->GetValue();
wxString value; wxString value;
int ShowErr = 3; // Post 3 error messages max.
if( m_parent->GetBoard()->m_Modules == NULL ) if( !m_parent->GetBoard()->m_Modules )
return false; return false;
if( !m_updateMode && newFPID == wxEmptyString ) if( !m_updateMode && newFPID == wxEmptyString )
return false; return false;
/* The change is done from the last module because /* The change is done from the last module because processModule() modifies the last item
* change_1_Module () modifies the last item in the list. * in the list.
* * Note: for the first module in chain (the last here), Module->Back() points to the board
* note: for the first module in chain (the last here), Module->Back() * or is NULL.
* points the board or is NULL
*/ */
Module = m_parent->GetBoard()->m_Modules.GetLast(); Module = m_parent->GetBoard()->m_Modules.GetLast();
for( ; Module && ( Module->Type() == PCB_MODULE_T ); Module = PtBack ) for( ; Module && Module->Type() == PCB_MODULE_T; Module = PtBack )
{ {
PtBack = Module->Back(); PtBack = Module->Back();
if( !isMatch( Module ) ) if( !isMatch( Module ) )
continue; continue;
bool result;
if( m_updateMode ) if( m_updateMode )
result = change_1_Module( Module, Module->GetFPID(), ShowErr ); {
if( processModule( Module, Module->GetFPID()) )
change = true;
}
else else
result = change_1_Module( Module, newFPID, ShowErr ); {
if( processModule( Module, newFPID ) )
if( result ) change = true;
change = true; }
else if( ShowErr )
ShowErr--;
} }
return change; return change;
} }
bool DIALOG_EXCHANGE_FOOTPRINTS::change_1_Module( MODULE* aModule, bool DIALOG_EXCHANGE_FOOTPRINTS::processModule( MODULE* aModule, const LIB_ID& aNewFPID )
const LIB_ID& aNewFootprintFPID,
bool aShowError )
{ {
MODULE* newModule; LIB_ID oldFPID = aModule->GetFPID();
wxString msg;
if( aModule == NULL )
return false;
wxBusyCursor dummy;
REPORTER& reporter = m_MessageWindow->Reporter(); REPORTER& reporter = m_MessageWindow->Reporter();
wxString msg;
// Copy parameters from the old footprint. // Load new module.
LIB_ID oldFootprintFPID = aModule->GetFPID(); msg.Printf( _( "%s footprint \"%s\" (from \"%s\") to \"%s\"" ),
m_updateMode ? _( "Update" ) : _( "Change" ),
aModule->GetReference(),
oldFPID.Format().c_str(),
aNewFPID.Format().c_str() );
// Load module. MODULE* newModule = m_parent->LoadFootprint( aNewFPID );
msg.Printf( _( "Change footprint \"%s\" (from \"%s\") to \"%s\"" ),
GetChars( aModule->GetReference() ),
oldFootprintFPID.Format().c_str(),
aNewFootprintFPID.Format().c_str() );
newModule = m_parent->LoadFootprint( aNewFootprintFPID ); if( !newModule )
if( newModule == NULL ) // New module not found.
{ {
msg << ": " << _( "footprint not found" ); msg << ": " << _( "*** footprint not found ***" );
reporter.Report( msg, REPORTER::RPT_ERROR ); reporter.Report( msg, REPORTER::RPT_ERROR );
return false; return false;
} }
m_parent->Exchange_Module( aModule, newModule, m_commit ); m_parent->Exchange_Module( aModule, newModule, m_commit,
m_removeExtraBox->GetValue(),
m_resetTextItemLayers->GetValue(),
m_resetTextItemEffects->GetValue() );
if( aModule == m_currentModule ) if( aModule == m_currentModule )
m_currentModule = newModule; m_currentModule = newModule;
if( aModule == m_parent->GetCurItem() ) if( aModule == m_parent->GetCurItem() )
m_parent->SetCurItem( newModule ); m_parent->SetCurItem( newModule );
@ -459,48 +416,89 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::change_1_Module( MODULE* aModule,
} }
void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule, void processTextItem( const TEXTE_MODULE& aSrc, TEXTE_MODULE& aDest,
MODULE* aNewModule, bool resetText, bool resetTextLayers, bool resetTextEffects )
BOARD_COMMIT& aCommit )
{ {
aNewModule->SetParent( GetBoard() ); if( !resetText )
aDest.SetText( aSrc.GetText() );
if( !resetTextLayers )
{
aDest.SetLayer( aSrc.GetLayer() );
aDest.SetVisible( aSrc.IsVisible() );
}
if( !resetTextEffects )
aDest.SetEffects( aSrc );
}
TEXTE_MODULE* getMatchingTextItem( TEXTE_MODULE* aRefItem, MODULE* aModule )
{
for( auto iItem = aModule->GraphicalItemsList().GetFirst(); iItem; iItem = iItem->Next() )
{
TEXTE_MODULE* candidate = dyn_cast<TEXTE_MODULE*>( iItem );
if( candidate && candidate->GetText() == aRefItem->GetText() )
return candidate;
}
return nullptr;
}
void PCB_EDIT_FRAME::Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT& aCommit,
bool deleteExtraTexts,
bool resetTextLayers, bool resetTextEffects )
{
aDest->SetParent( GetBoard() );
/* place module without ratsnest refresh: this will be made later /* place module without ratsnest refresh: this will be made later
* when all modules are on board */ * when all modules are on board */
PlaceModule( aNewModule, NULL, false ); PlaceModule( aDest, nullptr, false );
// Copy full placement and pad net names (when possible) // Copy full placement and pad net names (when possible)
// but not local settings like clearances (use library values) // but not local settings like clearances (use library values)
aOldModule->CopyNetlistSettings( aNewModule, false ); aSrc->CopyNetlistSettings( aDest, false );
// Copy reference // Copy reference
aNewModule->SetReference( aOldModule->GetReference() ); processTextItem( aSrc->Reference(), aDest->Reference(),
// never reset reference text
false,
resetTextLayers, resetTextEffects );
// Copy value unless it is a proxy for the footprint ID (a good example is replacing a // Copy value
// footprint with value "MoutingHole-2.5mm" with one of value "MountingHole-4mm"). processTextItem( aSrc->Value(), aDest->Value(),
if( aOldModule->GetValue() != aOldModule->GetFPID().GetLibItemName() ) // reset value text only when it is a proxy for the footprint ID
aNewModule->SetValue( aOldModule->GetValue() ); // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
aSrc->GetValue() == aSrc->GetFPID().GetLibItemName(),
resetTextLayers, resetTextEffects );
// Compare the footprint name only, in case the nickname is empty or in case // Copy fields in accordance with the reset* flags
// user moved the footprint to a new library. Chances are if footprint name is for( BOARD_ITEM* item = aSrc->GraphicalItemsList().GetFirst(); item; item = item->Next() )
// same then the footprint is very nearly the same and the two texts should
// be kept at same size, position, and rotation.
if( aNewModule->GetFPID().GetLibItemName() == aOldModule->GetFPID().GetLibItemName() )
{ {
aNewModule->Reference().SetEffects( aOldModule->Reference() ); TEXTE_MODULE* srcItem = dyn_cast<TEXTE_MODULE*>( item );
aNewModule->Value().SetEffects( aOldModule->Value() );
if( srcItem )
{
TEXTE_MODULE* destItem = getMatchingTextItem( srcItem, aDest );
if( destItem )
processTextItem( *srcItem, *destItem, false, resetTextLayers, resetTextEffects );
else if( !deleteExtraTexts )
aDest->GraphicalItemsList().Append( new TEXTE_MODULE( *srcItem ) );
}
} }
// Updating other parameters // Updating other parameters
aNewModule->SetTimeStamp( aOldModule->GetTimeStamp() ); aDest->SetTimeStamp( aSrc->GetTimeStamp() );
aNewModule->SetPath( aOldModule->GetPath() ); aDest->SetPath( aSrc->GetPath() );
aCommit.Remove( aOldModule ); aCommit.Remove( aSrc );
aCommit.Add( aNewModule ); aCommit.Add( aDest );
// @todo LEGACY should be unnecessary // @todo LEGACY should be unnecessary
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
aNewModule->ClearFlags(); aDest->ClearFlags();
} }
@ -522,73 +520,3 @@ void DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint( wxCommandEvent& event )
} }
void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
{
wxFileName fn;
MODULE* module = GetBoard()->m_Modules;
wxString msg;
wxString wildcard;
if( module == NULL )
{
DisplayError( this, _( "No footprints!" ) );
return;
}
// Build the .cmp file name from the board name
fn = GetBoard()->GetFileName();
fn.SetExt( ComponentFileExtension );
wildcard = ComponentFileWildcard();
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
wxFileDialog dlg( this, _( "Save Footprint Association File" ), pro_dir,
fn.GetFullName(), wildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
fn = dlg.GetPath();
if( ! RecreateCmpFile( GetBoard(), fn.GetFullPath() ) )
{
msg.Printf( _( "Could not create file \"%s\"" ), GetChars(fn.GetFullPath() ) );
DisplayError( this, msg );
return;
}
}
bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName )
{
FILE* cmpFile;
cmpFile = wxFopen( aFullCmpFileName, wxT( "wt" ) );
if( cmpFile == NULL )
return false;
fprintf( cmpFile, "Cmp-Mod V01 Created by PcbNew date = %s\n", TO_UTF8( DateAndTime() ) );
MODULE* module = aBrd->m_Modules;
for( ; module != NULL; module = module->Next() )
{
fprintf( cmpFile, "\nBeginCmp\n" );
fprintf( cmpFile, "TimeStamp = %8.8lX\n", (unsigned long)module->GetTimeStamp() );
fprintf( cmpFile, "Path = %s\n", TO_UTF8( module->GetPath() ) );
fprintf( cmpFile, "Reference = %s;\n",
!module->GetReference().IsEmpty() ?
TO_UTF8( module->GetReference() ) : "[NoRef]" );
fprintf( cmpFile, "ValeurCmp = %s;\n",
!module->GetValue().IsEmpty() ?
TO_UTF8( module->GetValue() ) : "[NoVal]" );
fprintf( cmpFile, "IdModule = %s;\n", module->GetFPID().Format().c_str() );
fprintf( cmpFile, "EndCmp\n" );
}
fprintf( cmpFile, "\nEndListe\n" );
fclose( cmpFile );
return true;
}

View File

@ -2,7 +2,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) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr * Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
@ -35,6 +35,7 @@ class MODULE;
class DIALOG_EXCHANGE_FOOTPRINTS : public DIALOG_EXCHANGE_FOOTPRINTS_BASE class DIALOG_EXCHANGE_FOOTPRINTS : public DIALOG_EXCHANGE_FOOTPRINTS_BASE
{ {
private: private:
BOARD_COMMIT m_commit;
PCB_EDIT_FRAME* m_parent; PCB_EDIT_FRAME* m_parent;
MODULE* m_currentModule; MODULE* m_currentModule;
bool m_updateMode; bool m_updateMode;
@ -45,7 +46,6 @@ private:
public: public:
DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, MODULE* aModule, bool updateMode ); DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, MODULE* aModule, bool updateMode );
~DIALOG_EXCHANGE_FOOTPRINTS() { };
private: private:
void updateMatchModeRadioButtons( wxUpdateUIEvent& event ) override; void updateMatchModeRadioButtons( wxUpdateUIEvent& event ) override;
@ -53,12 +53,8 @@ private:
void OnMatchRefClicked( wxCommandEvent& event ) override; void OnMatchRefClicked( wxCommandEvent& event ) override;
void OnMatchValueClicked( wxCommandEvent& event ) override; void OnMatchValueClicked( wxCommandEvent& event ) override;
void OnMatchIDClicked( wxCommandEvent& event ) override; void OnMatchIDClicked( wxCommandEvent& event ) override;
void OnApplyClick( wxCommandEvent& event ) override; void OnApplyClicked( wxCommandEvent& event ) override;
void OnQuit( wxCommandEvent& event ) override;
void ViewAndSelectFootprint( wxCommandEvent& event ) override; void ViewAndSelectFootprint( wxCommandEvent& event ) override;
void RebuildCmpList( wxCommandEvent& event ) override;
void init( bool updateMode );
int getMatchMode(); int getMatchMode();
void setMatchMode( int aMatchMode ); void setMatchMode( int aMatchMode );
@ -66,13 +62,9 @@ private:
wxRadioButton* getRadioButtonForMode(); wxRadioButton* getRadioButtonForMode();
bool isMatch( MODULE* ); bool isMatch( MODULE* );
bool changeCurrentFootprint(); bool processCurrentModule();
bool changeSameFootprints(); bool processMatchingModules();
bool change_1_Module( MODULE* aModule, bool processModule( MODULE* aModule, const LIB_ID& aNewFPID );
const LIB_ID& aNewFootprintFPID,
bool eShowError );
BOARD_COMMIT m_commit;
}; };
#endif // DIALOG_EXCHANGE_FOOTPRINTS_H_ #endif // DIALOG_EXCHANGE_FOOTPRINTS_H_

View File

@ -1,8 +1,8 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 4 2017) // C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#include "wx_html_report_panel.h" #include "wx_html_report_panel.h"
@ -67,16 +67,16 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* pare
m_mainSizer->Add( m_upperSizer, 0, wxALL|wxEXPAND, 5 ); m_mainSizer->Add( m_upperSizer, 0, wxALL|wxEXPAND, 5 );
m_middleSizer = new wxBoxSizer( wxVERTICAL ); m_changeSizer = new wxBoxSizer( wxVERTICAL );
wxStaticLine* staticline1; wxStaticLine* staticline1;
staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_middleSizer->Add( staticline1, 0, wxBOTTOM|wxEXPAND, 2 ); m_changeSizer->Add( staticline1, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 2 );
wxStaticText* newIdLabel; wxStaticText* newIdLabel;
newIdLabel = new wxStaticText( this, wxID_ANY, _("New footprint identifier:"), wxDefaultPosition, wxDefaultSize, 0 ); newIdLabel = new wxStaticText( this, wxID_ANY, _("New footprint identifier:"), wxDefaultPosition, wxDefaultSize, 0 );
newIdLabel->Wrap( -1 ); newIdLabel->Wrap( -1 );
m_middleSizer->Add( newIdLabel, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 ); m_changeSizer->Add( newIdLabel, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer2; wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 0, 2, 0, 0 ); fgSizer2 = new wxFlexGridSizer( 0, 2, 0, 0 );
@ -93,45 +93,44 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* pare
fgSizer2->Add( m_newIDBrowseButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0 ); fgSizer2->Add( m_newIDBrowseButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0 );
m_middleSizer->Add( fgSizer2, 0, wxEXPAND, 0 ); m_changeSizer->Add( fgSizer2, 0, wxEXPAND, 0 );
m_mainSizer->Add( m_middleSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_mainSizer->Add( m_changeSizer, 0, wxEXPAND|wxALL, 5 );
m_updateOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Update Options") ), wxVERTICAL );
m_removeExtraBox = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Remove text items which are not in library footprint"), wxDefaultPosition, wxDefaultSize, 0 );
m_removeExtraBox->SetToolTip( _("Removes fields that do not occur in the original library symbols") );
m_updateOptionsSizer->Add( m_removeExtraBox, 0, wxBOTTOM|wxRIGHT, 5 );
m_resetTextItemLayers = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset text layers and visibilities"), wxDefaultPosition, wxDefaultSize, 0 );
m_updateOptionsSizer->Add( m_resetTextItemLayers, 0, wxBOTTOM|wxRIGHT, 5 );
m_resetTextItemEffects = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset text sizes, styles and positions"), wxDefaultPosition, wxDefaultSize, 0 );
m_updateOptionsSizer->Add( m_resetTextItemEffects, 0, wxBOTTOM|wxRIGHT, 5 );
m_mainSizer->Add( m_updateOptionsSizer, 0, wxEXPAND|wxALL, 5 );
m_MessageWindow = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_MessageWindow = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_MessageWindow->SetMinSize( wxSize( -1,300 ) ); m_MessageWindow->SetMinSize( wxSize( -1,240 ) );
m_mainSizer->Add( m_MessageWindow, 5, wxALL|wxEXPAND, 5 ); m_mainSizer->Add( m_MessageWindow, 5, wxALL|wxEXPAND, 5 );
wxStaticLine* staticline2; wxStaticLine* staticline2;
staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_mainSizer->Add( staticline2, 0, wxEXPAND | wxALL, 5 ); m_mainSizer->Add( staticline2, 0, wxEXPAND|wxALL, 5 );
wxBoxSizer* bottomSizer; m_sdbSizer1 = new wxStdDialogButtonSizer();
bottomSizer = new wxBoxSizer( wxHORIZONTAL ); m_sdbSizer1Apply = new wxButton( this, wxID_APPLY );
m_sdbSizer1->AddButton( m_sdbSizer1Apply );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_exportButton = new wxButton( this, wxID_ANY, _("Export Footprint Associations"), wxDefaultPosition, wxDefaultSize, 0 ); m_mainSizer->Add( m_sdbSizer1, 0, wxEXPAND, 5 );
bottomSizer->Add( m_exportButton, 0, wxALL, 5 );
wxBoxSizer* paddingSizer;
paddingSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText* padding1;
padding1 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
padding1->Wrap( -1 );
paddingSizer->Add( padding1, 1, wxALL, 5 );
bottomSizer->Add( paddingSizer, 1, 0, 5 );
m_applyButton = new wxButton( this, wxID_ANY, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
bottomSizer->Add( m_applyButton, 0, wxALL, 5 );
m_closeButton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bottomSizer->Add( m_closeButton, 0, wxALL, 5 );
m_mainSizer->Add( bottomSizer, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( m_mainSizer ); this->SetSizer( m_mainSizer );
@ -152,9 +151,7 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* pare
m_matchSpecifiedID->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnMatchIDClicked ), NULL, this ); m_matchSpecifiedID->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnMatchIDClicked ), NULL, this );
m_specifiedIDBrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this ); m_specifiedIDBrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this );
m_newIDBrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this ); m_newIDBrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this );
m_exportButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::RebuildCmpList ), NULL, this ); m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnApplyClicked ), NULL, this );
m_applyButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnApplyClick ), NULL, this );
m_closeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnQuit ), NULL, this );
} }
DIALOG_EXCHANGE_FOOTPRINTS_BASE::~DIALOG_EXCHANGE_FOOTPRINTS_BASE() DIALOG_EXCHANGE_FOOTPRINTS_BASE::~DIALOG_EXCHANGE_FOOTPRINTS_BASE()
@ -173,8 +170,6 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::~DIALOG_EXCHANGE_FOOTPRINTS_BASE()
m_matchSpecifiedID->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnMatchIDClicked ), NULL, this ); m_matchSpecifiedID->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnMatchIDClicked ), NULL, this );
m_specifiedIDBrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this ); m_specifiedIDBrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this );
m_newIDBrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this ); m_newIDBrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this );
m_exportButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::RebuildCmpList ), NULL, this ); m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnApplyClicked ), NULL, this );
m_applyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnApplyClick ), NULL, this );
m_closeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnQuit ), NULL, this );
} }

View File

@ -1051,16 +1051,16 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_middleSizer</property> <property name="name">m_changeSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">2</property> <property name="border">2</property>
<property name="flag">wxBOTTOM|wxEXPAND</property> <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticLine" expanded="1"> <object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -1426,6 +1426,285 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Update Options</property>
<property name="minimum_size"></property>
<property name="name">m_updateOptionsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Remove text items which are not in library footprint</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_removeExtraBox</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Removes fields that do not occur in the original library symbols</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Reset text layers and visibilities</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_resetTextItemLayers</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Reset text sizes, styles and positions</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_resetTextItemEffects</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
@ -1463,7 +1742,7 @@
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property> <property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size">-1,300</property> <property name="minimum_size">-1,240</property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_MessageWindow</property> <property name="name">m_MessageWindow</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
@ -1508,7 +1787,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticLine" expanded="1"> <object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -1589,371 +1868,28 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">1</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">0</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bottomSizer</property> <property name="name">m_sdbSizer1</property>
<property name="orient">wxHORIZONTAL</property> <property name="permission">protected</property>
<property name="permission">none</property> <event name="OnApplyButtonClick">OnApplyClicked</event>
<object class="sizeritem" expanded="1"> <event name="OnCancelButtonClick"></event>
<property name="border">5</property> <event name="OnContextHelpButtonClick"></event>
<property name="flag">wxALL</property> <event name="OnHelpButtonClick"></event>
<property name="proportion">0</property> <event name="OnNoButtonClick"></event>
<object class="wxButton" expanded="1"> <event name="OnOKButtonClick"></event>
<property name="BottomDockable">1</property> <event name="OnSaveButtonClick"></event>
<property name="LeftDockable">1</property> <event name="OnYesButtonClick"></event>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Export Footprint Associations</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_exportButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; </property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">RebuildCmpList</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">paddingSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">padding1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">none</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; </property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Apply</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_applyButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; </property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnApplyClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Close</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_closeButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; </property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnQuit</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>

View File

@ -1,8 +1,8 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 4 2017) // C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EXCHANGE_FOOTPRINTS_BASE_H__ #ifndef __DIALOG_EXCHANGE_FOOTPRINTS_BASE_H__
@ -11,7 +11,6 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
class WX_HTML_REPORT_PANEL; class WX_HTML_REPORT_PANEL;
#include "dialog_shim.h" #include "dialog_shim.h"
@ -31,6 +30,8 @@ class WX_HTML_REPORT_PANEL;
#include <wx/gbsizer.h> #include <wx/gbsizer.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/dialog.h> #include <wx/dialog.h>
@ -57,13 +58,17 @@ class DIALOG_EXCHANGE_FOOTPRINTS_BASE : public DIALOG_SHIM
wxRadioButton* m_matchSpecifiedID; wxRadioButton* m_matchSpecifiedID;
wxTextCtrl* m_specifiedID; wxTextCtrl* m_specifiedID;
wxBitmapButton* m_specifiedIDBrowseButton; wxBitmapButton* m_specifiedIDBrowseButton;
wxBoxSizer* m_middleSizer; wxBoxSizer* m_changeSizer;
wxTextCtrl* m_newID; wxTextCtrl* m_newID;
wxBitmapButton* m_newIDBrowseButton; wxBitmapButton* m_newIDBrowseButton;
wxStaticBoxSizer* m_updateOptionsSizer;
wxCheckBox* m_removeExtraBox;
wxCheckBox* m_resetTextItemLayers;
wxCheckBox* m_resetTextItemEffects;
WX_HTML_REPORT_PANEL* m_MessageWindow; WX_HTML_REPORT_PANEL* m_MessageWindow;
wxButton* m_exportButton; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_applyButton; wxButton* m_sdbSizer1Apply;
wxButton* m_closeButton; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void updateMatchModeRadioButtons( wxUpdateUIEvent& event ) { event.Skip(); } virtual void updateMatchModeRadioButtons( wxUpdateUIEvent& event ) { event.Skip(); }
@ -72,9 +77,7 @@ class DIALOG_EXCHANGE_FOOTPRINTS_BASE : public DIALOG_SHIM
virtual void OnMatchValueClicked( wxCommandEvent& event ) { event.Skip(); } virtual void OnMatchValueClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMatchIDClicked( wxCommandEvent& event ) { event.Skip(); } virtual void OnMatchIDClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void ViewAndSelectFootprint( wxCommandEvent& event ) { event.Skip(); } virtual void ViewAndSelectFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void RebuildCmpList( wxCommandEvent& event ) { event.Skip(); } virtual void OnApplyClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
public: public:

View File

@ -0,0 +1,83 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2018 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>
#include <confirm.h>
#include <kicad_string.h>
#include <pcb_edit_frame.h>
#include <class_board.h>
#include <class_module.h>
#include <project.h>
#include <wildcards_and_files_ext.h>
bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName )
{
FILE* cmpFile = wxFopen( aFullCmpFileName, wxT( "wt" ) );
if( cmpFile == NULL )
return false;
fprintf( cmpFile, "Cmp-Mod V01 Created by PcbNew date = %s\n", TO_UTF8( DateAndTime() ) );
for( MODULE* module = aBrd->m_Modules; module != NULL; module = module->Next() )
{
fprintf( cmpFile, "\nBeginCmp\n" );
fprintf( cmpFile, "TimeStamp = %8.8lX\n", (unsigned long)module->GetTimeStamp() );
fprintf( cmpFile, "Path = %s\n", TO_UTF8( module->GetPath() ) );
fprintf( cmpFile, "Reference = %s;\n",
!module->GetReference().IsEmpty() ? TO_UTF8( module->GetReference() ) : "[NoRef]" );
fprintf( cmpFile, "ValeurCmp = %s;\n",
!module->GetValue().IsEmpty() ? TO_UTF8( module->GetValue() ) : "[NoVal]" );
fprintf( cmpFile, "IdModule = %s;\n", module->GetFPID().Format().c_str() );
fprintf( cmpFile, "EndCmp\n" );
}
fprintf( cmpFile, "\nEndListe\n" );
fclose( cmpFile );
return true;
}
void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
{
// Build the .cmp file name from the board name
wxString projectDir = wxPathOnly( Prj().GetProjectFullName() );
wxFileName fn = GetBoard()->GetFileName();
fn.SetExt( ComponentFileExtension );
wxFileDialog dlg( this, _( "Save Footprint Association File" ),
projectDir, fn.GetFullName(), ComponentFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
wxString path = dlg.GetPath();
if( !RecreateCmpFile( GetBoard(), path ) )
DisplayError( this, wxString::Format( _( "Could not create file \"%s\"." ), path ) );
}

View File

@ -1152,11 +1152,13 @@ public:
* Replaces OldModule by NewModule, using OldModule settings: * Replaces OldModule by NewModule, using OldModule settings:
* position, orientation, pad netnames ...) * position, orientation, pad netnames ...)
* OldModule is deleted or put in undo list. * OldModule is deleted or put in undo list.
* @param aOldModule = footprint to replace * @param aSrc = footprint to replace
* @param aNewModule = footprint to put * @param aDest = footprint to put
* @param aCommit = commit that should store the changes * @param aCommit = commit that should store the changes
*/ */
void Exchange_Module( MODULE* aOldModule, MODULE* aNewModule, BOARD_COMMIT& aCommit ); void Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT& aCommit,
bool deleteExtraTexts = true,
bool resetTextLayers = true, bool resetTextEffects = true );
// loading modules: see PCB_BASE_FRAME // loading modules: see PCB_BASE_FRAME