More Module -> Footprint and a bit of formatting cleanup.
This commit is contained in:
parent
48ab3a2819
commit
812b714ccd
|
@ -234,7 +234,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
|||
|
||||
if( strings.GetCount() ) // GetCount() == 0 for void strings
|
||||
{
|
||||
if( aLine >= 0 && (aLine < (int)strings.GetCount()) )
|
||||
if( aLine >= 0 && ( aLine < (int)strings.GetCount() ) )
|
||||
text = strings.Item( aLine );
|
||||
else
|
||||
text = strings.Item( 0 );
|
||||
|
@ -408,7 +408,7 @@ void EDA_TEXT::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, COLOR4
|
|||
|
||||
positions.reserve( strings.Count() );
|
||||
|
||||
GetLinePositions( positions, strings.Count());
|
||||
GetLinePositions( positions, strings.Count() );
|
||||
|
||||
for( unsigned ii = 0; ii < strings.Count(); ii++ )
|
||||
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
|
||||
|
@ -598,7 +598,7 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
|
|||
wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
|
||||
std::vector<wxPoint> positions;
|
||||
positions.reserve( strings_list.Count() );
|
||||
GetLinePositions( positions, strings_list.Count());
|
||||
GetLinePositions( positions, strings_list.Count() );
|
||||
|
||||
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
|
||||
{
|
||||
|
|
|
@ -482,10 +482,10 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
|
|||
wxString msg = _( "Alias: " );
|
||||
msg.append( tpath.m_alias );
|
||||
msg.append( wxT( "\n" ) );
|
||||
msg.append( _( "This path:" ) + wxS( " " ));
|
||||
msg.append( _( "This path:" ) + wxS( " " ) );
|
||||
msg.append( tpath.m_pathvar );
|
||||
msg.append( wxT( "\n" ) );
|
||||
msg.append( _( "Existing path:" ) + wxS( " " ));
|
||||
msg.append( _( "Existing path:" ) + wxS( " " ) );
|
||||
msg.append( sPL->m_pathvar );
|
||||
wxMessageBox( msg, _( "Bad alias (duplicate name)" ) );
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ static bool CopyStreamData( wxInputStream& inputStream, wxOutputStream& outputSt
|
|||
int readSize = 128 * 1024;
|
||||
wxFileOffset copiedData = 0;
|
||||
|
||||
for (;;)
|
||||
for( ; ; )
|
||||
{
|
||||
if (size != -1 && copiedData + readSize > size)
|
||||
if(size != -1 && copiedData + readSize > size )
|
||||
readSize = size - copiedData;
|
||||
|
||||
inputStream.Read( buf, readSize );
|
||||
|
@ -62,9 +62,9 @@ static bool CopyStreamData( wxInputStream& inputStream, wxOutputStream& outputSt
|
|||
//return false;
|
||||
}
|
||||
|
||||
if (size == -1)
|
||||
if( size == -1 )
|
||||
{
|
||||
if (inputStream.Eof())
|
||||
if( inputStream.Eof() )
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
@ -84,7 +84,7 @@ bool PROJECT_ARCHIVER::Unarchive( const wxString& aSrcFile, const wxString& aDes
|
|||
{
|
||||
wxFileInputStream stream( aSrcFile );
|
||||
|
||||
if (!stream.IsOk())
|
||||
if( !stream.IsOk() )
|
||||
{
|
||||
aReporter.Report( _( "Could not open archive file\n" ), RPT_SEVERITY_ERROR );
|
||||
return false;
|
||||
|
|
|
@ -635,7 +635,7 @@ bool WX_VIEW_CONTROLS::handleAutoPanning( const wxMouseEvent& aEvent )
|
|||
VECTOR2I p( aEvent.GetX(), aEvent.GetY() );
|
||||
VECTOR2I pKey( m_view->ToScreen(m_settings.m_lastKeyboardCursorPosition ) );
|
||||
|
||||
if( m_cursorWarped || (m_settings.m_lastKeyboardCursorPositionValid && (p == pKey)) )
|
||||
if( m_cursorWarped || ( m_settings.m_lastKeyboardCursorPositionValid && p == pKey ) )
|
||||
{
|
||||
// last cursor move event came from keyboard cursor control. If auto-panning is enabled and
|
||||
// the next position is inside the autopan zone, check if it really came from a mouse event, otherwise
|
||||
|
|
|
@ -325,7 +325,7 @@ public:
|
|||
* @param module
|
||||
* @param aDC (can be NULL ) = the current Device Context, to draw the new footprint
|
||||
*/
|
||||
virtual void AddModuleToBoard( MODULE* module );
|
||||
virtual void AddFootprintToBoard( MODULE* module );
|
||||
|
||||
/**
|
||||
* Function SelectFootprintFromLibBrowser
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
|
||||
|
||||
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||
EVT_MENU( wxID_CLOSE, FOOTPRINT_EDIT_FRAME::CloseModuleEditor )
|
||||
EVT_MENU( wxID_CLOSE, FOOTPRINT_EDIT_FRAME::CloseFootprintEditor )
|
||||
EVT_MENU( wxID_EXIT, FOOTPRINT_EDIT_FRAME::OnExitKiCad )
|
||||
|
||||
EVT_SIZE( FOOTPRINT_EDIT_FRAME::OnSize )
|
||||
|
@ -98,9 +98,9 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
|
||||
// UI update events.
|
||||
EVT_UPDATE_UI( ID_LOAD_FOOTPRINT_FROM_BOARD,
|
||||
FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard )
|
||||
FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard )
|
||||
EVT_UPDATE_UI( ID_ADD_FOOTPRINT_TO_BOARD,
|
||||
FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard )
|
||||
FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard )
|
||||
EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, FOOTPRINT_EDIT_FRAME::OnUpdateLayerSelectBox )
|
||||
EVT_UPDATE_UI( ID_GEN_IMPORT_GRAPHICS_FILE, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
|
||||
|
||||
|
@ -426,12 +426,12 @@ void FOOTPRINT_EDIT_FRAME::restoreLastFootprint()
|
|||
MODULE* footprint = loadFootprint( id );
|
||||
|
||||
if( footprint )
|
||||
AddModuleToBoard( footprint );
|
||||
AddFootprintToBoard( footprint );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::AddModuleToBoard( MODULE* aFootprint )
|
||||
void FOOTPRINT_EDIT_FRAME::AddFootprintToBoard( MODULE* aFootprint )
|
||||
{
|
||||
m_revertModule.reset( (MODULE*) aFootprint->Clone() );
|
||||
|
||||
|
@ -440,7 +440,7 @@ void FOOTPRINT_EDIT_FRAME::AddModuleToBoard( MODULE* aFootprint )
|
|||
// Pads are always editable in Footprint Editor
|
||||
aFootprint->SetPadsLocked( false );
|
||||
|
||||
PCB_BASE_EDIT_FRAME::AddModuleToBoard( aFootprint );
|
||||
PCB_BASE_EDIT_FRAME::AddFootprintToBoard( aFootprint );
|
||||
|
||||
if( IsCurrentFPFromBoard() )
|
||||
{
|
||||
|
@ -629,7 +629,7 @@ void FOOTPRINT_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::CloseModuleEditor( wxCommandEvent& Event )
|
||||
void FOOTPRINT_EDIT_FRAME::CloseFootprintEditor( wxCommandEvent& Event )
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
@ -641,7 +641,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected( wxUpdateUIEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent )
|
||||
void FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||
|
||||
|
@ -649,7 +649,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent )
|
||||
void FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
bool canCloseWindow( wxCloseEvent& Event ) override;
|
||||
void doCloseWindow() override;
|
||||
void CloseModuleEditor( wxCommandEvent& Event );
|
||||
void CloseFootprintEditor( wxCommandEvent& Event );
|
||||
void OnExitKiCad( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
void ReCreateOptToolbar() override;
|
||||
|
||||
/**
|
||||
* @brief (Re)Create the menubar for the module editor frame
|
||||
* @brief (Re)Create the menubar for the Footprint Editor frame
|
||||
*/
|
||||
void ReCreateMenuBar() override;
|
||||
|
||||
|
@ -154,8 +154,8 @@ public:
|
|||
bool SaveLibraryAs( const wxString& aLibraryPath );
|
||||
|
||||
void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLoadFootprintFromBoard( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateSaveFootprintToBoard( wxUpdateUIEvent& aEvent );
|
||||
|
||||
///> @copydoc PCB_BASE_EDIT_FRAME::OnEditItemRequest()
|
||||
void OnEditItemRequest( BOARD_ITEM* aItem ) override;
|
||||
|
@ -167,7 +167,7 @@ public:
|
|||
|
||||
void SaveFootprintToBoard( wxCommandEvent& event );
|
||||
|
||||
void LoadModuleFromLibrary( LIB_ID aFPID );
|
||||
void LoadFootprintFromLibrary( LIB_ID aFPID );
|
||||
|
||||
/**
|
||||
* Returns the adapter object that provides the stored data.
|
||||
|
@ -181,9 +181,9 @@ public:
|
|||
* @return : true if OK, false if abort
|
||||
*/
|
||||
bool SaveFootprint( MODULE* aFootprint );
|
||||
bool SaveFootprintAs( MODULE* aModule );
|
||||
bool SaveFootprintAs( MODULE* aFootprint );
|
||||
bool SaveFootprintToBoard( bool aAddNew );
|
||||
bool SaveFootprintInLibrary( MODULE* aModule, const wxString& aLibraryName );
|
||||
bool SaveFootprintInLibrary( MODULE* aFootprint, const wxString& aLibraryName );
|
||||
bool RevertFootprint();
|
||||
|
||||
/**
|
||||
|
@ -220,49 +220,37 @@ public:
|
|||
// importing / exporting Footprint
|
||||
/**
|
||||
* Create a file containing only one footprint.
|
||||
*
|
||||
* Used to export a footprint
|
||||
* Exported files have the standard ext .emp
|
||||
* This is the same format as .mod files but restricted to only one footprint
|
||||
* So Create a new lib (which will contains one module) and export a footprint
|
||||
* is basically the same thing
|
||||
* @param aModule = the module to export
|
||||
*/
|
||||
void Export_Module( MODULE* aModule );
|
||||
void ExportFootprint( MODULE* aFootprint );
|
||||
|
||||
/**
|
||||
* Read a file containing only one footprint.
|
||||
*
|
||||
* Used to import (after exporting) a footprint
|
||||
* Exported files have the standard ext .emp
|
||||
* This is the same format as .mod files but restricted to only one footprint
|
||||
* The import function can also read gpcb footprint file, in Newlib format
|
||||
* The import function can also read gpcb footprint file, in Newlib format.
|
||||
* (One footprint per file, Newlib files have no special ext.)
|
||||
*/
|
||||
MODULE* Import_Module( const wxString& aName = wxT("") );
|
||||
MODULE* ImportFootprint( const wxString& aName = wxT( "") );
|
||||
|
||||
/**
|
||||
* Load in Modedit a footprint from the main board.
|
||||
* Load a footprint from the main board into the Footprint Editor.
|
||||
*
|
||||
* @param aFootprint = the module to load. If NULL, a module reference will we asked to user
|
||||
* @return true if a module isloaded, false otherwise.
|
||||
* @param aFootprint = the footprint to load. If NULL, the user will be asked for a
|
||||
* footprint reference.
|
||||
* @return true if a footprint is loaded.
|
||||
*/
|
||||
bool LoadFootprintFromBoard( MODULE* aFootprint );
|
||||
|
||||
/**
|
||||
* Display the list of footprints currently existing on the BOARD.
|
||||
*
|
||||
* @return a pointer to a module if this module is selected or NULL otherwise
|
||||
* @param aPcb = the board from footprints can be loaded
|
||||
* @return the selected footprint or nullptr
|
||||
*/
|
||||
MODULE* SelectFootprintFromBoard( BOARD* aPcb );
|
||||
|
||||
// functions to edit footprint edges
|
||||
|
||||
/**
|
||||
* Delete the given module from its library.
|
||||
* Delete the given footprint from its library.
|
||||
*/
|
||||
bool DeleteModuleFromLibrary( const LIB_ID& aFPID, bool aConfirm );
|
||||
bool DeleteFootprintFromLibrary( const LIB_ID& aFPID, bool aConfirm );
|
||||
|
||||
/**
|
||||
* @return the color of the grid
|
||||
|
@ -290,10 +278,10 @@ public:
|
|||
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
|
||||
|
||||
/**
|
||||
* Override from PCB_BASE_EDIT_FRAME which adds a module to the editor's dummy board,
|
||||
* Override from PCB_BASE_EDIT_FRAME which adds a footprint to the editor's dummy board,
|
||||
* NOT to the user's PCB.
|
||||
*/
|
||||
void AddModuleToBoard( MODULE* module ) override;
|
||||
void AddFootprintToBoard( MODULE* aFootprint ) override;
|
||||
|
||||
/**
|
||||
* Allows Modedit to install its preferences panel into the preferences dialog.
|
||||
|
|
|
@ -46,7 +46,7 @@ void FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary( LIB_ID aFPID)
|
||||
void FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary( LIB_ID aFPID)
|
||||
{
|
||||
bool is_last_fp_from_brd = IsCurrentFPFromBoard();
|
||||
|
||||
|
@ -59,7 +59,7 @@ void FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary( LIB_ID aFPID)
|
|||
return;
|
||||
|
||||
GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
||||
AddModuleToBoard( footprint );
|
||||
AddFootprintToBoard( footprint );
|
||||
|
||||
footprint->ClearFlags();
|
||||
|
||||
|
@ -239,7 +239,7 @@ bool FOOTPRINT_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileS
|
|||
return false; // //this command is aborted
|
||||
|
||||
GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
||||
Import_Module( aFileSet[0] );
|
||||
ImportFootprint( aFileSet[ 0 ] );
|
||||
|
||||
if( GetBoard()->GetFirstFootprint() )
|
||||
GetBoard()->GetFirstFootprint()->ClearFlags();
|
||||
|
|
|
@ -222,7 +222,7 @@ MODULE* try_load_footprint( const wxFileName& aFileName, IO_MGR::PCB_FILE_T aFil
|
|||
}
|
||||
|
||||
|
||||
MODULE* FOOTPRINT_EDIT_FRAME::Import_Module( const wxString& aName )
|
||||
MODULE* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
|
||||
{
|
||||
wxString lastOpenedPathForLoading = m_mruPath;
|
||||
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
|
||||
|
@ -291,7 +291,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module( const wxString& aName )
|
|||
module->SetFPID( LIB_ID( wxEmptyString, moduleName ) );
|
||||
|
||||
// Insert footprint in list
|
||||
AddModuleToBoard( module );
|
||||
AddFootprintToBoard( module );
|
||||
|
||||
// Display info :
|
||||
SetMsgPanel( module );
|
||||
|
@ -306,15 +306,15 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module( const wxString& aName )
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule )
|
||||
void FOOTPRINT_EDIT_FRAME::ExportFootprint( MODULE* aFootprint )
|
||||
{
|
||||
wxFileName fn;
|
||||
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
|
||||
|
||||
if( !aModule )
|
||||
if( !aFootprint )
|
||||
return;
|
||||
|
||||
fn.SetName( aModule->GetFPID().GetLibItemName() );
|
||||
fn.SetName( aFootprint->GetFPID().GetLibItemName() );
|
||||
|
||||
wxString wildcard = KiCadFootprintLibFileWildcard();
|
||||
|
||||
|
@ -348,7 +348,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule )
|
|||
module->SetOrientation( 0 );
|
||||
*/
|
||||
|
||||
pcb_io.Format( aModule );
|
||||
pcb_io.Format( aFootprint );
|
||||
|
||||
FILE* fp = wxFopen( dlg.GetPath(), wxT( "wt" ) );
|
||||
|
||||
|
@ -556,7 +556,7 @@ bool PCB_BASE_EDIT_FRAME::AddLibrary( const wxString& aFilename )
|
|||
}
|
||||
|
||||
|
||||
bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary( const LIB_ID& aFPID, bool aConfirm )
|
||||
bool FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary( const LIB_ID& aFPID, bool aConfirm )
|
||||
{
|
||||
if( !aFPID.IsValid() )
|
||||
return false;
|
||||
|
@ -744,7 +744,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprint( MODULE* aFootprint )
|
|||
if( nameChanged )
|
||||
{
|
||||
LIB_ID oldFPID( libraryName, m_footprintNameWhenLoaded );
|
||||
DeleteModuleFromLibrary( oldFPID, false );
|
||||
DeleteFootprintFromLibrary( oldFPID, false );
|
||||
}
|
||||
|
||||
if( !SaveFootprintInLibrary( aFootprint, libraryName ) )
|
||||
|
@ -760,22 +760,23 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprint( MODULE* aFootprint )
|
|||
}
|
||||
|
||||
|
||||
bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( MODULE* aModule, const wxString& aLibraryName )
|
||||
bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( MODULE* aFootprint,
|
||||
const wxString& aLibraryName )
|
||||
{
|
||||
try
|
||||
{
|
||||
aModule->SetFPID( LIB_ID( wxEmptyString, aModule->GetFPID().GetLibItemName() ) );
|
||||
aFootprint->SetFPID( LIB_ID( wxEmptyString, aFootprint->GetFPID().GetLibItemName() ) );
|
||||
|
||||
Prj().PcbFootprintLibs()->FootprintSave( aLibraryName, aModule );
|
||||
Prj().PcbFootprintLibs()->FootprintSave( aLibraryName, aFootprint );
|
||||
|
||||
aModule->SetFPID( LIB_ID( aLibraryName, aModule->GetFPID().GetLibItemName() ) );
|
||||
aFootprint->SetFPID( LIB_ID( aLibraryName, aFootprint->GetFPID().GetLibItemName() ) );
|
||||
return true;
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
DisplayError( this, ioe.What() );
|
||||
|
||||
aModule->SetFPID( LIB_ID( aLibraryName, aModule->GetFPID().GetLibItemName() ) );
|
||||
aFootprint->SetFPID( LIB_ID( aLibraryName, aFootprint->GetFPID().GetLibItemName() ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -861,18 +862,18 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
|
|||
}
|
||||
|
||||
|
||||
bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aModule )
|
||||
bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aFootprint )
|
||||
{
|
||||
if( aModule == NULL )
|
||||
if( aFootprint == NULL )
|
||||
return false;
|
||||
|
||||
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
|
||||
|
||||
SetMsgPanel( aModule );
|
||||
SetMsgPanel( aFootprint );
|
||||
|
||||
wxString libraryName = aModule->GetFPID().GetLibNickname();
|
||||
wxString footprintName = aModule->GetFPID().GetLibItemName();
|
||||
bool updateValue = ( aModule->GetValue() == footprintName );
|
||||
wxString libraryName = aFootprint->GetFPID().GetLibNickname();
|
||||
wxString footprintName = aFootprint->GetFPID().GetLibItemName();
|
||||
bool updateValue = aFootprint->GetValue() == footprintName;
|
||||
|
||||
wxArrayString headers;
|
||||
std::vector<wxArrayString> itemsToDisplay;
|
||||
|
@ -940,10 +941,10 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aModule )
|
|||
return false;
|
||||
}
|
||||
|
||||
aModule->SetFPID( LIB_ID( libraryName, footprintName ) );
|
||||
aFootprint->SetFPID( LIB_ID( libraryName, footprintName ) );
|
||||
|
||||
if( updateValue )
|
||||
aModule->SetValue( footprintName );
|
||||
aFootprint->SetValue( footprintName );
|
||||
|
||||
// Legacy libraries are readable, but modifying legacy format is not allowed
|
||||
// So prompt the user if he try to add/replace a footprint in a legacy lib
|
||||
|
@ -970,11 +971,11 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aModule )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( !SaveFootprintInLibrary( aModule, libraryName ) )
|
||||
if( !SaveFootprintInLibrary( aFootprint, libraryName ) )
|
||||
return false;
|
||||
|
||||
// Once saved-as a board footprint is no longer a board footprint
|
||||
aModule->SetLink( niluuid );
|
||||
aFootprint->SetLink( niluuid );
|
||||
|
||||
wxString fmt = module_exists ? _( "Component \"%s\" replaced in \"%s\"" ) :
|
||||
_( "Component \"%s\" added in \"%s\"" );
|
||||
|
@ -998,7 +999,7 @@ bool FOOTPRINT_EDIT_FRAME::RevertFootprint()
|
|||
if( ConfirmRevertDialog( this, msg ) )
|
||||
{
|
||||
Clear_Pcb( false );
|
||||
AddModuleToBoard( (MODULE*) m_revertModule->Clone() );
|
||||
AddFootprintToBoard( (MODULE*) m_revertModule->Clone());
|
||||
|
||||
Zoom_Automatique( false );
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ FOOTPRINT_TREE_PANE::~FOOTPRINT_TREE_PANE()
|
|||
|
||||
void FOOTPRINT_TREE_PANE::onComponentSelected( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_frame->LoadModuleFromLibrary( GetLibTree()->GetSelectedLibId() );
|
||||
m_frame->LoadFootprintFromLibrary( GetLibTree()->GetSelectedLibId() );
|
||||
// Make sure current-part highlighting doesn't get lost in seleciton highlighting
|
||||
m_tree->Unselect();
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( MODULE* aFootprint )
|
|||
aItem->ClearFlags();
|
||||
} );
|
||||
|
||||
AddModuleToBoard( newFootprint );
|
||||
AddFootprintToBoard( newFootprint );
|
||||
|
||||
// Clear references to any net info, because the footprint editor
|
||||
// does know any thing about nets handled by the current edited board.
|
||||
|
|
|
@ -152,7 +152,7 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
|||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::AddModuleToBoard( MODULE* module )
|
||||
void PCB_BASE_FRAME::AddFootprintToBoard( MODULE* module )
|
||||
{
|
||||
if( module )
|
||||
{
|
||||
|
|
|
@ -1550,7 +1550,7 @@ void PCB_EDIT_FRAME::ShowFootprintPropertiesDialog( MODULE* aFootprint )
|
|||
{
|
||||
auto editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, true );
|
||||
|
||||
editor->LoadModuleFromLibrary( aFootprint->GetFPID() );
|
||||
editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
|
||||
|
||||
editor->Show( true );
|
||||
editor->Raise(); // Iconize( false );
|
||||
|
|
|
@ -917,7 +917,7 @@ void PCB_IO::format( FP_SHAPE* aModuleDrawing, int aNestLevel ) const
|
|||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_IO::format cannot format unknown FP_SHAPE shape:"
|
||||
+ PCB_SHAPE_TYPE_T_asString( aModuleDrawing->GetShape()) );
|
||||
+ PCB_SHAPE_TYPE_T_asString( aModuleDrawing->GetShape() ) );
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ int FOOTPRINT_EDITOR_TOOLS::NewFootprint( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
|
||||
canvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
||||
m_frame->AddModuleToBoard( newFootprint );
|
||||
m_frame->AddFootprintToBoard( newFootprint );
|
||||
|
||||
// Initialize data relative to nets and netclasses (for a new
|
||||
// module the defaults are used)
|
||||
|
@ -197,7 +197,7 @@ int FOOTPRINT_EDITOR_TOOLS::CreateFootprint( const TOOL_EVENT& aEvent )
|
|||
|
||||
canvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
||||
// Add the new object to board
|
||||
m_frame->AddModuleToBoard( newFootprint );
|
||||
m_frame->AddFootprintToBoard( newFootprint );
|
||||
|
||||
// Initialize data relative to nets and netclasses (for a new
|
||||
// module the defaults are used)
|
||||
|
@ -338,7 +338,7 @@ int FOOTPRINT_EDITOR_TOOLS::DeleteFootprint( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
FOOTPRINT_EDIT_FRAME* frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
|
||||
|
||||
if( frame->DeleteModuleFromLibrary( frame->GetTargetFPID(), true ) )
|
||||
if( frame->DeleteFootprintFromLibrary( frame->GetTargetFPID(), true ) )
|
||||
{
|
||||
if( frame->GetTargetFPID() == frame->GetLoadedFPID() )
|
||||
frame->Clear_Pcb( false );
|
||||
|
@ -356,7 +356,7 @@ int FOOTPRINT_EDITOR_TOOLS::ImportFootprint( const TOOL_EVENT& aEvent )
|
|||
return -1; // this command is aborted
|
||||
|
||||
getViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
||||
m_frame->Import_Module();
|
||||
m_frame->ImportFootprint();
|
||||
|
||||
if( m_frame->GetBoard()->GetFirstFootprint() )
|
||||
m_frame->GetBoard()->GetFirstFootprint()->ClearFlags();
|
||||
|
@ -379,14 +379,14 @@ int FOOTPRINT_EDITOR_TOOLS::ExportFootprint( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
fp = m_frame->LoadFootprint( fpID );
|
||||
|
||||
m_frame->Export_Module( fp );
|
||||
m_frame->ExportFootprint( fp );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int FOOTPRINT_EDITOR_TOOLS::EditFootprint( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->LoadModuleFromLibrary( m_frame->GetTreeFPID() );
|
||||
m_frame->LoadFootprintFromLibrary( m_frame->GetTreeFPID());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue