Add copy support to Symbol Chooser's details panel.
Fixes: lp:git * https://bugs.launchpad.net/kicad/+bug/git
This commit is contained in:
parent
920120864f
commit
2a3e82a144
|
@ -44,7 +44,7 @@
|
||||||
#include <widgets/footprint_preview_widget.h>
|
#include <widgets/footprint_preview_widget.h>
|
||||||
#include <widgets/footprint_select_widget.h>
|
#include <widgets/footprint_select_widget.h>
|
||||||
#include <widgets/symbol_preview_widget.h>
|
#include <widgets/symbol_preview_widget.h>
|
||||||
|
#include <wx/clipbrd.h>
|
||||||
|
|
||||||
wxSize DIALOG_CHOOSE_COMPONENT::m_last_dlg_size( -1, -1 );
|
wxSize DIALOG_CHOOSE_COMPONENT::m_last_dlg_size( -1, -1 );
|
||||||
int DIALOG_CHOOSE_COMPONENT::m_h_sash_pos = 0;
|
int DIALOG_CHOOSE_COMPONENT::m_h_sash_pos = 0;
|
||||||
|
@ -64,14 +64,15 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
|
||||||
m_vsplitter( nullptr ),
|
m_vsplitter( nullptr ),
|
||||||
m_fp_sel_ctrl( nullptr ),
|
m_fp_sel_ctrl( nullptr ),
|
||||||
m_fp_preview( nullptr ),
|
m_fp_preview( nullptr ),
|
||||||
|
m_tree( nullptr ),
|
||||||
|
m_details( nullptr ),
|
||||||
m_parent( aParent ),
|
m_parent( aParent ),
|
||||||
m_deMorganConvert( aDeMorganConvert >= 0 ? aDeMorganConvert : 0 ),
|
m_deMorganConvert( aDeMorganConvert >= 0 ? aDeMorganConvert : 0 ),
|
||||||
m_allow_field_edits( aAllowFieldEdits ),
|
m_allow_field_edits( aAllowFieldEdits ),
|
||||||
m_show_footprints( aShowFootprints ),
|
m_show_footprints( aShowFootprints ),
|
||||||
m_external_browser_requested( false )
|
m_external_browser_requested( false )
|
||||||
{
|
{
|
||||||
auto sizer = new wxBoxSizer( wxVERTICAL );
|
auto sizer = new wxBoxSizer( wxVERTICAL );
|
||||||
wxHtmlWindow* details = nullptr;
|
|
||||||
|
|
||||||
// Use a slightly different layout, with a details pane spanning the entire window,
|
// Use a slightly different layout, with a details pane spanning the entire window,
|
||||||
// if we're not showing footprints.
|
// if we're not showing footprints.
|
||||||
|
@ -100,9 +101,9 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
|
||||||
auto detailsSizer = new wxBoxSizer( wxVERTICAL );
|
auto detailsSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
detailsPanel->SetSizer( detailsSizer );
|
detailsPanel->SetSizer( detailsSizer );
|
||||||
|
|
||||||
details = new wxHtmlWindow( detailsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
m_details = new wxHtmlWindow( detailsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||||
wxHW_SCROLLBAR_AUTO );
|
wxHW_SCROLLBAR_AUTO );
|
||||||
detailsSizer->Add( details, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 );
|
detailsSizer->Add( m_details, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 );
|
||||||
detailsPanel->Layout();
|
detailsPanel->Layout();
|
||||||
detailsSizer->Fit( detailsPanel );
|
detailsSizer->Fit( detailsPanel );
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
|
||||||
}
|
}
|
||||||
|
|
||||||
m_tree = new LIB_TREE( m_hsplitter, Prj().SchSymbolLibTable(), aAdapter,
|
m_tree = new LIB_TREE( m_hsplitter, Prj().SchSymbolLibTable(), aAdapter,
|
||||||
LIB_TREE::WIDGETS::ALL, details );
|
LIB_TREE::WIDGETS::ALL, m_details );
|
||||||
|
|
||||||
m_hsplitter->SetSashGravity( 0.8 );
|
m_hsplitter->SetSashGravity( 0.8 );
|
||||||
m_hsplitter->SetMinimumPaneSize( 20 );
|
m_hsplitter->SetMinimumPaneSize( 20 );
|
||||||
|
@ -171,6 +172,9 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
|
||||||
if( m_fp_sel_ctrl )
|
if( m_fp_sel_ctrl )
|
||||||
m_fp_sel_ctrl->Bind( EVT_FOOTPRINT_SELECTED,
|
m_fp_sel_ctrl->Bind( EVT_FOOTPRINT_SELECTED,
|
||||||
&DIALOG_CHOOSE_COMPONENT::OnFootprintSelected, this );
|
&DIALOG_CHOOSE_COMPONENT::OnFootprintSelected, this );
|
||||||
|
|
||||||
|
m_details->Connect( wxEVT_CHAR_HOOK,
|
||||||
|
wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,8 +193,10 @@ DIALOG_CHOOSE_COMPONENT::~DIALOG_CHOOSE_COMPONENT()
|
||||||
m_fp_sel_ctrl->Unbind( EVT_FOOTPRINT_SELECTED,
|
m_fp_sel_ctrl->Unbind( EVT_FOOTPRINT_SELECTED,
|
||||||
&DIALOG_CHOOSE_COMPONENT::OnFootprintSelected, this );
|
&DIALOG_CHOOSE_COMPONENT::OnFootprintSelected, this );
|
||||||
|
|
||||||
// I am not sure the following two lines are necessary,
|
m_details->Disconnect( wxEVT_CHAR_HOOK,
|
||||||
// but they will not hurt anyone
|
wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ), NULL, this );
|
||||||
|
|
||||||
|
// I am not sure the following two lines are necessary, but they will not hurt anyone
|
||||||
m_dbl_click_timer->Stop();
|
m_dbl_click_timer->Stop();
|
||||||
delete m_dbl_click_timer;
|
delete m_dbl_click_timer;
|
||||||
|
|
||||||
|
@ -258,6 +264,25 @@ void DIALOG_CHOOSE_COMPONENT::OnInitDialog( wxInitDialogEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DIALOG_CHOOSE_COMPONENT::OnCharHook( wxKeyEvent& e )
|
||||||
|
{
|
||||||
|
if( e.GetKeyCode() == 'C' && e.ControlDown() && !e.AltDown() && !e.ShiftDown() && !e.MetaDown() )
|
||||||
|
{
|
||||||
|
wxString txt = m_details->SelectionToText();
|
||||||
|
|
||||||
|
if( wxTheClipboard->Open() )
|
||||||
|
{
|
||||||
|
wxTheClipboard->SetData( new wxTextDataObject( txt ) );
|
||||||
|
wxTheClipboard->Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Skip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_ID DIALOG_CHOOSE_COMPONENT::GetSelectedLibId( int* aUnit ) const
|
LIB_ID DIALOG_CHOOSE_COMPONENT::GetSelectedLibId( int* aUnit ) const
|
||||||
{
|
{
|
||||||
return m_tree->GetSelectedLibId( aUnit );
|
return m_tree->GetSelectedLibId( aUnit );
|
||||||
|
|
|
@ -151,6 +151,7 @@ protected:
|
||||||
wxPanel* ConstructRightPanel( wxWindow* aParent );
|
wxPanel* ConstructRightPanel( wxWindow* aParent );
|
||||||
|
|
||||||
void OnInitDialog( wxInitDialogEvent& aEvent );
|
void OnInitDialog( wxInitDialogEvent& aEvent );
|
||||||
|
void OnCharHook( wxKeyEvent& aEvt );
|
||||||
void OnCloseTimer( wxTimerEvent& aEvent );
|
void OnCloseTimer( wxTimerEvent& aEvent );
|
||||||
void OnUseBrowser( wxCommandEvent& aEvent );
|
void OnUseBrowser( wxCommandEvent& aEvent );
|
||||||
|
|
||||||
|
@ -197,6 +198,7 @@ protected:
|
||||||
FOOTPRINT_SELECT_WIDGET* m_fp_sel_ctrl;
|
FOOTPRINT_SELECT_WIDGET* m_fp_sel_ctrl;
|
||||||
FOOTPRINT_PREVIEW_WIDGET* m_fp_preview;
|
FOOTPRINT_PREVIEW_WIDGET* m_fp_preview;
|
||||||
LIB_TREE* m_tree;
|
LIB_TREE* m_tree;
|
||||||
|
wxHtmlWindow* m_details;
|
||||||
|
|
||||||
static int m_h_sash_pos; // remember sash positions during a session
|
static int m_h_sash_pos; // remember sash positions during a session
|
||||||
static int m_v_sash_pos;
|
static int m_v_sash_pos;
|
||||||
|
|
Loading…
Reference in New Issue