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
|
@ -203,13 +203,15 @@ protected:
|
|||
rawValue = m_preselect;
|
||||
|
||||
wxString symbolId = escapeLibId( rawValue );
|
||||
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_SYMBOL_CHOOSER, true, m_dlg );
|
||||
|
||||
if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_SYMBOL_CHOOSER, true, m_dlg ) )
|
||||
{
|
||||
if( frame->ShowModal( &symbolId, m_dlg ) )
|
||||
SetValue( UnescapeString( symbolId ) );
|
||||
|
||||
frame->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
DIALOG_SHIM* m_dlg;
|
||||
wxString m_preselect;
|
||||
|
@ -262,8 +264,8 @@ protected:
|
|||
// multiple clicks will cause multiple instances of the footprint loader process to start
|
||||
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 );
|
||||
|
@ -274,6 +276,8 @@ protected:
|
|||
SetValue( fpid );
|
||||
|
||||
frame->Destroy();
|
||||
}
|
||||
|
||||
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,
|
||||
m_frame );
|
||||
|
||||
// If Kiway() cannot create the eeschema frame, it shows a error message, and
|
||||
// frame is null
|
||||
if( !fpframe )
|
||||
{
|
||||
wxMessageBox( _( "Unable to create the footprint viewer frame" ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
fpframe->Show( true );
|
||||
}
|
||||
|
|
|
@ -248,8 +248,8 @@ void DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser( wxCommandEvent& aEvent )
|
|||
{
|
||||
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 ) );
|
||||
|
@ -258,14 +258,15 @@ void DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser( wxCommandEvent& aEvent )
|
|||
|
||||
frame->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser( wxCommandEvent& aEvent )
|
||||
{
|
||||
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 ) );
|
||||
|
@ -274,6 +275,7 @@ void DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser( wxCommandEvent& aEvent )
|
|||
|
||||
frame->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
|
||||
|
|
|
@ -110,15 +110,16 @@ protected:
|
|||
if( event.GetId() == MYID_SELECT_FOOTPRINT )
|
||||
{
|
||||
// pick a footprint using the footprint picker.
|
||||
wxString fpid = m_grid->GetCellValue( m_grid->GetGridCursorRow(),
|
||||
FOOTPRINT_FIELD );
|
||||
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg );
|
||||
wxString fpid = m_grid->GetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD );
|
||||
|
||||
if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
|
||||
{
|
||||
if( frame->ShowModal( &fpid, m_dlg ) )
|
||||
m_grid->SetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD, fpid );
|
||||
|
||||
frame->Destroy();
|
||||
}
|
||||
}
|
||||
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
||||
{
|
||||
wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(),
|
||||
|
|
|
@ -919,13 +919,15 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
|
|||
{
|
||||
// pick a footprint using the footprint picker.
|
||||
wxString fpid = m_grid->GetCellValue( FOOTPRINT_FIELD, FDC_VALUE );
|
||||
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( frame->ShowModal( &fpid, m_dlg ) )
|
||||
m_grid->SetCellValue( FOOTPRINT_FIELD, FDC_VALUE, fpid );
|
||||
|
||||
frame->Destroy();
|
||||
}
|
||||
}
|
||||
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
||||
{
|
||||
wxString datasheet_uri = m_grid->GetCellValue( DATASHEET_FIELD, FDC_VALUE );
|
||||
|
|
|
@ -1826,10 +1826,9 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( retval == SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL )
|
||||
{
|
||||
auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR,
|
||||
true );
|
||||
|
||||
wxCHECK( editor, 0 );
|
||||
if( KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true ) )
|
||||
{
|
||||
SYMBOL_EDIT_FRAME* editor = static_cast<SYMBOL_EDIT_FRAME*>( frame );
|
||||
|
||||
if( wxWindow* blocking_win = editor->Kiway().GetBlockingDialog() )
|
||||
blocking_win->Close( true );
|
||||
|
@ -1839,25 +1838,24 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
|
||||
editor->LoadSymbolFromSchematic( symbol );
|
||||
|
||||
editor->Show( true );
|
||||
editor->Raise();
|
||||
}
|
||||
}
|
||||
else if( retval == SYMBOL_PROPS_EDIT_LIBRARY_SYMBOL )
|
||||
{
|
||||
auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR,
|
||||
true );
|
||||
|
||||
wxCHECK( editor, 0 );
|
||||
if( KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true ) )
|
||||
{
|
||||
SYMBOL_EDIT_FRAME* editor = static_cast<SYMBOL_EDIT_FRAME*>( frame );
|
||||
|
||||
if( wxWindow* blocking_win = editor->Kiway().GetBlockingDialog() )
|
||||
blocking_win->Close( true );
|
||||
|
||||
editor->LoadSymbol( symbol->GetLibId(), symbol->GetUnit(), symbol->GetBodyStyle() );
|
||||
|
||||
editor->Show( true );
|
||||
editor->Raise();
|
||||
}
|
||||
}
|
||||
else if( retval == SYMBOL_PROPS_WANT_UPDATE_SYMBOL )
|
||||
{
|
||||
DIALOG_CHANGE_SYMBOLS dlg( m_frame, symbol, DIALOG_CHANGE_SYMBOLS::MODE::UPDATE );
|
||||
|
|
|
@ -544,8 +544,8 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
|
|||
int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
SIMULATOR_FRAME* simFrame = (SIMULATOR_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR,
|
||||
false );
|
||||
KIWAY_PLAYER* player = m_frame->Kiway().Player( FRAME_SIMULATOR, false );
|
||||
SIMULATOR_FRAME* simFrame = static_cast<SIMULATOR_FRAME*>( player );
|
||||
|
||||
if( !simFrame ) // Defensive coding; shouldn't happen.
|
||||
return 0;
|
||||
|
|
|
@ -406,8 +406,8 @@ void DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint( wxCommandEvent& event )
|
|||
{
|
||||
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 )
|
||||
{
|
||||
/*
|
||||
|
@ -444,5 +444,6 @@ void DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint( wxCommandEvent& event )
|
|||
|
||||
frame->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2100,21 +2100,25 @@ void PCB_EDIT_FRAME::ShowFootprintPropertiesDialog( FOOTPRINT* aFootprint )
|
|||
}
|
||||
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 );
|
||||
|
||||
editor->Show( true );
|
||||
editor->Raise(); // Iconize( false );
|
||||
fp_editor->LoadFootprintFromBoard( aFootprint );
|
||||
fp_editor->Show( true );
|
||||
fp_editor->Raise(); // Iconize( false );
|
||||
}
|
||||
}
|
||||
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() );
|
||||
|
||||
editor->Show( true );
|
||||
editor->Raise(); // Iconize( false );
|
||||
fp_editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
|
||||
fp_editor->Show( true );
|
||||
fp_editor->Raise(); // Iconize( false );
|
||||
}
|
||||
}
|
||||
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>();
|
||||
|
||||
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 ) )
|
||||
editor->LoadFootprintFromBoard( fp );
|
||||
fp_editor->LoadFootprintFromBoard( fp );
|
||||
else if( aEvent.IsAction( &PCB_ACTIONS::editLibFpInFpEditor ) )
|
||||
editor->LoadFootprintFromLibrary( fp->GetFPID() );
|
||||
fp_editor->LoadFootprintFromLibrary( fp->GetFPID() );
|
||||
|
||||
editor->Show( true );
|
||||
editor->Raise(); // Iconize( false );
|
||||
fp_editor->Show( true );
|
||||
fp_editor->Raise(); // Iconize( false );
|
||||
}
|
||||
|
||||
if( selection.IsHover() )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
|
||||
|
|
|
@ -228,8 +228,9 @@ int FOOTPRINT_EDITOR_CONTROL::CreateFootprint( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
auto* wizard = (FOOTPRINT_WIZARD_FRAME*) m_frame->Kiway().Player( FRAME_FOOTPRINT_WIZARD,
|
||||
true, m_frame );
|
||||
if( KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_FOOTPRINT_WIZARD, true, m_frame ) )
|
||||
{
|
||||
FOOTPRINT_WIZARD_FRAME* wizard = static_cast<FOOTPRINT_WIZARD_FRAME*>( frame );
|
||||
|
||||
if( wizard->ShowModal( nullptr, m_frame ) )
|
||||
{
|
||||
|
@ -244,8 +245,8 @@ int FOOTPRINT_EDITOR_CONTROL::CreateFootprint( const TOOL_EVENT& aEvent )
|
|||
// 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.
|
||||
// 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();
|
||||
|
@ -273,6 +274,8 @@ int FOOTPRINT_EDITOR_CONTROL::CreateFootprint( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
wizard->Destroy();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue