The user can cancel the opening of many editors.
Don't play dice with the devil. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17989
This commit is contained in:
parent
dc8822b421
commit
a99377c1ec
|
@ -202,13 +202,15 @@ protected:
|
||||||
if( rawValue.IsEmpty() )
|
if( rawValue.IsEmpty() )
|
||||||
rawValue = m_preselect;
|
rawValue = m_preselect;
|
||||||
|
|
||||||
wxString symbolId = escapeLibId( rawValue );
|
wxString symbolId = escapeLibId( rawValue );
|
||||||
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_SYMBOL_CHOOSER, true, m_dlg );
|
|
||||||
|
|
||||||
if( frame->ShowModal( &symbolId, m_dlg ) )
|
if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_SYMBOL_CHOOSER, true, m_dlg ) )
|
||||||
SetValue( UnescapeString( symbolId ) );
|
{
|
||||||
|
if( frame->ShowModal( &symbolId, m_dlg ) )
|
||||||
|
SetValue( UnescapeString( symbolId ) );
|
||||||
|
|
||||||
frame->Destroy();
|
frame->Destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DIALOG_SHIM* m_dlg;
|
DIALOG_SHIM* m_dlg;
|
||||||
|
@ -262,18 +264,20 @@ protected:
|
||||||
// multiple clicks will cause multiple instances of the footprint loader process to start
|
// multiple clicks will cause multiple instances of the footprint loader process to start
|
||||||
Disable();
|
Disable();
|
||||||
|
|
||||||
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg );
|
if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
|
||||||
|
|
||||||
if( !m_symbolNetlist.empty() )
|
|
||||||
{
|
{
|
||||||
KIWAY_EXPRESS event( FRAME_FOOTPRINT_CHOOSER, MAIL_SYMBOL_NETLIST, m_symbolNetlist );
|
if( !m_symbolNetlist.empty() )
|
||||||
frame->KiwayMailIn( event );
|
{
|
||||||
|
KIWAY_EXPRESS event( FRAME_FOOTPRINT_CHOOSER, MAIL_SYMBOL_NETLIST, m_symbolNetlist );
|
||||||
|
frame->KiwayMailIn( event );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( frame->ShowModal( &fpid, m_dlg ) )
|
||||||
|
SetValue( fpid );
|
||||||
|
|
||||||
|
frame->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( frame->ShowModal( &fpid, m_dlg ) )
|
|
||||||
SetValue( fpid );
|
|
||||||
|
|
||||||
frame->Destroy();
|
|
||||||
Enable();
|
Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,11 +177,11 @@ int CVPCB_CONTROL::ShowFootprintViewer( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
fpframe = (DISPLAY_FOOTPRINTS_FRAME*) m_frame->Kiway().Player( FRAME_CVPCB_DISPLAY, true,
|
fpframe = (DISPLAY_FOOTPRINTS_FRAME*) m_frame->Kiway().Player( FRAME_CVPCB_DISPLAY, true,
|
||||||
m_frame );
|
m_frame );
|
||||||
|
|
||||||
|
// If Kiway() cannot create the eeschema frame, it shows a error message, and
|
||||||
|
// frame is null
|
||||||
if( !fpframe )
|
if( !fpframe )
|
||||||
{
|
|
||||||
wxMessageBox( _( "Unable to create the footprint viewer frame" ) );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
fpframe->Show( true );
|
fpframe->Show( true );
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,15 +248,16 @@ void DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
wxString newName = getLibIdValue( m_specifiedId );
|
wxString newName = getLibIdValue( m_specifiedId );
|
||||||
|
|
||||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_SYMBOL_CHOOSER, true, this );
|
if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_SYMBOL_CHOOSER, true, this ) )
|
||||||
|
|
||||||
if( frame->ShowModal( &newName, this ) )
|
|
||||||
{
|
{
|
||||||
m_specifiedId->SetValue( UnescapeString( newName ) );
|
if( frame->ShowModal( &newName, this ) )
|
||||||
updateFieldsList();
|
{
|
||||||
}
|
m_specifiedId->SetValue( UnescapeString( newName ) );
|
||||||
|
updateFieldsList();
|
||||||
|
}
|
||||||
|
|
||||||
frame->Destroy();
|
frame->Destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -264,15 +265,16 @@ void DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
wxString newName = getLibIdValue( m_newId );
|
wxString newName = getLibIdValue( m_newId );
|
||||||
|
|
||||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_SYMBOL_CHOOSER, true, this );
|
if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_SYMBOL_CHOOSER, true, this ) )
|
||||||
|
|
||||||
if( frame->ShowModal( &newName, this ) )
|
|
||||||
{
|
{
|
||||||
m_newId->SetValue( UnescapeString( newName ) );
|
if( frame->ShowModal( &newName, this ) )
|
||||||
updateFieldsList();
|
{
|
||||||
}
|
m_newId->SetValue( UnescapeString( newName ) );
|
||||||
|
updateFieldsList();
|
||||||
|
}
|
||||||
|
|
||||||
frame->Destroy();
|
frame->Destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -110,14 +110,15 @@ protected:
|
||||||
if( event.GetId() == MYID_SELECT_FOOTPRINT )
|
if( event.GetId() == MYID_SELECT_FOOTPRINT )
|
||||||
{
|
{
|
||||||
// pick a footprint using the footprint picker.
|
// pick a footprint using the footprint picker.
|
||||||
wxString fpid = m_grid->GetCellValue( m_grid->GetGridCursorRow(),
|
wxString fpid = m_grid->GetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD );
|
||||||
FOOTPRINT_FIELD );
|
|
||||||
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg );
|
|
||||||
|
|
||||||
if( frame->ShowModal( &fpid, m_dlg ) )
|
if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
|
||||||
m_grid->SetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD, fpid );
|
{
|
||||||
|
if( frame->ShowModal( &fpid, m_dlg ) )
|
||||||
|
m_grid->SetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD, fpid );
|
||||||
|
|
||||||
frame->Destroy();
|
frame->Destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
||||||
{
|
{
|
||||||
|
|
|
@ -918,13 +918,15 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
|
||||||
if( event.GetId() == MYID_SELECT_FOOTPRINT )
|
if( event.GetId() == MYID_SELECT_FOOTPRINT )
|
||||||
{
|
{
|
||||||
// pick a footprint using the footprint picker.
|
// pick a footprint using the footprint picker.
|
||||||
wxString fpid = m_grid->GetCellValue( FOOTPRINT_FIELD, FDC_VALUE );
|
wxString fpid = m_grid->GetCellValue( FOOTPRINT_FIELD, FDC_VALUE );
|
||||||
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg );
|
|
||||||
|
|
||||||
if( frame->ShowModal( &fpid, m_dlg ) )
|
if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
|
||||||
m_grid->SetCellValue( FOOTPRINT_FIELD, FDC_VALUE, fpid );
|
{
|
||||||
|
if( frame->ShowModal( &fpid, m_dlg ) )
|
||||||
|
m_grid->SetCellValue( FOOTPRINT_FIELD, FDC_VALUE, fpid );
|
||||||
|
|
||||||
frame->Destroy();
|
frame->Destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1826,37 +1826,35 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else if( retval == SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL )
|
else if( retval == SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL )
|
||||||
{
|
{
|
||||||
auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR,
|
if( KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true ) )
|
||||||
true );
|
{
|
||||||
|
SYMBOL_EDIT_FRAME* editor = static_cast<SYMBOL_EDIT_FRAME*>( frame );
|
||||||
|
|
||||||
wxCHECK( editor, 0 );
|
if( wxWindow* blocking_win = editor->Kiway().GetBlockingDialog() )
|
||||||
|
blocking_win->Close( true );
|
||||||
|
|
||||||
if( wxWindow* blocking_win = editor->Kiway().GetBlockingDialog() )
|
// The broken library symbol link indicator cannot be edited.
|
||||||
blocking_win->Close( true );
|
if( symbol->IsMissingLibSymbol() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
// The broken library symbol link indicator cannot be edited.
|
editor->LoadSymbolFromSchematic( symbol );
|
||||||
if( symbol->IsMissingLibSymbol() )
|
editor->Show( true );
|
||||||
return 0;
|
editor->Raise();
|
||||||
|
}
|
||||||
editor->LoadSymbolFromSchematic( symbol );
|
|
||||||
|
|
||||||
editor->Show( true );
|
|
||||||
editor->Raise();
|
|
||||||
}
|
}
|
||||||
else if( retval == SYMBOL_PROPS_EDIT_LIBRARY_SYMBOL )
|
else if( retval == SYMBOL_PROPS_EDIT_LIBRARY_SYMBOL )
|
||||||
{
|
{
|
||||||
auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR,
|
if( KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true ) )
|
||||||
true );
|
{
|
||||||
|
SYMBOL_EDIT_FRAME* editor = static_cast<SYMBOL_EDIT_FRAME*>( frame );
|
||||||
|
|
||||||
wxCHECK( editor, 0 );
|
if( wxWindow* blocking_win = editor->Kiway().GetBlockingDialog() )
|
||||||
|
blocking_win->Close( true );
|
||||||
|
|
||||||
if( wxWindow* blocking_win = editor->Kiway().GetBlockingDialog() )
|
editor->LoadSymbol( symbol->GetLibId(), symbol->GetUnit(), symbol->GetBodyStyle() );
|
||||||
blocking_win->Close( true );
|
editor->Show( true );
|
||||||
|
editor->Raise();
|
||||||
editor->LoadSymbol( symbol->GetLibId(), symbol->GetUnit(), symbol->GetBodyStyle() );
|
}
|
||||||
|
|
||||||
editor->Show( true );
|
|
||||||
editor->Raise();
|
|
||||||
}
|
}
|
||||||
else if( retval == SYMBOL_PROPS_WANT_UPDATE_SYMBOL )
|
else if( retval == SYMBOL_PROPS_WANT_UPDATE_SYMBOL )
|
||||||
{
|
{
|
||||||
|
|
|
@ -544,8 +544,8 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
|
||||||
int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||||
SIMULATOR_FRAME* simFrame = (SIMULATOR_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR,
|
KIWAY_PLAYER* player = m_frame->Kiway().Player( FRAME_SIMULATOR, false );
|
||||||
false );
|
SIMULATOR_FRAME* simFrame = static_cast<SIMULATOR_FRAME*>( player );
|
||||||
|
|
||||||
if( !simFrame ) // Defensive coding; shouldn't happen.
|
if( !simFrame ) // Defensive coding; shouldn't happen.
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -406,43 +406,44 @@ void DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString newname = m_newID->GetValue();
|
wxString newname = m_newID->GetValue();
|
||||||
|
|
||||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, this );
|
if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, this ) )
|
||||||
|
|
||||||
if( m_currentFootprint )
|
|
||||||
{
|
{
|
||||||
/*
|
if( m_currentFootprint )
|
||||||
* Symbol netlist format:
|
{
|
||||||
* pinNumber pinName <tab> pinNumber pinName...
|
/*
|
||||||
* fpFilter fpFilter...
|
* Symbol netlist format:
|
||||||
*/
|
* pinNumber pinName <tab> pinNumber pinName...
|
||||||
wxString netlist;
|
* fpFilter fpFilter...
|
||||||
|
*/
|
||||||
|
wxString netlist;
|
||||||
|
|
||||||
wxArrayString pins;
|
wxArrayString pins;
|
||||||
|
|
||||||
for( const wxString& pad : m_currentFootprint->GetUniquePadNumbers() )
|
for( const wxString& pad : m_currentFootprint->GetUniquePadNumbers() )
|
||||||
pins.push_back( pad + ' ' + wxEmptyString /* leave pinName empty */ );
|
pins.push_back( pad + ' ' + wxEmptyString /* leave pinName empty */ );
|
||||||
|
|
||||||
if( !pins.IsEmpty() )
|
if( !pins.IsEmpty() )
|
||||||
netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );
|
netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );
|
||||||
|
|
||||||
netlist << wxS( "\r" );
|
netlist << wxS( "\r" );
|
||||||
|
|
||||||
netlist << EscapeString( m_currentFootprint->GetFilters(), CTX_LINE ) << wxS( "\r" );
|
netlist << EscapeString( m_currentFootprint->GetFilters(), CTX_LINE ) << wxS( "\r" );
|
||||||
|
|
||||||
std::string payload( netlist.ToStdString() );
|
std::string payload( netlist.ToStdString() );
|
||||||
KIWAY_EXPRESS mail( FRAME_FOOTPRINT_CHOOSER, MAIL_SYMBOL_NETLIST, payload );
|
KIWAY_EXPRESS mail( FRAME_FOOTPRINT_CHOOSER, MAIL_SYMBOL_NETLIST, payload );
|
||||||
frame->KiwayMailIn( mail );
|
frame->KiwayMailIn( mail );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( frame->ShowModal( &newname, this ) )
|
||||||
|
{
|
||||||
|
if( event.GetEventObject() == m_newIDBrowseButton )
|
||||||
|
m_newID->SetValue( newname );
|
||||||
|
else
|
||||||
|
m_specifiedID->SetValue( newname );
|
||||||
|
}
|
||||||
|
|
||||||
|
frame->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( frame->ShowModal( &newname, this ) )
|
|
||||||
{
|
|
||||||
if( event.GetEventObject() == m_newIDBrowseButton )
|
|
||||||
m_newID->SetValue( newname );
|
|
||||||
else
|
|
||||||
m_specifiedID->SetValue( newname );
|
|
||||||
}
|
|
||||||
|
|
||||||
frame->Destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2100,21 +2100,25 @@ void PCB_EDIT_FRAME::ShowFootprintPropertiesDialog( FOOTPRINT* aFootprint )
|
||||||
}
|
}
|
||||||
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_EDIT_BOARD_FP )
|
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_EDIT_BOARD_FP )
|
||||||
{
|
{
|
||||||
auto editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, true );
|
if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
|
||||||
|
{
|
||||||
|
FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
|
||||||
|
|
||||||
editor->LoadFootprintFromBoard( aFootprint );
|
fp_editor->LoadFootprintFromBoard( aFootprint );
|
||||||
|
fp_editor->Show( true );
|
||||||
editor->Show( true );
|
fp_editor->Raise(); // Iconize( false );
|
||||||
editor->Raise(); // Iconize( false );
|
}
|
||||||
}
|
}
|
||||||
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_EDIT_LIBRARY_FP )
|
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_EDIT_LIBRARY_FP )
|
||||||
{
|
{
|
||||||
auto editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, true );
|
if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
|
||||||
|
{
|
||||||
|
FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
|
||||||
|
|
||||||
editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
|
fp_editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
|
||||||
|
fp_editor->Show( true );
|
||||||
editor->Show( true );
|
fp_editor->Raise(); // Iconize( false );
|
||||||
editor->Raise(); // Iconize( false );
|
}
|
||||||
}
|
}
|
||||||
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_UPDATE_FP )
|
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_UPDATE_FP )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1591,15 +1591,18 @@ int BOARD_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||||
|
|
||||||
auto editor = (FOOTPRINT_EDIT_FRAME*) editFrame->Kiway().Player( FRAME_FOOTPRINT_EDITOR, true );
|
if( KIWAY_PLAYER* frame = editFrame->Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
|
||||||
|
{
|
||||||
|
FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
|
||||||
|
|
||||||
if( aEvent.IsAction( &PCB_ACTIONS::editFpInFpEditor ) )
|
if( aEvent.IsAction( &PCB_ACTIONS::editFpInFpEditor ) )
|
||||||
editor->LoadFootprintFromBoard( fp );
|
fp_editor->LoadFootprintFromBoard( fp );
|
||||||
else if( aEvent.IsAction( &PCB_ACTIONS::editLibFpInFpEditor ) )
|
else if( aEvent.IsAction( &PCB_ACTIONS::editLibFpInFpEditor ) )
|
||||||
editor->LoadFootprintFromLibrary( fp->GetFPID() );
|
fp_editor->LoadFootprintFromLibrary( fp->GetFPID() );
|
||||||
|
|
||||||
editor->Show( true );
|
fp_editor->Show( true );
|
||||||
editor->Raise(); // Iconize( false );
|
fp_editor->Raise(); // Iconize( false );
|
||||||
|
}
|
||||||
|
|
||||||
if( selection.IsHover() )
|
if( selection.IsHover() )
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
|
||||||
|
|
|
@ -228,51 +228,54 @@ int FOOTPRINT_EDITOR_CONTROL::CreateFootprint( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* wizard = (FOOTPRINT_WIZARD_FRAME*) m_frame->Kiway().Player( FRAME_FOOTPRINT_WIZARD,
|
if( KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_FOOTPRINT_WIZARD, true, m_frame ) )
|
||||||
true, m_frame );
|
|
||||||
|
|
||||||
if( wizard->ShowModal( nullptr, m_frame ) )
|
|
||||||
{
|
{
|
||||||
// Creates the new footprint from python script wizard
|
FOOTPRINT_WIZARD_FRAME* wizard = static_cast<FOOTPRINT_WIZARD_FRAME*>( frame );
|
||||||
FOOTPRINT* newFootprint = wizard->GetBuiltFootprint();
|
|
||||||
|
|
||||||
if( newFootprint ) // i.e. if create footprint command is OK
|
if( wizard->ShowModal( nullptr, m_frame ) )
|
||||||
{
|
{
|
||||||
m_frame->Clear_Pcb( false );
|
// Creates the new footprint from python script wizard
|
||||||
|
FOOTPRINT* newFootprint = wizard->GetBuiltFootprint();
|
||||||
|
|
||||||
canvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
if( newFootprint ) // i.e. if create footprint command is OK
|
||||||
// Add the new object to board
|
|
||||||
m_frame->AddFootprintToBoard( newFootprint );
|
|
||||||
|
|
||||||
// Initialize data relative to nets and netclasses (for a new footprint the defaults
|
|
||||||
// are used). This is mandatory to handle and draw pads.
|
|
||||||
board()->BuildListOfNets();
|
|
||||||
newFootprint->SetPosition( VECTOR2I( 0, 0 ) );
|
|
||||||
newFootprint->ClearFlags();
|
|
||||||
|
|
||||||
m_frame->Zoom_Automatique( false );
|
|
||||||
m_frame->GetScreen()->SetContentModified();
|
|
||||||
m_frame->OnModify();
|
|
||||||
|
|
||||||
// If selected from the library tree then go ahead and save it there
|
|
||||||
if( !selected.GetLibNickname().empty() )
|
|
||||||
{
|
{
|
||||||
LIB_ID fpid = newFootprint->GetFPID();
|
m_frame->Clear_Pcb( false );
|
||||||
fpid.SetLibNickname( selected.GetLibNickname() );
|
|
||||||
newFootprint->SetFPID( fpid );
|
canvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
||||||
m_frame->SaveFootprint( newFootprint );
|
// Add the new object to board
|
||||||
m_frame->ClearModify();
|
m_frame->AddFootprintToBoard( newFootprint );
|
||||||
|
|
||||||
|
// Initialize data relative to nets and netclasses (for a new footprint the
|
||||||
|
// defaults are used). This is mandatory to handle and draw pads.
|
||||||
|
board()->BuildListOfNets();
|
||||||
|
newFootprint->SetPosition( VECTOR2I( 0, 0 ) );
|
||||||
|
newFootprint->ClearFlags();
|
||||||
|
|
||||||
|
m_frame->Zoom_Automatique( false );
|
||||||
|
m_frame->GetScreen()->SetContentModified();
|
||||||
|
m_frame->OnModify();
|
||||||
|
|
||||||
|
// If selected from the library tree then go ahead and save it there
|
||||||
|
if( !selected.GetLibNickname().empty() )
|
||||||
|
{
|
||||||
|
LIB_ID fpid = newFootprint->GetFPID();
|
||||||
|
fpid.SetLibNickname( selected.GetLibNickname() );
|
||||||
|
newFootprint->SetFPID( fpid );
|
||||||
|
m_frame->SaveFootprint( newFootprint );
|
||||||
|
m_frame->ClearModify();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_frame->UpdateView();
|
||||||
|
canvas()->Refresh();
|
||||||
|
m_frame->Update3DView( true, true );
|
||||||
|
|
||||||
|
m_frame->SyncLibraryTree( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_frame->UpdateView();
|
|
||||||
canvas()->Refresh();
|
|
||||||
m_frame->Update3DView( true, true );
|
|
||||||
|
|
||||||
m_frame->SyncLibraryTree( false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wizard->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
wizard->Destroy();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue