KiCad PCB EDA Suite
Loading...
Searching...
No Matches
simulator_control.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
21
22#define wxUSE_BASE64 1
23#include <wx/base64.h>
24
25#include <wx/ffile.h>
26#include <wx/filedlg.h>
27#include <wx_filename.h>
28#include <kiplatform/ui.h>
29#include <wx/stc/stc.h>
30
31#include <kiway.h>
32#include <confirm.h>
36#include <sch_edit_frame.h>
37#include <sim/simulator_frame.h>
38#include <sim/sim_plot_tab.h>
39#include <tool/tool_manager.h>
40#include <tools/sch_actions.h>
41#include <scintilla_tricks.h>
44#include <wx/clipbrd.h>
45#include <wx/dataobj.h>
46#include <wx/mstream.h>
47#include <richio.h>
48#include <string_utils.h>
49
50
52{
54 return true;
55}
56
57
59{
61
63 {
64 m_schematicFrame = m_simulatorFrame->GetSchematicFrame();
65 m_circuitModel = m_simulatorFrame->GetCircuitModel();
66 m_simulator = m_simulatorFrame->GetSimulator();
67 }
68}
69
70
72{
75
77 reporter );
78
79 if( reporter.HasMessageOfSeverity( RPT_SEVERITY_UNDEFINED | RPT_SEVERITY_ERROR ) )
80 {
81 DisplayErrorMessage( m_simulatorFrame, _( "Errors during netlist generation." ),
82 reporter.GetMessages() );
83 }
84 else if( reporter.HasMessageOfSeverity( RPT_SEVERITY_WARNING ) )
85 {
86 DisplayInfoMessage( m_simulatorFrame, _( "Warnings during netlist generation." ),
87 reporter.GetMessages() );
88 }
89
90 dlg.SetSimCommand( wxS( "*" ) );
92
93 if( dlg.ShowModal() == wxID_OK )
94 {
95 SIM_TAB* tab = m_simulatorFrame->NewSimTab( dlg.GetSimCommand() );
96 dlg.ApplySettings( tab );
97 m_simulatorFrame->OnModify();
98 }
99
100 return 0;
101}
102
103
105{
106 wxFileDialog openDlg( m_simulatorFrame, _( "Open Simulation Workbook" ), getDefaultPath(), "",
107 FILEEXT::WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
108
110
111 if( openDlg.ShowModal() == wxID_CANCEL )
112 return -1;
113
114 m_simulatorFrame->LoadWorkbook( openDlg.GetPath() );
115 return 0;
116}
117
118
120{
121 wxFileName filename = m_simulator->Settings()->GetWorkbookFilename();
122
123 if( filename.GetName().IsEmpty() )
124 {
125 if( m_simulatorFrame->Prj().GetProjectName().IsEmpty() )
126 {
127 filename.SetName( _( "noname" ) );
128 filename.SetExt( FILEEXT::WorkbookFileExtension );
129 }
130 else
131 {
132 filename.SetName( m_simulatorFrame->Prj().GetProjectName() );
133 filename.SetExt( FILEEXT::WorkbookFileExtension );
134 }
135 }
136
137 return filename.GetFullName();
138}
139
140
142{
143 wxFileName path = m_simulator->Settings()->GetWorkbookFilename();
144
145 path.Normalize( FN_NORMALIZE_FLAGS|wxPATH_NORM_ENV_VARS,
146 m_simulatorFrame->Prj().GetProjectPath() );
147 return path.GetPath();
148}
149
150
152{
153 wxString filename;
154
155 if( aEvent.IsAction( &SCH_ACTIONS::saveWorkbook ) )
156 filename = m_simulator->Settings()->GetWorkbookFilename();
157
158 if( filename.IsEmpty() )
159 {
160 wxFileDialog saveAsDlg( m_simulatorFrame, _( "Save Simulation Workbook As" ),
163 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
164
166
167 if( saveAsDlg.ShowModal() == wxID_CANCEL )
168 return -1;
169
170 filename = saveAsDlg.GetPath();
171 }
172
173 m_simulatorFrame->SaveWorkbook( m_simulatorFrame->Prj().AbsolutePath( filename ) );
174 return 0;
175}
176
177
179{
180 if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
181 {
182 wxFileDialog saveDlg( m_simulatorFrame, _( "Save Plot as Image" ), "", "",
183 FILEEXT::PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
184
186
187 if( saveDlg.ShowModal() == wxID_CANCEL )
188 return -1;
189
190 wxImage screenImage;
191 plotTab->GetPlotWin()->SaveScreenshot( screenImage );
192 screenImage.SaveFile( saveDlg.GetPath(), wxBITMAP_TYPE_PNG );
193 }
194
195 return 0;
196}
197
198
200{
201 if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
202 {
203 wxImage screenImage;
204 plotTab->GetPlotWin()->SaveScreenshot( screenImage );
205
206 if( wxTheClipboard->Open() )
207 {
208 wxBitmap bm( screenImage );
209
210 wxTheClipboard->SetData( new wxBitmapDataObject( bm ) );
211 wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
212 wxTheClipboard->Close();
213 }
214 }
215
216 return 0;
217}
218
219
221{
222 if( m_schematicFrame == nullptr )
223 return -1;
224
225 if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
226 {
227 wxWindow* blocking_dialog = m_schematicFrame->Kiway().GetBlockingDialog();
228
229 if( blocking_dialog )
230 blocking_dialog->Close( true );
231
232 wxImage screenImage;
233 plotTab->GetPlotWin()->SaveScreenshot( screenImage );
234
235 if( wxTheClipboard->Open() )
236 {
237 // Build a PNG bitmap:
238 wxMemoryOutputStream stream;
239 screenImage.SaveFile( stream, wxBITMAP_TYPE_PNG );
240 stream.Close();
241
242 // Create a SCH_BITMAP data string
243 wxString string;
244 string << "(image (at 0 0)\n";
245 string << " (data\n";
246
247 wxMemoryBuffer buff;
248 buff.GetWriteBuf( stream.GetLength() );
249 stream.CopyTo( buff.GetData(), stream.GetLength() );
250 buff.SetDataLen( stream.GetLength() );
251
252 wxString out;
253 out << wxBase64Encode( buff );
254
255 #define MIME_BASE64_LENGTH 76
256 size_t first = 0;
257
258 while( first < out.Length() )
259 {
260 string << " \"" << TO_UTF8( out( first, MIME_BASE64_LENGTH ) );
261 string << "\"\n";
262 first += MIME_BASE64_LENGTH;
263 }
264 string << " )\n)\n";
265
266 wxTheClipboard->SetData( new wxTextDataObject( string ) );
267 wxTheClipboard->Close();
268
269 m_schematicFrame->GetToolManager()->PostAction( ACTIONS::paste );
270 m_schematicFrame->Raise();
271 }
272 }
273
274 return 0;
275}
276
277
279{
280 return m_simulatorFrame->GetCurrentSimTab();
281}
282
283
285{
286 if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
287 {
288 const wxChar SEPARATOR = ';';
289
290 wxFileDialog saveDlg( m_simulatorFrame, _( "Save Plot Data" ), "", "",
292 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
293
295
296 if( saveDlg.ShowModal() == wxID_CANCEL )
297 return -1;
298
299 wxFFile out( saveDlg.GetPath(), "wb" );
300
301 std::map<wxString, TRACE*> traces = plotTab->GetTraces();
302
303 if( traces.size() == 0 )
304 return -1;
305
306 SIM_TYPE simType = plotTab->GetSimType();
307
308 if( plotTab->IsSmithMode() )
309 {
310 // smith traces hold Re/Im of the reflection coefficient, frequency lives beside them
311 std::vector<SMITH_TRACE*> smithTraces;
312
313 for( const auto& [name, trace] : traces )
314 {
315 if( SMITH_TRACE* smithTrace = dynamic_cast<SMITH_TRACE*>( trace ) )
316 smithTraces.push_back( smithTrace );
317 }
318
319 if( smithTraces.empty() )
320 return -1;
321
322 const std::vector<double>& freqs = smithTraces[0]->GetFrequencies();
323
324 out.Write( wxString::Format( wxT( "%s%c" ), wxS( "frequency" ), SEPARATOR ) );
325
326 for( SMITH_TRACE* trace : smithTraces )
327 {
328 out.Write( wxString::Format( wxT( "%s Re%c%s Im%c" ), trace->GetDisplayName(), SEPARATOR,
329 trace->GetDisplayName(), SEPARATOR ) );
330 }
331
332 out.Write( wxS( "\r\n" ) );
333
334 for( std::size_t curRow = 0; curRow < freqs.size(); curRow++ )
335 {
336 out.Write( wxString::Format( wxT( "%g%c" ), freqs[curRow], SEPARATOR ) );
337
338 for( SMITH_TRACE* trace : smithTraces )
339 {
340 double re = curRow < trace->GetDataX().size() ? trace->GetDataX()[curRow] : 0.0;
341 double im = curRow < trace->GetDataY().size() ? trace->GetDataY()[curRow] : 0.0;
342
343 out.Write( wxString::Format( wxT( "%g%c%g%c" ), re, SEPARATOR, im, SEPARATOR ) );
344 }
345
346 out.Write( wxS( "\r\n" ) );
347 }
348
349 out.Close();
350 return 0;
351 }
352
353 std::size_t rowCount = traces.begin()->second->GetDataX().size();
354
355 // write column header names on the first row
356 wxString xAxisName( m_simulator->GetXAxis( simType ) );
357 out.Write( wxString::Format( wxT( "%s%c" ), xAxisName, SEPARATOR ) );
358
359 for( const auto& [name, trace] : traces )
360 out.Write( wxString::Format( wxT( "%s%c" ), trace->GetDisplayName(), SEPARATOR ) );
361
362 out.Write( wxS( "\r\n" ) );
363
364 // write each row's numerical value
365 for ( std::size_t curRow=0; curRow < rowCount; curRow++ )
366 {
367 double xAxisValue = traces.begin()->second->GetDataX().at( curRow );
368 out.Write( wxString::Format( wxT( "%g%c" ), xAxisValue, SEPARATOR ) );
369
370 for( const auto& [name, trace] : traces )
371 {
372 double yAxisValue = trace->GetDataY().at( curRow );
373 out.Write( wxString::Format( wxT( "%g%c" ), yAxisValue, SEPARATOR ) );
374 }
375
376 out.Write( wxS( "\r\n" ) );
377 }
378
379 out.Close();
380 }
381
382 return 0;
383}
384
385
387{
388 m_simulatorFrame->Close();
389 return 0;
390}
391
392
394{
395 if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
396 {
397 mpWindow* plot = plotTab->GetPlotWin();
398
399 if( plotTab->IsSmithMode() )
400 {
401 // the chart is drawn from the Smith view, not the hidden axes
402 wxPoint center( plot->GetScrX() / 2, plot->GetScrY() / 2 );
403
404 if( aEvent.IsAction( &ACTIONS::zoomInCenter ) )
405 {
406 plotTab->SmithZoomAt( center, 1.5 );
407 }
408 else if( aEvent.IsAction( &ACTIONS::zoomOutCenter ) )
409 {
410 plotTab->SmithZoomAt( center, 1.0 / 1.5 );
411 }
412 else if( aEvent.IsAction( &ACTIONS::zoomFitScreen ) )
413 {
414 plotTab->ResetSmithView();
415 plot->Refresh();
416 }
417
418 return 0;
419 }
420
421 if( aEvent.IsAction( &ACTIONS::zoomInCenter ) )
422 {
423 plot->ZoomIn();
424 }
425 else if( aEvent.IsAction( &ACTIONS::zoomOutCenter ) )
426 {
427 plot->ZoomOut();
428 }
429 else if( aEvent.IsAction( &ACTIONS::zoomInHorizontally ) )
430 {
431 plot->ZoomIn( wxDefaultPosition, mpWindow::zoomIncrementalFactor, wxHORIZONTAL );
432 }
433 else if( aEvent.IsAction( &ACTIONS::zoomOutHorizontally ) )
434 {
435 plot->ZoomOut( wxDefaultPosition, mpWindow::zoomIncrementalFactor, wxHORIZONTAL );
436 }
437 else if( aEvent.IsAction( &ACTIONS::zoomInVertically ) )
438 {
439 plot->ZoomIn( wxDefaultPosition, mpWindow::zoomIncrementalFactor, wxVERTICAL );
440 }
441 else if( aEvent.IsAction( &ACTIONS::zoomOutVertically ) )
442 {
443 plot->ZoomOut( wxDefaultPosition, mpWindow::zoomIncrementalFactor, wxVERTICAL );
444 }
445 else if( aEvent.IsAction( &ACTIONS::zoomFitScreen ) )
446 {
447 wxCommandEvent dummy;
448 plot->OnFit( dummy );
449 }
450 }
451
452 return 0;
453}
454
455
457{
458 if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
459 {
460 // the Smith view keeps no zoom history, and the hidden axes must not move
461 if( !plotTab->IsSmithMode() )
462 plotTab->GetPlotWin()->ZoomUndo();
463 }
464
465 return 0;
466}
467
468
470{
471 if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
472 {
473 if( !plotTab->IsSmithMode() )
474 plotTab->GetPlotWin()->ZoomRedo();
475 }
476
477 return 0;
478}
479
480
482{
483 if( m_simulatorFrame )
484 m_simulatorFrame->ToggleSimConsole();
485
486 return 0;
487}
488
489
491{
492 if( m_simulatorFrame )
493 m_simulatorFrame->ToggleSimSidePanel();
494
495 return 0;
496}
497
498
500{
501 if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
502 {
503 plotTab->ShowGrid( !plotTab->IsGridShown() );
504 m_simulatorFrame->OnModify();
505 }
506
507 return 0;
508}
509
510
512{
513 if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
514 {
515 plotTab->ShowLegend( !plotTab->IsLegendShown() );
516 m_simulatorFrame->OnModify();
517 }
518
519 return 0;
520}
521
522
524{
525 if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
526 {
527 plotTab->SetDottedSecondary( !plotTab->GetDottedSecondary() );
528 m_simulatorFrame->OnModify();
529 }
530
531 return 0;
532}
533
534
536{
537 m_simulatorFrame->ToggleSmithChart();
538 return 0;
539}
540
541
543{
544 m_simulatorFrame->ToggleDarkModePlots();
545 return 0;
546}
547
548
550{
551 m_simulatorFrame->EditAnalysis();
552 return 0;
553}
554
555
557{
558 if( m_simulator->IsRunning() )
559 {
560 m_simulator->Stop();
561 return 0;
562 }
563
564 if( !getCurrentSimTab() )
565 NewAnalysisTab( aEvent );
566
567 if( !getCurrentSimTab() )
568 return 0;
569
570 m_simulatorFrame->StartSimulation();
571
572 return 0;
573}
574
575
577{
578 if( m_schematicFrame == nullptr )
579 return -1;
580
581 wxWindow* blocking_dialog = m_schematicFrame->Kiway().GetBlockingDialog();
582
583 if( blocking_dialog )
584 blocking_dialog->Close( true );
585
586 m_schematicFrame->GetToolManager()->PostAction( SCH_ACTIONS::simProbe );
587 m_schematicFrame->Raise();
588
589 return 0;
590}
591
592
594{
595 if( m_schematicFrame == nullptr )
596 return -1;
597
598 wxWindow* blocking_dialog = m_schematicFrame->Kiway().GetBlockingDialog();
599
600 if( blocking_dialog )
601 blocking_dialog->Close( true );
602
603 m_schematicFrame->GetToolManager()->PostAction( SCH_ACTIONS::simTune );
604 m_schematicFrame->Raise();
605
606 return 0;
607}
608
609
611{
612public:
613 enum
614 {
616 };
617
618 void onClose( wxCloseEvent& evt )
619 {
620 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL ) );
621 }
622
623 NETLIST_VIEW_DIALOG( wxWindow* parent ) :
624 DIALOG_SHIM( parent, wxID_ANY, _( "SPICE Netlist" ), wxDefaultPosition,
625 wxSize( 800, 800 ), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
626 m_textCtrl( nullptr ),
627 m_reporter( nullptr )
628 {
629 m_splitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
630 wxSP_LIVE_UPDATE | wxSP_NOBORDER | wxSP_3DSASH );
631
632 //Avoid the splitter window being assigned as the Parent to additional windows
633 m_splitter->SetExtraStyle( wxWS_EX_TRANSIENT );
634
635 m_textCtrl = new wxStyledTextCtrl( m_splitter, wxID_ANY );
636
637 m_textCtrl->SetMarginWidth( MARGIN_LINE_NUMBERS, 50 );
638 m_textCtrl->StyleSetForeground( wxSTC_STYLE_LINENUMBER, wxColour( 75, 75, 75 ) );
639 m_textCtrl->StyleSetBackground( wxSTC_STYLE_LINENUMBER, wxColour( 220, 220, 220 ) );
640 m_textCtrl->SetMarginType( MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER );
641
642 wxFont fixedFont = KIUI::GetMonospacedUIFont();
643
644 for( int i = 0; i < wxSTC_STYLE_MAX; ++i )
645 m_textCtrl->StyleSetFont( i, fixedFont );
646
647 m_textCtrl->StyleClearAll(); // Addresses a bug in wx3.0 where styles are not correctly set
648
649 m_textCtrl->SetWrapMode( wxSTC_WRAP_WORD );
650 m_textCtrl->SetLexer( wxSTC_LEX_SPICE );
651 m_textCtrl->SetMinSize( wxSize( 40, 40 ) );
652 m_textCtrl->SetSize( wxSize( 40, 40 ) );
653
654 m_reporter = new WX_HTML_REPORT_BOX( m_splitter, wxID_ANY );
655 m_reporter->SetMinSize( wxSize( 40, 40 ) );
656 m_reporter->SetSize( wxSize( 40, 40 ) );
657
658 m_splitter->SetMinimumPaneSize( 40 );
659 m_splitter->SetSashPosition( 760 );
660 m_splitter->SetSashGravity( 0.9 );
661 m_splitter->SplitHorizontally( m_textCtrl, m_reporter );
662
663 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
664 sizer->Add( m_splitter, 1, wxEXPAND | wxALL, 5 );
665 SetSizer( sizer );
666 Layout();
667
668 Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ),
669 nullptr, this );
670
671 m_scintillaTricks = std::make_unique<SCINTILLA_TRICKS>( m_textCtrl, wxT( "{}" ), false );
672
674 }
675
676 void SetNetlist( const wxString& aSource )
677 {
678 m_textCtrl->SetText( aSource );
679 m_textCtrl->SetEditable( false );
680
681 m_reporter->Flush();
682 }
683
685
686private:
687 wxSplitterWindow* m_splitter;
688 wxStyledTextCtrl* m_textCtrl;
690
691 std::unique_ptr<SCINTILLA_TRICKS> m_scintillaTricks;
692};
693
694
696{
697 std::map<int, wxString> userSignals = m_simulatorFrame->UserDefinedSignals();
698
700
701 // QuasiModal required for syntax help and Scintilla auto-complete
702 if( dlg.ShowQuasiModal() == wxID_OK )
703 m_simulatorFrame->SetUserDefinedSignals( userSignals );
704
705 return 0;
706}
707
708
710{
711 if( m_schematicFrame == nullptr || m_simulator == nullptr )
712 return -1;
713
714 STRING_FORMATTER formatter;
716
717 m_circuitModel->GetNetlist( m_simulatorFrame->GetCurrentSimCommand(),
718 m_simulatorFrame->GetCurrentOptions(),
719 &formatter, *dlg.GetReporter() );
720
721 dlg.SetNetlist( wxString( formatter.GetString() ) );
722 dlg.ShowModal();
723
724 return 0;
725}
726
727
729{
730 // clang-format off
739
742
757
763
766 // clang-format on
767}
const char * name
static TOOL_ACTION toggleGrid
Definition actions.h:194
static TOOL_ACTION paste
Definition actions.h:76
static TOOL_ACTION zoomOutCenter
Definition actions.h:132
static TOOL_ACTION zoomRedo
Definition actions.h:144
static TOOL_ACTION zoomOutHorizontally
Definition actions.h:134
static TOOL_ACTION zoomOutVertically
Definition actions.h:136
static TOOL_ACTION zoomInHorizontally
Definition actions.h:133
static TOOL_ACTION zoomFitScreen
Definition actions.h:138
static TOOL_ACTION zoomInCenter
Definition actions.h:131
static TOOL_ACTION zoomInVertically
Definition actions.h:135
static TOOL_ACTION zoomUndo
Definition actions.h:143
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
DIALOG_SHIM(wxWindow *aParent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER, const wxString &name=wxDialogNameStr)
int ShowModal() override
void SetSimCommand(const wxString &aCommand)
void ApplySettings(SIM_TAB *aTab)
void SetSimOptions(int aOptions)
const wxString & GetSimCommand() const
WX_HTML_REPORT_BOX * m_reporter
void SetNetlist(const wxString &aSource)
std::unique_ptr< SCINTILLA_TRICKS > m_scintillaTricks
void onClose(wxCloseEvent &evt)
wxStyledTextCtrl * m_textCtrl
NETLIST_VIEW_DIALOG(wxWindow *parent)
wxSplitterWindow * m_splitter
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:72
static TOOL_ACTION toggleSimConsole
static TOOL_ACTION exportPlotToClipboard
static TOOL_ACTION saveWorkbookAs
static TOOL_ACTION toggleSimSidePanel
static TOOL_ACTION exportPlotAsCSV
static TOOL_ACTION simAnalysisProperties
static TOOL_ACTION toggleSmithChart
static TOOL_ACTION toggleDottedSecondary
static TOOL_ACTION simTune
static TOOL_ACTION toggleDarkModePlots
static TOOL_ACTION exportPlotAsPNG
static TOOL_ACTION exportPlotToSchematic
static TOOL_ACTION runSimulation
static TOOL_ACTION editUserDefinedSignals
static TOOL_ACTION newAnalysisTab
static TOOL_ACTION simProbe
static TOOL_ACTION showNetlist
static TOOL_ACTION openWorkbook
static TOOL_ACTION saveWorkbook
static TOOL_ACTION toggleLegend
static TOOL_ACTION stopSimulation
int ExportPlotAsPNG(const TOOL_EVENT &aEvent)
wxString getDefaultPath()
Return the default path to be used in file browser dialog.
SCH_EDIT_FRAME * m_schematicFrame
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
int ToggleLegend(const TOOL_EVENT &aEvent)
int RedoZoom(const TOOL_EVENT &aEvent)
int ShowNetlist(const TOOL_EVENT &aEvent)
int ExportPlotToClipboard(const TOOL_EVENT &aEvent)
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
int ToggleDarkModePlots(const TOOL_EVENT &aEvent)
int Tune(const TOOL_EVENT &aEvent)
wxString getDefaultFilename()
Return the default filename (with extension) to be used in file browser dialog.
SIMULATOR_FRAME * m_simulatorFrame
bool Init() override
Init() is called once upon a registration of the tool.
int SaveWorkbook(const TOOL_EVENT &aEvent)
int RunSimulation(const TOOL_EVENT &aEvent)
SIM_TAB * getCurrentSimTab()
Set up handlers for various events.
int OpenWorkbook(const TOOL_EVENT &aEvent)
int ToggleSmithChart(const TOOL_EVENT &aEvent)
int EditUserDefinedSignals(const TOOL_EVENT &aEvent)
std::shared_ptr< SPICE_CIRCUIT_MODEL > m_circuitModel
int ToggleGrid(const TOOL_EVENT &aEvent)
int Zoom(const TOOL_EVENT &aEvent)
int EditAnalysisTab(const TOOL_EVENT &aEvent)
int ToggleSimConsolePanel(const TOOL_EVENT &aEvent)
int ToggleDottedSecondary(const TOOL_EVENT &aEvent)
std::shared_ptr< SPICE_SIMULATOR > m_simulator
int ExportPlotAsCSV(const TOOL_EVENT &aEvent)
int UndoZoom(const TOOL_EVENT &aEvent)
int ExportPlotToSchematic(const TOOL_EVENT &aEvent)
int Probe(const TOOL_EVENT &aEvent)
int ToggleSimSidePanel(const TOOL_EVENT &aEvent)
int NewAnalysisTab(const TOOL_EVENT &aEvent)
int Close(const TOOL_EVENT &aEvent)
Cursor that snaps along a Smith chart locus, keyed by frequency.
Implement an OUTPUTFORMATTER to a memory buffer.
Definition richio.h:418
const std::string & GetString()
Definition richio.h:441
T * getEditFrame() const
Return the application window object, casted to requested user type.
Definition tool_base.h:182
RESET_REASON
Determine the reason of reset for a tool.
Definition tool_base.h:74
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition tool_base.h:76
Generic, UI-independent tool event.
Definition tool_event.h:167
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
A slimmed down version of WX_HTML_REPORT_PANEL.
A wrapper for reporting to a wxString object.
Definition reporter.h:225
Canvas for plotting mpLayer implementations.
Definition mathplot.h:920
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition mathplot.h:1205
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition confirm.cpp:245
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:217
This file is part of the common library.
#define _(s)
void Reset() override
static const std::string WorkbookFileExtension
static wxString PngFileWildcard()
static wxString CsvFileWildcard()
static wxString WorkbookFileWildcard()
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:521
KICOMMON_API wxFont GetMonospacedUIFont()
Definition ui_common.cpp:93
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_UNDEFINED
SIM_TYPE
< Possible simulation types
Definition sim_types.h:31
#define MIME_BASE64_LENGTH
std::vector< FAB_LAYER_COLOR > dummy
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
std::string path
IbisParser parser & reporter
VECTOR2I center
Definition of file extensions used in Kicad.
#define SEPARATOR
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().
Definition wx_filename.h:35