Add browse buttons to Library Manager dialogs.
Fixes: lp:1804924 * https://bugs.launchpad.net/kicad/+bug/1804924
This commit is contained in:
parent
0e705cd338
commit
b2db49f4ac
|
@ -38,6 +38,7 @@
|
|||
#include <viewlib_frame.h>
|
||||
#include <kiway.h>
|
||||
#include <widgets/grid_readonly_text_helpers.h>
|
||||
#include <widgets/grid_text_button_helpers.h>
|
||||
|
||||
/**
|
||||
* Build a wxGridTableBase by wrapping an #SYMBOL_LIB_TABLE object.
|
||||
|
@ -151,7 +152,8 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
|
|||
m_globalTable( aGlobal ),
|
||||
m_projectTable( aProject ),
|
||||
m_projectBasePath( aProjectBasePath ),
|
||||
m_parent( aParent )
|
||||
m_parent( aParent ),
|
||||
m_lastBrowseDir( aProjectBasePath )
|
||||
{
|
||||
// For user info, shows the table filenames:
|
||||
m_GblTableFilename->SetLabel( aGlobalTablePath );
|
||||
|
@ -163,8 +165,8 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
|
|||
m_project_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *aProject ), true );
|
||||
|
||||
// Give a bit more room for combobox editors
|
||||
m_global_grid->SetDefaultRowSize( m_global_grid->GetDefaultRowSize() + 2 );
|
||||
m_project_grid->SetDefaultRowSize( m_project_grid->GetDefaultRowSize() + 2 );
|
||||
m_global_grid->SetDefaultRowSize( m_global_grid->GetDefaultRowSize() + 4 );
|
||||
m_project_grid->SetDefaultRowSize( m_project_grid->GetDefaultRowSize() + 4 );
|
||||
|
||||
// add Cut, Copy, and Paste to wxGrids
|
||||
m_global_grid->PushEventHandler( new SYMBOL_GRID_TRICKS( m_parent, m_global_grid ) );
|
||||
|
@ -189,6 +191,10 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
|
|||
// Set special attributes
|
||||
wxGridCellAttr* attr;
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new GRID_CELL_PATH_EDITOR( m_parent, &m_lastBrowseDir ) );
|
||||
g->SetColAttr( COL_URI, attr );
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new wxGridCellChoiceEditor( pluginChoices ) );
|
||||
g->SetColAttr( COL_TYPE, attr );
|
||||
|
@ -338,9 +344,6 @@ void PANEL_SYM_LIB_TABLE::pageChangedHandler( wxAuiNotebookEvent& event )
|
|||
|
||||
void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
|
||||
{
|
||||
if( m_lastBrowseDir.IsEmpty() )
|
||||
m_lastBrowseDir = m_projectBasePath;
|
||||
|
||||
wxFileDialog dlg( this, _( "Select Library" ), m_lastBrowseDir,
|
||||
wxEmptyString, SchematicLibraryFileWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include <footprint_edit_frame.h>
|
||||
#include <kiway.h>
|
||||
#include <widgets/grid_readonly_text_helpers.h>
|
||||
#include <widgets/grid_text_button_helpers.h>
|
||||
|
||||
// Filters for the file picker
|
||||
static constexpr int FILTER_COUNT = 4;
|
||||
|
@ -282,8 +283,8 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
|
|||
m_project_grid->SetTable( new FP_LIB_TABLE_GRID( *aProject ), true );
|
||||
|
||||
// Give a bit more room for wxChoice editors
|
||||
m_global_grid->SetDefaultRowSize( m_global_grid->GetDefaultRowSize() + 2 );
|
||||
m_project_grid->SetDefaultRowSize( m_project_grid->GetDefaultRowSize() + 2 );
|
||||
m_global_grid->SetDefaultRowSize( m_global_grid->GetDefaultRowSize() + 4 );
|
||||
m_project_grid->SetDefaultRowSize( m_project_grid->GetDefaultRowSize() + 4 );
|
||||
|
||||
// add Cut, Copy, and Paste to wxGrids
|
||||
m_global_grid->PushEventHandler( new FP_GRID_TRICKS( m_parent, m_global_grid ) );
|
||||
|
@ -314,6 +315,10 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
|
|||
{
|
||||
wxGridCellAttr* attr;
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new GRID_CELL_PATH_EDITOR( m_parent, &m_lastBrowseDir ) );
|
||||
g->SetColAttr( COL_URI, attr );
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new wxGridCellChoiceEditor( choices ) );
|
||||
g->SetColAttr( COL_TYPE, attr );
|
||||
|
|
Loading…
Reference in New Issue