Schematic editor Table Properties and commenting for QuasiModal usage.

This commit is contained in:
Jeff Young 2024-03-10 12:18:27 +00:00
parent a12d79cd13
commit 1bf24da385
16 changed files with 53 additions and 11 deletions

View File

@ -103,6 +103,7 @@ void SCH_EDIT_FRAME::ShowSchematicSetupDialog( const wxString& aInitialPage )
if( !aInitialPage.IsEmpty() )
dlg.SetInitialPage( aInitialPage, wxEmptyString );
// TODO: is QuasiModal required here?
if( dlg.ShowQuasiModal() == wxID_OK )
{
// Mark document as modified so that project settings can be saved as part of doc save

View File

@ -61,6 +61,7 @@
#include <dialogs/dialog_text_properties.h>
#include <dialogs/dialog_wire_bus_properties.h>
#include <dialogs/dialog_junction_props.h>
#include <dialogs/dialog_table_properties.h>
#include <import_gfx/dialog_import_gfx_sch.h>
#include <sync_sheet_pin/sheet_synchronization_agent.h>
#include <string_utils.h>
@ -1296,7 +1297,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
{
DIALOG_LABEL_PROPERTIES dlg( m_frame, static_cast<SCH_LABEL_BASE*>( textItem ) );
// Must be quasi modal for syntax help
// QuasiModal required for syntax help and Scintilla auto-complete
if( dlg.ShowQuasiModal() != wxID_OK )
{
delete labelItem;
@ -2158,15 +2159,25 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent )
table->SetFlags( IS_NEW );
table->Normalize();
SCH_COMMIT commit( m_toolMgr );
commit.Add( table, m_frame->GetScreen() );
commit.Push( _( "Draw Table" ) );
DIALOG_TABLE_PROPERTIES dlg( m_frame, table );
// QuasiModal required for Scintilla auto-complete
if( dlg.ShowQuasiModal() == wxID_OK )
{
SCH_COMMIT commit( m_toolMgr );
commit.Add( table, m_frame->GetScreen() );
commit.Push( _( "Draw Table" ) );
m_selectionTool->AddItemToSel( table );
m_toolMgr->PostAction( ACTIONS::activatePointEditor );
}
else
{
delete table;
}
m_selectionTool->AddItemToSel( table );
table = nullptr;
m_view->ClearPreview();
m_toolMgr->PostAction( ACTIONS::activatePointEditor );
}
else if( table && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{

View File

@ -70,7 +70,8 @@ int SCH_EDIT_TABLE_TOOL::EditTable( const TOOL_EVENT& aEvent )
{
DIALOG_TABLE_PROPERTIES dlg( m_frame, parentTable );
dlg.ShowQuasiModal(); // Scintilla's auto-complete requires quasiModal
// QuasiModal required for Scintilla auto-complete
dlg.ShowQuasiModal();
}
if( clearSelection )

View File

@ -1700,6 +1700,7 @@ int SCH_EDIT_TOOL::ChangeSymbols( const TOOL_EVENT& aEvent )
DIALOG_CHANGE_SYMBOLS dlg( m_frame, selectedSymbol, mode );
// QuasiModal required to invoke symbol browser
dlg.ShowQuasiModal();
return 0;
@ -1933,12 +1934,21 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
SCH_TABLE* table = static_cast<SCH_TABLE*>( cells[0]->GetParent() );
DIALOG_TABLE_PROPERTIES tableDlg( m_frame, table );
tableDlg.ShowQuasiModal(); // Scintilla's auto-complete requires quasiModal
tableDlg.ShowModal();
}
}
break;
case SCH_TABLE_T:
{
DIALOG_TABLE_PROPERTIES dlg( m_frame, static_cast<SCH_TABLE*>( curr_item ) );
// QuasiModal required for Scintilla auto-complete
dlg.ShowQuasiModal();
break;
}
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
@ -1946,7 +1956,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
DIALOG_LABEL_PROPERTIES dlg( m_frame, static_cast<SCH_LABEL_BASE*>( curr_item ) );
// Must be quasi modal for syntax help
// QuasiModal for syntax help and Scintilla auto-complete
dlg.ShowQuasiModal();
break;
}

View File

@ -480,6 +480,7 @@ int SIMULATOR_CONTROL::EditUserDefinedSignals( const TOOL_EVENT& aEvent )
DIALOG_USER_DEFINED_SIGNALS dlg( m_simulatorFrame, &userSignals );
// QuasiModal required for syntax help and Scintilla auto-complete
if( dlg.ShowQuasiModal() == wxID_OK )
m_simulatorFrame->SetUserDefinedSignals( userSignals );

View File

@ -527,6 +527,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt
LIB_TEXTBOX* textbox = static_cast<LIB_TEXTBOX*>( item );
DIALOG_LIB_TEXTBOX_PROPERTIES dlg( m_frame, static_cast<LIB_TEXTBOX*>( item ) );
// QuasiModal required for syntax help and Scintilla auto-complete
if( dlg.ShowQuasiModal() != wxID_OK )
{
cleanup();

View File

@ -129,6 +129,7 @@ int InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings,
{
DIALOG_COPPER_ZONE dlg( aCaller, aSettings, aConvertSettings );
// TODO: why does this need QuasiModal?
return dlg.ShowQuasiModal();
}

View File

@ -74,6 +74,7 @@ int InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSetting
{
DIALOG_NON_COPPER_ZONES_EDITOR dlg( aParent, aSettings, aConvertSettings );
// TODO: why does this require QuasiModal?
return dlg.ShowQuasiModal();
}

View File

@ -138,6 +138,7 @@ void PCB_BASE_FRAME::ShowPadPropertiesDialog( PAD* aPad )
{
DIALOG_PAD_PROPERTIES dlg( this, aPad );
// QuasiModal required for NET_SELECTOR
dlg.ShowQuasiModal();
}

View File

@ -256,6 +256,8 @@ DIALOG_TEXT_PROPERTIES::~DIALOG_TEXT_PROPERTIES()
void PCB_BASE_EDIT_FRAME::ShowTextPropertiesDialog( PCB_TEXT* aText )
{
DIALOG_TEXT_PROPERTIES dlg( this, aText );
// QuasiModal required for Scintilla auto-complete
dlg.ShowQuasiModal();
}

View File

@ -141,7 +141,9 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
case PCB_TABLE_T:
{
DIALOG_TABLE_PROPERTIES dlg( this, static_cast<PCB_TABLE*>( aItem ) );
dlg.ShowQuasiModal(); // Scintilla's auto-complete requires quasiModal
//QuasiModal required for Scintilla auto-complete
dlg.ShowQuasiModal();
break;
}
@ -164,6 +166,8 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
case PCB_DIM_LEADER_T:
{
DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
// TODO: why is this QuasiModal?
dlg.ShowQuasiModal();
break;
}

View File

@ -215,6 +215,8 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
case PCB_DIM_LEADER_T:
{
DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
// TODO: why is this QuasiModal?
dlg.ShowQuasiModal();
break;
}

View File

@ -80,6 +80,7 @@ FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprint
wxString value = editFrame->StringFromValue( gap_size );
WX_TEXT_ENTRY_DIALOG dlg( editFrame, msg, _( "Create Microwave Footprint" ), value );
// TODO: why is this QuasiModal?
if( dlg.ShowQuasiModal() != wxID_OK )
return nullptr; // cancelled by user
@ -94,6 +95,7 @@ FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprint
WX_TEXT_ENTRY_DIALOG angledlg( editFrame, _( "Angle in degrees:" ),
_( "Create Microwave Footprint" ), msg );
// TODO: why is this QuasiModal?
if( angledlg.ShowQuasiModal() != wxID_OK )
return nullptr; // cancelled by user

View File

@ -365,6 +365,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
wxString msg = editFrame->StringFromValue( aInductorPattern.m_Length );
WX_TEXT_ENTRY_DIALOG dlg( editFrame, _( "Length of Trace:" ), wxEmptyString, msg );
// TODO: why is this QuasiModal?
if( dlg.ShowQuasiModal() != wxID_OK )
return nullptr; // canceled by user
@ -404,6 +405,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
WX_TEXT_ENTRY_DIALOG cmpdlg( editFrame, _( "Component Value:" ), wxEmptyString, msg );
cmpdlg.SetTextValidator( FOOTPRINT_NAME_VALIDATOR( &msg ) );
// TODO: why is this QuasiModal?
if( ( cmpdlg.ShowQuasiModal() != wxID_OK ) || msg.IsEmpty() )
return nullptr; // Aborted by user

View File

@ -1225,6 +1225,7 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
if( !aInitialPage.IsEmpty() )
dlg.SetInitialPage( aInitialPage, wxEmptyString );
// QuasiModal required for Scintilla auto-complete
if( dlg.ShowQuasiModal() == wxID_OK )
{
GetBoard()->SynchronizeNetsAndNetClasses( true );

View File

@ -1167,6 +1167,7 @@ int DRAWING_TOOL::DrawTable( const TOOL_EVENT& aEvent )
DIALOG_TABLE_PROPERTIES dlg( m_frame, table );
// QuasiModal required for Scintilla auto-complete
if( dlg.ShowQuasiModal() == wxID_OK )
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );