Add Manage Symbol and Footprint Library tables to project frame.
Fixes: lp:1780604 * https://bugs.launchpad.net/kicad/+bug/1780604
This commit is contained in:
parent
5621f4221a
commit
eaf5b913b6
|
@ -156,6 +156,7 @@ set( COMMON_DLG_SRCS
|
|||
dialogs/dialog_configure_paths.cpp
|
||||
dialogs/dialog_configure_paths_base.cpp
|
||||
dialogs/dialog_display_info_HTML_base.cpp
|
||||
dialogs/dialog_edit_library_tables.cpp
|
||||
dialogs/dialog_exit_base.cpp
|
||||
dialogs/dialog_file_dir_picker.cpp
|
||||
dialogs/dialog_image_editor.cpp
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <wx/statline.h>
|
||||
|
||||
#include "dialog_edit_library_tables.h"
|
||||
|
||||
|
||||
DIALOG_EDIT_LIBRARY_TABLES::DIALOG_EDIT_LIBRARY_TABLES( wxWindow* aParent,
|
||||
const wxString& aTitle ) :
|
||||
DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
|
||||
m_GlobalTableChanged( false ),
|
||||
m_ProjectTableChanged( false )
|
||||
{
|
||||
// Construction delayed until after panel is installed
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_EDIT_LIBRARY_TABLES::InstallPanel( wxPanel* aPanel )
|
||||
{
|
||||
m_contentPanel = aPanel;
|
||||
|
||||
// Now perform the body of the constructor
|
||||
auto mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
SetSizer( mainSizer );
|
||||
|
||||
mainSizer->Add( m_contentPanel, 1, wxEXPAND|wxALL, 5 );
|
||||
m_contentPanel->SetMinSize( wxSize( 1000, 600 ) );
|
||||
|
||||
auto line = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
mainSizer->Add( line, 0, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 10 );
|
||||
|
||||
auto sdbSizer = new wxStdDialogButtonSizer();
|
||||
auto sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
sdbSizer->AddButton( sdbSizerOK );
|
||||
auto sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
||||
sdbSizer->AddButton( sdbSizerCancel );
|
||||
sdbSizer->Realize();
|
||||
|
||||
mainSizer->Add( sdbSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
sdbSizerOK->SetDefault();
|
||||
|
||||
FinishDialogSettings();
|
||||
|
||||
// On some windows manager (Unity, XFCE), this dialog is not always raised, depending
|
||||
// on how the dialog is run.
|
||||
Raise();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_EDIT_LIBRARY_TABLES::TransferDataToWindow()
|
||||
{
|
||||
if( !DIALOG_SHIM::TransferDataToWindow() )
|
||||
return false;
|
||||
|
||||
return m_contentPanel->TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_EDIT_LIBRARY_TABLES::TransferDataFromWindow()
|
||||
{
|
||||
if( !DIALOG_SHIM::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
return m_contentPanel->TransferDataFromWindow();
|
||||
}
|
||||
|
|
@ -64,12 +64,12 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
// Path configuration edit dialog.
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
||||
_( "Configure &Paths..." ),
|
||||
_( "&Configure Paths..." ),
|
||||
_( "Edit path configuration environment variables" ),
|
||||
KiBitmap( editor_xpm ) );
|
||||
|
||||
AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT,
|
||||
_( "Manage Footprint &Libraries..." ), _( "Manage footprint libraries" ),
|
||||
_( "Manage &Footprint Libraries..." ), _( "Manage footprint libraries" ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
|
||||
preferencesMenu->AppendSeparator();
|
||||
|
|
|
@ -288,14 +288,14 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
// Environment varialbes
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
||||
_( "Configure Pa&ths..." ),
|
||||
_( "&Configure Paths..." ),
|
||||
_( "Edit path configuration environment variables" ),
|
||||
KiBitmap( path_xpm ) );
|
||||
|
||||
// Library list
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_EDIT_SYM_LIB_TABLE,
|
||||
_( "Manage Symbol Libraries..." ),
|
||||
_( "Manage &Symbol Libraries..." ),
|
||||
_( "Edit the global and project symbol library tables." ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
|
||||
|
@ -304,7 +304,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
// Default values and options
|
||||
AddMenuItem( preferencesMenu,
|
||||
wxID_PREFERENCES,
|
||||
_( "Preferences..." ),
|
||||
_( "&Preferences..." ),
|
||||
_( "Show preferences for all open tools" ),
|
||||
KiBitmap( preference_xpm ) );
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DIALOG_EDIT_LIBRARY_TABLES_H
|
||||
#define DIALOG_EDIT_LIBRARY_TABLES_H
|
||||
|
||||
#include <dialog_shim.h>
|
||||
|
||||
|
||||
class DIALOG_EDIT_LIBRARY_TABLES : public DIALOG_SHIM
|
||||
{
|
||||
public:
|
||||
bool m_GlobalTableChanged;
|
||||
bool m_ProjectTableChanged;
|
||||
|
||||
public:
|
||||
DIALOG_EDIT_LIBRARY_TABLES( wxWindow* aParent, const wxString& aTitle );
|
||||
|
||||
void InstallPanel( wxPanel* aPanel );
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
protected:
|
||||
wxPanel* m_contentPanel;
|
||||
};
|
||||
|
||||
|
||||
#endif //DIALOG_EDIT_LIBRARY_TABLES_H
|
|
@ -79,6 +79,15 @@ public:
|
|||
|
||||
~DIALOG_SHIM();
|
||||
|
||||
/**
|
||||
* Sets the window (usually a wxTextCtrl) that should be focused when the dialog is
|
||||
* shown.
|
||||
*/
|
||||
void SetInitialFocus( wxWindow* aWindow )
|
||||
{
|
||||
m_initialFocusTarget = aWindow;
|
||||
}
|
||||
|
||||
int ShowQuasiModal(); // disable only the parent window, otherwise modal.
|
||||
|
||||
void EndQuasiModal( int retCode ); // End quasi-modal mode
|
||||
|
@ -112,15 +121,6 @@ protected:
|
|||
*/
|
||||
void FinishDialogSettings();
|
||||
|
||||
/**
|
||||
* Sets the window (usually a wxTextCtrl) that should be focused when the dialog is
|
||||
* shown.
|
||||
*/
|
||||
void SetInitialFocus( wxWindow* aWindow )
|
||||
{
|
||||
m_initialFocusTarget = aWindow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the dialog to the given dimensions in "dialog units". These are units equivalent
|
||||
* to 4* the average character width and 8* the average character height, allowing a dialog
|
||||
|
|
|
@ -87,6 +87,7 @@ class TOOL_MANAGER;
|
|||
class TOOL_DISPATCHER;
|
||||
class ACTIONS;
|
||||
class PAGED_DIALOG;
|
||||
class DIALOG_EDIT_LIBRARY_TABLES;
|
||||
|
||||
|
||||
enum id_librarytype {
|
||||
|
@ -241,6 +242,13 @@ public:
|
|||
*/
|
||||
virtual void InstallPreferences( PAGED_DIALOG* aParent ) { }
|
||||
|
||||
/**
|
||||
* Function InstallLibraryTablesPanel
|
||||
* allows a Frame to load its library tables (if any) into a library tables dialog.
|
||||
* @param aDialog a library tables dialog
|
||||
*/
|
||||
virtual void InstallLibraryTablesPanel( DIALOG_EDIT_LIBRARY_TABLES* aDialog ) { }
|
||||
|
||||
/**
|
||||
* Function LoadSettings
|
||||
* loads common frame parameters from a configuration file.
|
||||
|
|
|
@ -91,6 +91,8 @@ enum main_id
|
|||
|
||||
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
|
||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
||||
ID_EDIT_SYMBOL_LIBRARY_TABLE,
|
||||
ID_EDIT_FOOTPRINT_LIBRARY_TABLE,
|
||||
|
||||
ID_GEN_PLOT,
|
||||
ID_GEN_PLOT_PS,
|
||||
|
|
|
@ -265,7 +265,7 @@ private:
|
|||
*/
|
||||
class LIB_TABLE : public PROJECT::_ELEM
|
||||
{
|
||||
friend class DIALOG_FP_LIB_TABLE;
|
||||
friend class PANEL_FP_LIB_TABLE;
|
||||
friend class LIB_TABLE_GRID;
|
||||
|
||||
public:
|
||||
|
|
|
@ -172,15 +172,16 @@ public:
|
|||
void OnRunPageLayoutEditor( wxCommandEvent& event );
|
||||
|
||||
void OnConfigurePaths( wxCommandEvent& aEvent );
|
||||
void OnEditSymLibTable( wxCommandEvent& aEvent );
|
||||
void OnEditFpLibTable( wxCommandEvent& aEvent );
|
||||
void OnPreferences( wxCommandEvent& aEvent );
|
||||
void OnOpenTextEditor( wxCommandEvent& event );
|
||||
void OnOpenFileInTextEditor( wxCommandEvent& event );
|
||||
void OnShowHotkeys( wxCommandEvent& event );
|
||||
|
||||
void OnFileHistory( wxCommandEvent& event );
|
||||
void OnExit( wxCommandEvent& event );
|
||||
|
||||
void Process_Config( wxCommandEvent& event );
|
||||
|
||||
void ReCreateMenuBar() override;
|
||||
void RecreateBaseHToolbar();
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <executable_names.h>
|
||||
#include <build_version.h>
|
||||
#include <dialog_configure_paths.h>
|
||||
#include <dialog_edit_library_tables.h>
|
||||
#include "pgm_kicad.h"
|
||||
#include "tree_project_frame.h"
|
||||
|
||||
|
@ -548,21 +549,9 @@ void KICAD_MANAGER_FRAME::PrintPrjInfo()
|
|||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::Process_Config( wxCommandEvent& event )
|
||||
void KICAD_MANAGER_FRAME::OnShowHotkeys( wxCommandEvent& event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
|
||||
// Display current hotkey list for LibEdit.
|
||||
DisplayHotkeyList( this, m_manager_Hokeys_Descr );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxT( "KICAD_MANAGER_FRAME::Process_Config error" ) );
|
||||
break;
|
||||
}
|
||||
DisplayHotkeyList( this, m_manager_Hokeys_Descr );
|
||||
}
|
||||
|
||||
|
||||
|
@ -573,6 +562,48 @@ void KICAD_MANAGER_FRAME::OnConfigurePaths( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::OnEditSymLibTable( wxCommandEvent& aEvent )
|
||||
{
|
||||
auto frame = Kiway().Player( FRAME_SCH, false );
|
||||
bool alreadyRunning = frame != nullptr;
|
||||
|
||||
if( !frame )
|
||||
frame = Kiway().Player( FRAME_SCH, true );
|
||||
|
||||
if( frame )
|
||||
{
|
||||
DIALOG_EDIT_LIBRARY_TABLES dlg( this, _( "Symbol Libraries" ) );
|
||||
frame->InstallLibraryTablesPanel( &dlg );
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
if( !alreadyRunning )
|
||||
frame->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::OnEditFpLibTable( wxCommandEvent& aEvent )
|
||||
{
|
||||
auto frame = Kiway().Player( FRAME_PCB, false );
|
||||
bool alreadyRunning = frame != nullptr;
|
||||
|
||||
if( !frame )
|
||||
frame = Kiway().Player( FRAME_PCB, true );
|
||||
|
||||
if( frame )
|
||||
{
|
||||
DIALOG_EDIT_LIBRARY_TABLES dlg( this, _( "Footprint Libraries" ) );
|
||||
frame->InstallLibraryTablesPanel( &dlg );
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
if( !alreadyRunning )
|
||||
frame->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::OnPreferences( wxCommandEvent& aEvent )
|
||||
{
|
||||
ShowPreferences( m_manager_Hokeys_Descr, m_manager_Hokeys_Descr, wxT( "kicad" ) );
|
||||
|
|
|
@ -54,6 +54,8 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
|
|||
EVT_MENU( ID_TO_TEXT_EDITOR, KICAD_MANAGER_FRAME::OnOpenTextEditor )
|
||||
EVT_MENU( ID_BROWSE_AN_SELECT_FILE, KICAD_MANAGER_FRAME::OnOpenFileInTextEditor )
|
||||
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, KICAD_MANAGER_FRAME::OnConfigurePaths )
|
||||
EVT_MENU( ID_EDIT_SYMBOL_LIBRARY_TABLE, KICAD_MANAGER_FRAME::OnEditSymLibTable )
|
||||
EVT_MENU( ID_EDIT_FOOTPRINT_LIBRARY_TABLE, KICAD_MANAGER_FRAME::OnEditFpLibTable )
|
||||
EVT_MENU( wxID_PREFERENCES, KICAD_MANAGER_FRAME::OnPreferences )
|
||||
EVT_MENU( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles )
|
||||
EVT_MENU( ID_READ_ZIP_ARCHIVE, KICAD_MANAGER_FRAME::OnUnarchiveFiles )
|
||||
|
@ -71,7 +73,7 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
|
|||
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, KICAD_MANAGER_FRAME::OnFileHistory )
|
||||
|
||||
// Show hotkeys
|
||||
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, KICAD_MANAGER_FRAME::Process_Config )
|
||||
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, KICAD_MANAGER_FRAME::OnShowHotkeys )
|
||||
|
||||
|
||||
// Special functions
|
||||
|
@ -323,10 +325,22 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
|||
// Path configuration edit dialog.
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
||||
_( "Configure Pa&ths..." ),
|
||||
_( "&Configure Paths..." ),
|
||||
_( "Edit path configuration environment variables" ),
|
||||
KiBitmap( path_xpm ) );
|
||||
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_EDIT_SYMBOL_LIBRARY_TABLE,
|
||||
_( "Manage &Symbol Libraries..." ),
|
||||
_( "Edit the global and project symbol library tables" ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_EDIT_FOOTPRINT_LIBRARY_TABLE,
|
||||
_( "Manage &Footprint Libraries..." ),
|
||||
_( "Configure footprint library table" ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
|
||||
AddMenuItem( preferencesMenu,
|
||||
wxID_PREFERENCES,
|
||||
_( "&Preferences..." ),
|
||||
|
|
|
@ -49,8 +49,10 @@
|
|||
#include <lib_table_grid.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <pgm_base.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <env_paths.h>
|
||||
#include <dialogs/dialog_file_dir_picker.h>
|
||||
#include <dialog_edit_library_tables.h>
|
||||
|
||||
// Filters for the file picker
|
||||
static constexpr int FILTER_COUNT = 4;
|
||||
|
@ -106,6 +108,7 @@ static wxString getFilterString()
|
|||
*/
|
||||
class FP_LIB_TABLE_GRID : public LIB_TABLE_GRID, public FP_LIB_TABLE
|
||||
{
|
||||
friend class PANEL_FP_LIB_TABLE;
|
||||
friend class FP_GRID_TRICKS;
|
||||
|
||||
protected:
|
||||
|
@ -252,14 +255,15 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
DIALOG_FP_LIB_TABLE::DIALOG_FP_LIB_TABLE( wxWindow* aParent, FP_LIB_TABLE* aGlobal,
|
||||
FP_LIB_TABLE* aProject ) :
|
||||
DIALOG_FP_LIB_TABLE_BASE( aParent ),
|
||||
PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, FP_LIB_TABLE* aGlobal,
|
||||
FP_LIB_TABLE* aProject ) :
|
||||
PANEL_FP_LIB_TABLE_BASE( aParent ),
|
||||
m_global( aGlobal ),
|
||||
m_project( aProject )
|
||||
m_project( aProject ),
|
||||
m_parent( aParent )
|
||||
{
|
||||
// For user info, shows the table filenames:
|
||||
m_PrjTableFilename->SetLabel( Prj().FootprintLibTblName() );
|
||||
m_PrjTableFilename->SetLabel( m_parent->Prj().FootprintLibTblName() );
|
||||
m_GblTableFilename->SetLabel( FP_LIB_TABLE::GetGlobalTableFileName() );
|
||||
|
||||
// wxGrid only supports user owned tables if they exist past end of ~wxGrid(),
|
||||
|
@ -331,21 +335,10 @@ DIALOG_FP_LIB_TABLE::DIALOG_FP_LIB_TABLE( wxWindow* aParent, FP_LIB_TABLE* aGlob
|
|||
// Without that, we do not see what lib will be deleted
|
||||
m_global_grid->SetGridCursor( 0, 1 );
|
||||
m_project_grid->SetGridCursor( 0, 1 );
|
||||
|
||||
m_sdbSizerOK->SetDefault();
|
||||
|
||||
SetSizeInDU( 450, 380 );
|
||||
Center();
|
||||
|
||||
FinishDialogSettings();
|
||||
|
||||
// On some windows manager (Unity, XFCE), this dialog is not always raised, depending
|
||||
// on how the dialog is run.
|
||||
Raise();
|
||||
}
|
||||
|
||||
|
||||
DIALOG_FP_LIB_TABLE::~DIALOG_FP_LIB_TABLE()
|
||||
PANEL_FP_LIB_TABLE::~PANEL_FP_LIB_TABLE()
|
||||
{
|
||||
// Delete the GRID_TRICKS.
|
||||
// Any additional event handlers should be popped before the window is deleted.
|
||||
|
@ -354,14 +347,14 @@ DIALOG_FP_LIB_TABLE::~DIALOG_FP_LIB_TABLE()
|
|||
}
|
||||
|
||||
|
||||
bool DIALOG_FP_LIB_TABLE::Show( bool aShow )
|
||||
bool PANEL_FP_LIB_TABLE::Show( bool aShow )
|
||||
{
|
||||
if( aShow )
|
||||
{
|
||||
m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid;
|
||||
|
||||
// for ALT+A handling, we want the initial focus to be on the first selected grid.
|
||||
SetInitialFocus( m_cur_grid );
|
||||
m_parent->SetInitialFocus( m_cur_grid );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -369,14 +362,14 @@ bool DIALOG_FP_LIB_TABLE::Show( bool aShow )
|
|||
// We must do this on Show( false ) because when the first grid is hidden it
|
||||
// gives focus to the next one (which is then hidden), but the result is that
|
||||
// we save the wrong grid if we do it after this.
|
||||
m_pageNdx = m_auinotebook->GetSelection();
|
||||
m_pageNdx = (unsigned) std::max( 0, m_auinotebook->GetSelection() );
|
||||
}
|
||||
|
||||
return DIALOG_SHIM::Show( aShow );
|
||||
return wxPanel::Show( aShow );
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_FP_LIB_TABLE::verifyTables()
|
||||
bool PANEL_FP_LIB_TABLE::verifyTables()
|
||||
{
|
||||
for( int t=0; t<2; ++t )
|
||||
{
|
||||
|
@ -398,9 +391,9 @@ bool DIALOG_FP_LIB_TABLE::verifyTables()
|
|||
}
|
||||
else if( ( illegalCh = LIB_ID::FindIllegalLibNicknameChar( nick, LIB_ID::ID_PCB ) ) )
|
||||
{
|
||||
wxString msg = wxString::Format(
|
||||
_( "Illegal character \"%c\" in Nickname: \"%s\"" ),
|
||||
illegalCh, GetChars( nick ) );
|
||||
wxString msg = wxString::Format( _( "Illegal character '%c' in Nickname: \"%s\"" ),
|
||||
illegalCh,
|
||||
GetChars( nick ) );
|
||||
|
||||
// show the tabbed panel holding the grid we have flunked:
|
||||
if( &model != cur_model() )
|
||||
|
@ -438,10 +431,7 @@ bool DIALOG_FP_LIB_TABLE::verifyTables()
|
|||
|
||||
if( nick1 == nick2 )
|
||||
{
|
||||
wxString msg = wxString::Format(
|
||||
_( "Duplicate Nickname: \"%s\" in rows %d and %d" ),
|
||||
GetChars( nick1 ), r1+1, r2+1
|
||||
);
|
||||
wxString msg = wxString::Format( _( "Duplicate Nicknames \"%s\"." ), nick1 );
|
||||
|
||||
// show the tabbed panel holding the grid we have flunked:
|
||||
if( &model != cur_model() )
|
||||
|
@ -465,13 +455,13 @@ bool DIALOG_FP_LIB_TABLE::verifyTables()
|
|||
|
||||
//-----<event handlers>----------------------------------
|
||||
|
||||
void DIALOG_FP_LIB_TABLE::pageChangedHandler( wxAuiNotebookEvent& event )
|
||||
void PANEL_FP_LIB_TABLE::pageChangedHandler( wxAuiNotebookEvent& event )
|
||||
{
|
||||
m_cur_grid = ( m_auinotebook->GetSelection() == 0 ) ? m_global_grid : m_project_grid;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FP_LIB_TABLE::appendRowHandler( wxCommandEvent& event )
|
||||
void PANEL_FP_LIB_TABLE::appendRowHandler( wxCommandEvent& event )
|
||||
{
|
||||
if( m_cur_grid->AppendRows( 1 ) )
|
||||
{
|
||||
|
@ -486,7 +476,7 @@ void DIALOG_FP_LIB_TABLE::appendRowHandler( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_FP_LIB_TABLE::deleteRowHandler( wxCommandEvent& event )
|
||||
void PANEL_FP_LIB_TABLE::deleteRowHandler( wxCommandEvent& event )
|
||||
{
|
||||
int curRow = m_cur_grid->GetGridCursorRow();
|
||||
int curCol = m_cur_grid->GetGridCursorCol();
|
||||
|
@ -535,7 +525,7 @@ void DIALOG_FP_LIB_TABLE::deleteRowHandler( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_FP_LIB_TABLE::moveUpHandler( wxCommandEvent& event )
|
||||
void PANEL_FP_LIB_TABLE::moveUpHandler( wxCommandEvent& event )
|
||||
{
|
||||
FP_LIB_TABLE_GRID* tbl = cur_model();
|
||||
int curRow = m_cur_grid->GetGridCursorRow();
|
||||
|
@ -562,7 +552,7 @@ void DIALOG_FP_LIB_TABLE::moveUpHandler( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_FP_LIB_TABLE::moveDownHandler( wxCommandEvent& event )
|
||||
void PANEL_FP_LIB_TABLE::moveDownHandler( wxCommandEvent& event )
|
||||
{
|
||||
FP_LIB_TABLE_GRID* tbl = cur_model();
|
||||
int curRow = m_cur_grid->GetGridCursorRow();
|
||||
|
@ -589,13 +579,13 @@ void DIALOG_FP_LIB_TABLE::moveDownHandler( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
|
||||
void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
|
||||
{
|
||||
if( m_lastBrowseDir.IsEmpty() )
|
||||
m_lastBrowseDir = Prj().GetProjectPath();
|
||||
m_lastBrowseDir = m_parent->Prj().GetProjectPath();
|
||||
|
||||
DIALOG_FILE_DIR_PICKER dlg( this, _( "Select Library" ), m_lastBrowseDir,
|
||||
getFilterString(), FD_MULTIPLE );
|
||||
getFilterString(), FD_MULTIPLE );
|
||||
|
||||
auto result = dlg.ShowModal();
|
||||
|
||||
|
@ -608,6 +598,7 @@ void DIALOG_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
|
|||
if( m_lastBrowseDir.EndsWith( KiCadFootprintLibPathExtension ) )
|
||||
m_lastBrowseDir = m_lastBrowseDir.BeforeLast( wxFileName::GetPathSeparator() );
|
||||
|
||||
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
|
||||
bool skipRemainingDuplicates = false;
|
||||
wxArrayString files;
|
||||
dlg.GetFilenames( files );
|
||||
|
@ -648,9 +639,12 @@ void DIALOG_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
|
|||
m_cur_grid->SetCellValue( last_row, COL_TYPE, IO_MGR::ShowType( type ) );
|
||||
|
||||
// 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 );
|
||||
wxString path = NormalizePath( filePath, &envVars, &m_parent->Prj() );
|
||||
|
||||
if( path.IsEmpty() )
|
||||
path = fn.GetFullPath();
|
||||
|
||||
m_cur_grid->SetCellValue( last_row, COL_URI, path );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -662,7 +656,7 @@ void DIALOG_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
void DIALOG_FP_LIB_TABLE::adjustPathSubsGridColumns( int aWidth )
|
||||
void PANEL_FP_LIB_TABLE::adjustPathSubsGridColumns( int aWidth )
|
||||
{
|
||||
// Account for scroll bars
|
||||
aWidth -= ( m_path_subs_grid->GetSize().x - m_path_subs_grid->GetClientSize().x );
|
||||
|
@ -672,7 +666,7 @@ void DIALOG_FP_LIB_TABLE::adjustPathSubsGridColumns( int aWidth )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_FP_LIB_TABLE::onSizeGrid( wxSizeEvent& event )
|
||||
void PANEL_FP_LIB_TABLE::onSizeGrid( wxSizeEvent& event )
|
||||
{
|
||||
adjustPathSubsGridColumns( event.GetSize().GetX() );
|
||||
|
||||
|
@ -680,10 +674,8 @@ void DIALOG_FP_LIB_TABLE::onSizeGrid( wxSizeEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_FP_LIB_TABLE::onOKButtonClick( wxCommandEvent& event )
|
||||
bool PANEL_FP_LIB_TABLE::TransferDataFromWindow()
|
||||
{
|
||||
int dialogRet = 0;
|
||||
|
||||
// stuff any pending cell editor text into the table.
|
||||
m_cur_grid->DisableCellEditControl();
|
||||
|
||||
|
@ -691,7 +683,7 @@ void DIALOG_FP_LIB_TABLE::onOKButtonClick( wxCommandEvent& event )
|
|||
{
|
||||
if( *global_model() != *m_global )
|
||||
{
|
||||
dialogRet |= 1;
|
||||
m_parent->m_GlobalTableChanged = true;
|
||||
|
||||
m_global->Clear();
|
||||
m_global->rows.transfer( m_global->rows.end(), global_model()->rows.begin(),
|
||||
|
@ -701,22 +693,22 @@ void DIALOG_FP_LIB_TABLE::onOKButtonClick( wxCommandEvent& event )
|
|||
|
||||
if( *project_model() != *m_project )
|
||||
{
|
||||
dialogRet |= 2;
|
||||
m_parent->m_ProjectTableChanged = true;
|
||||
|
||||
m_project->Clear();
|
||||
m_project->rows.transfer( m_project->rows.end(), project_model()->rows.begin(),
|
||||
project_model()->rows.end(), project_model()->rows );
|
||||
m_project->reindex();
|
||||
}
|
||||
|
||||
EndModal( dialogRet );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// Populate the readonly environment variable table with names and values
|
||||
/// by examining all the full_uri columns.
|
||||
void DIALOG_FP_LIB_TABLE::populateEnvironReadOnlyTable()
|
||||
void PANEL_FP_LIB_TABLE::populateEnvironReadOnlyTable()
|
||||
{
|
||||
wxRegEx re( ".*?(\\$\\{(.+?)\\})|(\\$\\((.+?)\\)).*?", wxRE_ADVANCED );
|
||||
wxASSERT( re.IsValid() ); // wxRE_ADVANCED is required.
|
||||
|
@ -782,17 +774,26 @@ void DIALOG_FP_LIB_TABLE::populateEnvironReadOnlyTable()
|
|||
|
||||
|
||||
|
||||
size_t DIALOG_FP_LIB_TABLE::m_pageNdx = 0;
|
||||
size_t PANEL_FP_LIB_TABLE::m_pageNdx = 0;
|
||||
|
||||
wxString DIALOG_FP_LIB_TABLE::m_lastBrowseDir;
|
||||
wxString PANEL_FP_LIB_TABLE::m_lastBrowseDir;
|
||||
|
||||
|
||||
int InvokePcbLibTableEditor( wxTopLevelWindow* aCaller, FP_LIB_TABLE* aGlobal,
|
||||
FP_LIB_TABLE* aProject )
|
||||
int InvokePcbLibTableEditor( wxTopLevelWindow* aCaller, FP_LIB_TABLE* aGlobalTable,
|
||||
FP_LIB_TABLE* aProjectTable )
|
||||
{
|
||||
DIALOG_FP_LIB_TABLE dlg( aCaller, aGlobal, aProject );
|
||||
DIALOG_EDIT_LIBRARY_TABLES dlg( aCaller, _( "Footprint Libraries" ) );
|
||||
|
||||
int dialogRet = dlg.ShowModal(); // returns value passed to EndModal() above
|
||||
dlg.InstallPanel( new PANEL_FP_LIB_TABLE( &dlg, aGlobalTable, aProjectTable ) );
|
||||
|
||||
return dialogRet;
|
||||
return dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::InstallLibraryTablesPanel( DIALOG_EDIT_LIBRARY_TABLES* aDialog )
|
||||
{
|
||||
FP_LIB_TABLE* globalTable = &GFootprintTable;
|
||||
FP_LIB_TABLE* projectTable = Prj().PcbFootprintLibs();
|
||||
|
||||
aDialog->InstallPanel( new PANEL_FP_LIB_TABLE( aDialog, globalTable, projectTable ) );
|
||||
}
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_FP_LIB_TABLE_H
|
||||
#define DIALOG_FP_LIB_TABLE_H
|
||||
#ifndef PANEL_FP_LIB_TABLE_H
|
||||
#define PANEL_FP_LIB_TABLE_H
|
||||
|
||||
#include <dialog_edit_library_tables.h>
|
||||
#include "dialog_fp_lib_table_base.h"
|
||||
|
||||
class FP_LIB_TABLE;
|
||||
|
@ -29,16 +30,19 @@ class FP_LIB_TABLE_GRID;
|
|||
/**
|
||||
* Dialog to show and edit symbol library tables.
|
||||
*/
|
||||
class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
|
||||
class PANEL_FP_LIB_TABLE : public PANEL_FP_LIB_TABLE_BASE
|
||||
{
|
||||
|
||||
public:
|
||||
DIALOG_FP_LIB_TABLE( wxWindow* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject );
|
||||
~DIALOG_FP_LIB_TABLE() override;
|
||||
PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, FP_LIB_TABLE* aGlobal,
|
||||
FP_LIB_TABLE* aProject );
|
||||
~PANEL_FP_LIB_TABLE() override;
|
||||
|
||||
bool Show( bool aShow ) override;
|
||||
|
||||
private:
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
/**
|
||||
* Trim important fields, removes blank row entries, and checks for duplicates.
|
||||
*
|
||||
|
@ -52,7 +56,6 @@ private:
|
|||
void deleteRowHandler( wxCommandEvent& event ) override;
|
||||
void moveUpHandler( wxCommandEvent& event ) override;
|
||||
void moveDownHandler( wxCommandEvent& event ) override;
|
||||
void onOKButtonClick( wxCommandEvent& event ) override;
|
||||
void onSizeGrid( wxSizeEvent& event ) override;
|
||||
|
||||
void adjustPathSubsGridColumns( int aWidth );
|
||||
|
@ -80,9 +83,11 @@ private:
|
|||
return (FP_LIB_TABLE_GRID*) m_cur_grid->GetTable();
|
||||
}
|
||||
|
||||
DIALOG_EDIT_LIBRARY_TABLES* m_parent;
|
||||
|
||||
wxGrid* m_cur_grid; // changed based on tab choice
|
||||
static size_t m_pageNdx; // Remember last notebook page selected during a session
|
||||
static wxString m_lastBrowseDir; // Remember last directory browsed during a session
|
||||
};
|
||||
|
||||
#endif // DIALOG_FP_LIB_TABLE_H
|
||||
#endif // PANEL_FP_LIB_TABLE_H
|
||||
|
|
|
@ -9,10 +9,8 @@
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_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 )
|
||||
PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
@ -133,19 +131,19 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
|
|||
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_append_button = new wxBitmapButton( m_top_sizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW );
|
||||
bButtonsSizer->Add( m_append_button, 0, wxLEFT, 5 );
|
||||
bButtonsSizer->Add( m_append_button, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_browse_button = new wxBitmapButton( m_top_sizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW );
|
||||
bButtonsSizer->Add( m_browse_button, 0, wxRIGHT, 5 );
|
||||
bButtonsSizer->Add( m_browse_button, 0, wxRIGHT, 10 );
|
||||
|
||||
m_delete_button = new wxBitmapButton( m_top_sizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW );
|
||||
bButtonsSizer->Add( m_delete_button, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_move_up_button = new wxBitmapButton( m_top_sizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW );
|
||||
bButtonsSizer->Add( m_move_up_button, 0, wxLEFT, 5 );
|
||||
bButtonsSizer->Add( m_move_up_button, 0, wxLEFT, 10 );
|
||||
|
||||
m_move_down_button = new wxBitmapButton( m_top_sizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW );
|
||||
bButtonsSizer->Add( m_move_down_button, 0, wxRIGHT, 5 );
|
||||
bButtonsSizer->Add( m_move_down_button, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
m_top_sizer->Add( bButtonsSizer, 0, wxEXPAND, 5 );
|
||||
|
@ -190,48 +188,29 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
|
|||
|
||||
bMainSizer->Add( sbSizer1, 0, wxEXPAND|wxRIGHT|wxLEFT, 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, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( m_bottom_sizer, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
|
||||
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
|
||||
m_browse_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this );
|
||||
m_delete_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
|
||||
m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
|
||||
m_move_down_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
|
||||
m_path_subs_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FP_LIB_TABLE_BASE::onSizeGrid ), NULL, this );
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this );
|
||||
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( PANEL_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
|
||||
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
|
||||
m_browse_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this );
|
||||
m_delete_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::deleteRowHandler ), 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_path_subs_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_LIB_TABLE_BASE::onSizeGrid ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
|
||||
PANEL_FP_LIB_TABLE_BASE::~PANEL_FP_LIB_TABLE_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
|
||||
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
|
||||
m_browse_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this );
|
||||
m_delete_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
|
||||
m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
|
||||
m_move_down_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
|
||||
m_path_subs_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FP_LIB_TABLE_BASE::onSizeGrid ), NULL, this );
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this );
|
||||
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( PANEL_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
|
||||
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
|
||||
m_browse_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this );
|
||||
m_delete_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::deleteRowHandler ), 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_path_subs_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_LIB_TABLE_BASE::onSizeGrid ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -26,34 +26,28 @@
|
|||
<property name="ui_table">UI</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<object class="Panel" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">0</property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">decl_pure_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_FP_LIB_TABLE_BASE</property>
|
||||
<property name="name">PANEL_FP_LIB_TABLE_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">717,600</property>
|
||||
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Footprint Libraries</property>
|
||||
<property name="size">500,300</property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnActivate"></event>
|
||||
<event name="OnActivateApp"></event>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnAuiFindManager"></event>
|
||||
<event name="OnAuiPaneButton"></event>
|
||||
<event name="OnAuiPaneClose"></event>
|
||||
|
@ -61,12 +55,8 @@
|
|||
<event name="OnAuiPaneRestore"></event>
|
||||
<event name="OnAuiRender"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnClose"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
|
@ -1660,43 +1650,6 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_bottom_sizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="0">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">1</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">1</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnApplyButtonClick"></event>
|
||||
<event name="OnCancelButtonClick"></event>
|
||||
<event name="OnContextHelpButtonClick"></event>
|
||||
<event name="OnHelpButtonClick"></event>
|
||||
<event name="OnNoButtonClick"></event>
|
||||
<event name="OnOKButtonClick">onOKButtonClick</event>
|
||||
<event name="OnSaveButtonClick"></event>
|
||||
<event name="OnYesButtonClick"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
|
@ -28,15 +27,14 @@
|
|||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_FP_LIB_TABLE_BASE
|
||||
/// Class PANEL_FP_LIB_TABLE_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
|
||||
class PANEL_FP_LIB_TABLE_BASE : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -56,25 +54,21 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
|
|||
wxBitmapButton* m_move_up_button;
|
||||
wxBitmapButton* 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 browseLibrariesHandler( wxCommandEvent& event ) = 0;
|
||||
virtual void deleteRowHandler( wxCommandEvent& event ) = 0;
|
||||
virtual void moveUpHandler( wxCommandEvent& event ) = 0;
|
||||
virtual void moveDownHandler( wxCommandEvent& event ) = 0;
|
||||
virtual void onSizeGrid( wxSizeEvent& event ) = 0;
|
||||
virtual void onOKButtonClick( wxCommandEvent& event ) = 0;
|
||||
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); }
|
||||
virtual void appendRowHandler( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void browseLibrariesHandler( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void deleteRowHandler( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void moveUpHandler( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void moveDownHandler( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onSizeGrid( wxSizeEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Libraries"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 717,600 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
|
||||
~DIALOG_FP_LIB_TABLE_BASE();
|
||||
PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
|
||||
~PANEL_FP_LIB_TABLE_BASE();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -422,12 +422,12 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
// Path configuration edit dialog.
|
||||
AddMenuItem( prefs_menu,
|
||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
||||
_( "Configure Pa&ths..." ),
|
||||
_( "&Configure Paths..." ),
|
||||
_( "Edit path configuration environment variables" ),
|
||||
KiBitmap( path_xpm ) );
|
||||
|
||||
AddMenuItem( prefs_menu, ID_PCB_LIB_TABLE_EDIT,
|
||||
_( "Manage Footprint Li&braries..." ), _( "Configure footprint library table" ),
|
||||
_( "Manage &Footprint Libraries..." ), _( "Configure footprint library table" ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
|
||||
// Settings
|
||||
|
|
|
@ -258,12 +258,12 @@ void prepareLibraryMenu( wxMenu* aParentMenu )
|
|||
{
|
||||
AddMenuItem( aParentMenu,
|
||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
||||
_( "Configure Pa&ths..." ),
|
||||
_( "&Configure Paths..." ),
|
||||
_( "Edit path configuration environment variables" ),
|
||||
KiBitmap( path_xpm ) );
|
||||
|
||||
AddMenuItem( aParentMenu, ID_PCB_LIB_TABLE_EDIT,
|
||||
_( "Manage Footprint Li&braries..." ),
|
||||
_( "Manage &Footprint Libraries..." ),
|
||||
_( "Edit the global and project footprint library lists" ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
|
||||
|
|
|
@ -1662,6 +1662,11 @@ public:
|
|||
*/
|
||||
void InstallPreferences( PAGED_DIALOG* aParent ) override;
|
||||
|
||||
/**
|
||||
* Allows Pcbnew to install the footprint library tables into the edit libraries dialog.
|
||||
*/
|
||||
void InstallLibraryTablesPanel( DIALOG_EDIT_LIBRARY_TABLES* aDialog ) override;
|
||||
|
||||
/**
|
||||
* Called after the preferences dialog is run.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue