Commit 3a5097f0 authored by jean-pierre charras's avatar jean-pierre charras

Fix a compatibility issue on wxGTK 2.8, on Linux ( Bug #1369290 )

parents d3f6e3d6 587e34ee
...@@ -106,6 +106,7 @@ private: ...@@ -106,6 +106,7 @@ private:
void setRowItem( int aFieldNdx, const SCH_FIELD& aField ); void setRowItem( int aFieldNdx, const SCH_FIELD& aField );
// event handlers // event handlers
void OnCloseDialog( wxCloseEvent& event );
void OnListItemDeselected( wxListEvent& event ); void OnListItemDeselected( wxListEvent& event );
void OnListItemSelected( wxListEvent& event ); void OnListItemSelected( wxListEvent& event );
void OnCancelButtonClick( wxCommandEvent& event ); void OnCancelButtonClick( wxCommandEvent& event );
...@@ -216,9 +217,21 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemSelected( wxListEvent& event ...@@ -216,9 +217,21 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemSelected( wxListEvent& event
} }
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCloseDialog( wxCloseEvent& event )
{
// On wxWidgets 2.8, and on Linux, calling EndQuasiModal here is mandatory
// Otherwise, the main event loop is never restored, and Eeschema does not
// respond to any event, because the DIALOG_SHIM destructor is never called.
// on wxWidgets 3.0, or on Windows, the DIALOG_SHIM destructor is called,
// and calls EndQuasiModal.
// therefore calling EndQuasiModal here is not mandatory but it creates no issues
EndQuasiModal( wxID_CANCEL );
}
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick( wxCommandEvent& event ) void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick( wxCommandEvent& event )
{ {
EndQuasiModal( 1 ); EndQuasiModal( wxID_CANCEL );
} }
...@@ -402,7 +415,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event ...@@ -402,7 +415,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
m_Parent->GetScreen()->TestDanglingEnds(); m_Parent->GetScreen()->TestDanglingEnds();
m_Parent->GetCanvas()->Refresh( true ); m_Parent->GetCanvas()->Refresh( true );
EndQuasiModal( 0 ); EndQuasiModal( wxID_OK );
} }
...@@ -1026,6 +1039,6 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) ...@@ -1026,6 +1039,6 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
m_Cmp->Draw( m_Parent->GetCanvas(), &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); m_Cmp->Draw( m_Parent->GetCanvas(), &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
EndQuasiModal( 1 ); EndQuasiModal( wxID_OK );
} }
} }
...@@ -280,6 +280,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -280,6 +280,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
mainSizer->Fit( this ); mainSizer->Fit( this );
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCloseDialog ) );
defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this ); defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this ); fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this ); fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
...@@ -294,6 +295,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -294,6 +295,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP() DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCloseDialog ) );
defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this ); defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this ); fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this ); fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<event name="OnAuiPaneRestore"></event> <event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event> <event name="OnAuiRender"></event>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnClose"></event> <event name="OnClose">OnCloseDialog</event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
<event name="OnHibernate"></event> <event name="OnHibernate"></event>
......
...@@ -81,6 +81,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM ...@@ -81,6 +81,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
wxButton* stdDialogButtonSizerCancel; wxButton* stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); } virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); } virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); } virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
......
...@@ -60,6 +60,7 @@ public: ...@@ -60,6 +60,7 @@ public:
private: private:
// Events handlers: // Events handlers:
void OnInitDialog( wxInitDialogEvent& event ); void OnInitDialog( wxInitDialogEvent& event );
void OnCloseDialog( wxCloseEvent& event );
void OnListItemDeselected( wxListEvent& event ); void OnListItemDeselected( wxListEvent& event );
void OnListItemSelected( wxListEvent& event ); void OnListItemSelected( wxListEvent& event );
...@@ -146,9 +147,7 @@ void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event ) ...@@ -146,9 +147,7 @@ void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event )
// frame. Therefore this dialog as a modal frame parent, MUST be run under // frame. Therefore this dialog as a modal frame parent, MUST be run under
// quasimodal mode for the quasimodal frame support to work. So don't use // quasimodal mode for the quasimodal frame support to work. So don't use
// the QUASIMODAL macros here. // the QUASIMODAL macros here.
int abort = dlg.ShowQuasiModal(); if( dlg.ShowQuasiModal() != wxID_OK )
if( abort )
return; return;
UpdateAliasSelectList(); UpdateAliasSelectList();
...@@ -216,7 +215,19 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnListItemSelected( wxListEvent& event ...@@ -216,7 +215,19 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnListItemSelected( wxListEvent& event
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick( wxCommandEvent& event ) void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick( wxCommandEvent& event )
{ {
EndQuasiModal( 1 ); EndQuasiModal( wxID_CANCEL );
}
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCloseDialog( wxCloseEvent& event )
{
// On wxWidgets 2.8, and on Linux, call EndQuasiModal here is mandatory
// Otherwise, the main event loop is never restored, and Eeschema does not
// respond to any event, because the DIALOG_SHIM destructor is never called.
// on wxWidgets 3.0, or on Windows, the DIALOG_SHIM destructor is called,
// and calls EndQuasiModal.
// Therefore calling EndQuasiModal here is not mandatory but it creates no issues.
EndQuasiModal( wxID_CANCEL );
} }
...@@ -287,7 +298,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event ...@@ -287,7 +298,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
m_parent->OnModify(); m_parent->OnModify();
EndQuasiModal( 0 ); EndQuasiModal( wxID_OK );
} }
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 5 2013) // C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -202,6 +202,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE ...@@ -202,6 +202,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
mainSizer->Fit( this ); mainSizer->Fit( this );
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCloseDialog ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) ); this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this ); fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this ); fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this );
...@@ -216,6 +217,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE ...@@ -216,6 +217,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE() DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCloseDialog ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) ); this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this ); fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this ); fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this );
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<event name="OnAuiPaneRestore"></event> <event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event> <event name="OnAuiRender"></event>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnClose"></event> <event name="OnClose">OnCloseDialog</event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
<event name="OnHibernate"></event> <event name="OnHibernate"></event>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 5 2013) // C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -70,6 +70,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM ...@@ -70,6 +70,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM
wxButton* stdDialogButtonSizerCancel; wxButton* stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); } virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); } virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment