ADDED: Reset option for Library tables

This re-shows the option to reset the global library table to its
default, empty or specified state

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2309
This commit is contained in:
Seth Hillbrand 2024-05-01 14:52:02 -07:00
parent f8c8dcde13
commit ae610bbe85
13 changed files with 2667 additions and 2320 deletions

View File

@ -194,6 +194,8 @@ WX_GRID::~WX_GRID()
if( m_weOwnTable )
DestroyTable( GetTable() );
Disconnect( wxEVT_GRID_EDITOR_SHOWN, wxGridEventHandler( WX_GRID::onCellEditorShown ), nullptr, this );
Disconnect( wxEVT_GRID_EDITOR_HIDDEN, wxGridEventHandler( WX_GRID::onCellEditorHidden ), nullptr, this );
Disconnect( wxEVT_DPI_CHANGED, wxDPIChangedEventHandler( WX_GRID::onDPIChanged ), nullptr, this );
}

View File

@ -64,10 +64,9 @@ bool DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow()
ioe.What() ) );
return false;
}
return true;
}
else
{
wxString fileName = m_filePicker1->GetPath();
if( fileName.IsEmpty() )
@ -96,8 +95,7 @@ bool DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow()
{
DisplayError( this, wxString::Format( _( "Error reading symbol library table '%s'.\n"
"%s" ),
fn.GetFullPath(),
ioe.What() ) );
fn.GetFullPath(), ioe.What() ) );
return false;
}
@ -114,12 +112,13 @@ bool DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow()
// Copy the global symbol library table file to the user config.
if( !::wxCopyFile( fn.GetFullPath(), symTableFileName.GetFullPath() ) )
{
DisplayError( this, wxString::Format( _( "Error copying global symbol library table '%s' "
DisplayError( this,
wxString::Format( _( "Error copying global symbol library table '%s' "
"to '%s'." ),
fn.GetFullPath(),
symTableFileName.GetFullPath() ) );
fn.GetFullPath(), symTableFileName.GetFullPath() ) );
return false;
}
}
// Load the successfully copied symbol library table file. This should not fail since the
// file was tested above. Check for failure anyway to keep the compiler from complaining.

View File

@ -24,6 +24,7 @@
#include <build_version.h>
#include <common.h> // For ExpandEnvVarSubstitutions
#include <dialogs/dialog_global_sym_lib_table_config.h>
#include <dialogs/dialog_plugin_options.h>
#include <project.h>
#include <panel_sym_lib_table.h>
@ -230,41 +231,8 @@ protected:
};
PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PROJECT* aProject,
SYMBOL_LIB_TABLE* aGlobalTable,
const wxString& aGlobalTablePath,
SYMBOL_LIB_TABLE* aProjectTable,
const wxString& aProjectTablePath ) :
PANEL_SYM_LIB_TABLE_BASE( aParent ),
m_globalTable( aGlobalTable ),
m_projectTable( aProjectTable ),
m_project( aProject ),
m_parent( aParent )
void PANEL_SYM_LIB_TABLE::setupGrid( WX_GRID* aGrid )
{
// wxGrid only supports user owned tables if they exist past end of ~wxGrid(),
// so make it a grid owned table.
m_global_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *m_globalTable ), true );
wxArrayString pluginChoices;
for( const SCH_IO_MGR::SCH_FILE_T& type : SCH_IO_MGR::SCH_FILE_T_vector )
{
IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( type ) );
if( !pi )
continue;
if( const IO_BASE::IO_FILE_DESC& desc = pi->GetLibraryDesc() )
pluginChoices.Add( SCH_IO_MGR::ShowType( type ) );
}
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
if( cfg->m_lastSymbolLibDir.IsEmpty() )
cfg->m_lastSymbolLibDir = PATHS::GetDefaultUserSymbolsPath();
m_lastProjectLibDir = m_project->GetProjectPath();
auto autoSizeCol =
[&]( WX_GRID* aGrid, int aCol )
{
@ -274,11 +242,11 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
aGrid->SetColSize( aCol, std::max( prevWidth, aGrid->GetColSize( aCol ) ) );
};
auto setupGrid =
[&]( WX_GRID* aGrid )
{
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
// Give a bit more room for combobox editors
aGrid->SetDefaultRowSize( aGrid->GetDefaultRowSize() + 4 );
for( int ii = 0; ii < aGrid->GetNumberRows(); ++ii )
aGrid->SetRowSize( ii, aGrid->GetDefaultRowSize() + 4 );
// add Cut, Copy, and Paste to wxGrids
aGrid->PushEventHandler( new SYMBOL_GRID_TRICKS( m_parent, aGrid ) );
@ -316,7 +284,7 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
aGrid->SetColAttr( COL_URI, attr );
attr = new wxGridCellAttr;
attr->SetEditor( new wxGridCellChoiceEditor( pluginChoices ) );
attr->SetEditor( new wxGridCellChoiceEditor( m_pluginChoices ) );
aGrid->SetColAttr( COL_TYPE, attr );
attr = new wxGridCellAttr;
@ -342,6 +310,41 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
aGrid->SelectRow( 0 );
};
PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PROJECT* aProject,
SYMBOL_LIB_TABLE* aGlobalTable,
const wxString& aGlobalTablePath,
SYMBOL_LIB_TABLE* aProjectTable,
const wxString& aProjectTablePath ) :
PANEL_SYM_LIB_TABLE_BASE( aParent ),
m_globalTable( aGlobalTable ),
m_projectTable( aProjectTable ),
m_project( aProject ),
m_parent( aParent )
{
// wxGrid only supports user owned tables if they exist past end of ~wxGrid(),
// so make it a grid owned table.
m_global_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *m_globalTable ), true );
for( const SCH_IO_MGR::SCH_FILE_T& type : SCH_IO_MGR::SCH_FILE_T_vector )
{
IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( type ) );
if( !pi )
continue;
if( const IO_BASE::IO_FILE_DESC& desc = pi->GetLibraryDesc() )
m_pluginChoices.Add( SCH_IO_MGR::ShowType( type ) );
}
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
if( cfg->m_lastSymbolLibDir.IsEmpty() )
cfg->m_lastSymbolLibDir = PATHS::GetDefaultUserSymbolsPath();
m_lastProjectLibDir = m_project->GetProjectPath();
setupGrid( m_global_grid );
if( m_projectTable )
@ -413,6 +416,7 @@ bool PANEL_SYM_LIB_TABLE::allowAutomaticPluginTypeSelection( wxString& aLibraryP
bool PANEL_SYM_LIB_TABLE::verifyTables()
{
wxString msg;
wxBusyCursor wait;
for( SYMBOL_LIB_TABLE_GRID* model : { global_model(), project_model() } )
{
@ -443,9 +447,13 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
badCellDlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Remove Invalid Cells" ) ),
wxMessageDialog::ButtonLabel( _( "Cancel Table Update" ) ) );
wxEndBusyCursor();
if( badCellDlg.ShowModal() == wxID_NO )
return false;
wxBeginBusyCursor( wxHOURGLASS_CURSOR );
// Delete the "empty" row, where empty means missing nick or uri.
// This also updates the UI which could be slow, but there should only be a few
// rows to delete, unless the user fell asleep on the Add Row
@ -468,6 +476,8 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
wxWindow* topLevelParent = wxGetTopLevelParent( this );
wxMessageDialog errdlg( topLevelParent, msg, _( "Library Nickname Error" ) );
wxEndBusyCursor();
errdlg.ShowModal();
return false;
}
@ -519,6 +529,7 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
wxWindow* topLevelParent = wxGetTopLevelParent( this );
wxEndBusyCursor();
wxMessageDialog errdlg( topLevelParent, msg, _( "Library Nickname Error" ) );
errdlg.ShowModal();
@ -558,7 +569,7 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
msg.Printf( _( "Symbol library '%s' failed to load." ), row.GetNickName() );
wxWindow* topLevelParent = wxGetTopLevelParent( this );
wxEndBusyCursor();
wxMessageDialog errdlg( topLevelParent, msg + wxS( "\n" ) + ioe.What(),
_( "Error Loading Library" ) );
errdlg.ShowModal();
@ -574,8 +585,6 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
void PANEL_SYM_LIB_TABLE::OnUpdateUI( wxUpdateUIEvent& event )
{
m_pageNdx = (unsigned) std::max( 0, m_notebook->GetSelection() );
m_cur_grid = m_pageNdx == 0 ? m_global_grid : m_project_grid;
}
@ -827,6 +836,56 @@ void PANEL_SYM_LIB_TABLE::moveDownHandler( wxCommandEvent& event )
}
void PANEL_SYM_LIB_TABLE::onReset( wxCommandEvent& event )
{
if( !m_cur_grid->CommitPendingChanges() )
return;
// No need to prompt to preserve an empty table
if( m_global_grid->GetNumberRows() > 0 &&
!IsOK( this, wxString::Format( _( "This action will reset your global library table on "
"disk and cannot be undone." ) ) ) )
{
return;
}
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG dlg( m_parent );
if( dlg.ShowModal() == wxID_OK )
{
m_global_grid->Freeze();
wxGridTableBase* table = m_global_grid->GetTable();
m_global_grid->DestroyTable( table );
m_global_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *m_globalTable ), true );
m_global_grid->PopEventHandler( true );
setupGrid( m_global_grid );
m_parent->m_GlobalTableChanged = true;
m_global_grid->Thaw();
}
}
void PANEL_SYM_LIB_TABLE::onPageChange( wxBookCtrlEvent& event )
{
m_pageNdx = (unsigned) std::max( 0, m_notebook->GetSelection() );
if( m_pageNdx == 0 )
{
m_cur_grid = m_global_grid;
m_resetGlobal->Enable();
}
else
{
m_cur_grid = m_project_grid;
m_resetGlobal->Disable();
}
}
void PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries( wxCommandEvent& event )
{
if( !m_cur_grid->CommitPendingChanges() )

View File

@ -59,6 +59,11 @@ private:
void adjustPathSubsGridColumns( int aWidth );
void onConvertLegacyLibraries( wxCommandEvent& event ) override;
void onPageChange( wxBookCtrlEvent& event ) override;
void onReset( wxCommandEvent& event ) override;
void setupGrid( WX_GRID* aGrid );
bool TransferDataFromWindow() override;
/// Populate the readonly environment variable table with names and values
@ -86,6 +91,7 @@ private:
PROJECT* m_project;
DIALOG_EDIT_LIBRARY_TABLES* m_parent;
wxArrayString m_pluginChoices;
WX_GRID* m_cur_grid; ///< changed based on tab choice
static size_t m_pageNdx; ///< Remember the last notebook page selected

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf0)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -156,6 +156,12 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
bButtonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_resetGlobal = new wxButton( this, wxID_ANY, _("Reset Libraries"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_resetGlobal, 0, wxALL, 5 );
bButtonsSizer->Add( 0, 0, 0, wxEXPAND, 5 );
m_convertLegacy = new wxButton( this, wxID_ANY, _("Migrate Libraries"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_convertLegacy, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
@ -211,11 +217,13 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SYM_LIB_TABLE_BASE::OnUpdateUI ) );
m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_SYM_LIB_TABLE_BASE::onPageChange ), NULL, this );
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_browse_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_delete_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_resetGlobal->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::onReset ), NULL, this );
m_convertLegacy->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::onConvertLegacyLibraries ), NULL, this );
m_path_subs_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_SYM_LIB_TABLE_BASE::onSizeGrid ), NULL, this );
}
@ -224,11 +232,13 @@ PANEL_SYM_LIB_TABLE_BASE::~PANEL_SYM_LIB_TABLE_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SYM_LIB_TABLE_BASE::OnUpdateUI ) );
m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_SYM_LIB_TABLE_BASE::onPageChange ), NULL, this );
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_browse_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_delete_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_resetGlobal->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::onReset ), NULL, this );
m_convertLegacy->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::onConvertLegacyLibraries ), NULL, this );
m_path_subs_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_SYM_LIB_TABLE_BASE::onSizeGrid ), NULL, this );

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<FileVersion major="1" minor="17"/>
<object class="Project" expanded="true">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
@ -29,12 +29,13 @@
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
<object class="Panel" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
@ -53,16 +54,16 @@
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnUpdateUI">OnUpdateUI</event>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bMainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxNotebook" expanded="1">
<object class="wxNotebook" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -84,6 +85,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -115,11 +117,12 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="notebookpage" expanded="1">
<event name="OnNotebookPageChanged">onPageChange</event>
<object class="notebookpage" expanded="true">
<property name="bitmap"></property>
<property name="label">Global Libraries</property>
<property name="select">1</property>
<object class="wxPanel" expanded="1">
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -140,6 +143,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -170,16 +174,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">m_global_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">5</property>
<object class="wxGrid" expanded="0">
<object class="wxGrid" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -213,6 +217,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">1</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
@ -266,11 +271,11 @@
</object>
</object>
</object>
<object class="notebookpage" expanded="1">
<object class="notebookpage" expanded="true">
<property name="bitmap"></property>
<property name="label">Project Specific Libraries</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -291,6 +296,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -321,16 +327,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">m_project_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">2</property>
<object class="wxGrid" expanded="0">
<object class="wxGrid" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -364,6 +370,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">1</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
@ -419,20 +426,20 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bButtonsSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -458,6 +465,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -502,11 +510,11 @@
<event name="OnButtonClick">appendRowHandler</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -532,6 +540,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -576,11 +585,11 @@
<event name="OnButtonClick">browseLibrariesHandler</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -606,6 +615,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -650,11 +660,11 @@
<event name="OnButtonClick">moveUpHandler</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -680,6 +690,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -724,21 +735,21 @@
<event name="OnButtonClick">moveDownHandler</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -764,6 +775,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -808,21 +820,21 @@
<event name="OnButtonClick">deleteRowHandler</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<object class="wxButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -848,6 +860,92 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Reset Libraries</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_resetGlobal</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onReset</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -894,21 +992,21 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<object class="spacer" expanded="true">
<property name="height">5</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">8</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxStaticText" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -929,6 +1027,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -965,21 +1064,21 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<object class="spacer" expanded="true">
<property name="height">2</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxGrid" expanded="0">
<object class="wxGrid" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1013,6 +1112,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf0)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -50,16 +50,19 @@ class PANEL_SYM_LIB_TABLE_BASE : public wxPanel
STD_BITMAP_BUTTON* m_move_up_button;
STD_BITMAP_BUTTON* m_move_down_button;
STD_BITMAP_BUTTON* m_delete_button;
wxButton* m_resetGlobal;
wxButton* m_convertLegacy;
WX_GRID* m_path_subs_grid;
// Virtual event handlers, override them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onPageChange( wxNotebookEvent& event ) { event.Skip(); }
virtual void appendRowHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void browseLibrariesHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveUpHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveDownHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteRowHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void onReset( wxCommandEvent& event ) { event.Skip(); }
virtual void onConvertLegacyLibraries( wxCommandEvent& event ) { event.Skip(); }
virtual void onSizeGrid( wxSizeEvent& event ) { event.Skip(); }

View File

@ -63,10 +63,9 @@ bool DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow()
+ wxS( "\n" ) + ioe.What() );
return false;
}
return true;
}
else
{
wxString fileName = m_filePicker1->GetPath();
if( fileName.IsEmpty() )
@ -93,7 +92,8 @@ bool DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow()
}
catch( const IO_ERROR& ioe )
{
DisplayError( this, wxString::Format( _( "'%s' is not a valid footprint library table." ),
DisplayError( this,
wxString::Format( _( "'%s' is not a valid footprint library table." ),
fn.GetFullPath() )
+ wxS( "\n" ) + ioe.What() );
return false;
@ -112,14 +112,15 @@ bool DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow()
// Copy the global footprint library table file to the user config.
if( !::wxCopyFile( fn.GetFullPath(), fpTableFileName.GetFullPath() ) )
{
DisplayError( this, wxString::Format( _( "Cannot copy footprint library table from:\n"
DisplayError( this,
wxString::Format( _( "Cannot copy footprint library table from:\n"
"%s\n"
"to:\n"
"%s." ),
fn.GetFullPath(),
fpTableFileName.GetFullPath() ) );
fn.GetFullPath(), fpTableFileName.GetFullPath() ) );
return false;
}
}
// Load the successfully copied footprint library table file. This should not fail
// since the file was tested above. Check for failure anyway to keep the compiler

View File

@ -58,6 +58,7 @@
#include <pcb_edit_frame.h>
#include <env_paths.h>
#include <dialogs/dialog_edit_library_tables.h>
#include <dialogs/dialog_global_fp_lib_table_config.h>
#include <dialogs/dialog_plugin_options.h>
#include <footprint_viewer_frame.h>
#include <footprint_edit_frame.h>
@ -299,39 +300,11 @@ protected:
};
PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PROJECT* aProject,
FP_LIB_TABLE* aGlobalTable, const wxString& aGlobalTblPath,
FP_LIB_TABLE* aProjectTable, const wxString& aProjectTblPath,
const wxString& aProjectBasePath ) :
PANEL_FP_LIB_TABLE_BASE( aParent ),
m_globalTable( aGlobalTable ),
m_projectTable( aProjectTable ),
m_project( aProject ),
m_projectBasePath( aProjectBasePath ),
m_parent( aParent )
void PANEL_FP_LIB_TABLE::setupGrid( WX_GRID* aGrid )
{
m_global_grid->SetTable( new FP_LIB_TABLE_GRID( *aGlobalTable ), true );
// add Cut, Copy, and Paste to wxGrids
m_path_subs_grid->PushEventHandler( new GRID_TRICKS( m_path_subs_grid ) );
populatePluginList();
wxArrayString choices;
for( auto& [fileType, desc] : m_supportedFpFiles )
choices.Add( PCB_IO_MGR::ShowType( fileType ) );
PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
if( cfg->m_lastFootprintLibDir.IsEmpty() )
cfg->m_lastFootprintLibDir = PATHS::GetDefaultUserFootprintsPath();
m_lastProjectLibDir = m_projectBasePath;
auto autoSizeCol =
[&]( WX_GRID* aGrid, int aCol )
auto autoSizeCol = [&]( WX_GRID* aGrid, int aCol )
{
int prevWidth = aGrid->GetColSize( aCol );
@ -339,11 +312,9 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PRO
aGrid->SetColSize( aCol, std::max( prevWidth, aGrid->GetColSize( aCol ) ) );
};
auto setupGrid =
[&]( WX_GRID* aGrid )
{
// Give a bit more room for wxChoice editors
aGrid->SetDefaultRowSize( aGrid->GetDefaultRowSize() + 4 );
for( int ii = 0; ii < aGrid->GetNumberRows(); ++ii )
aGrid->SetRowSize( ii, aGrid->GetDefaultRowSize() + 4 );
// add Cut, Copy, and Paste to wxGrids
aGrid->PushEventHandler( new FP_GRID_TRICKS( m_parent, aGrid ) );
@ -353,8 +324,8 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PRO
wxGridCellAttr* attr;
attr = new wxGridCellAttr;
attr->SetEditor( new GRID_CELL_PATH_EDITOR( m_parent, aGrid,
&cfg->m_lastFootprintLibDir, true, m_projectBasePath,
attr->SetEditor( new GRID_CELL_PATH_EDITOR(
m_parent, aGrid, &cfg->m_lastFootprintLibDir, true, m_projectBasePath,
[this]( WX_GRID* grid, int row ) -> wxString
{
auto* libTable = static_cast<FP_LIB_TABLE_GRID*>( grid->GetTable() );
@ -370,7 +341,7 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PRO
aGrid->SetColAttr( COL_URI, attr );
attr = new wxGridCellAttr;
attr->SetEditor( new wxGridCellChoiceEditor( choices ) );
attr->SetEditor( new wxGridCellChoiceEditor( m_pluginChoices ) );
aGrid->SetColAttr( COL_TYPE, attr );
attr = new wxGridCellAttr;
@ -395,6 +366,36 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PRO
aGrid->SelectRow( 0 );
};
PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PROJECT* aProject,
FP_LIB_TABLE* aGlobalTable, const wxString& aGlobalTblPath,
FP_LIB_TABLE* aProjectTable, const wxString& aProjectTblPath,
const wxString& aProjectBasePath ) :
PANEL_FP_LIB_TABLE_BASE( aParent ),
m_globalTable( aGlobalTable ),
m_projectTable( aProjectTable ),
m_project( aProject ),
m_projectBasePath( aProjectBasePath ),
m_parent( aParent )
{
m_global_grid->SetTable( new FP_LIB_TABLE_GRID( *aGlobalTable ), true );
// add Cut, Copy, and Paste to wxGrids
m_path_subs_grid->PushEventHandler( new GRID_TRICKS( m_path_subs_grid ) );
populatePluginList();
for( auto& [fileType, desc] : m_supportedFpFiles )
m_pluginChoices.Add( PCB_IO_MGR::ShowType( fileType ) );
PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
if( cfg->m_lastFootprintLibDir.IsEmpty() )
cfg->m_lastFootprintLibDir = PATHS::GetDefaultUserFootprintsPath();
m_lastProjectLibDir = m_projectBasePath;
setupGrid( m_global_grid );
populateEnvironReadOnlyTable();
@ -639,8 +640,6 @@ bool PANEL_FP_LIB_TABLE::verifyTables()
void PANEL_FP_LIB_TABLE::OnUpdateUI( wxUpdateUIEvent& event )
{
m_pageNdx = (unsigned) std::max( 0, m_notebook->GetSelection() );
m_cur_grid = m_pageNdx == 0 ? m_global_grid : m_project_grid;
}
@ -1053,6 +1052,55 @@ void PANEL_FP_LIB_TABLE::onSizeGrid( wxSizeEvent& event )
}
void PANEL_FP_LIB_TABLE::onReset( wxCommandEvent& event )
{
if( !m_cur_grid->CommitPendingChanges() )
return;
// No need to prompt to preserve an empty table
if( m_global_grid->GetNumberRows() > 0 &&
!IsOK( this, wxString::Format( _( "This action will reset your global library table on "
"disk and cannot be undone." ) ) ) )
{
return;
}
DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG dlg( m_parent );
if( dlg.ShowModal() == wxID_OK )
{
m_global_grid->Freeze();
wxGridTableBase* table = m_global_grid->GetTable();
m_global_grid->DestroyTable( table );
m_global_grid->SetTable( new FP_LIB_TABLE_GRID( *m_globalTable ), true );
m_global_grid->PopEventHandler( true );
setupGrid( m_global_grid );
m_parent->m_GlobalTableChanged = true;
m_global_grid->Thaw();
}
}
void PANEL_FP_LIB_TABLE::onPageChange( wxBookCtrlEvent& event )
{
m_pageNdx = (unsigned) std::max( 0, m_notebook->GetSelection() );
if( m_pageNdx == 0 )
{
m_cur_grid = m_global_grid;
m_resetGlobal->Enable();
}
else
{
m_cur_grid = m_project_grid;
m_resetGlobal->Disable();
}
}
bool PANEL_FP_LIB_TABLE::TransferDataFromWindow()
{
if( !m_cur_grid->CommitPendingChanges() )

View File

@ -61,6 +61,11 @@ private:
void onMigrateLibraries( wxCommandEvent& event ) override;
void onSizeGrid( wxSizeEvent& event ) override;
void onPageChange( wxBookCtrlEvent& event ) override;
void onReset( wxCommandEvent& event ) override;
void setupGrid( WX_GRID* aGrid );
void adjustPathSubsGridColumns( int aWidth );
/// Populate the readonly environment variable table with names and values
@ -90,6 +95,7 @@ private:
wxString m_projectBasePath;
DIALOG_EDIT_LIBRARY_TABLES* m_parent;
wxArrayString m_pluginChoices;
WX_GRID* m_cur_grid; // changed based on tab choice
static size_t m_pageNdx; // Remember last notebook page selected during a session

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf0)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -153,6 +153,12 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i
bButtonsSizer->Add( 20, 0, 1, wxEXPAND, 5 );
m_resetGlobal = new wxButton( this, wxID_ANY, _("Reset Libraries"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_resetGlobal, 0, wxALL, 5 );
bButtonsSizer->Add( 0, 0, 0, wxEXPAND, 5 );
m_migrate_libs_button = new wxButton( this, wxID_ANY, _("Migrate Libraries"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_migrate_libs_button, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
@ -205,10 +211,12 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_FP_LIB_TABLE_BASE::OnUpdateUI ) );
m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_FP_LIB_TABLE_BASE::onPageChange ), NULL, this );
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_delete_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_resetGlobal->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::onReset ), NULL, this );
m_migrate_libs_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::onMigrateLibraries ), NULL, this );
m_path_subs_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_LIB_TABLE_BASE::onSizeGrid ), NULL, this );
}
@ -217,10 +225,12 @@ PANEL_FP_LIB_TABLE_BASE::~PANEL_FP_LIB_TABLE_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_FP_LIB_TABLE_BASE::OnUpdateUI ) );
m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_FP_LIB_TABLE_BASE::onPageChange ), NULL, this );
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_delete_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_resetGlobal->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::onReset ), NULL, this );
m_migrate_libs_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::onMigrateLibraries ), NULL, this );
m_path_subs_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_LIB_TABLE_BASE::onSizeGrid ), NULL, this );

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<FileVersion major="1" minor="17"/>
<object class="Project" expanded="true">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
@ -29,12 +29,13 @@
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
<object class="Panel" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
@ -53,16 +54,16 @@
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnUpdateUI">OnUpdateUI</event>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bMainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxNotebook" expanded="1">
<object class="wxNotebook" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -84,6 +85,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -115,11 +117,12 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="notebookpage" expanded="1">
<event name="OnNotebookPageChanged">onPageChange</event>
<object class="notebookpage" expanded="true">
<property name="bitmap"></property>
<property name="label">Global Libraries</property>
<property name="select">1</property>
<object class="wxPanel" expanded="1">
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -140,6 +143,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -170,16 +174,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">m_global_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="0">
<object class="wxGrid" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -213,6 +217,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">1</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
@ -266,11 +271,11 @@
</object>
</object>
</object>
<object class="notebookpage" expanded="1">
<object class="notebookpage" expanded="true">
<property name="bitmap"></property>
<property name="label">Project Specific Libraries</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -291,6 +296,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -321,16 +327,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">m_project_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="0">
<object class="wxGrid" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -364,6 +370,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">1</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
@ -419,20 +426,20 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">8</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bButtonsSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -458,6 +465,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -502,11 +510,11 @@
<event name="OnButtonClick">appendRowHandler</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="CustomControl" expanded="1">
<object class="CustomControl" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -530,6 +538,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -564,11 +573,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -594,6 +603,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -638,11 +648,11 @@
<event name="OnButtonClick">moveUpHandler</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -668,6 +678,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -712,21 +723,21 @@
<event name="OnButtonClick">moveDownHandler</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -752,6 +763,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -796,21 +808,21 @@
<event name="OnButtonClick">deleteRowHandler</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<object class="wxButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -836,6 +848,92 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Reset Libraries</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_resetGlobal</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onReset</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -882,11 +980,11 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">8</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxStaticText" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -907,6 +1005,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -943,21 +1042,21 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<object class="spacer" expanded="true">
<property name="height">2</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxGrid" expanded="0">
<object class="wxGrid" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -991,6 +1090,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf0)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -51,15 +51,18 @@ class PANEL_FP_LIB_TABLE_BASE : public wxPanel
STD_BITMAP_BUTTON* m_move_up_button;
STD_BITMAP_BUTTON* m_move_down_button;
STD_BITMAP_BUTTON* m_delete_button;
wxButton* m_resetGlobal;
wxButton* m_migrate_libs_button;
WX_GRID* m_path_subs_grid;
// Virtual event handlers, override them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onPageChange( wxNotebookEvent& event ) { event.Skip(); }
virtual void appendRowHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveUpHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveDownHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteRowHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void onReset( wxCommandEvent& event ) { event.Skip(); }
virtual void onMigrateLibraries( wxCommandEvent& event ) { event.Skip(); }
virtual void onSizeGrid( wxSizeEvent& event ) { event.Skip(); }