Go back to using QuasiModal for TextBox Properties.

Also removes auto-closing of blocking dialogs when inserting
symbols from the Symbol Editor or Chooser, preventing the bug
that QuasiModel was removed for earlier.

Also fixes a non-initialized parent pointer when the TextBox
Properties dialog was called from DrawShape().

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14777

(cherry picked from commit 5a9ed66cfd)
This commit is contained in:
Jeff Young 2023-05-24 10:28:46 +01:00
parent c6e4f18d99
commit 4a274709e7
4 changed files with 21 additions and 8 deletions

View File

@ -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 );

View File

@ -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 );

View File

@ -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<FOOTPRINT*>( m_fpText->GetParentFootprint() ) )
footprint->GetContextualTextVars( &autocompleteTokens );
}
for( std::pair<wxString, wxString> entry : board->GetProject()->GetTextVars() )
autocompleteTokens.push_back( entry.first );

View File

@ -36,6 +36,7 @@
#include <pcb_edit_frame.h>
#include <pcb_layer_box_selector.h>
#include <scintilla_tricks.h>
#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<wxString, wxString> entry : board->GetProject()->GetTextVars() )
autocompleteTokens.push_back( entry.first );