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 <[email protected]>
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
33class SIM_WORKBOOK : public wxAuiNotebook
34{
35public:
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 bool DeleteTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aName );
54
55 void SetSimCommand( SIM_PANEL_BASE* aPlotPanel, const wxString& aSimCommand )
56 {
57 aPlotPanel->setSimCommand( aSimCommand );
59 }
60
61 const wxString& GetSimCommand( const SIM_PANEL_BASE* aPlotPanel )
62 {
63 return aPlotPanel->getSimCommand();
64 }
65
66 void ClrModified();
67 bool IsModified() const { return m_modified; }
68
69private:
70 void setModified( bool value = true );
71
74};
75
76wxDECLARE_EVENT( EVT_WORKBOOK_MODIFIED, wxCommandEvent );
77wxDECLARE_EVENT( EVT_WORKBOOK_CLR_MODIFIED, wxCommandEvent );
78
79#endif // __SIM_WORKBOOK__
const wxString & getSimCommand() const
void setSimCommand(const wxString &aSimCommand)
const wxString & GetSimCommand(const SIM_PANEL_BASE *aPlotPanel)
Definition: sim_workbook.h:61
bool AddTrace(SIM_PLOT_PANEL *aPlotPanel, const wxString &aTitle, const wxString &aName, int aPoints, const double *aX, const double *aY, SIM_PLOT_TYPE aType)
bool DeleteAllPages() override
void SetSimCommand(SIM_PANEL_BASE *aPlotPanel, const wxString &aSimCommand)
Definition: sim_workbook.h:55
void setModified(bool value=true)
Dirty bit, indicates something in the workbook has changed.
void ClrModified()
bool DeleteTrace(SIM_PLOT_PANEL *aPlotPanel, const wxString &aName)
bool DeletePage(size_t aPage) override
bool IsModified() const
Definition: sim_workbook.h:67
bool AddPage(wxWindow *aPage, const wxString &aCaption, bool aSelect=false, const wxBitmap &aBitmap=wxNullBitmap)
SIM_PLOT_TYPE
Definition: sim_types.h:47
wxDECLARE_EVENT(EVT_WORKBOOK_MODIFIED, wxCommandEvent)