Browse Source
Add initial support for database library settings UI
Add initial support for database library settings UI
For now, just for diagnostic purposes (settings changes are not preserved)newinvert
17 changed files with 1993 additions and 12 deletions
-
1common/CMakeLists.txt
-
21common/lib_table_grid_tricks.cpp
-
53common/widgets/grid_button.cpp
-
2eeschema/CMakeLists.txt
-
129eeschema/dialogs/dialog_database_lib_settings.cpp
-
50eeschema/dialogs/dialog_database_lib_settings.h
-
201eeschema/dialogs/dialog_database_lib_settings_base.cpp
-
1332eeschema/dialogs/dialog_database_lib_settings_base.fbp
-
84eeschema/dialogs/dialog_database_lib_settings_base.h
-
40eeschema/sch_plugins/database/sch_database_plugin.cpp
-
6eeschema/sch_plugins/database/sch_database_plugin.h
-
15eeschema/symbol_lib_table.cpp
-
10eeschema/symbol_lib_table.h
-
7include/lib_table_base.h
-
5include/lib_table_grid.h
-
3include/lib_table_grid_tricks.h
-
46include/widgets/grid_button.h
@ -0,0 +1,53 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2023 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 <widgets/grid_button.h>
|
|||
#include <wx/dc.h>
|
|||
#include <wx/renderer.h>
|
|||
|
|||
|
|||
GRID_BUTTON_RENDERER::GRID_BUTTON_RENDERER( const wxString& aLabel ) : |
|||
wxGridCellRenderer(), |
|||
m_button( nullptr, wxID_ANY, aLabel ) |
|||
{ |
|||
} |
|||
|
|||
|
|||
GRID_BUTTON_RENDERER* GRID_BUTTON_RENDERER::Clone() const |
|||
{ |
|||
GRID_BUTTON_RENDERER* clone = new GRID_BUTTON_RENDERER( m_button.GetLabel() ); |
|||
return clone; |
|||
} |
|||
|
|||
|
|||
void GRID_BUTTON_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDc, |
|||
const wxRect& aRect, int aRow, int aCol, bool aIsSelected ) |
|||
{ |
|||
// erase background
|
|||
wxGridCellRenderer::Draw( aGrid, aAttr, aDc, aRect, aRow, aCol, aIsSelected ); |
|||
|
|||
wxRendererNative::Get().DrawPushButton( &aGrid, aDc, aRect ); |
|||
} |
|||
|
|||
|
|||
wxSize GRID_BUTTON_RENDERER::GetBestSize( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDc, |
|||
int aRow, int aCol) |
|||
{ |
|||
return m_button.GetSize(); |
|||
} |
@ -0,0 +1,129 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2023 Jon Evans <jon@craftyjon.com> |
|||
* Copyright (C) 2023 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 <dialogs/dialog_database_lib_settings.h>
|
|||
#include <sch_plugins/database/sch_database_plugin.h>
|
|||
#include <database/database_lib_settings.h>
|
|||
|
|||
|
|||
DIALOG_DATABASE_LIB_SETTINGS::DIALOG_DATABASE_LIB_SETTINGS( wxWindow* aParent, |
|||
SCH_DATABASE_PLUGIN* aPlugin ) : |
|||
DIALOG_DATABASE_LIB_SETTINGS_BASE( aParent ), |
|||
m_plugin( aPlugin ) |
|||
{ |
|||
Layout(); |
|||
SetupStandardButtons(); |
|||
finishDialogSettings(); |
|||
} |
|||
|
|||
|
|||
bool DIALOG_DATABASE_LIB_SETTINGS::TransferDataToWindow() |
|||
{ |
|||
wxCommandEvent dummy; |
|||
DATABASE_LIB_SETTINGS* settings = m_plugin->Settings(); |
|||
|
|||
m_txtConnectionString->SetValue( settings->m_Source.connection_string ); |
|||
|
|||
if( !settings->m_Source.connection_string.empty() ) |
|||
{ |
|||
m_rbConnectionString->SetValue( true ); |
|||
OnConnectionStringSelected( dummy ); |
|||
} |
|||
else |
|||
{ |
|||
m_rbDSN->SetValue( true ); |
|||
OnDSNSelected( dummy ); |
|||
m_txtDSN->SetValue( settings->m_Source.dsn ); |
|||
m_txtUser->SetValue( settings->m_Source.username ); |
|||
m_txtPassword->SetValue( settings->m_Source.password ); |
|||
} |
|||
|
|||
m_spinCacheSize->SetValue( settings->m_Cache.max_size ); |
|||
m_spinCacheTimeout->SetValue( settings->m_Cache.max_age ); |
|||
|
|||
if( hasPotentiallyValidConfig() ) |
|||
OnBtnTest( dummy ); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
|
|||
bool DIALOG_DATABASE_LIB_SETTINGS::TransferDataFromWindow() |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
|
|||
void DIALOG_DATABASE_LIB_SETTINGS::OnDSNSelected( wxCommandEvent& aEvent ) |
|||
{ |
|||
m_txtConnectionString->Disable(); |
|||
m_txtDSN->Enable(); |
|||
m_txtUser->Enable(); |
|||
m_txtPassword->Enable(); |
|||
} |
|||
|
|||
|
|||
void DIALOG_DATABASE_LIB_SETTINGS::OnConnectionStringSelected( wxCommandEvent& aEvent ) |
|||
{ |
|||
m_txtConnectionString->Enable(); |
|||
m_txtDSN->Disable(); |
|||
m_txtUser->Disable(); |
|||
m_txtPassword->Disable(); |
|||
} |
|||
|
|||
|
|||
void DIALOG_DATABASE_LIB_SETTINGS::OnBtnTest( wxCommandEvent& aEvent ) |
|||
{ |
|||
wxString errorMsg; |
|||
|
|||
if( m_plugin->TestConnection( &errorMsg ) ) |
|||
{ |
|||
m_stConnectionTestStatus->SetLabel( _( "Connected to database successfully" ) ); |
|||
|
|||
wxCommandEvent dummy; |
|||
OnBtnReloadConfig( dummy ); |
|||
} |
|||
else |
|||
{ |
|||
m_stConnectionTestStatus->SetLabel( wxString::Format( _( "Database connection failed: %s" ), |
|||
errorMsg ) ); |
|||
} |
|||
} |
|||
|
|||
|
|||
void DIALOG_DATABASE_LIB_SETTINGS::OnBtnReloadConfig( wxCommandEvent& aEvent ) |
|||
{ |
|||
if( !m_plugin->TestConnection() ) |
|||
{ |
|||
m_stLibrariesStatus->SetLabel( _( "No connection to database" ) ); |
|||
return; |
|||
} |
|||
|
|||
std::vector<wxString> libs; |
|||
m_plugin->GetSubLibraryNames( libs ); |
|||
|
|||
m_stLibrariesStatus->SetLabel( wxString::Format( _( "Loaded %zu libraries" ), libs.size() ) ); |
|||
} |
|||
|
|||
|
|||
bool DIALOG_DATABASE_LIB_SETTINGS::hasPotentiallyValidConfig() |
|||
{ |
|||
return ( m_rbDSN->GetValue() && !m_txtDSN->IsEmpty() ) || !m_txtConnectionString->IsEmpty(); |
|||
} |
@ -0,0 +1,50 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2023 Jon Evans <jon@craftyjon.com> |
|||
* Copyright (C) 2023 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 KICAD_DIALOG_DATABASE_LIB_SETTINGS_H |
|||
#define KICAD_DIALOG_DATABASE_LIB_SETTINGS_H |
|||
|
|||
#include "dialog_database_lib_settings_base.h" |
|||
|
|||
class SCH_DATABASE_PLUGIN; |
|||
|
|||
class DIALOG_DATABASE_LIB_SETTINGS : public DIALOG_DATABASE_LIB_SETTINGS_BASE |
|||
{ |
|||
public: |
|||
DIALOG_DATABASE_LIB_SETTINGS( wxWindow* aParent, SCH_DATABASE_PLUGIN* aPlugin ); |
|||
|
|||
virtual ~DIALOG_DATABASE_LIB_SETTINGS() {} |
|||
|
|||
bool TransferDataFromWindow() override; |
|||
bool TransferDataToWindow() override; |
|||
|
|||
protected: |
|||
void OnDSNSelected( wxCommandEvent& aEvent ) override; |
|||
void OnConnectionStringSelected( wxCommandEvent& aEvent ) override; |
|||
void OnBtnTest( wxCommandEvent& aEvent ) override; |
|||
void OnBtnReloadConfig( wxCommandEvent& aEvent ) override; |
|||
|
|||
private: |
|||
bool hasPotentiallyValidConfig(); |
|||
|
|||
SCH_DATABASE_PLUGIN* m_plugin; |
|||
}; |
|||
|
|||
#endif //KICAD_DIALOG_DATABASE_LIB_SETTINGS_H |
@ -0,0 +1,201 @@ |
|||
///////////////////////////////////////////////////////////////////////////
|
|||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
|||
// http://www.wxformbuilder.org/
|
|||
//
|
|||
// PLEASE DO *NOT* EDIT THIS FILE!
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
#include "widgets/wx_infobar.h"
|
|||
|
|||
#include "dialog_database_lib_settings_base.h"
|
|||
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
DIALOG_DATABASE_LIB_SETTINGS_BASE::DIALOG_DATABASE_LIB_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) |
|||
{ |
|||
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); |
|||
|
|||
wxBoxSizer* bmainSizer; |
|||
bmainSizer = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
m_infoBar = new WX_INFOBAR( this ); |
|||
m_infoBar->SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE ); |
|||
m_infoBar->SetEffectDuration( 500 ); |
|||
m_infoBar->Hide(); |
|||
|
|||
bmainSizer->Add( m_infoBar, 0, wxEXPAND|wxBOTTOM, 5 ); |
|||
|
|||
wxBoxSizer* bupperSizer; |
|||
bupperSizer = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
wxStaticBoxSizer* sbSizer4; |
|||
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Connection") ), wxVERTICAL ); |
|||
|
|||
wxGridBagSizer* gbSizer2; |
|||
gbSizer2 = new wxGridBagSizer( 0, 0 ); |
|||
gbSizer2->SetFlexibleDirection( wxBOTH ); |
|||
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); |
|||
|
|||
m_rbDSN = new wxRadioButton( sbSizer4->GetStaticBox(), wxID_ANY, _("DSN:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
gbSizer2->Add( m_rbDSN, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
|||
|
|||
m_txtDSN = new wxTextCtrl( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
gbSizer2->Add( m_txtDSN, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_staticText2 = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, _("Username:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText2->Wrap( -1 ); |
|||
gbSizer2->Add( m_staticText2, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
|||
|
|||
m_txtUser = new wxTextCtrl( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_txtUser->SetMinSize( wxSize( 150,-1 ) ); |
|||
|
|||
gbSizer2->Add( m_txtUser, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_staticText3 = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, _("Password:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText3->Wrap( -1 ); |
|||
gbSizer2->Add( m_staticText3, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
|||
|
|||
m_txtPassword = new wxTextCtrl( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_txtPassword->SetMinSize( wxSize( 150,-1 ) ); |
|||
|
|||
gbSizer2->Add( m_txtPassword, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
|
|||
gbSizer2->AddGrowableCol( 2 ); |
|||
|
|||
sbSizer4->Add( gbSizer2, 1, wxALL|wxEXPAND, 5 ); |
|||
|
|||
wxBoxSizer* bSizer4; |
|||
bSizer4 = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
m_rbConnectionString = new wxRadioButton( sbSizer4->GetStaticBox(), wxID_ANY, _("Connection String:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
bSizer4->Add( m_rbConnectionString, 0, wxALL, 5 ); |
|||
|
|||
m_txtConnectionString = new wxTextCtrl( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_txtConnectionString->Enable( false ); |
|||
|
|||
bSizer4->Add( m_txtConnectionString, 0, wxALL|wxEXPAND, 5 ); |
|||
|
|||
|
|||
sbSizer4->Add( bSizer4, 0, wxALL|wxEXPAND, 5 ); |
|||
|
|||
wxBoxSizer* bSizer5; |
|||
bSizer5 = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
m_btnTest = new wxButton( sbSizer4->GetStaticBox(), wxID_ANY, _("Test"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
bSizer5->Add( m_btnTest, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
|||
|
|||
m_stConnectionTestStatus = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_stConnectionTestStatus->Wrap( -1 ); |
|||
bSizer5->Add( m_stConnectionTestStatus, 1, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); |
|||
|
|||
|
|||
sbSizer4->Add( bSizer5, 0, wxALL|wxEXPAND, 5 ); |
|||
|
|||
|
|||
bupperSizer->Add( sbSizer4, 0, wxALL|wxEXPAND, 5 ); |
|||
|
|||
wxStaticBoxSizer* sbSizer2; |
|||
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Libraries") ), wxHORIZONTAL ); |
|||
|
|||
wxBoxSizer* bSizer6; |
|||
bSizer6 = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
m_btnReloadConfig = new wxButton( sbSizer2->GetStaticBox(), wxID_ANY, _("Reload Configuration"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_btnReloadConfig->SetToolTip( _("Reload the database library configuration file") ); |
|||
|
|||
bSizer6->Add( m_btnReloadConfig, 0, wxALL, 5 ); |
|||
|
|||
m_stLibrariesStatus = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_stLibrariesStatus->Wrap( -1 ); |
|||
bSizer6->Add( m_stLibrariesStatus, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
|||
|
|||
|
|||
sbSizer2->Add( bSizer6, 1, wxALL|wxEXPAND, 5 ); |
|||
|
|||
|
|||
bupperSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 ); |
|||
|
|||
wxStaticBoxSizer* sbSizer3; |
|||
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Caching") ), wxVERTICAL ); |
|||
|
|||
wxFlexGridSizer* fgSizer1; |
|||
fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 ); |
|||
fgSizer1->SetFlexibleDirection( wxBOTH ); |
|||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); |
|||
|
|||
m_staticText5 = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Cache size:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText5->Wrap( -1 ); |
|||
m_staticText5->SetToolTip( _("How many database queries to cache") ); |
|||
|
|||
fgSizer1->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
|||
|
|||
m_spinCacheSize = new wxSpinCtrl( sbSizer3->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 1024, 256 ); |
|||
m_spinCacheSize->SetToolTip( _("How many database queries to cache") ); |
|||
|
|||
fgSizer1->Add( m_spinCacheSize, 0, wxALL, 5 ); |
|||
|
|||
m_staticText6 = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Cache timeout:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticText6->Wrap( -1 ); |
|||
m_staticText6->SetToolTip( _("Time in seconds that database queries will be cached for") ); |
|||
|
|||
fgSizer1->Add( m_staticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
|||
|
|||
m_spinCacheTimeout = new wxSpinCtrl( sbSizer3->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 600, 10 ); |
|||
m_spinCacheTimeout->SetToolTip( _("Time in seconds that database queries will be cached for") ); |
|||
|
|||
fgSizer1->Add( m_spinCacheTimeout, 0, wxALL, 5 ); |
|||
|
|||
|
|||
sbSizer3->Add( fgSizer1, 1, wxEXPAND, 5 ); |
|||
|
|||
|
|||
bupperSizer->Add( sbSizer3, 1, wxALL|wxEXPAND, 5 ); |
|||
|
|||
|
|||
bmainSizer->Add( bupperSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 6 ); |
|||
|
|||
wxBoxSizer* m_buttonsSizer; |
|||
m_buttonsSizer = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
|
|||
m_buttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 ); |
|||
|
|||
m_sdbSizer1 = new wxStdDialogButtonSizer(); |
|||
m_sdbSizer1OK = new wxButton( this, wxID_OK ); |
|||
m_sdbSizer1->AddButton( m_sdbSizer1OK ); |
|||
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); |
|||
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); |
|||
m_sdbSizer1->Realize(); |
|||
|
|||
m_buttonsSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); |
|||
|
|||
|
|||
bmainSizer->Add( m_buttonsSizer, 0, wxEXPAND|wxLEFT, 5 ); |
|||
|
|||
|
|||
this->SetSizer( bmainSizer ); |
|||
this->Layout(); |
|||
|
|||
// Connect Events
|
|||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnClose ) ); |
|||
m_rbDSN->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnDSNSelected ), NULL, this ); |
|||
m_rbConnectionString->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnConnectionStringSelected ), NULL, this ); |
|||
m_btnTest->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnBtnTest ), NULL, this ); |
|||
m_btnReloadConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnBtnReloadConfig ), NULL, this ); |
|||
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnCloseClick ), NULL, this ); |
|||
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnApplyClick ), NULL, this ); |
|||
} |
|||
|
|||
DIALOG_DATABASE_LIB_SETTINGS_BASE::~DIALOG_DATABASE_LIB_SETTINGS_BASE() |
|||
{ |
|||
// Disconnect Events
|
|||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnClose ) ); |
|||
m_rbDSN->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnDSNSelected ), NULL, this ); |
|||
m_rbConnectionString->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnConnectionStringSelected ), NULL, this ); |
|||
m_btnTest->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnBtnTest ), NULL, this ); |
|||
m_btnReloadConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnBtnReloadConfig ), NULL, this ); |
|||
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnCloseClick ), NULL, this ); |
|||
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DATABASE_LIB_SETTINGS_BASE::OnApplyClick ), NULL, this ); |
|||
|
|||
} |
1332
eeschema/dialogs/dialog_database_lib_settings_base.fbp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,84 @@ |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) |
|||
// http://www.wxformbuilder.org/ |
|||
// |
|||
// PLEASE DO *NOT* EDIT THIS FILE! |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
#pragma once |
|||
|
|||
#include <wx/artprov.h> |
|||
#include <wx/xrc/xmlres.h> |
|||
#include <wx/intl.h> |
|||
class WX_INFOBAR; |
|||
|
|||
#include "dialog_shim.h" |
|||
#include <wx/infobar.h> |
|||
#include <wx/gdicmn.h> |
|||
#include <wx/font.h> |
|||
#include <wx/colour.h> |
|||
#include <wx/settings.h> |
|||
#include <wx/string.h> |
|||
#include <wx/radiobut.h> |
|||
#include <wx/textctrl.h> |
|||
#include <wx/stattext.h> |
|||
#include <wx/gbsizer.h> |
|||
#include <wx/sizer.h> |
|||
#include <wx/button.h> |
|||
#include <wx/bitmap.h> |
|||
#include <wx/image.h> |
|||
#include <wx/icon.h> |
|||
#include <wx/statbox.h> |
|||
#include <wx/spinctrl.h> |
|||
#include <wx/dialog.h> |
|||
|
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
|
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
/// Class DIALOG_DATABASE_LIB_SETTINGS_BASE |
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
class DIALOG_DATABASE_LIB_SETTINGS_BASE : public DIALOG_SHIM |
|||
{ |
|||
private: |
|||
|
|||
protected: |
|||
WX_INFOBAR* m_infoBar; |
|||
wxRadioButton* m_rbDSN; |
|||
wxTextCtrl* m_txtDSN; |
|||
wxStaticText* m_staticText2; |
|||
wxTextCtrl* m_txtUser; |
|||
wxStaticText* m_staticText3; |
|||
wxTextCtrl* m_txtPassword; |
|||
wxRadioButton* m_rbConnectionString; |
|||
wxTextCtrl* m_txtConnectionString; |
|||
wxButton* m_btnTest; |
|||
wxButton* m_btnReloadConfig; |
|||
wxStaticText* m_staticText5; |
|||
wxSpinCtrl* m_spinCacheSize; |
|||
wxStaticText* m_staticText6; |
|||
wxSpinCtrl* m_spinCacheTimeout; |
|||
wxStdDialogButtonSizer* m_sdbSizer1; |
|||
wxButton* m_sdbSizer1OK; |
|||
wxButton* m_sdbSizer1Cancel; |
|||
|
|||
// Virtual event handlers, override them in your derived class |
|||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } |
|||
virtual void OnDSNSelected( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void OnConnectionStringSelected( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void OnBtnTest( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void OnBtnReloadConfig( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void OnCloseClick( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); } |
|||
|
|||
|
|||
public: |
|||
wxStaticText* m_stConnectionTestStatus; |
|||
wxStaticText* m_stLibrariesStatus; |
|||
|
|||
DIALOG_DATABASE_LIB_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Database Library Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,600 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); |
|||
|
|||
~DIALOG_DATABASE_LIB_SETTINGS_BASE(); |
|||
|
|||
}; |
|||
|
@ -0,0 +1,46 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2023 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 KICAD_GRID_BUTTON_H |
|||
#define KICAD_GRID_BUTTON_H |
|||
|
|||
#include <wx/button.h> |
|||
#include <wx/grid.h> |
|||
|
|||
|
|||
class GRID_BUTTON_RENDERER : public wxGridCellRenderer |
|||
{ |
|||
public: |
|||
GRID_BUTTON_RENDERER( const wxString& aLabel ); |
|||
|
|||
virtual ~GRID_BUTTON_RENDERER() = default; |
|||
|
|||
GRID_BUTTON_RENDERER* Clone() const override; |
|||
|
|||
void Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDc, const wxRect& aRect, |
|||
int aRow, int aCol, bool aIsSelected ) override; |
|||
|
|||
wxSize GetBestSize( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDc, |
|||
int aRow, int aCol) override; |
|||
|
|||
private: |
|||
wxButton m_button; |
|||
}; |
|||
|
|||
#endif //KICAD_GRID_BUTTON_H |
Write
Preview
Loading…
Cancel
Save
Reference in new issue