Signals are added using a separate dialog
This commit is contained in:
parent
b897af7eb9
commit
51f0564119
|
@ -184,6 +184,8 @@ set( EESCHEMA_SRCS
|
|||
sim/spice_simulator.cpp
|
||||
sim/ngspice.cpp
|
||||
sim/netlist_exporter_pspice_sim.cpp
|
||||
dialogs/dialog_signal_list.cpp
|
||||
dialogs/dialog_signal_list_base.cpp
|
||||
dialogs/dialog_sim_settings.cpp
|
||||
dialogs/dialog_sim_settings_base.cpp
|
||||
dialogs/dialog_spice_model.cpp
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* 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 "dialog_signal_list.h"
|
||||
#include <sim/sim_plot_frame.h>
|
||||
|
||||
#include <sim/netlist_exporter_pspice_sim.h>
|
||||
|
||||
DIALOG_SIGNAL_LIST::DIALOG_SIGNAL_LIST( SIM_PLOT_FRAME* aParent, NETLIST_EXPORTER_PSPICE_SIM* aExporter )
|
||||
: DIALOG_SIGNAL_LIST_BASE( aParent ), m_plotFrame( aParent ), m_exporter( aExporter )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_SIGNAL_LIST::TransferDataFromWindow()
|
||||
{
|
||||
if( !DIALOG_SIGNAL_LIST_BASE::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
addSelectionToPlotFrame();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_SIGNAL_LIST::TransferDataToWindow()
|
||||
{
|
||||
// Create a list of possible signals
|
||||
// TODO switch( m_exporter->GetSimType() )
|
||||
// {
|
||||
|
||||
if( m_exporter )
|
||||
{
|
||||
for( const auto& net : m_exporter->GetNetIndexMap() )
|
||||
{
|
||||
if( net.first != "GND" )
|
||||
m_signals->Append( net.first );
|
||||
}
|
||||
}
|
||||
|
||||
return DIALOG_SIGNAL_LIST_BASE::TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SIGNAL_LIST::addSelectionToPlotFrame()
|
||||
{
|
||||
for( unsigned int i = 0; i < m_signals->GetCount(); ++i )
|
||||
{
|
||||
if( m_signals->IsSelected( i ) )
|
||||
m_plotFrame->AddVoltagePlot( m_signals->GetString( i ) );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* 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 DIALOG_SIGNAL_LIST_H
|
||||
#define DIALOG_SIGNAL_LIST_H
|
||||
|
||||
#include "dialog_signal_list_base.h"
|
||||
|
||||
class SIM_PLOT_FRAME;
|
||||
class NETLIST_EXPORTER_PSPICE_SIM;
|
||||
|
||||
class DIALOG_SIGNAL_LIST : public DIALOG_SIGNAL_LIST_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_SIGNAL_LIST( SIM_PLOT_FRAME* aParent, NETLIST_EXPORTER_PSPICE_SIM* aExporter );
|
||||
|
||||
bool TransferDataFromWindow() override;
|
||||
bool TransferDataToWindow() override;
|
||||
|
||||
private:
|
||||
void onSignalAdd( wxCommandEvent& event ) override
|
||||
{
|
||||
addSelectionToPlotFrame();
|
||||
}
|
||||
|
||||
void addSelectionToPlotFrame();
|
||||
|
||||
SIM_PLOT_FRAME* m_plotFrame;
|
||||
NETLIST_EXPORTER_PSPICE_SIM* m_exporter;
|
||||
};
|
||||
|
||||
#endif /* DIALOG_SIGNAL_LIST_H */
|
|
@ -0,0 +1,46 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 24 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_signal_list_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_SIGNAL_LIST_BASE::DIALOG_SIGNAL_LIST_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bSizer6;
|
||||
bSizer6 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_signals = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_MULTIPLE|wxLB_NEEDED_SB|wxLB_SORT );
|
||||
bSizer6->Add( m_signals, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer->AddButton( m_sdbSizerOK );
|
||||
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer->AddButton( m_sdbSizerCancel );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
bSizer6->Add( m_sdbSizer, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizer6 );
|
||||
this->Layout();
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_signals->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( DIALOG_SIGNAL_LIST_BASE::onSignalAdd ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_SIGNAL_LIST_BASE::~DIALOG_SIGNAL_LIST_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_signals->Disconnect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( DIALOG_SIGNAL_LIST_BASE::onSignalAdd ), NULL, this );
|
||||
|
||||
}
|
|
@ -0,0 +1,213 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="13" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_signal_list_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">DIALOG_SIGNAL_LIST_BASE</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_SIGNAL_LIST_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">424,535</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="title"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnActivate"></event>
|
||||
<event name="OnActivateApp"></event>
|
||||
<event name="OnAuiFindManager"></event>
|
||||
<event name="OnAuiPaneButton"></event>
|
||||
<event name="OnAuiPaneClose"></event>
|
||||
<event name="OnAuiPaneMaximize"></event>
|
||||
<event name="OnAuiPaneRestore"></event>
|
||||
<event name="OnAuiRender"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnClose"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer6</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxListBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices"></property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_signals</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxLB_MULTIPLE|wxLB_NEEDED_SB|wxLB_SORT</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnListBox"></event>
|
||||
<event name="OnListBoxDClick">onSignalAdd</event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">1</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">1</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnApplyButtonClick"></event>
|
||||
<event name="OnCancelButtonClick"></event>
|
||||
<event name="OnContextHelpButtonClick"></event>
|
||||
<event name="OnHelpButtonClick"></event>
|
||||
<event name="OnNoButtonClick"></event>
|
||||
<event name="OnOKButtonClick"></event>
|
||||
<event name="OnSaveButtonClick"></event>
|
||||
<event name="OnYesButtonClick"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -0,0 +1,51 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 24 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_SIGNAL_LIST_BASE_H__
|
||||
#define __DIALOG_SIGNAL_LIST_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_SIGNAL_LIST_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_SIGNAL_LIST_BASE : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxListBox* m_signals;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onSignalAdd( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_SIGNAL_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 424,535 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~DIALOG_SIGNAL_LIST_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_SIGNAL_LIST_BASE_H__
|
|
@ -27,6 +27,7 @@
|
|||
#include <eeschema_id.h>
|
||||
#include <kiway.h>
|
||||
|
||||
#include <dialogs/dialog_signal_list.h>
|
||||
#include "netlist_exporter_pspice_sim.h"
|
||||
|
||||
#include "sim_plot_frame.h"
|
||||
|
@ -127,22 +128,39 @@ void SIM_PLOT_FRAME::StopSimulation()
|
|||
}
|
||||
|
||||
|
||||
void SIM_PLOT_FRAME::NewPlotPanel( SIM_TYPE aSimType )
|
||||
SIM_PLOT_PANEL* SIM_PLOT_FRAME::NewPlotPanel( SIM_TYPE aSimType )
|
||||
{
|
||||
SIM_PLOT_PANEL* plot = new SIM_PLOT_PANEL( aSimType, m_plotNotebook, wxID_ANY );
|
||||
|
||||
m_plotNotebook->AddPage( plot,
|
||||
wxString::Format( wxT( "Plot%u" ), (unsigned int) m_plotNotebook->GetPageCount() + 1 ), true );
|
||||
m_plotNotebook->AddPage( plot, wxString::Format( wxT( "Plot%u" ),
|
||||
(unsigned int) m_plotNotebook->GetPageCount() + 1 ), true );
|
||||
|
||||
return plot;
|
||||
}
|
||||
|
||||
|
||||
void SIM_PLOT_FRAME::AddVoltagePlot( const wxString& aNetName )
|
||||
{
|
||||
SIM_TYPE simType = m_exporter->GetSimType();
|
||||
|
||||
if( !SIM_PLOT_PANEL::IsPlottable( simType ) )
|
||||
return; // TODO else write out in console?
|
||||
|
||||
int nodeNumber = getNodeNumber( aNetName );
|
||||
|
||||
if( nodeNumber >= -1 )
|
||||
{
|
||||
updatePlot( wxString::Format( "V(%d)", nodeNumber ), aNetName, CurrentPlot() );
|
||||
// Create a new plot if the current one displays a different type
|
||||
SIM_PLOT_PANEL* plotPanel = CurrentPlot();
|
||||
|
||||
if( plotPanel == nullptr || plotPanel->GetType() != simType )
|
||||
plotPanel = NewPlotPanel( simType );
|
||||
|
||||
if( updatePlot( wxString::Format( "V(%d)", nodeNumber ), aNetName, plotPanel ) )
|
||||
{
|
||||
updateSignalList();
|
||||
plotPanel->Fit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,11 +268,23 @@ bool SIM_PLOT_FRAME::updatePlot( const wxString& aSpiceName, const wxString& aNa
|
|||
}
|
||||
|
||||
|
||||
void SIM_PLOT_FRAME::updateSignalList()
|
||||
{
|
||||
SIM_PLOT_PANEL* plotPanel = CurrentPlot();
|
||||
|
||||
if( !plotPanel )
|
||||
return;
|
||||
|
||||
// Fill the signals listbox
|
||||
m_signals->Clear();
|
||||
|
||||
for( const auto& trace : plotPanel->GetTraces() )
|
||||
m_signals->Append( trace.second->GetName() );
|
||||
}
|
||||
|
||||
|
||||
int SIM_PLOT_FRAME::getNodeNumber( const wxString& aNetName )
|
||||
{
|
||||
if( !m_exporter )
|
||||
return -1;
|
||||
|
||||
const auto& netMapping = m_exporter->GetNetIndexMap();
|
||||
auto it = netMapping.find( aNetName );
|
||||
|
||||
|
@ -267,13 +297,10 @@ int SIM_PLOT_FRAME::getNodeNumber( const wxString& aNetName )
|
|||
|
||||
void SIM_PLOT_FRAME::menuNewPlot( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( m_exporter )
|
||||
{
|
||||
SIM_TYPE type = m_exporter->GetSimType();
|
||||
SIM_TYPE type = m_exporter->GetSimType();
|
||||
|
||||
if( SIM_PLOT_PANEL::IsPlottable( type ) )
|
||||
NewPlotPanel( type );
|
||||
}
|
||||
if( SIM_PLOT_PANEL::IsPlottable( type ) )
|
||||
NewPlotPanel( type );
|
||||
}
|
||||
|
||||
|
||||
|
@ -391,33 +418,25 @@ void SIM_PLOT_FRAME::menuShowCoordsUpdate( wxUpdateUIEvent& event )
|
|||
|
||||
void SIM_PLOT_FRAME::onPlotChanged( wxNotebookEvent& event )
|
||||
{
|
||||
updateSignalList();
|
||||
|
||||
// Update cursors
|
||||
wxQueueEvent( this, new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) );
|
||||
}
|
||||
|
||||
|
||||
void SIM_PLOT_FRAME::onSignalDblClick( wxCommandEvent& event )
|
||||
{
|
||||
// Remove signal from the plot on double click
|
||||
int idx = m_signals->GetSelection();
|
||||
SIM_PLOT_PANEL* plot = CurrentPlot();
|
||||
SIM_TYPE simType = m_exporter->GetSimType();
|
||||
|
||||
// Create a new plot if the current one displays a different type
|
||||
if( SIM_PLOT_PANEL::IsPlottable( simType ) && ( plot == nullptr || plot->GetType() != simType ) )
|
||||
{
|
||||
NewPlotPanel( simType );
|
||||
plot = CurrentPlot();
|
||||
}
|
||||
|
||||
if( idx != wxNOT_FOUND )
|
||||
{
|
||||
const wxString& netName = m_signals->GetString( idx );
|
||||
|
||||
if( plot->IsShown( netName ) )
|
||||
plot->DeleteTrace( netName );
|
||||
else
|
||||
AddVoltagePlot( netName );
|
||||
|
||||
plot->Fit();
|
||||
m_signals->Delete( idx );
|
||||
wxASSERT( plot->IsShown( netName ) );
|
||||
plot->DeleteTrace( netName );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,7 +477,14 @@ void SIM_PLOT_FRAME::onSettings( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void SIM_PLOT_FRAME::onPlaceProbe( wxCommandEvent& event )
|
||||
void SIM_PLOT_FRAME::onAddSignal( wxCommandEvent& event )
|
||||
{
|
||||
DIALOG_SIGNAL_LIST dialog( this, m_exporter.get() );
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
void SIM_PLOT_FRAME::onProbe( wxCommandEvent& event )
|
||||
{
|
||||
if( m_schematicFrame == NULL )
|
||||
return;
|
||||
|
@ -513,20 +539,10 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
|
|||
SetCursor( wxCURSOR_ARROW );
|
||||
|
||||
SIM_TYPE simType = m_exporter->GetSimType();
|
||||
|
||||
// Fill the signals listbox
|
||||
m_signals->Clear();
|
||||
|
||||
for( const auto& net : m_exporter->GetNetIndexMap() )
|
||||
{
|
||||
if( net.first != "GND" )
|
||||
m_signals->Append( net.first );
|
||||
}
|
||||
|
||||
SIM_PLOT_PANEL* plotPanel = CurrentPlot();
|
||||
|
||||
if( plotPanel == nullptr || plotPanel->GetType() != simType )
|
||||
return;
|
||||
plotPanel = NewPlotPanel( simType );
|
||||
|
||||
// If there are any signals plotted, update them
|
||||
if( SIM_PLOT_PANEL::IsPlottable( simType ) )
|
||||
|
@ -591,7 +607,6 @@ void SIM_PLOT_FRAME::SIGNAL_CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
|
|||
{
|
||||
case SHOW_SIGNAL:
|
||||
m_plotFrame->AddVoltagePlot( m_signal );
|
||||
plot->Fit();
|
||||
break;
|
||||
|
||||
break;
|
||||
|
|
|
@ -54,7 +54,14 @@ class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE
|
|||
void StartSimulation();
|
||||
void StopSimulation();
|
||||
|
||||
void NewPlotPanel( SIM_TYPE aSimType );
|
||||
/**
|
||||
* @brief Creates a new plot panel for a given simulation type and adds it to the main
|
||||
* notebook.
|
||||
* @param aSimType is requested simulation type.
|
||||
* @return The new plot panel.
|
||||
*/
|
||||
SIM_PLOT_PANEL* NewPlotPanel( SIM_TYPE aSimType );
|
||||
|
||||
void AddVoltagePlot( const wxString& aNetName );
|
||||
|
||||
SIM_PLOT_PANEL* CurrentPlot() const;
|
||||
|
@ -74,7 +81,11 @@ class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE
|
|||
* @return True if a plot was successfully added/updated.
|
||||
*/
|
||||
bool updatePlot( const wxString& aSpiceName, const wxString& aName, SIM_PLOT_PANEL* aPanel );
|
||||
|
||||
/**
|
||||
* @brief Updates the list of currently plotted signals.
|
||||
*/
|
||||
void updateSignalList();
|
||||
|
||||
/**
|
||||
* @brief Returns node number for a given net.
|
||||
|
@ -111,7 +122,8 @@ class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE
|
|||
|
||||
void onSimulate( wxCommandEvent& event ) override;
|
||||
void onSettings( wxCommandEvent& event ) override;
|
||||
void onPlaceProbe( wxCommandEvent& event ) override;
|
||||
void onAddSignal( wxCommandEvent& event ) override;
|
||||
void onProbe( wxCommandEvent& event ) override;
|
||||
|
||||
void onClose( wxCloseEvent& aEvent );
|
||||
|
||||
|
|
|
@ -122,16 +122,19 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
|
|||
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_simulateBtn = new wxButton( this, wxID_ANY, _("Simulate"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_simulateBtn, 1, wxALL, 5 );
|
||||
bSizer4->Add( m_simulateBtn, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_settingsBtn = new wxButton( this, wxID_ANY, _("Settings"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_settingsBtn, 1, wxALL, 5 );
|
||||
bSizer4->Add( m_settingsBtn, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_addSignal = new wxButton( this, wxID_ANY, _("Add signal"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_addSignal, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_probeBtn = new wxButton( this, wxID_ANY, _("Probe"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_probeBtn, 1, wxALL, 5 );
|
||||
bSizer4->Add( m_probeBtn, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_tuneBtn = new wxButton( this, wxID_ANY, _("Tune"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_tuneBtn, 1, wxALL, 5 );
|
||||
bSizer4->Add( m_tuneBtn, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer7->Add( bSizer4, 0, 0, 5 );
|
||||
|
@ -169,7 +172,8 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
|
|||
m_signals->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( SIM_PLOT_FRAME_BASE::onSignalRClick ), NULL, this );
|
||||
m_simulateBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSimulate ), NULL, this );
|
||||
m_settingsBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSettings ), NULL, this );
|
||||
m_probeBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onPlaceProbe ), NULL, this );
|
||||
m_addSignal->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onAddSignal ), NULL, this );
|
||||
m_probeBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onProbe ), NULL, this );
|
||||
m_tuneBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onTune ), NULL, this );
|
||||
}
|
||||
|
||||
|
@ -196,7 +200,8 @@ SIM_PLOT_FRAME_BASE::~SIM_PLOT_FRAME_BASE()
|
|||
m_signals->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( SIM_PLOT_FRAME_BASE::onSignalRClick ), NULL, this );
|
||||
m_simulateBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSimulate ), NULL, this );
|
||||
m_settingsBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSettings ), NULL, this );
|
||||
m_probeBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onPlaceProbe ), NULL, this );
|
||||
m_addSignal->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onAddSignal ), NULL, this );
|
||||
m_probeBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onProbe ), NULL, this );
|
||||
m_tuneBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onTune ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -919,7 +919,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1007,7 +1007,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1093,9 +1093,97 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Add signal</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_addSignal</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">onAddSignal</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1155,7 +1243,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">onPlaceProbe</event>
|
||||
<event name="OnButtonClick">onProbe</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
|
@ -1183,7 +1271,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
|
|
@ -54,6 +54,7 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
|
|||
wxListCtrl* m_cursors;
|
||||
wxButton* m_simulateBtn;
|
||||
wxButton* m_settingsBtn;
|
||||
wxButton* m_addSignal;
|
||||
wxButton* m_probeBtn;
|
||||
wxButton* m_tuneBtn;
|
||||
|
||||
|
@ -78,7 +79,8 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
|
|||
virtual void onSignalRClick( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void onSimulate( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onSettings( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onPlaceProbe( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onAddSignal( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onProbe( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onTune( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue