2021-05-04 22:35:04 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2021 Mikołaj Wielgus <wielgusmikolaj@gmail.com>
|
|
|
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2021-06-30 00:13:10 +00:00
|
|
|
#ifndef __SIM_WORKBOOK__
|
|
|
|
#define __SIM_WORKBOOK__
|
|
|
|
|
2022-12-11 15:49:29 +00:00
|
|
|
#include <dialog_sim_command.h>
|
2021-05-04 22:35:04 +00:00
|
|
|
#include <sim/sim_panel_base.h>
|
|
|
|
#include <sim/sim_plot_panel.h>
|
|
|
|
|
|
|
|
|
2021-06-30 00:13:10 +00:00
|
|
|
class SIM_WORKBOOK : public wxAuiNotebook
|
2021-05-04 22:35:04 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SIM_WORKBOOK();
|
2021-06-30 00:13:10 +00:00
|
|
|
SIM_WORKBOOK( wxWindow* aParent, wxWindowID aId=wxID_ANY, const wxPoint&
|
|
|
|
aPos=wxDefaultPosition, const wxSize& aSize=wxDefaultSize, long
|
|
|
|
aStyle=wxAUI_NB_DEFAULT_STYLE );
|
2021-05-04 22:35:04 +00:00
|
|
|
|
2021-06-30 00:13:10 +00:00
|
|
|
// Methods from wxAuiNotebook
|
|
|
|
|
|
|
|
bool AddPage( wxWindow* aPage, const wxString& aCaption, bool aSelect=false, const wxBitmap& aBitmap=wxNullBitmap );
|
|
|
|
bool AddPage( wxWindow* aPage, const wxString& aText, bool aSelect, int aImageId ) override;
|
2021-05-04 22:35:04 +00:00
|
|
|
|
2021-06-30 00:13:10 +00:00
|
|
|
bool DeleteAllPages() override;
|
|
|
|
bool DeletePage( size_t aPage ) override;
|
2021-05-04 22:35:04 +00:00
|
|
|
|
2021-06-30 00:13:10 +00:00
|
|
|
// Custom methods
|
2021-05-11 23:27:34 +00:00
|
|
|
|
2021-09-07 21:18:22 +00:00
|
|
|
bool AddTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aTitle, const wxString& aName,
|
2022-04-12 14:37:06 +00:00
|
|
|
int aPoints, const double* aX, const double* aY, SIM_PLOT_TYPE aType );
|
2021-07-11 18:31:50 +00:00
|
|
|
bool DeleteTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aName );
|
2021-06-30 00:13:10 +00:00
|
|
|
|
2021-06-29 15:59:07 +00:00
|
|
|
void SetSimCommand( SIM_PANEL_BASE* aPlotPanel, const wxString& aSimCommand )
|
|
|
|
{
|
2021-06-30 00:13:10 +00:00
|
|
|
aPlotPanel->setSimCommand( aSimCommand );
|
2021-07-11 18:31:50 +00:00
|
|
|
setModified();
|
2021-06-29 15:59:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const wxString& GetSimCommand( const SIM_PANEL_BASE* aPlotPanel )
|
|
|
|
{
|
2021-06-30 00:13:10 +00:00
|
|
|
return aPlotPanel->getSimCommand();
|
2021-06-29 15:59:07 +00:00
|
|
|
}
|
|
|
|
|
2023-01-14 00:17:33 +00:00
|
|
|
void SetSimOptions( SIM_PANEL_BASE* aPlotPanel, int aOptions )
|
|
|
|
{
|
|
|
|
aPlotPanel->setSimOptions( aOptions );
|
|
|
|
setModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetSimOptions( const SIM_PANEL_BASE* aPlotPanel )
|
|
|
|
{
|
|
|
|
return aPlotPanel->getSimOptions();
|
|
|
|
}
|
|
|
|
|
2021-07-11 18:31:50 +00:00
|
|
|
void ClrModified();
|
2021-06-30 00:13:10 +00:00
|
|
|
bool IsModified() const { return m_modified; }
|
2021-05-04 22:35:04 +00:00
|
|
|
|
|
|
|
private:
|
2022-12-07 00:23:18 +00:00
|
|
|
void setModified();
|
2021-07-11 18:31:50 +00:00
|
|
|
|
2021-05-04 22:35:04 +00:00
|
|
|
///< Dirty bit, indicates something in the workbook has changed
|
2021-06-30 00:13:10 +00:00
|
|
|
bool m_modified;
|
2021-05-04 22:35:04 +00:00
|
|
|
};
|
2021-06-30 00:13:10 +00:00
|
|
|
|
2021-07-11 18:31:50 +00:00
|
|
|
wxDECLARE_EVENT( EVT_WORKBOOK_MODIFIED, wxCommandEvent );
|
|
|
|
wxDECLARE_EVENT( EVT_WORKBOOK_CLR_MODIFIED, wxCommandEvent );
|
|
|
|
|
2021-06-30 00:13:10 +00:00
|
|
|
#endif // __SIM_WORKBOOK__
|