Get rid of SIM_NOTEBOOK. It's completely unnecessary.

This commit is contained in:
Jeff Young 2023-08-08 18:19:40 +01:00
parent a1f1e4c371
commit 1b080ed02f
11 changed files with 7 additions and 155 deletions

View File

@ -238,7 +238,6 @@ set( EESCHEMA_SIM_SRCS
sim/legacy_workbook.cpp
widgets/sim_notebook.cpp
widgets/tuner_slider.cpp
widgets/tuner_slider_base.cpp
)

View File

@ -27,6 +27,7 @@
#include <sim/spice_circuit_model.h>
#include <sim/ngspice.h>
#include <sim/simulator_frame.h>
#include <sim/sim_plot_tab.h>
#include <confirm.h>
#include <wx/tokenzr.h>

View File

@ -46,6 +46,7 @@ class SCH_SYMBOL;
class SIMULATOR_FRAME_UI;
class SIM_THREAD_REPORTER;
class ACTION_TOOLBAR;
class SPICE_SIMULATOR;
/**

View File

@ -523,7 +523,6 @@ SIMULATOR_FRAME_UI::SIMULATOR_FRAME_UI( SIMULATOR_FRAME* aSimulatorFrame,
SIM_PLOT_COLORS::FillDefaultColorList( m_darkMode );
Bind( EVT_SIM_CURSOR_UPDATE, &SIMULATOR_FRAME_UI::onPlotCursorUpdate, this );
Bind( EVT_WORKBOOK_MODIFIED, &SIMULATOR_FRAME_UI::onNotebookModified, this );
Bind( wxEVT_TIMER,
[&]( wxTimerEvent& aEvent )
@ -2343,13 +2342,6 @@ void SIMULATOR_FRAME_UI::onPlotDragged( wxAuiNotebookEvent& event )
}
void SIMULATOR_FRAME_UI::onNotebookModified( wxCommandEvent& event )
{
m_simulatorFrame->OnModify();
m_simulatorFrame->UpdateTitle();
}
std::shared_ptr<SPICE_SIMULATOR> SIMULATOR_FRAME_UI::simulator() const
{
return m_simulatorFrame->GetSimulator();

View File

@ -307,8 +307,6 @@ private:
bool loadLegacyWorkbook( const wxString & aPath );
bool loadJsonWorkbook( const wxString & aPath );
void onNotebookModified( wxCommandEvent& event );
void onPlotCursorUpdate( wxCommandEvent& aEvent );
public:

View File

@ -36,7 +36,7 @@ SIMULATOR_FRAME_UI_BASE::SIMULATOR_FRAME_UI_BASE( wxWindow* parent, wxWindowID i
m_sizerPlot = new wxBoxSizer( wxHORIZONTAL );
m_plotNotebook = new SIM_NOTEBOOK( m_plotPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_MIDDLE_CLICK_CLOSE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TOP );
m_plotNotebook = new wxAuiNotebook( m_plotPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_MIDDLE_CLICK_CLOSE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TOP );
m_plotNotebook->SetMinSize( wxSize( 200,200 ) );

View File

@ -343,7 +343,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_MIDDLE_CLICK_CLOSE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TOP</property>
<property name="subclass">SIM_NOTEBOOK; sim_notebook.h; </property>
<property name="subclass"></property>
<property name="tab_ctrl_height">-1</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>

View File

@ -12,7 +12,6 @@
#include <wx/intl.h>
class WX_GRID;
#include "sim_notebook.h"
#include <wx/gdicmn.h>
#include <wx/aui/auibook.h>
#include <wx/font.h>
@ -43,7 +42,7 @@ class SIMULATOR_FRAME_UI_BASE : public wxPanel
wxSplitterWindow* m_splitterPlotAndConsole;
wxPanel* m_plotPanel;
wxBoxSizer* m_sizerPlot;
SIM_NOTEBOOK* m_plotNotebook;
wxAuiNotebook* m_plotNotebook;
wxPanel* m_panelConsole;
wxBoxSizer* m_sizerConsole;
wxTextCtrl* m_simConsole;

View File

@ -33,10 +33,12 @@
#include <project/project_file.h>
#include <sch_edit_frame.h>
#include <sim/simulator_frame.h>
#include <sim/sim_plot_tab.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/simulator_control.h>
#include <scintilla_tricks.h>
#include <sim/spice_circuit_model.h>
#include <dialogs/dialog_user_defined_signals.h>

View File

@ -1,87 +0,0 @@
/*
* 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-2023 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
*/
#include "widgets/sim_notebook.h"
SIM_NOTEBOOK::SIM_NOTEBOOK() :
wxAuiNotebook()
{ }
SIM_NOTEBOOK::SIM_NOTEBOOK( wxWindow* aParent, wxWindowID aId, const wxPoint& aPos, const wxSize&
aSize, long aStyle ) :
wxAuiNotebook( aParent, aId, aPos, aSize, aStyle )
{ }
bool SIM_NOTEBOOK::AddPage( wxWindow* page, const wxString& caption, bool select, const wxBitmap& bitmap )
{
if( wxAuiNotebook::AddPage( page, caption, select, bitmap ) )
{
wxPostEvent( GetParent(), wxCommandEvent( EVT_WORKBOOK_MODIFIED ) );
return true;
}
return false;
}
bool SIM_NOTEBOOK::AddPage( wxWindow* page, const wxString& text, bool select, int imageId )
{
if( wxAuiNotebook::AddPage( page, text, select, imageId ) )
{
wxPostEvent( GetParent(), wxCommandEvent( EVT_WORKBOOK_MODIFIED ) );
return true;
}
return false;
}
bool SIM_NOTEBOOK::DeleteAllPages()
{
if( wxAuiNotebook::DeleteAllPages() )
{
wxPostEvent( GetParent(), wxCommandEvent( EVT_WORKBOOK_MODIFIED ) );
return true;
}
return false;
}
bool SIM_NOTEBOOK::DeletePage( size_t page )
{
if( wxAuiNotebook::DeletePage( page ) )
{
wxPostEvent( GetParent(), wxCommandEvent( EVT_WORKBOOK_MODIFIED ) );
return true;
}
return false;
}
wxDEFINE_EVENT( EVT_WORKBOOK_MODIFIED, wxCommandEvent );

View File

@ -1,53 +0,0 @@
/*
* 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-2023 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
*/
#ifndef SIM_NOTEBOOK_H
#define SIM_NOTEBOOK_H
#include "dialogs/dialog_sim_command.h"
#include "sim/sim_tab.h"
#include "sim/sim_plot_tab.h"
class SIM_NOTEBOOK : public wxAuiNotebook
{
public:
SIM_NOTEBOOK();
SIM_NOTEBOOK( wxWindow* aParent, wxWindowID aId = wxID_ANY,
const wxPoint& aPos = wxDefaultPosition, const wxSize& aSize = wxDefaultSize,
long aStyle = wxAUI_NB_DEFAULT_STYLE );
// 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;
bool DeleteAllPages() override;
bool DeletePage( size_t aPage ) override;
};
wxDECLARE_EVENT( EVT_WORKBOOK_MODIFIED, wxCommandEvent );
#endif // SIM_NOTEBOOK_H