kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #39069
Re: [PATCH 6/7] Eeschema: Field editor closes on Esc+Shift.
Alternative version of patch:
if dialog has a grid and the grid has an active cell editor Esc key closes
cell editor, otherwise Esc key closes the dialog.
ср, 16 янв. 2019 г. в 21:13, Wayne Stambaugh <stambaughw@xxxxxxxxx>:
> This is why the development branch has a warning dialog to ask you if
> you want to discard all changes so this issue is mitigated. This will
> be available in the stable 5.1 release.
>
> On 1/16/2019 1:18 PM, Константин Барановский wrote:
> > I agree that Shift+Esc isn't intuitive but in other way casual dialog
> > closing on Esc (that often happens in my case) may be annoying,
> > especially in large projects where you may need to fill a lot of fields.
> > Exactly why I decide to use shortcut Shift+Esc.
> >
> > ср, 16 янв. 2019 г. в 19:19, José Ignacio <jose.cyborg@xxxxxxxxx
> > <mailto:jose.cyborg@xxxxxxxxx>>:
> >
> > Double escape can work if there is some sort of visual feedback.
> > Luckily now the dialog will ask before exiting with unsaved changes,
> > that didn't use to be the case, so exiting with escape is not that
> > huge a deal anymore.
> >
> > On Wed, Jan 16, 2019 at 10:12 AM Wayne Stambaugh
> > <stambaughw@xxxxxxxxx <mailto:stambaughw@xxxxxxxxx>> wrote:
> >
> > We should get some more feedback on this change. I'm not
> > convinced this
> > is the way to go. It should not be surprising to anyone that
> > the escape
> > keep closes a dialog since AFAIK this is the default dialog
> > behavior for
> > all platforms. My guess is that users will not intuitively know
> > that
> > shift+escape will close the dialog and there will be bug report
> > about
> > that immediately after we merge this change. Maybe switching the
> > behavior between the escape and shift+escape would be more
> > natural for
> > users. The other option is the go with a double escape schema
> > where if
> > the user is editing a grid cell, the first escape exits out of
> > the grid
> > editing and the second escape closes the dialog as expected. If
> > no grid
> > is being edited, then a single escape closes the dialog.
> >
> > On 1/16/2019 9:54 AM, José Ignacio wrote:
> > > great change, the current behavior of exiting with esc has
> > bitten me in
> > > the ass too many times to count!
> > >
> > > On Wed, Jan 16, 2019, 7:41 AM Baranovskiy Konstantin
> > > <baranovskiykonstantin@xxxxxxxxx
> > <mailto:baranovskiykonstantin@xxxxxxxxx>
> > > <mailto:baranovskiykonstantin@xxxxxxxxx
> > <mailto:baranovskiykonstantin@xxxxxxxxx>> wrote:
> > >
> > > CHANGED: By default dialog closes on Esc key immediately.
> > But in case
> > > with Field editor there is no way to close a cell editor
> > with canceling
> > > changes in a fields grid (it's done by pressing Esc key).
> > The fields
> > > grid is the main control here and it must be the most
> > comfortable to
> > > work with. So default behavior on Esc key pressing
> > disabled in Field
> > > editor and for now it closes by Esc+Shift.
> > > ---
> > > .../dialogs/dialog_fields_editor_global.cpp | 15 +-
> > > .../dialogs/dialog_fields_editor_global.h | 3 +-
> > > .../dialog_fields_editor_global_base.cpp | 90 +-
> > > .../dialog_fields_editor_global_base.fbp | 826
> > ++++++------------
> > > .../dialog_fields_editor_global_base.h | 23 +-
> > > 5 files changed, 347 insertions(+), 610 deletions(-)
> > >
> > > diff --git
> a/eeschema/dialogs/dialog_fields_editor_global.cpp
> > > b/eeschema/dialogs/dialog_fields_editor_global.cpp
> > > index ec928e05b..868297350 100644
> > > --- a/eeschema/dialogs/dialog_fields_editor_global.cpp
> > > +++ b/eeschema/dialogs/dialog_fields_editor_global.cpp
> > > @@ -646,6 +646,11 @@
> > > DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(
> > > SCH_EDIT_FRAME* parent
> > > {
> > > wxSize defaultDlgSize = ConvertDialogToPixels(
> > wxSize( 600, 300
> > > ) );
> > >
> > > + // Disable dialog closing on Esc key.
> > > + // It is necessary for a grid that also must handle
> > this key event.
> > > + // Current dialog closes on Esc+Shift (see OnCharHook
> > handler).
> > > + SetEscapeId( wxID_NONE );
> > > +
> > > // Get all components from the list of schematic
> sheets
> > > SCH_SHEET_LIST sheets( g_RootSheet );
> > > sheets.GetComponents( m_componentRefs, false );
> > > @@ -1025,19 +1030,25 @@ void
> > > DIALOG_FIELDS_EDITOR_GLOBAL::OnSizeFieldList( wxSizeEvent&
> > event )
> > > }
> > >
> > >
> > > -void DIALOG_FIELDS_EDITOR_GLOBAL::OnSaveAndContinue(
> > > wxCommandEvent& aEvent )
> > > +void DIALOG_FIELDS_EDITOR_GLOBAL::OnSaveAndContinue(
> > > wxCommandEvent& event )
> > > {
> > > if( TransferDataFromWindow() )
> > > m_parent->SaveProject();
> > > }
> > >
> > > +void DIALOG_FIELDS_EDITOR_GLOBAL::OnCharHook( wxKeyEvent&
> > event )
> > > +{
> > > + if( event.GetKeyCode() == WXK_ESCAPE &&
> > event.ShiftDown() )
> > > + Close();
> > > +
> > > + event.Skip();
> > > +}
> > >
> > > void DIALOG_FIELDS_EDITOR_GLOBAL::OnCancel(
> > wxCommandEvent& event )
> > > {
> > > Close();
> > > }
> > >
> > > -
> > > void DIALOG_FIELDS_EDITOR_GLOBAL::OnClose( wxCloseEvent&
> > event )
> > > {
> > > // This is a cancel, so commit quietly as we're going
> > to throw
> > > the results away anyway.
> > > diff --git a/eeschema/dialogs/dialog_fields_editor_global.h
> > > b/eeschema/dialogs/dialog_fields_editor_global.h
> > > index 4d8abfc65..a9c14818c 100644
> > > --- a/eeschema/dialogs/dialog_fields_editor_global.h
> > > +++ b/eeschema/dialogs/dialog_fields_editor_global.h
> > > @@ -64,7 +64,8 @@ private:
> > > void OnTableItemContextMenu( wxGridEvent& event )
> > override;
> > > void OnSizeFieldList( wxSizeEvent& event ) override;
> > > void OnAddField( wxCommandEvent& event ) override;
> > > - void OnSaveAndContinue( wxCommandEvent& aEvent )
> > override;
> > > + void OnSaveAndContinue( wxCommandEvent& event )
> override;
> > > + void OnCharHook( wxKeyEvent& event ) override;
> > > void OnCancel( wxCommandEvent& event ) override;
> > > void OnClose( wxCloseEvent& event ) override;
> > > };
> > > diff --git
> > a/eeschema/dialogs/dialog_fields_editor_global_base.cpp
> > > b/eeschema/dialogs/dialog_fields_editor_global_base.cpp
> > > index c261b5bc8..ab2fcf2e3 100644
> > > --- a/eeschema/dialogs/dialog_fields_editor_global_base.cpp
> > > +++ b/eeschema/dialogs/dialog_fields_editor_global_base.cpp
> > > @@ -1,5 +1,5 @@
> > >
> >
> ///////////////////////////////////////////////////////////////////////////
> > > -// C++ code generated with wxFormBuilder (version Dec 30
> > 2017)
> > > +// C++ code generated with wxFormBuilder (version Jan 12
> > 2019)
> > > // http://www.wxformbuilder.org/
> > > //
> > > // PLEASE DO *NOT* EDIT THIS FILE!
> > > @@ -14,118 +14,119 @@
> > >
> >
> DIALOG_FIELDS_EDITOR_GLOBAL_BASE::DIALOG_FIELDS_EDITOR_GLOBAL_BASE(
> > > wxWindow* parent, wxWindowID id, const wxString& title,
> const
> > > wxPoint& pos, const wxSize& size, long style ) :
> DIALOG_SHIM(
> > > parent, id, title, pos, size, style )
> > > {
> > > this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize
> );
> > > -
> > > +
> > > wxBoxSizer* bMainSizer;
> > > bMainSizer = new wxBoxSizer( wxVERTICAL );
> > > -
> > > +
> > > m_splitter1 = new wxSplitterWindow( this, wxID_ANY,
> > > wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE );
> > > m_splitter1->SetMinimumPaneSize( 200 );
> > > -
> > > +
> > > m_leftPanel = new wxPanel( m_splitter1, wxID_ANY,
> > > wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
> > > wxBoxSizer* bLeftSizer;
> > > bLeftSizer = new wxBoxSizer( wxVERTICAL );
> > > -
> > > +
> > > wxBoxSizer* bGroupSizer;
> > > bGroupSizer = new wxBoxSizer( wxHORIZONTAL );
> > > -
> > > +
> > > m_groupComponentsBox = new wxCheckBox( m_leftPanel,
> > > OPT_GROUP_COMPONENTS, _("Group symbols"),
> wxDefaultPosition,
> > > wxDefaultSize, 0 );
> > > - m_groupComponentsBox->SetValue(true);
> > > + m_groupComponentsBox->SetValue(true);
> > > m_groupComponentsBox->SetToolTip( _("Group
> components
> > > together based on common properties") );
> > > -
> > > +
> > > bGroupSizer->Add( m_groupComponentsBox, 0,
> > wxALL|wxEXPAND, 5 );
> > > -
> > > -
> > > +
> > > +
> > > bGroupSizer->Add( 0, 0, 1,
> > wxEXPAND|wxRIGHT|wxLEFT, 10 );
> > > -
> > > - m_bRefresh = new wxBitmapButton( m_leftPanel,
> > wxID_ANY,
> > > wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
> > > +
> > > + m_bRefresh = new wxBitmapButton( m_leftPanel,
> > wxID_ANY,
> > > wxNullBitmap, wxDefaultPosition, wxDefaultSize,
> > wxBU_AUTODRAW|0 );
> > > m_bRefresh->SetMinSize( wxSize( 30,30 ) );
> > > -
> > > +
> > > bGroupSizer->Add( m_bRefresh, 0,
> > wxALIGN_CENTER_VERTICAL, 5 );
> > > -
> > > -
> > > +
> > > +
> > > bLeftSizer->Add( bGroupSizer, 0,
> > > wxALL|wxBOTTOM|wxEXPAND|wxTOP, 2 );
> > > -
> > > +
> > > m_fieldsCtrl = new wxDataViewListCtrl( m_leftPanel,
> > > wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
> > > m_fieldsCtrl->SetMinSize( wxSize( -1,220 ) );
> > > -
> > > +
> > > bLeftSizer->Add( m_fieldsCtrl, 1, wxALL|wxEXPAND,
> 5 );
> > > -
> > > +
> > > m_addFieldButton = new wxButton( m_leftPanel,
> > wxID_ANY,
> > > _("Add Field..."), wxDefaultPosition, wxDefaultSize, 0 );
> > > bLeftSizer->Add( m_addFieldButton, 0,
> > wxALL|wxEXPAND, 5 );
> > > -
> > > -
> > > +
> > > +
> > > m_leftPanel->SetSizer( bLeftSizer );
> > > m_leftPanel->Layout();
> > > bLeftSizer->Fit( m_leftPanel );
> > > m_panel4 = new wxPanel( m_splitter1, wxID_ANY,
> > > wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
> > > wxBoxSizer* bRightSizer;
> > > bRightSizer = new wxBoxSizer( wxVERTICAL );
> > > -
> > > +
> > > m_grid = new WX_GRID( m_panel4, wxID_ANY,
> > wxDefaultPosition,
> > > wxDefaultSize, 0 );
> > > -
> > > +
> > > // Grid
> > > m_grid->CreateGrid( 5, 5 );
> > > m_grid->EnableEditing( true );
> > > m_grid->EnableGridLines( true );
> > > m_grid->EnableDragGridSize( false );
> > > m_grid->SetMargins( 0, 0 );
> > > -
> > > +
> > > // Columns
> > > m_grid->EnableDragColMove( true );
> > > m_grid->EnableDragColSize( true );
> > > m_grid->SetColLabelSize( 20 );
> > > - m_grid->SetColLabelAlignment( wxALIGN_CENTRE,
> > wxALIGN_CENTRE );
> > > -
> > > + m_grid->SetColLabelAlignment( wxALIGN_CENTER,
> > wxALIGN_CENTER );
> > > +
> > > // Rows
> > > m_grid->EnableDragRowSize( false );
> > > m_grid->SetRowLabelSize( 0 );
> > > - m_grid->SetRowLabelAlignment( wxALIGN_CENTRE,
> > wxALIGN_CENTRE );
> > > -
> > > + m_grid->SetRowLabelAlignment( wxALIGN_CENTER,
> > wxALIGN_CENTER );
> > > +
> > > // Label Appearance
> > > -
> > > +
> > > // Cell Defaults
> > > m_grid->SetDefaultCellAlignment( wxALIGN_LEFT,
> > wxALIGN_TOP );
> > > m_grid->SetMinSize( wxSize( 400,240 ) );
> > > -
> > > +
> > > bRightSizer->Add( m_grid, 1, wxALL|wxEXPAND, 5 );
> > > -
> > > -
> > > +
> > > +
> > > m_panel4->SetSizer( bRightSizer );
> > > m_panel4->Layout();
> > > bRightSizer->Fit( m_panel4 );
> > > m_splitter1->SplitVertically( m_leftPanel,
> > m_panel4, -1 );
> > > bMainSizer->Add( m_splitter1, 1, wxALL|wxEXPAND, 5
> );
> > > -
> > > +
> > > wxBoxSizer* bButtonsSizer;
> > > bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
> > > -
> > > -
> > > +
> > > +
> > > bButtonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
> > > -
> > > +
> > > m_button1 = new wxButton( this, wxID_ANY,
> > _("Apply, Save
> > > Schematic && Continue"), wxDefaultPosition, wxDefaultSize,
> > 0 );
> > > bButtonsSizer->Add( m_button1, 0,
> > > wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
> > > -
> > > +
> > > m_sdbSizer1 = new wxStdDialogButtonSizer();
> > > m_sdbSizer1OK = new wxButton( this, wxID_OK );
> > > m_sdbSizer1->AddButton( m_sdbSizer1OK );
> > > m_sdbSizer1Cancel = new wxButton( this,
> wxID_CANCEL );
> > > m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
> > > m_sdbSizer1->Realize();
> > > -
> > > +
> > > bButtonsSizer->Add( m_sdbSizer1, 0,
> > > wxBOTTOM|wxEXPAND|wxLEFT, 5 );
> > > -
> > > -
> > > +
> > > +
> > > bMainSizer->Add( bButtonsSizer, 0, wxEXPAND, 5 );
> > > -
> > > -
> > > +
> > > +
> > > this->SetSizer( bMainSizer );
> > > this->Layout();
> > > bMainSizer->Fit( this );
> > > -
> > > +
> > > this->Centre( wxBOTH );
> > > -
> > > +
> > > // Connect Events
> > > this->Connect( wxEVT_CLOSE_WINDOW,
> > wxCloseEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnClose ) );
> > > + m_splitter1->Connect( wxEVT_CHAR_HOOK,
> > wxKeyEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnCharHook ), NULL, this
> );
> > > m_groupComponentsBox->Connect(
> > > wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnGroupComponentsToggled
> > ), NULL,
> > > this );
> > > m_bRefresh->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
> > > wxCommandEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnRegroupComponents ),
> > NULL, this );
> > > m_fieldsCtrl->Connect(
> > > wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,
> > wxDataViewEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnColumnItemToggled ),
> > NULL, this );
> > > @@ -143,6 +144,7 @@
> > >
> >
> DIALOG_FIELDS_EDITOR_GLOBAL_BASE::~DIALOG_FIELDS_EDITOR_GLOBAL_BASE()
> > > {
> > > // Disconnect Events
> > > this->Disconnect( wxEVT_CLOSE_WINDOW,
> > wxCloseEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnClose ) );
> > > + m_splitter1->Disconnect( wxEVT_CHAR_HOOK,
> > wxKeyEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnCharHook ), NULL, this
> );
> > > m_groupComponentsBox->Disconnect(
> > > wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnGroupComponentsToggled
> > ), NULL,
> > > this );
> > > m_bRefresh->Disconnect(
> wxEVT_COMMAND_BUTTON_CLICKED,
> > > wxCommandEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnRegroupComponents ),
> > NULL, this );
> > > m_fieldsCtrl->Disconnect(
> > > wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,
> > wxDataViewEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnColumnItemToggled ),
> > NULL, this );
> > > @@ -154,5 +156,5 @@
> > >
> >
> DIALOG_FIELDS_EDITOR_GLOBAL_BASE::~DIALOG_FIELDS_EDITOR_GLOBAL_BASE()
> > > m_grid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK,
> > > wxGridEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnTableItemContextMenu
> > ), NULL,
> > > this );
> > > m_button1->Disconnect(
> wxEVT_COMMAND_BUTTON_CLICKED,
> > > wxCommandEventHandler(
> > > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnSaveAndContinue ),
> > NULL, this );
> > > m_sdbSizer1Cancel->Disconnect(
> > wxEVT_COMMAND_BUTTON_CLICKED,
> > > wxCommandEventHandler(
> > DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnCancel ),
> > > NULL, this );
> > > -
> > > +
> > > }
> > > diff --git
> > a/eeschema/dialogs/dialog_fields_editor_global_base.fbp
> > > b/eeschema/dialogs/dialog_fields_editor_global_base.fbp
> > > index 6e4c89459..fb04b14ff 100644
> > > --- a/eeschema/dialogs/dialog_fields_editor_global_base.fbp
> > > +++ b/eeschema/dialogs/dialog_fields_editor_global_base.fbp
> > > @@ -2,7 +2,7 @@
> > > <wxFormBuilder_Project>
> > > <FileVersion major="1" minor="15" />
> > > <object class="Project" expanded="1">
> > > - <property name="class_decoration" />
> > > + <property name="class_decoration"></property>
> > > <property name="code_generation">C++</property>
> > > <property name="disconnect_events">1</property>
> > > <property
> > name="disconnect_mode">source_name</property>
> > > @@ -14,11 +14,12 @@
> > > <property
> > > name="file">dialog_fields_editor_global_base</property>
> > > <property name="first_id">1000</property>
> > > <property name="help_provider">none</property>
> > > + <property name="indent_with_spaces"></property>
> > > <property name="internationalize">1</property>
> > > <property
> > > name="name">dialog_fields_editor_global_base</property>
> > > - <property name="namespace" />
> > > + <property name="namespace"></property>
> > > <property name="path">.</property>
> > > - <property name="precompiled_header" />
> > > + <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>
> > > @@ -29,244 +30,160 @@
> > > <object class="Dialog" expanded="1">
> > > <property name="aui_managed">0</property>
> > > <property
> > > name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
> > > - <property name="bg" />
> > > + <property name="bg"></property>
> > > <property name="center">wxBOTH</property>
> > > - <property name="context_help" />
> > > + <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 name="fg" />
> > > - <property name="font" />
> > > + <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 name="maximum_size"></property>
> > > <property name="minimum_size">-1,-1</property>
> > > <property
> > > name="name">DIALOG_FIELDS_EDITOR_GLOBAL_BASE</property>
> > > - <property name="pos" />
> > > + <property name="pos"></property>
> > > <property name="size">-1,-1</property>
> > > <property
> > >
> >
> name="style">wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER</property>
> > > <property name="subclass">DIALOG_SHIM;
> > > dialog_shim.h</property>
> > > <property name="title">Symbol
> Fields</property>
> > > - <property name="tooltip" />
> > > - <property name="window_extra_style" />
> > > - <property name="window_name" />
> > > - <property name="window_style" />
> > > - <event name="OnActivate" />
> > > - <event name="OnActivateApp" />
> > > - <event name="OnAuiFindManager" />
> > > - <event name="OnAuiPaneButton" />
> > > - <event name="OnAuiPaneClose" />
> > > - <event name="OnAuiPaneMaximize" />
> > > - <event name="OnAuiPaneRestore" />
> > > - <event name="OnAuiRender" />
> > > - <event name="OnChar" />
> > > + <property name="tooltip"></property>
> > > + <property
> name="window_extra_style"></property>
> > > + <property name="window_name"></property>
> > > + <property name="window_style"></property>
> > > <event name="OnClose">OnClose</event>
> > > - <event name="OnEnterWindow" />
> > > - <event name="OnEraseBackground" />
> > > - <event name="OnHibernate" />
> > > - <event name="OnIconize" />
> > > - <event name="OnIdle" />
> > > - <event name="OnInitDialog" />
> > > - <event name="OnKeyDown" />
> > > - <event name="OnKeyUp" />
> > > - <event name="OnKillFocus" />
> > > - <event name="OnLeaveWindow" />
> > > - <event name="OnLeftDClick" />
> > > - <event name="OnLeftDown" />
> > > - <event name="OnLeftUp" />
> > > - <event name="OnMiddleDClick" />
> > > - <event name="OnMiddleDown" />
> > > - <event name="OnMiddleUp" />
> > > - <event name="OnMotion" />
> > > - <event name="OnMouseEvents" />
> > > - <event name="OnMouseWheel" />
> > > - <event name="OnPaint" />
> > > - <event name="OnRightDClick" />
> > > - <event name="OnRightDown" />
> > > - <event name="OnRightUp" />
> > > - <event name="OnSetFocus" />
> > > - <event name="OnSize" />
> > > - <event name="OnUpdateUI" />
> > > <object class="wxBoxSizer" expanded="1">
> > > <property
> > name="minimum_size">-1,-1</property>
> > > <property
> name="name">bMainSizer</property>
> > > <property
> name="orient">wxVERTICAL</property>
> > > <property
> name="permission">none</property>
> > > - <object class="sizeritem" expanded="1">
> > > + <object class="sizeritem" expanded="0">
> > > <property name="border">5</property>
> > > <property
> > name="flag">wxALL|wxEXPAND</property>
> > > <property
> name="proportion">1</property>
> > > - <object class="wxSplitterWindow"
> > expanded="1">
> > > + <object class="wxSplitterWindow"
> > expanded="0">
> > > <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 name="aui_name" />
> > > - <property name="aui_position" />
> > > - <property name="aui_row" />
> > > - <property name="best_size" />
> > > - <property name="bg" />
> > > - <property name="caption" />
> > > + <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
> > 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 name="fg"></property>
> > > <property
> > name="floatable">1</property>
> > > - <property name="font" />
> > > + <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
> name="max_size"></property>
> > > <property
> > name="maximize_button">0</property>
> > > - <property name="maximum_size" />
> > > + <property
> > name="maximum_size"></property>
> > > <property
> > name="min_pane_size">200</property>
> > > - <property name="min_size" />
> > > + <property
> name="min_size"></property>
> > > <property
> > name="minimize_button">0</property>
> > > <property
> > name="minimum_size">-1,-1</property>
> > > <property
> > name="moveable">1</property>
> > > <property
> > name="name">m_splitter1</property>
> > > <property
> > name="pane_border">1</property>
> > > - <property name="pane_position" />
> > > - <property name="pane_size" />
> > > + <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 name="pos"></property>
> > > <property
> > name="resize">Resizable</property>
> > > <property
> > name="sashgravity">0.0</property>
> > > <property
> > name="sashpos">-1</property>
> > > <property
> > name="sashsize">-1</property>
> > > <property name="show">1</property>
> > > - <property name="size" />
> > > + <property name="size"></property>
> > > <property
> > > name="splitmode">wxSPLIT_VERTICAL</property>
> > > <property
> > > name="style">wxSP_LIVE_UPDATE</property>
> > > - <property name="subclass" />
> > > + <property
> name="subclass"></property>
> > > <property
> > name="toolbar_pane">0</property>
> > > - <property name="tooltip" />
> > > - <property
> > name="window_extra_style" />
> > > - <property name="window_name" />
> > > - <property name="window_style" />
> > > - <event name="OnChar" />
> > > - <event name="OnEnterWindow" />
> > > - <event name="OnEraseBackground" />
> > > - <event name="OnKeyDown" />
> > > - <event name="OnKeyUp" />
> > > - <event name="OnKillFocus" />
> > > - <event name="OnLeaveWindow" />
> > > - <event name="OnLeftDClick" />
> > > - <event name="OnLeftDown" />
> > > - <event name="OnLeftUp" />
> > > - <event name="OnMiddleDClick" />
> > > - <event name="OnMiddleDown" />
> > > - <event name="OnMiddleUp" />
> > > - <event name="OnMotion" />
> > > - <event name="OnMouseEvents" />
> > > - <event name="OnMouseWheel" />
> > > - <event name="OnPaint" />
> > > - <event name="OnRightDClick" />
> > > - <event name="OnRightDown" />
> > > - <event name="OnRightUp" />
> > > - <event name="OnSetFocus" />
> > > - <event name="OnSize" />
> > > - <event name="OnSplitterDClick" />
> > > - <event
> > name="OnSplitterSashPosChanged" />
> > > - <event
> > name="OnSplitterSashPosChanging" />
> > > - <event name="OnSplitterUnsplit" />
> > > - <event name="OnUpdateUI" />
> > > - <object class="splitteritem"
> > expanded="1">
> > > - <object class="wxPanel"
> > expanded="1">
> > > + <property
> name="tooltip"></property>
> > > + <property
> > name="window_extra_style"></property>
> > > + <property
> > name="window_name"></property>
> > > + <property
> > name="window_style"></property>
> > > + <event
> > name="OnCharHook">OnCharHook</event>
> > > + <object class="splitteritem"
> > expanded="0">
> > > + <object class="wxPanel"
> > expanded="0">
> > > <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 name="aui_name"
> />
> > > - <property
> > name="aui_position" />
> > > - <property name="aui_row"
> />
> > > - <property
> name="best_size" />
> > > - <property name="bg" />
> > > - <property name="caption"
> />
> > > + <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
> > > 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
> > name="fg"></property>
> > > <property
> > name="floatable">1</property>
> > > - <property name="font" />
> > > + <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
> > name="max_size"></property>
> > > <property
> > > name="maximize_button">0</property>
> > > - <property
> > name="maximum_size" />
> > > - <property name="min_size"
> />
> > > + <property
> > > name="maximum_size"></property>
> > > + <property
> > name="min_size"></property>
> > > <property
> > > name="minimize_button">0</property>
> > > - <property
> > name="minimum_size" />
> > > + <property
> > > name="minimum_size"></property>
> > > <property
> > name="moveable">1</property>
> > > <property
> > > name="name">m_leftPanel</property>
> > > <property
> > > name="pane_border">1</property>
> > > - <property
> > name="pane_position" />
> > > - <property
> name="pane_size" />
> > > + <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
> > name="pos"></property>
> > > <property
> > > name="resize">Resizable</property>
> > > <property
> > name="show">1</property>
> > > - <property name="size" />
> > > - <property name="subclass"
> />
> > > + <property
> > name="size"></property>
> > > + <property
> > name="subclass"></property>
> > > <property
> > > name="toolbar_pane">0</property>
> > > - <property name="tooltip"
> />
> > > - <property
> > name="window_extra_style" />
> > > - <property
> > name="window_name" />
> > > + <property
> > name="tooltip"></property>
> > > + <property
> > > name="window_extra_style"></property>
> > > + <property
> > > name="window_name"></property>
> > > <property
> > > name="window_style">wxTAB_TRAVERSAL</property>
> > > - <event name="OnChar" />
> > > - <event
> > name="OnEnterWindow" />
> > > - <event
> > name="OnEraseBackground" />
> > > - <event name="OnKeyDown" />
> > > - <event name="OnKeyUp" />
> > > - <event name="OnKillFocus"
> />
> > > - <event
> > name="OnLeaveWindow" />
> > > - <event
> name="OnLeftDClick" />
> > > - <event name="OnLeftDown"
> />
> > > - <event name="OnLeftUp" />
> > > - <event
> > name="OnMiddleDClick" />
> > > - <event
> name="OnMiddleDown" />
> > > - <event name="OnMiddleUp"
> />
> > > - <event name="OnMotion" />
> > > - <event
> > name="OnMouseEvents" />
> > > - <event
> name="OnMouseWheel" />
> > > - <event name="OnPaint" />
> > > - <event
> > name="OnRightDClick" />
> > > - <event name="OnRightDown"
> />
> > > - <event name="OnRightUp" />
> > > - <event name="OnSetFocus"
> />
> > > - <event name="OnSize" />
> > > - <event name="OnUpdateUI"
> />
> > > - <object class="wxBoxSizer"
> > > expanded="1">
> > > - <property
> > name="minimum_size" />
> > > + <object class="wxBoxSizer"
> > > expanded="0">
> > > + <property
> > > name="minimum_size"></property>
> > > <property
> > > name="name">bLeftSizer</property>
> > > <property
> > > name="orient">wxVERTICAL</property>
> > > <property
> > > name="permission">none</property>
> > > - <object
> class="sizeritem"
> > > expanded="1">
> > > + <object
> class="sizeritem"
> > > expanded="0">
> > > <property
> > > name="border">2</property>
> > > <property
> > > name="flag">wxALL|wxBOTTOM|wxEXPAND|wxTOP</property>
> > > <property
> > > name="proportion">0</property>
> > > - <object
> > class="wxBoxSizer"
> > > expanded="1">
> > > - <property
> > > name="minimum_size" />
> > > + <object
> > class="wxBoxSizer"
> > > expanded="0">
> > > + <property
> > > name="minimum_size"></property>
> > > <property
> > > name="name">bGroupSizer</property>
> > > <property
> > > name="orient">wxHORIZONTAL</property>
> > > <property
> > > name="permission">none</property>
> > > @@ -279,83 +196,60 @@
> > >
> <property
> > > name="LeftDockable">1</property>
> > >
> <property
> > > name="RightDockable">1</property>
> > >
> <property
> > > name="TopDockable">1</property>
> > > -
> <property
> > > name="aui_layer" />
> > > -
> <property
> > > name="aui_name" />
> > > -
> <property
> > > name="aui_position" />
> > > -
> <property
> > > name="aui_row" />
> > > -
> <property
> > > name="best_size" />
> > > -
> <property
> > > name="bg" />
> > > -
> <property
> > > name="caption" />
> > > +
> <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">1</property>
> > >
> <property
> > > name="close_button">1</property>
> > > -
> <property
> > > name="context_help" />
> > > +
> <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
> > > name="fg"></property>
> > >
> <property
> > > name="floatable">1</property>
> > > -
> <property
> > > name="font" />
> > > +
> <property
> > > name="font"></property>
> > >
> <property
> > > name="gripper">0</property>
> > >
> <property
> > > name="hidden">0</property>
> > >
> <property
> > > name="id">OPT_GROUP_COMPONENTS</property>
> > >
> <property
> > > name="label">Group symbols</property>
> > > -
> <property
> > > name="max_size" />
> > > +
> <property
> > > name="max_size"></property>
> > >
> <property
> > > name="maximize_button">0</property>
> > > -
> <property
> > > name="maximum_size" />
> > > -
> <property
> > > name="min_size" />
> > > +
> <property
> > > name="maximum_size"></property>
> > > +
> <property
> > > name="min_size"></property>
> > >
> <property
> > > name="minimize_button">0</property>
> > > -
> <property
> > > name="minimum_size" />
> > > +
> <property
> > > name="minimum_size"></property>
> > >
> <property
> > > name="moveable">1</property>
> > >
> <property
> > > name="name">m_groupComponentsBox</property>
> > >
> <property
> > > name="pane_border">1</property>
> > > -
> <property
> > > name="pane_position" />
> > > -
> <property
> > > name="pane_size" />
> > > +
> <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
> > > name="pos"></property>
> > >
> <property
> > > name="resize">Resizable</property>
> > >
> <property
> > > name="show">1</property>
> > > -
> <property
> > > name="size" />
> > > -
> <property
> > > name="style" />
> > > -
> <property
> > > name="subclass" />
> > > +
> <property
> > > name="size"></property>
> > > +
> <property
> > > name="style"></property>
> > > +
> <property
> > > name="subclass"></property>
> > >
> <property
> > > name="toolbar_pane">0</property>
> > >
> <property
> > > name="tooltip">Group components together based on common
> > > properties</property>
> > > -
> <property
> > > name="validator_data_type" />
> > > +
> <property
> > > name="validator_data_type"></property>
> > >
> <property
> > > name="validator_style">wxFILTER_NONE</property>
> > >
> <property
> > > name="validator_type">wxDefaultValidator</property>
> > > -
> <property
> > > name="validator_variable" />
> > > -
> <property
> > > name="window_extra_style" />
> > > -
> <property
> > > name="window_name" />
> > > -
> <property
> > > name="window_style" />
> > > - <event
> > > name="OnChar" />
> > > +
> <property
> > > name="validator_variable"></property>
> > > +
> <property
> > > name="window_extra_style"></property>
> > > +
> <property
> > > name="window_name"></property>
> > > +
> <property
> > > name="window_style"></property>
> > > <event
> > > name="OnCheckBox">OnGroupComponentsToggled</event>
> > > - <event
> > > name="OnEnterWindow" />
> > > - <event
> > > name="OnEraseBackground" />
> > > - <event
> > > name="OnKeyDown" />
> > > - <event
> > > name="OnKeyUp" />
> > > - <event
> > > name="OnKillFocus" />
> > > - <event
> > > name="OnLeaveWindow" />
> > > - <event
> > > name="OnLeftDClick" />
> > > - <event
> > > name="OnLeftDown" />
> > > - <event
> > > name="OnLeftUp" />
> > > - <event
> > > name="OnMiddleDClick" />
> > > - <event
> > > name="OnMiddleDown" />
> > > - <event
> > > name="OnMiddleUp" />
> > > - <event
> > > name="OnMotion" />
> > > - <event
> > > name="OnMouseEvents" />
> > > - <event
> > > name="OnMouseWheel" />
> > > - <event
> > > name="OnPaint" />
> > > - <event
> > > name="OnRightDClick" />
> > > - <event
> > > name="OnRightDown" />
> > > - <event
> > > name="OnRightUp" />
> > > - <event
> > > name="OnSetFocus" />
> > > - <event
> > > name="OnSize" />
> > > - <event
> > > name="OnUpdateUI" />
> > > </object>
> > > </object>
> > > <object
> > > class="sizeritem" expanded="0">
> > > @@ -377,88 +271,68 @@
> > >
> <property
> > > name="LeftDockable">1</property>
> > >
> <property
> > > name="RightDockable">1</property>
> > >
> <property
> > > name="TopDockable">1</property>
> > > -
> <property
> > > name="aui_layer" />
> > > -
> <property
> > > name="aui_name" />
> > > -
> <property
> > > name="aui_position" />
> > > -
> <property
> > > name="aui_row" />
> > > -
> <property
> > > name="best_size" />
> > > -
> <property
> > > name="bg" />
> > > -
> <property
> > > name="bitmap" />
> > > -
> <property
> > > name="caption" />
> > > +
> <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="bitmap"></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
> > > name="context_help"></property>
> > >
> <property
> > > name="context_menu">1</property>
> > > +
> <property
> > > name="current"></property>
> > >
> <property
> > > name="default">0</property>
> > >
> <property
> > > name="default_pane">0</property>
> > > -
> <property
> > > name="disabled" />
> > > +
> <property
> > > name="disabled"></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
> > > name="fg"></property>
> > >
> <property
> > > name="floatable">1</property>
> > > -
> <property
> > > name="focus" />
> > > -
> <property
> > > name="font" />
> > > +
> <property
> > > name="focus"></property>
> > > +
> <property
> > > name="font"></property>
> > >
> <property
> > > name="gripper">0</property>
> > >
> <property
> > > name="hidden">0</property>
> > > -
> > >
> > >
> > > _______________________________________________
> > > Mailing list: https://launchpad.net/~kicad-developers
> > > Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > <mailto: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
> > <mailto: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
> > <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help : https://help.launchpad.net/ListHelp
> >
>
From 30d72625a25b1a6ce596d01243298879675be7e9 Mon Sep 17 00:00:00 2001
From: Baranovskiy Konstantin <baranovskiykonstantin@xxxxxxxxx>
Date: Thu, 17 Jan 2019 14:19:43 +0200
Subject: [PATCH 6/7] Dialog: Esc key closes a grid editor first.
CHANGED: By default dialog closes on Esc key immediately and if dialog
has a grid control there is no way to close a cell editor with canceling
changes. New behavior is next: if dialog has a grid and the grid has an
active cell editor Esc key closes cell editor, otherwise Esc key closes
the dialog.
---
common/dialog_shim.cpp | 23 +++++++++++++++++++++++
include/dialog_shim.h | 7 +++++++
2 files changed, 30 insertions(+)
diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp
index f1a9e08d7..581d0a507 100644
--- a/common/dialog_shim.cpp
+++ b/common/dialog_shim.cpp
@@ -28,6 +28,7 @@
#include <pgm_base.h>
#include <eda_rect.h>
#include <wx/display.h>
+#include <wx/grid.h>
/// Toggle a window's "enable" status to disabled, then enabled on destruction.
class WDO_ENABLE_DISABLE
@@ -54,6 +55,14 @@ public:
};
+BEGIN_EVENT_TABLE( DIALOG_SHIM, wxDialog )
+ // If dialog has a grid and the grid has an active cell editor
+ // Esc key closes cell editor, otherwise Esc key closes the dialog.
+ EVT_GRID_EDITOR_SHOWN( DIALOG_SHIM::OnGridEditorShown )
+ EVT_GRID_EDITOR_HIDDEN( DIALOG_SHIM::OnGridEditorHidden )
+END_EVENT_TABLE()
+
+
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name ) :
wxDialog( aParent, id, title, pos, size, style, name ),
@@ -461,3 +470,17 @@ void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent )
// This is mandatory to allow wxDialogBase::OnButton() to be called.
aEvent.Skip();
}
+
+
+void DIALOG_SHIM::OnGridEditorShown( wxGridEvent& event )
+{
+ SetEscapeId( wxID_NONE );
+ event.Skip();
+}
+
+
+void DIALOG_SHIM::OnGridEditorHidden( wxGridEvent& event )
+{
+ SetEscapeId( wxID_ANY );
+ event.Skip();
+}
diff --git a/include/dialog_shim.h b/include/dialog_shim.h
index 595291b30..0cb58c29b 100644
--- a/include/dialog_shim.h
+++ b/include/dialog_shim.h
@@ -28,6 +28,7 @@
#include <wx/dialog.h>
#include <hashtables.h>
#include <kiway_player.h>
+class wxGridEvent;
@@ -182,6 +183,12 @@ protected:
WX_EVENT_LOOP* m_qmodal_loop; // points to nested event_loop, NULL means not qmodal and dismissed
bool m_qmodal_showing;
WDO_ENABLE_DISABLE* m_qmodal_parent_disabler;
+
+private:
+ void OnGridEditorShown( wxGridEvent& event );
+ void OnGridEditorHidden( wxGridEvent& event );
+
+ DECLARE_EVENT_TABLE()
};
#endif // DIALOG_SHIM_
--
2.20.1
Follow ups
References