2018-07-19 19:15:40 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-02-22 01:51:51 +00:00
|
|
|
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-07-19 19:15:40 +00:00
|
|
|
*
|
|
|
|
* 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
|
2021-02-22 01:51:51 +00:00
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2018-07-19 19:15:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <wx/statline.h>
|
2020-10-18 11:31:07 +00:00
|
|
|
#include <wx/button.h>
|
2018-07-19 19:15:40 +00:00
|
|
|
|
2020-10-25 13:36:19 +00:00
|
|
|
#include <dialogs/dialog_edit_library_tables.h>
|
2018-07-19 19:15:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
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 ),
|
2019-01-03 16:49:25 +00:00
|
|
|
m_ProjectTableChanged( false ),
|
|
|
|
m_contentPanel( nullptr )
|
2018-07-19 19:15:40 +00:00
|
|
|
{
|
|
|
|
// 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 );
|
|
|
|
|
2024-06-12 15:58:20 +00:00
|
|
|
m_infoBar = new WX_INFOBAR( this );
|
|
|
|
mainSizer->Add( m_infoBar, 0, wxEXPAND, 0 );
|
|
|
|
|
2018-08-15 13:29:53 +00:00
|
|
|
mainSizer->Add( m_contentPanel, 1, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 5 );
|
2024-02-04 20:53:15 +00:00
|
|
|
m_contentPanel->SetMinSize( FromDIP( wxSize( 1000, 600 ) ) );
|
2018-07-19 19:15:40 +00:00
|
|
|
|
|
|
|
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 );
|
|
|
|
|
2021-11-16 19:39:58 +00:00
|
|
|
SetupStandardButtons();
|
2018-07-19 19:15:40 +00:00
|
|
|
|
2020-11-16 11:16:44 +00:00
|
|
|
finishDialogSettings();
|
2018-07-19 19:15:40 +00:00
|
|
|
|
|
|
|
// 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()
|
|
|
|
{
|
|
|
|
return m_contentPanel->TransferDataToWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool DIALOG_EDIT_LIBRARY_TABLES::TransferDataFromWindow()
|
|
|
|
{
|
2018-07-26 17:42:43 +00:00
|
|
|
/* Transfer tables edited in dialog to the global and project tables:
|
|
|
|
* A good way is to use m_contentPanel->TransferDataFromWindow to do that.
|
2021-04-05 13:24:57 +00:00
|
|
|
* But be careful:
|
2018-07-26 17:42:43 +00:00
|
|
|
* Since wxWidgets 3.1, it is called by wxDialog::TransferDataFromWindow()
|
|
|
|
* Before wxWidgets 3.1, it is *not* called by wxDialog::TransferDataFromWindow()
|
|
|
|
* m_contentPanel->TransferDataFromWindow do not works with two calls.
|
|
|
|
* Therefore *do not* call wxDialog::TransferDataFromWindow(),
|
|
|
|
* because m_contentPanel->TransferDataFromWindow() is called here.
|
|
|
|
*/
|
2018-07-19 19:15:40 +00:00
|
|
|
return m_contentPanel->TransferDataFromWindow();
|
|
|
|
}
|
|
|
|
|