You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.0 KiB

  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. #include "sim_panel_base.h"
  25. #include "sim_plot_frame.h"
  26. #include <wx/sizer.h>
  27. SIM_PANEL_BASE::SIM_PANEL_BASE() : m_type( ST_UNKNOWN )
  28. {
  29. }
  30. SIM_PANEL_BASE::SIM_PANEL_BASE( SIM_TYPE aType ) : m_type( aType )
  31. {
  32. }
  33. SIM_PANEL_BASE::SIM_PANEL_BASE( SIM_TYPE aType, wxWindow* parent, wxWindowID id,
  34. const wxPoint& pos, const wxSize& size, long style, const wxString& name )
  35. : wxWindow( parent, id, pos, size, style, name ), m_type( aType )
  36. {
  37. }
  38. SIM_PANEL_BASE::~SIM_PANEL_BASE()
  39. {
  40. }
  41. bool SIM_PANEL_BASE::IsPlottable( SIM_TYPE aSimType )
  42. {
  43. switch( aSimType )
  44. {
  45. case ST_AC:
  46. case ST_DC:
  47. case ST_TRANSIENT:
  48. return true;
  49. default:
  50. return false;
  51. }
  52. }
  53. SIM_NOPLOT_PANEL::SIM_NOPLOT_PANEL( SIM_TYPE aType, wxWindow* parent, wxWindowID id,
  54. const wxPoint& pos, const wxSize& size, long style, const wxString& name )
  55. : SIM_PANEL_BASE( aType, parent, id, pos, size, style, name )
  56. {
  57. m_sizer = new wxBoxSizer( wxVERTICAL );
  58. m_sizer->Add( 0, 1, 1, wxEXPAND, 5 );
  59. m_textInfo = new wxStaticText( dynamic_cast<wxWindow*>( this ), wxID_ANY, "", wxDefaultPosition,
  60. wxDefaultSize, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL );
  61. m_textInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT,
  62. wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
  63. m_textInfo->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
  64. //ST_UNKNOWN serves purpose of a welcome panel
  65. m_textInfo->SetLabel(
  66. ( aType == ST_UNKNOWN ) ?
  67. _( "Start the simulation by clicking the Run Simulation button" ) :
  68. _( "This simulation provide no plots. Please refer to console window for results" ) );
  69. m_sizer->Add( m_textInfo, 1, wxALL | wxEXPAND, 5 );
  70. m_sizer->Add( 0, 1, 1, wxEXPAND, 5 );
  71. dynamic_cast<wxWindow*>( this )->SetSizer( m_sizer );
  72. }
  73. SIM_NOPLOT_PANEL::~SIM_NOPLOT_PANEL()
  74. {
  75. }