KiCad PCB EDA Suite
sim_workbook.h
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) 2021 MikoĊ‚aj Wielgus <wielgusmikolaj@gmail.com>
5  * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
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 2
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  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 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 #ifndef __SIM_WORKBOOK__
26 #define __SIM_WORKBOOK__
27 
28 #include <dialog_sim_settings.h>
29 #include <sim/sim_panel_base.h>
30 #include <sim/sim_plot_panel.h>
31 
32 
33 class SIM_WORKBOOK : public wxAuiNotebook
34 {
35 public:
36  SIM_WORKBOOK();
37  SIM_WORKBOOK( wxWindow* aParent, wxWindowID aId=wxID_ANY, const wxPoint&
38  aPos=wxDefaultPosition, const wxSize& aSize=wxDefaultSize, long
39  aStyle=wxAUI_NB_DEFAULT_STYLE );
40 
41  // Methods from wxAuiNotebook
42 
43  bool AddPage( wxWindow* aPage, const wxString& aCaption, bool aSelect=false, const wxBitmap& aBitmap=wxNullBitmap );
44  bool AddPage( wxWindow* aPage, const wxString& aText, bool aSelect, int aImageId ) override;
45 
46  bool DeleteAllPages() override;
47  bool DeletePage( size_t aPage ) override;
48 
49  // Custom methods
50 
51  bool AddTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aTitle, const wxString& aName,
52  int aPoints, const double* aX, const double* aY, SIM_PLOT_TYPE aType,
53  const wxString& aParam );
54  bool DeleteTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aName );
55 
56  void SetSimCommand( SIM_PANEL_BASE* aPlotPanel, const wxString& aSimCommand )
57  {
58  aPlotPanel->setSimCommand( aSimCommand );
59  setModified();
60  }
61 
62  const wxString& GetSimCommand( const SIM_PANEL_BASE* aPlotPanel )
63  {
64  return aPlotPanel->getSimCommand();
65  }
66 
67  void ClrModified();
68  bool IsModified() const { return m_modified; }
69 
70 private:
71  void setModified( bool value = true );
72 
74  bool m_modified;
75 };
76 
77 wxDECLARE_EVENT( EVT_WORKBOOK_MODIFIED, wxCommandEvent );
78 wxDECLARE_EVENT( EVT_WORKBOOK_CLR_MODIFIED, wxCommandEvent );
79 
80 #endif // __SIM_WORKBOOK__
void SetSimCommand(SIM_PANEL_BASE *aPlotPanel, const wxString &aSimCommand)
Definition: sim_workbook.h:56
bool DeletePage(size_t aPage) override
bool AddPage(wxWindow *aPage, const wxString &aCaption, bool aSelect=false, const wxBitmap &aBitmap=wxNullBitmap)
void setModified(bool value=true)
Dirty bit, indicates something in the workbook has changed.
bool DeleteAllPages() override
bool IsModified() const
Definition: sim_workbook.h:68
bool AddTrace(SIM_PLOT_PANEL *aPlotPanel, const wxString &aTitle, const wxString &aName, int aPoints, const double *aX, const double *aY, SIM_PLOT_TYPE aType, const wxString &aParam)
void setSimCommand(const wxString &aSimCommand)
const wxString & getSimCommand() const
const wxString & GetSimCommand(const SIM_PANEL_BASE *aPlotPanel)
Definition: sim_workbook.h:62
bool DeleteTrace(SIM_PLOT_PANEL *aPlotPanel, const wxString &aName)
void ClrModified()
SIM_PLOT_TYPE
Definition: sim_types.h:46
wxDECLARE_EVENT(EVT_WORKBOOK_MODIFIED, wxCommandEvent)