diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index de0b46d2a1..78d02e741c 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -1609,6 +1609,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) textbox->SetHorizJustify( m_lastTextJust ); textbox->SetStroke( m_lastTextboxStroke ); textbox->SetFillColor( m_lastTextboxFillColor ); + textbox->SetParent( schematic ); item = textbox; } @@ -1618,6 +1619,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) item->SetStroke( m_lastStroke ); item->SetFillColor( m_lastFillColor ); + item->SetParent( schematic ); } item->SetFlags( IS_NEW ); diff --git a/eeschema/tools/symbol_editor_control.cpp b/eeschema/tools/symbol_editor_control.cpp index 31f290fba0..3b30b0ebcb 100644 --- a/eeschema/tools/symbol_editor_control.cpp +++ b/eeschema/tools/symbol_editor_control.cpp @@ -655,7 +655,11 @@ int SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent ) wxWindow* blocking_dialog = schframe->Kiway().GetBlockingDialog(); if( blocking_dialog ) - blocking_dialog->Close( true ); + { + blocking_dialog->Raise(); + wxBell(); + return 0; + } wxCHECK( libSymbol->GetLibId().IsValid(), 0 ); diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index d47cf10996..7e2c8e7c14 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -266,8 +266,11 @@ void DIALOG_TEXT_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent ) board->GetContextualTextVars( &autocompleteTokens ); - if( FOOTPRINT* footprint = m_item->GetParentFootprint() ) - footprint->GetContextualTextVars( &autocompleteTokens ); + if( m_fpText ) + { + if( FOOTPRINT* footprint = static_cast( m_fpText->GetParentFootprint() ) ) + footprint->GetContextualTextVars( &autocompleteTokens ); + } for( std::pair entry : board->GetProject()->GetTextVars() ) autocompleteTokens.push_back( entry.first ); diff --git a/pcbnew/dialogs/dialog_textbox_properties.cpp b/pcbnew/dialogs/dialog_textbox_properties.cpp index ea810fec79..d598954cb6 100644 --- a/pcbnew/dialogs/dialog_textbox_properties.cpp +++ b/pcbnew/dialogs/dialog_textbox_properties.cpp @@ -36,6 +36,7 @@ #include #include #include +#include "macros.h" DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem ) : @@ -158,7 +159,7 @@ DIALOG_TEXTBOX_PROPERTIES::~DIALOG_TEXTBOX_PROPERTIES() int PCB_BASE_EDIT_FRAME::ShowTextBoxPropertiesDialog( BOARD_ITEM* aText ) { - DIALOG_TEXTBOX_PROPERTIES dlg( this, aTextBox ); + DIALOG_TEXTBOX_PROPERTIES dlg( this, aText ); // QuasiModal required for Scintilla auto-complete return dlg.ShowQuasiModal(); @@ -189,7 +190,7 @@ void DIALOG_TEXTBOX_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent partial = te->GetRange( start, text_pos ); wxString ref = te->GetRange( refStart, start-1 ); - BOARD* board = m_textBox->GetBoard(); + BOARD* board = m_frame->GetBoard(); for( FOOTPRINT* candidate : board->Footprints() ) { @@ -205,12 +206,15 @@ void DIALOG_TEXTBOX_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent { partial = te->GetTextRange( start, text_pos ); - BOARD* board = m_textBox->GetBoard(); + BOARD* board = m_frame->GetBoard(); board->GetContextualTextVars( &autocompleteTokens ); - if( FOOTPRINT* footprint = m_textBox->GetParentFootprint() ) - footprint->GetContextualTextVars( &autocompleteTokens ); + if( m_fpTextBox ) + { + if( FOOTPRINT* footprint = m_fpTextBox->GetParentFootprint() ) + footprint->GetContextualTextVars( &autocompleteTokens ); + } for( std::pair entry : board->GetProject()->GetTextVars() ) autocompleteTokens.push_back( entry.first );