kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #42231
Re: [patch][eeschema] Show SPICE Netlist window should not be editable
Hi,
I prepared another patch for KiCad with two fixes:
1. The same as previously, added ESC handler for "Show SPICE Netlist"
window, but this time
I didn't change behavior of text field. Still I would like to have
handling escape on that window,
it will be convenient during testing simulations.
2. When rows were deleted from grid with fields, there was a message
generated with number
less than zero. I found it during playing with my changes regarding
initial conditions. On a Linux
it resulted with failed assert and wrong number of rows. On Windows, I
don't see message box
complaining, but still grid looked bad.
This patch fixes that, but I didn't test it on Linux, only on Windows.
Best regards,
Sylwester
On 05/07/2019 23:01, Wayne Stambaugh wrote:
Hi Sylwester,
There is a minor problem with this patch. You can no longer copy the
contents of the netlist viewer window to the clipboard (a least on
linux) with your patch so I am reluctant to merge it because I'm sure
users will want to be able to copy and paste the generated netlist for
bug reporting purposes.
Cheers,
Wayne
On 6/23/19 4:45 PM, Sylwester Kocjan wrote:
Hello,
I noticed in simulation settings, that window displaying netlist for
simulation is editable. I think it is a bug and may be confusing for
user (typing random text didn't have influence on simulation)
See the attachment for a patch, where I fixed this and also added key
handler for wxStyledTextCtrl. Thanks to this window can be dismissed
when pressing Escape.
Is it OK to share patch directly here or should I rather create bug
report?
Best regards,
Sylwek
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp
From bcb5a9968bf09df91f02739b618ac94260913c5e Mon Sep 17 00:00:00 2001
From: Sylwester Kocjan <s.kocjan@xxxxx>
Date: Fri, 11 Oct 2019 21:30:35 +0200
Subject: [PATCH] eeschema: fixed removing negative number of rows from grid.
eeschema: added ESC handler to 'Show SPICE Netlist' window.
---
eeschema/dialogs/dialog_edit_component_in_lib.cpp | 2 +-
.../dialogs/dialog_edit_component_in_schematic.cpp | 2 +-
eeschema/sim/sim_plot_frame.cpp | 12 ++++++++++--
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp
index ea00e1011..31feec555 100644
--- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp
+++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp
@@ -604,7 +604,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnEditSpiceModel( wxCommandEvent& event )
}
else if( diff < 0 )
{
- wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, diff );
+ wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, -diff );
m_grid->ProcessTableMessage( msg );
}
diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp
index 1d7a2b954..5850cf5e9 100644
--- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp
+++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp
@@ -299,7 +299,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnEditSpiceModel( wxCommandEvent& event
}
else if( diff < 0 )
{
- wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, diff );
+ wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, -diff );
m_grid->ProcessTableMessage( msg );
}
diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp
index c24b0e165..ece328150 100644
--- a/eeschema/sim/sim_plot_frame.cpp
+++ b/eeschema/sim/sim_plot_frame.cpp
@@ -1229,6 +1229,12 @@ void SIM_PLOT_FRAME::onShowNetlist( wxCommandEvent& event )
EndModal( GetReturnCode() );
}
+ void onEscape( wxKeyEvent& evt )
+ {
+ if( evt.GetKeyCode() == WXK_ESCAPE )
+ Close();
+ }
+
NETLIST_VIEW_DIALOG(wxWindow* parent, wxString source) :
wxDialog(parent, wxID_ANY, "SPICE Netlist",
wxDefaultPosition, wxSize(1500,900),
@@ -1252,8 +1258,10 @@ void SIM_PLOT_FRAME::onShowNetlist( wxCommandEvent& event )
sizer->Add( text, 1, wxEXPAND );
SetSizer( sizer );
- Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ), NULL,
- this );
+ Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ),
+ NULL, this );
+ text->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( NETLIST_VIEW_DIALOG::onEscape ),
+ NULL, this );
}
};
--
2.23.0
References