From c971460467823ac7c67690ab8103b384f1b0f3e9 Mon Sep 17 00:00:00 2001 From: Antia Puentes Date: Tue, 4 Dec 2012 13:04:04 -0600 Subject: [PATCH 1/2] In eeschema, when inserting a component into the schematic using the Library Browser tool, you have to select it in the components listbox and then press the "Insert component into schematic" button to close the window and return to the schematic. The attached patch enables the selection and insertion of a component in schematic by double clicking on it in the Library Browser component listbox. As the double clicking should have effect only if the Library Browser was launched to load a component in schematic, the patch checks for NULL the m_Semaphore variable, used two distinguish the mode in which the Library Browser is running (modal, used when inserting a component in schematic, or non-modal). --- eeschema/viewlib_frame.cpp | 8 ++++++++ eeschema/viewlib_frame.h | 1 + 2 files changed, 9 insertions(+) diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 576a96ffae..07f6fccded 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -74,6 +74,7 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME ) /* listbox events */ EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, LIB_VIEW_FRAME::ClickOnLibList ) EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::ClickOnCmpList ) + EVT_LISTBOX_DCLICK( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::DClickOnCmpList ) EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset ) END_EVENT_TABLE() @@ -497,6 +498,13 @@ void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event ) } } +void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event ) +{ + if( m_Semaphore ) + { + ExportToSchematicLibraryPart ( event ); + } +} void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event ) { diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h index 49099a2c92..cb22fef52a 100644 --- a/eeschema/viewlib_frame.h +++ b/eeschema/viewlib_frame.h @@ -166,6 +166,7 @@ private: void ExportToSchematicLibraryPart( wxCommandEvent& event ); void ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); + void DClickOnCmpList( wxCommandEvent& event ); DECLARE_EVENT_TABLE() }; From 79015495b1ba126ce14e6b090292ed6556b9e6f9 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 4 Dec 2012 13:09:53 -0600 Subject: [PATCH 2/2] Prevent the double click from being as a single click in the parent window which would cause the part to be parked rather than staying in drag mode. --- eeschema/viewlib_frame.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 07f6fccded..582eca93cd 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -502,7 +502,12 @@ void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event ) { if( m_Semaphore ) { - ExportToSchematicLibraryPart ( event ); + ExportToSchematicLibraryPart( event ); + + // Prevent the double click from being as a single click in the parent + // window which would cause the part to be parked rather than staying + // in drag mode. + event.StopPropagation(); } }