Don't select all of netlist when showing it in simulator.

This commit is contained in:
Jeff Young 2022-12-14 13:35:57 +00:00
parent e41b0775db
commit 13d9b061ee
1 changed files with 16 additions and 15 deletions

View File

@ -1599,39 +1599,40 @@ void SIM_PLOT_FRAME::onShowNetlist( wxCommandEvent& event )
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL ) ); wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL ) );
} }
NETLIST_VIEW_DIALOG( wxWindow* parent, wxString source) : NETLIST_VIEW_DIALOG( wxWindow* parent, const wxString& source) :
DIALOG_SHIM( parent, wxID_ANY, wxT( "SPICE Netlist" ), wxDefaultPosition, DIALOG_SHIM( parent, wxID_ANY, wxT( "SPICE Netlist" ), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ) wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{ {
wxStyledTextCtrl* text = new wxStyledTextCtrl( this, wxID_ANY ); wxStyledTextCtrl* textCtrl = new wxStyledTextCtrl( this, wxID_ANY );
text->SetMinSize( wxSize( 600, 400 ) ); textCtrl->SetMinSize( wxSize( 600, 400 ) );
text->SetMarginWidth( MARGIN_LINE_NUMBERS, 50 ); textCtrl->SetMarginWidth( MARGIN_LINE_NUMBERS, 50 );
text->StyleSetForeground( wxSTC_STYLE_LINENUMBER, wxColour( 75, 75, 75 ) ); textCtrl->StyleSetForeground( wxSTC_STYLE_LINENUMBER, wxColour( 75, 75, 75 ) );
text->StyleSetBackground( wxSTC_STYLE_LINENUMBER, wxColour( 220, 220, 220 ) ); textCtrl->StyleSetBackground( wxSTC_STYLE_LINENUMBER, wxColour( 220, 220, 220 ) );
text->SetMarginType( MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER ); textCtrl->SetMarginType( MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER );
wxFont fixedFont = KIUI::GetMonospacedUIFont(); wxFont fixedFont = KIUI::GetMonospacedUIFont();
for( size_t i = 0; i < wxSTC_STYLE_MAX; ++i ) for( int i = 0; i < wxSTC_STYLE_MAX; ++i )
text->StyleSetFont( i, fixedFont ); textCtrl->StyleSetFont( i, fixedFont );
text->StyleClearAll(); // Addresses a bug in wx3.0 where styles are not correctly set textCtrl->StyleClearAll(); // Addresses a bug in wx3.0 where styles are not correctly set
text->SetWrapMode( wxSTC_WRAP_WORD ); textCtrl->SetWrapMode( wxSTC_WRAP_WORD );
text->SetText( source ); textCtrl->SetText( source );
textCtrl->ClearSelections();
text->SetLexer( wxSTC_LEX_SPICE ); textCtrl->SetLexer( wxSTC_LEX_SPICE );
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
sizer->Add( text, 1, wxEXPAND | wxALL, 5 ); sizer->Add( textCtrl, 1, wxEXPAND | wxALL, 5 );
SetSizer( sizer ); SetSizer( sizer );
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ), Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ),
nullptr, this ); nullptr, this );
m_scintillaTricks = std::make_unique<SCINTILLA_TRICKS>( text, wxT( "{}" ), false ); m_scintillaTricks = std::make_unique<SCINTILLA_TRICKS>( textCtrl, wxT( "{}" ), false );
finishDialogSettings(); finishDialogSettings();
} }