From 85e96c92ed8c36bd2a0e77f6cbd93bab99bd3814 Mon Sep 17 00:00:00 2001 From: Antia Puentes Date: Tue, 4 Dec 2012 13:04:04 -0600 Subject: [PATCH] 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() };