Sim Model Editor: Add "Save {} in Value field as "{}"" checkbox
This commit is contained in:
parent
740dbdf09a
commit
1550a1e3a4
|
@ -28,6 +28,7 @@
|
|||
#include <sim/sim_library_spice.h>
|
||||
#include <sim/sim_model_kibis.h>
|
||||
#include <sim/sim_model_raw_spice.h>
|
||||
#include <sim/sim_serde.h>
|
||||
#include <grid_tricks.h>
|
||||
#include <widgets/grid_icon_text_helpers.h>
|
||||
#include <kiplatform/ui.h>
|
||||
|
@ -227,6 +228,7 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
|
|||
m_curModelTypeOfDeviceType[deviceType] = type;
|
||||
}
|
||||
|
||||
m_saveInValueCheckbox->SetValue( curModel().IsStoredInValue() );
|
||||
m_excludeCheckbox->SetValue( !curModel().IsEnabled() );
|
||||
|
||||
onRadioButton( dummyEvent );
|
||||
|
@ -238,7 +240,6 @@ template <typename T>
|
|||
bool DIALOG_SIM_MODEL<T>::TransferDataFromWindow()
|
||||
{
|
||||
m_pinAssignmentsGrid->CommitPendingChanges();
|
||||
|
||||
m_paramGrid->GetGrid()->CommitChangesFromEditor();
|
||||
|
||||
if( !DIALOG_SIM_MODEL_BASE::TransferDataFromWindow() )
|
||||
|
@ -370,6 +371,15 @@ void DIALOG_SIM_MODEL<T>::updateInstanceWidgets()
|
|||
}
|
||||
|
||||
m_typeChoice->Enable( !m_useLibraryModelRadioButton->GetValue() || isIbisLoaded() );
|
||||
|
||||
if( curModel().HasPrimaryValue() )
|
||||
{
|
||||
m_saveInValueCheckbox->SetLabel( wxString::Format( "Save %s in Value field as \"%s\"",
|
||||
curModel().GetParam( 0 ).info.description,
|
||||
curModel().Serde().GenerateValue() ) );
|
||||
}
|
||||
|
||||
m_saveInValueCheckbox->Show( curModel().HasPrimaryValue() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1165,6 +1175,13 @@ void DIALOG_SIM_MODEL<T>::onPinAssignmentsGridSize( wxSizeEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onSaveInValueCheckbox( wxCommandEvent& aEvent )
|
||||
{
|
||||
curModel().SetIsStoredInValue( m_saveInValueCheckbox->GetValue() );
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onExcludeCheckbox( wxCommandEvent& aEvent )
|
||||
{
|
||||
|
|
|
@ -128,6 +128,7 @@ private:
|
|||
void onCodePreviewSetFocus( wxFocusEvent& aEvent ) override;
|
||||
void onPinAssignmentsGridCellChange( wxGridEvent& aEvent ) override;
|
||||
void onPinAssignmentsGridSize( wxSizeEvent& aEvent ) override;
|
||||
void onSaveInValueCheckbox( wxCommandEvent& aEvent ) override;
|
||||
void onExcludeCheckbox( wxCommandEvent& aEvent ) override;
|
||||
void onDifferentialCheckbox( wxCommandEvent& event ) override;
|
||||
|
||||
|
|
|
@ -249,6 +249,11 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c
|
|||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizer8->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_saveInValueCheckbox = new wxCheckBox( this, wxID_ANY, _("Save {} in Value field as \"{}\""), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_saveInValueCheckbox->Hide();
|
||||
|
||||
bSizer8->Add( m_saveInValueCheckbox, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizer81;
|
||||
bSizer81 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
@ -310,6 +315,7 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c
|
|||
m_codePreview->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SIM_MODEL_BASE::onCodePreviewSetFocus ), NULL, this );
|
||||
m_pinAssignmentsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridCellChange ), NULL, this );
|
||||
m_pinAssignmentsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridSize ), NULL, this );
|
||||
m_saveInValueCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onSaveInValueCheckbox ), NULL, this );
|
||||
m_excludeCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onExcludeCheckbox ), NULL, this );
|
||||
}
|
||||
|
||||
|
@ -348,6 +354,7 @@ DIALOG_SIM_MODEL_BASE::~DIALOG_SIM_MODEL_BASE()
|
|||
m_codePreview->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SIM_MODEL_BASE::onCodePreviewSetFocus ), NULL, this );
|
||||
m_pinAssignmentsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridCellChange ), NULL, this );
|
||||
m_pinAssignmentsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridSize ), NULL, this );
|
||||
m_saveInValueCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onSaveInValueCheckbox ), NULL, this );
|
||||
m_excludeCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onExcludeCheckbox ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -1877,6 +1877,71 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" 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="checked">0</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">1</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Save {} in Value field as "{}"</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_saveInValueCheckbox</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">; ; forward_declare</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="OnCheckBox">onSaveInValueCheckbox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
|
|
|
@ -79,6 +79,7 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM
|
|||
wxPanel* m_pinAssignmentsPanel;
|
||||
WX_GRID* m_pinAssignmentsGrid;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxCheckBox* m_saveInValueCheckbox;
|
||||
wxCheckBox* m_excludeCheckbox;
|
||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||
wxButton* m_sdbSizer1OK;
|
||||
|
@ -112,6 +113,7 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM
|
|||
virtual void onCodePreviewSetFocus( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void onPinAssignmentsGridCellChange( wxGridEvent& event ) { event.Skip(); }
|
||||
virtual void onPinAssignmentsGridSize( wxSizeEvent& event ) { event.Skip(); }
|
||||
virtual void onSaveInValueCheckbox( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onExcludeCheckbox( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
|
|
@ -908,7 +908,8 @@ SIM_MODEL::SIM_MODEL( TYPE aType,
|
|||
m_serde( std::move( aSerde ) ),
|
||||
m_spiceGenerator( std::move( aSpiceGenerator ) ),
|
||||
m_type( aType ),
|
||||
m_isEnabled( true )
|
||||
m_isEnabled( true ),
|
||||
m_isStoredInValue( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -412,6 +412,7 @@ public:
|
|||
const std::string& aValue );
|
||||
|
||||
const SPICE_GENERATOR& SpiceGenerator() const { return *m_spiceGenerator; }
|
||||
const SIM_SERDE& Serde() const { return *m_serde; }
|
||||
|
||||
|
||||
// Move semantics.
|
||||
|
@ -504,13 +505,16 @@ public:
|
|||
|
||||
// Can modifying a model parameter also modify other parameters?
|
||||
virtual bool HasAutofill() const { return false; }
|
||||
|
||||
virtual bool HasPrimaryValue() const { return false; }
|
||||
|
||||
void SetIsEnabled( bool aIsEnabled ) { m_isEnabled = aIsEnabled; }
|
||||
bool IsEnabled() const { return m_isEnabled; }
|
||||
|
||||
void SetIsStoredInValue( bool aIsStoredInValue ) { m_isStoredInValue = aIsStoredInValue; }
|
||||
void SetIsStoredInValue( bool aIsStoredInValue )
|
||||
{
|
||||
if( HasPrimaryValue() )
|
||||
m_isStoredInValue = aIsStoredInValue;
|
||||
}
|
||||
bool IsStoredInValue() const { return m_isStoredInValue; }
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue