Added 'Browse Library' button to Symbol Library Table dialog

NEW: File browser for the Symbol Library Table dialog
This commit is contained in:
Maciej Suminski 2017-11-14 11:18:45 +01:00
parent 759359f602
commit 4c623daa1d
5 changed files with 2068 additions and 1913 deletions

View File

@ -30,6 +30,8 @@
#include <grid_tricks.h>
#include <confirm.h>
#include <lib_table_grid.h>
#include <wildcards_and_files_ext.h>
#include <env_paths.h>
/**
@ -340,17 +342,61 @@ void DIALOG_SYMBOL_LIB_TABLE::pageChangedHandler( wxAuiNotebookEvent& event )
}
void DIALOG_SYMBOL_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
{
wxFileDialog dlg( this, _( "Select Library" ), Prj().GetProjectPath(),
wxEmptyString, SchematicLibraryFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
if( dlg.ShowModal() == wxID_CANCEL )
return;
wxArrayString files;
dlg.GetFilenames( files );
for( const auto& file : files )
{
wxString filePath = dlg.GetDirectory() + wxFileName::GetPathSeparator() + file;
if( m_cur_grid->AppendRows( 1 ) )
{
int last_row = m_cur_grid->GetNumberRows() - 1;
wxFileName fn( filePath );
m_cur_grid->SetCellValue( last_row, COL_NICKNAME, fn.GetName() );
// TODO the following code can detect only schematic types, not libs
// SCH_IO_MGR needs to provide file extension information for libraries too
// auto detect the plugin type
/*for( auto pluginType : SCH_IO_MGR::SCH_FILE_T_vector )
{
if( SCH_IO_MGR::GetFileExtension( pluginType ).Lower() == fn.GetExt().Lower() )
{
m_cur_grid->SetCellValue( last_row, COL_TYPE,
SCH_IO_MGR::ShowType( pluginType ) );
break;
}
}*/
m_cur_grid->SetCellValue( last_row, COL_TYPE,
SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY ) );
// try to use path normalized to an environmental variable or project path
wxString normalizedPath = NormalizePath( filePath, &Pgm().GetLocalEnvVariables(), &Prj() );
m_cur_grid->SetCellValue( last_row, COL_URI,
normalizedPath.IsEmpty() ? fn.GetFullPath() : normalizedPath );
}
}
if( !files.IsEmpty() )
scrollToRow( m_cur_grid->GetNumberRows() - 1 ); // scroll to the new libraries
}
void DIALOG_SYMBOL_LIB_TABLE::appendRowHandler( wxCommandEvent& event )
{
if( m_cur_grid->AppendRows( 1 ) )
{
int last_row = m_cur_grid->GetNumberRows() - 1;
// wx documentation is wrong, SetGridCursor does not make visible.
m_cur_grid->MakeCellVisible( last_row, 0 );
m_cur_grid->SetGridCursor( last_row, 0 );
m_cur_grid->SelectRow( m_cur_grid->GetGridCursorRow() );
}
scrollToRow( m_cur_grid->GetNumberRows() - 1 );
}
@ -580,6 +626,15 @@ void DIALOG_SYMBOL_LIB_TABLE::populateEnvironReadOnlyTable()
}
void DIALOG_SYMBOL_LIB_TABLE::scrollToRow( int aRowNumber )
{
// wx documentation is wrong, SetGridCursor does not make visible.
m_cur_grid->MakeCellVisible( aRowNumber, 0 );
m_cur_grid->SetGridCursor( aRowNumber, 0 );
m_cur_grid->SelectRow( m_cur_grid->GetGridCursorRow() );
}
SYMBOL_LIB_TABLE_GRID* DIALOG_SYMBOL_LIB_TABLE::global_model() const
{
return (SYMBOL_LIB_TABLE_GRID*) m_global_grid->GetTable();

View File

@ -57,6 +57,8 @@ private:
void pageChangedHandler( wxAuiNotebookEvent& event ) override;
void browseLibrariesHandler( wxCommandEvent& event ) override;
void appendRowHandler( wxCommandEvent& event ) override;
void deleteRowHandler( wxCommandEvent& event ) override;
@ -71,6 +73,9 @@ private:
/// by examining all the full_uri columns.
void populateEnvironReadOnlyTable();
/// Makes a specific row visible
void scrollToRow( int aRowNumber );
// Caller's tables are modified only on OK button and successful verification.
SYMBOL_LIB_TABLE* m_global;
SYMBOL_LIB_TABLE* m_project;

View File

@ -1,237 +1,242 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 29 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_sym_lib_table_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SYMBOL_LIB_TABLE_BASE::DIALOG_SYMBOL_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* m_top_sizer;
m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Library Tables by Scope") ), wxVERTICAL );
m_auinotebook = new wxAuiNotebook( m_top_sizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_BOTTOM );
m_global_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_global_sizer;
m_global_sizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 1, 2, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText3 = new wxStaticText( m_global_panel, wxID_ANY, _("Table:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer1->Add( m_staticText3, 0, wxRIGHT|wxLEFT, 5 );
m_GblTableFilename = new wxStaticText( m_global_panel, wxID_ANY, _("Table Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_GblTableFilename->Wrap( -1 );
fgSizer1->Add( m_GblTableFilename, 0, wxRIGHT|wxLEFT, 5 );
m_global_sizer->Add( fgSizer1, 0, wxEXPAND, 5 );
m_global_grid = new wxGrid( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_global_grid->CreateGrid( 1, 5 );
m_global_grid->EnableEditing( true );
m_global_grid->EnableGridLines( true );
m_global_grid->EnableDragGridSize( false );
m_global_grid->SetMargins( 0, 0 );
// Columns
m_global_grid->AutoSizeColumns();
m_global_grid->EnableDragColMove( false );
m_global_grid->EnableDragColSize( true );
m_global_grid->SetColLabelSize( 30 );
m_global_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_global_grid->AutoSizeRows();
m_global_grid->EnableDragRowSize( false );
m_global_grid->SetRowLabelSize( 40 );
m_global_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_global_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_global_sizer->Add( m_global_grid, 5, wxALL|wxEXPAND, 5 );
m_global_panel->SetSizer( m_global_sizer );
m_global_panel->Layout();
m_global_sizer->Fit( m_global_panel );
m_auinotebook->AddPage( m_global_panel, _("Global Libraries"), true, wxNullBitmap );
m_project_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_project_sizer;
m_project_sizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 1, 2, 0, 0 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText4 = new wxStaticText( m_project_panel, wxID_ANY, _("Table:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
fgSizer2->Add( m_staticText4, 0, wxRIGHT|wxLEFT, 5 );
m_PrjTableFilename = new wxStaticText( m_project_panel, wxID_ANY, _("Table Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_PrjTableFilename->Wrap( -1 );
fgSizer2->Add( m_PrjTableFilename, 0, wxRIGHT|wxLEFT, 5 );
m_project_sizer->Add( fgSizer2, 0, wxEXPAND, 5 );
m_project_grid = new wxGrid( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_project_grid->CreateGrid( 1, 5 );
m_project_grid->EnableEditing( true );
m_project_grid->EnableGridLines( true );
m_project_grid->EnableDragGridSize( false );
m_project_grid->SetMargins( 0, 0 );
// Columns
m_project_grid->AutoSizeColumns();
m_project_grid->EnableDragColMove( false );
m_project_grid->EnableDragColSize( true );
m_project_grid->SetColLabelSize( 30 );
m_project_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_project_grid->EnableDragRowSize( false );
m_project_grid->SetRowLabelSize( 40 );
m_project_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_project_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_project_sizer->Add( m_project_grid, 2, wxALL|wxEXPAND, 5 );
m_project_panel->SetSizer( m_project_sizer );
m_project_panel->Layout();
m_project_sizer->Fit( m_project_panel );
m_auinotebook->AddPage( m_project_panel, _("Project Specific Libraries"), false, wxNullBitmap );
m_top_sizer->Add( m_auinotebook, 1, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizer51;
bSizer51 = new wxBoxSizer( wxHORIZONTAL );
m_append_button = new wxButton( m_top_sizer->GetStaticBox(), wxID_ANY, _("Append Library"), wxDefaultPosition, wxDefaultSize, 0 );
m_append_button->SetToolTip( _("Add a PCB library row to this table") );
bSizer51->Add( m_append_button, 0, wxALL, 5 );
m_delete_button = new wxButton( m_top_sizer->GetStaticBox(), wxID_ANY, _("Remove Library"), wxDefaultPosition, wxDefaultSize, 0 );
m_delete_button->SetToolTip( _("Remove a PCB library from this library table") );
bSizer51->Add( m_delete_button, 0, wxALL, 5 );
m_move_up_button = new wxButton( m_top_sizer->GetStaticBox(), wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
m_move_up_button->SetToolTip( _("Move the currently selected row up one position") );
bSizer51->Add( m_move_up_button, 0, wxALL, 5 );
m_move_down_button = new wxButton( m_top_sizer->GetStaticBox(), wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
m_move_down_button->SetToolTip( _("Move the currently selected row down one position") );
bSizer51->Add( m_move_down_button, 0, wxALL, 5 );
m_top_sizer->Add( bSizer51, 0, wxALIGN_CENTER|wxBOTTOM, 8 );
bSizer1->Add( m_top_sizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Path Substitutions") ), wxVERTICAL );
m_path_subs_grid = new wxGrid( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_path_subs_grid->CreateGrid( 1, 2 );
m_path_subs_grid->EnableEditing( false );
m_path_subs_grid->EnableGridLines( true );
m_path_subs_grid->EnableDragGridSize( false );
m_path_subs_grid->SetMargins( 0, 0 );
// Columns
m_path_subs_grid->SetColSize( 0, 150 );
m_path_subs_grid->SetColSize( 1, 500 );
m_path_subs_grid->AutoSizeColumns();
m_path_subs_grid->EnableDragColMove( false );
m_path_subs_grid->EnableDragColSize( true );
m_path_subs_grid->SetColLabelSize( 30 );
m_path_subs_grid->SetColLabelValue( 0, _("Environment Variable") );
m_path_subs_grid->SetColLabelValue( 1, _("Path Segment") );
m_path_subs_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_path_subs_grid->EnableDragRowSize( true );
m_path_subs_grid->SetRowLabelSize( 40 );
m_path_subs_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_path_subs_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_path_subs_grid->SetToolTip( _("This is a read-only table which shows pertinent environment variables.") );
sbSizer1->Add( m_path_subs_grid, 1, wxALL|wxEXPAND, 5 );
bSizer1->Add( sbSizer1, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* m_bottom_sizer;
m_bottom_sizer = new wxBoxSizer( wxVERTICAL );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
m_bottom_sizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
bSizer1->Add( m_bottom_sizer, 0, wxEXPAND, 5 );
this->SetSizer( bSizer1 );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_delete_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
}
DIALOG_SYMBOL_LIB_TABLE_BASE::~DIALOG_SYMBOL_LIB_TABLE_BASE()
{
// Disconnect Events
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_delete_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 17 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_sym_lib_table_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SYMBOL_LIB_TABLE_BASE::DIALOG_SYMBOL_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* m_top_sizer;
m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Library Tables by Scope") ), wxVERTICAL );
m_auinotebook = new wxAuiNotebook( m_top_sizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_BOTTOM );
m_global_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_global_sizer;
m_global_sizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 1, 2, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText3 = new wxStaticText( m_global_panel, wxID_ANY, _("Table:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer1->Add( m_staticText3, 0, wxRIGHT|wxLEFT, 5 );
m_GblTableFilename = new wxStaticText( m_global_panel, wxID_ANY, _("Table Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_GblTableFilename->Wrap( -1 );
fgSizer1->Add( m_GblTableFilename, 0, wxRIGHT|wxLEFT, 5 );
m_global_sizer->Add( fgSizer1, 0, wxEXPAND, 5 );
m_global_grid = new wxGrid( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_global_grid->CreateGrid( 1, 5 );
m_global_grid->EnableEditing( true );
m_global_grid->EnableGridLines( true );
m_global_grid->EnableDragGridSize( false );
m_global_grid->SetMargins( 0, 0 );
// Columns
m_global_grid->AutoSizeColumns();
m_global_grid->EnableDragColMove( false );
m_global_grid->EnableDragColSize( true );
m_global_grid->SetColLabelSize( 30 );
m_global_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_global_grid->AutoSizeRows();
m_global_grid->EnableDragRowSize( false );
m_global_grid->SetRowLabelSize( 40 );
m_global_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_global_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_global_sizer->Add( m_global_grid, 5, wxALL|wxEXPAND, 5 );
m_global_panel->SetSizer( m_global_sizer );
m_global_panel->Layout();
m_global_sizer->Fit( m_global_panel );
m_auinotebook->AddPage( m_global_panel, _("Global Libraries"), true, wxNullBitmap );
m_project_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_project_sizer;
m_project_sizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 1, 2, 0, 0 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText4 = new wxStaticText( m_project_panel, wxID_ANY, _("Table:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
fgSizer2->Add( m_staticText4, 0, wxRIGHT|wxLEFT, 5 );
m_PrjTableFilename = new wxStaticText( m_project_panel, wxID_ANY, _("Table Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_PrjTableFilename->Wrap( -1 );
fgSizer2->Add( m_PrjTableFilename, 0, wxRIGHT|wxLEFT, 5 );
m_project_sizer->Add( fgSizer2, 0, wxEXPAND, 5 );
m_project_grid = new wxGrid( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_project_grid->CreateGrid( 1, 5 );
m_project_grid->EnableEditing( true );
m_project_grid->EnableGridLines( true );
m_project_grid->EnableDragGridSize( false );
m_project_grid->SetMargins( 0, 0 );
// Columns
m_project_grid->AutoSizeColumns();
m_project_grid->EnableDragColMove( false );
m_project_grid->EnableDragColSize( true );
m_project_grid->SetColLabelSize( 30 );
m_project_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_project_grid->EnableDragRowSize( false );
m_project_grid->SetRowLabelSize( 40 );
m_project_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_project_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_project_sizer->Add( m_project_grid, 2, wxALL|wxEXPAND, 5 );
m_project_panel->SetSizer( m_project_sizer );
m_project_panel->Layout();
m_project_sizer->Fit( m_project_panel );
m_auinotebook->AddPage( m_project_panel, _("Project Specific Libraries"), false, wxNullBitmap );
m_top_sizer->Add( m_auinotebook, 1, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizer51;
bSizer51 = new wxBoxSizer( wxHORIZONTAL );
m_browse_button = new wxButton( m_top_sizer->GetStaticBox(), wxID_ANY, _("Browse Libraries..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizer51->Add( m_browse_button, 0, wxALL, 5 );
m_append_button = new wxButton( m_top_sizer->GetStaticBox(), wxID_ANY, _("Append Library"), wxDefaultPosition, wxDefaultSize, 0 );
m_append_button->SetToolTip( _("Add a PCB library row to this table") );
bSizer51->Add( m_append_button, 0, wxALL, 5 );
m_delete_button = new wxButton( m_top_sizer->GetStaticBox(), wxID_ANY, _("Remove Library"), wxDefaultPosition, wxDefaultSize, 0 );
m_delete_button->SetToolTip( _("Remove a PCB library from this library table") );
bSizer51->Add( m_delete_button, 0, wxALL, 5 );
m_move_up_button = new wxButton( m_top_sizer->GetStaticBox(), wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
m_move_up_button->SetToolTip( _("Move the currently selected row up one position") );
bSizer51->Add( m_move_up_button, 0, wxALL, 5 );
m_move_down_button = new wxButton( m_top_sizer->GetStaticBox(), wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
m_move_down_button->SetToolTip( _("Move the currently selected row down one position") );
bSizer51->Add( m_move_down_button, 0, wxALL, 5 );
m_top_sizer->Add( bSizer51, 0, wxALIGN_CENTER|wxBOTTOM, 8 );
bSizer1->Add( m_top_sizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Path Substitutions") ), wxVERTICAL );
m_path_subs_grid = new wxGrid( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_path_subs_grid->CreateGrid( 1, 2 );
m_path_subs_grid->EnableEditing( false );
m_path_subs_grid->EnableGridLines( true );
m_path_subs_grid->EnableDragGridSize( false );
m_path_subs_grid->SetMargins( 0, 0 );
// Columns
m_path_subs_grid->SetColSize( 0, 150 );
m_path_subs_grid->SetColSize( 1, 500 );
m_path_subs_grid->AutoSizeColumns();
m_path_subs_grid->EnableDragColMove( false );
m_path_subs_grid->EnableDragColSize( true );
m_path_subs_grid->SetColLabelSize( 30 );
m_path_subs_grid->SetColLabelValue( 0, _("Environment Variable") );
m_path_subs_grid->SetColLabelValue( 1, _("Path Segment") );
m_path_subs_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_path_subs_grid->EnableDragRowSize( true );
m_path_subs_grid->SetRowLabelSize( 40 );
m_path_subs_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_path_subs_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_path_subs_grid->SetToolTip( _("This is a read-only table which shows pertinent environment variables.") );
sbSizer1->Add( m_path_subs_grid, 1, wxALL|wxEXPAND, 5 );
bSizer1->Add( sbSizer1, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* m_bottom_sizer;
m_bottom_sizer = new wxBoxSizer( wxVERTICAL );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
m_bottom_sizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
bSizer1->Add( m_bottom_sizer, 0, wxEXPAND, 5 );
this->SetSizer( bSizer1 );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_browse_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this );
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_delete_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
}
DIALOG_SYMBOL_LIB_TABLE_BASE::~DIALOG_SYMBOL_LIB_TABLE_BASE()
{
// Disconnect Events
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_browse_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this );
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_delete_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,78 +1,80 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 29 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SYM_LIB_TABLE_BASE_H__
#define __DIALOG_SYM_LIB_TABLE_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/grid.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/aui/auibook.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SYMBOL_LIB_TABLE_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SYMBOL_LIB_TABLE_BASE : public DIALOG_SHIM
{
private:
protected:
wxAuiNotebook* m_auinotebook;
wxPanel* m_global_panel;
wxStaticText* m_staticText3;
wxStaticText* m_GblTableFilename;
wxGrid* m_global_grid;
wxPanel* m_project_panel;
wxStaticText* m_staticText4;
wxStaticText* m_PrjTableFilename;
wxGrid* m_project_grid;
wxButton* m_append_button;
wxButton* m_delete_button;
wxButton* m_move_up_button;
wxButton* m_move_down_button;
wxGrid* m_path_subs_grid;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) = 0;
virtual void appendRowHandler( wxCommandEvent& event ) = 0;
virtual void deleteRowHandler( wxCommandEvent& event ) = 0;
virtual void moveUpHandler( wxCommandEvent& event ) = 0;
virtual void moveDownHandler( wxCommandEvent& event ) = 0;
public:
DIALOG_SYMBOL_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 800,600 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_SYMBOL_LIB_TABLE_BASE();
};
#endif //__DIALOG_SYM_LIB_TABLE_BASE_H__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 17 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SYM_LIB_TABLE_BASE_H__
#define __DIALOG_SYM_LIB_TABLE_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/grid.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/aui/auibook.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SYMBOL_LIB_TABLE_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SYMBOL_LIB_TABLE_BASE : public DIALOG_SHIM
{
private:
protected:
wxAuiNotebook* m_auinotebook;
wxPanel* m_global_panel;
wxStaticText* m_staticText3;
wxStaticText* m_GblTableFilename;
wxGrid* m_global_grid;
wxPanel* m_project_panel;
wxStaticText* m_staticText4;
wxStaticText* m_PrjTableFilename;
wxGrid* m_project_grid;
wxButton* m_browse_button;
wxButton* m_append_button;
wxButton* m_delete_button;
wxButton* m_move_up_button;
wxButton* m_move_down_button;
wxGrid* m_path_subs_grid;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) = 0;
virtual void browseLibrariesHandler( wxCommandEvent& event ) = 0;
virtual void appendRowHandler( wxCommandEvent& event ) = 0;
virtual void deleteRowHandler( wxCommandEvent& event ) = 0;
virtual void moveUpHandler( wxCommandEvent& event ) = 0;
virtual void moveDownHandler( wxCommandEvent& event ) = 0;
public:
DIALOG_SYMBOL_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 800,600 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_SYMBOL_LIB_TABLE_BASE();
};
#endif //__DIALOG_SYM_LIB_TABLE_BASE_H__