KiCad PCB EDA Suite
sim_panel_base.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 (C) 2016 CERN
5  * @author Sylwester Kocjan <s.kocjan@o2.pl>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * https://www.gnu.org/licenses/gpl-3.0.html
20  * or you may search the http://www.gnu.org website for the version 3 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include "sim_panel_base.h"
26 
27 #include "sim_plot_frame.h"
29 
30 
31 SIM_PANEL_BASE::SIM_PANEL_BASE() : m_simCommand( wxEmptyString )
32 {
33 }
34 
35 
36 SIM_PANEL_BASE::SIM_PANEL_BASE( wxString aCommand ) : m_simCommand( aCommand )
37 {
38 }
39 
40 
41 SIM_PANEL_BASE::SIM_PANEL_BASE( wxString aCommand, wxWindow* parent, wxWindowID id,
42  const wxPoint& pos, const wxSize& size, long style,
43  const wxString& name ) :
44  wxWindow( parent, id, pos, size, style, name ),
45  m_simCommand( aCommand )
46 {
47 }
48 
49 
51 {
52 }
53 
54 
56 {
57  switch( aSimType )
58  {
59  case ST_AC:
60  case ST_DC:
61  case ST_TRANSIENT:
62  return true;
63 
64  default:
65  return false;
66  }
67 }
68 
69 
71 {
73 }
74 
75 
76 SIM_NOPLOT_PANEL::SIM_NOPLOT_PANEL( wxString aCommand, wxWindow* parent, wxWindowID id,
77  const wxPoint& pos, const wxSize& size, long style,
78  const wxString& name ) :
79  SIM_PANEL_BASE( aCommand, parent, id, pos, size, style, name )
80 {
81  m_sizer = new wxBoxSizer( wxVERTICAL );
82  m_sizer->Add( 0, 1, 1, wxEXPAND, 5 );
83 
84  m_textInfo = new wxStaticText( dynamic_cast<wxWindow*>( this ), wxID_ANY, "", wxDefaultPosition,
85  wxDefaultSize, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL );
86  m_textInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT,
87  wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
88  m_textInfo->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
89 
90  //ST_UNKNOWN serves purpose of a welcome panel
91  m_textInfo->SetLabel(
92  ( GetType() == ST_UNKNOWN )
93  ? _( "Start the simulation by clicking the Run Simulation button" )
94  : _( "This simulation provide no plots. Please refer to console window for "
95  "results" ) );
96 
97  m_sizer->Add( m_textInfo, 1, wxALL | wxEXPAND, 5 );
98  m_sizer->Add( 0, 1, 1, wxEXPAND, 5 );
99 
100  dynamic_cast<wxWindow*>( this )->SetSizer( m_sizer );
101 }
102 
103 
105 {
106 }
static bool IsPlottable(SIM_TYPE aSimType)
static SIM_TYPE CommandToSimType(const wxString &aCmd)
Return simulation type basing on a simulation command directive.
SIM_NOPLOT_PANEL(wxString aCommand, wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
SIM_TYPE
< Possible simulation types
Definition: sim_types.h:31
Subclass of SIM_PLOT_FRAME_BASE, which is generated by wxFormBuilder.
SIM_TYPE GetType() const
const wxString m_simCommand
const char * name
Definition: DXF_plotter.cpp:59
#define _(s)
Definition: 3d_actions.cpp:33
virtual ~SIM_NOPLOT_PANEL()
wxStaticText * m_textInfo
virtual ~SIM_PANEL_BASE()