Lay groundwork for loading the initial global footprint library table.

Factor out common dialog code from global symbol library table dialog for
loading initial library table.

Update global symbol library table code to user factored out common dialog
code.
This commit is contained in:
Wayne Stambaugh 2019-01-19 20:45:17 -05:00
parent 179dfa0dda
commit 2dcba4723d
9 changed files with 229 additions and 107 deletions

View File

@ -186,6 +186,8 @@ set( COMMON_DLG_SRCS
dialogs/dialog_edit_library_tables.cpp dialogs/dialog_edit_library_tables.cpp
dialogs/dialog_exit_base.cpp dialogs/dialog_exit_base.cpp
dialogs/dialog_file_dir_picker.cpp dialogs/dialog_file_dir_picker.cpp
dialogs/dialog_global_lib_table_config.cpp
dialogs/dialog_global_lib_table_config_base.cpp
dialogs/dialog_hotkey_list.cpp dialogs/dialog_hotkey_list.cpp
dialogs/dialog_image_editor.cpp dialogs/dialog_image_editor.cpp
dialogs/dialog_image_editor_base.cpp dialogs/dialog_image_editor_base.cpp

View File

@ -0,0 +1,117 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2019 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 "dialog_global_lib_table_config.h"
#include <kiface_i.h>
DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG( wxWindow* aParent,
const wxString& aTableName ) :
DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE( aParent )
{
m_tableName = aTableName;
wxString tmp;
tmp.Printf( _( "Configure Global %s Library Table" ), aTableName.Capitalize() );
SetTitle( tmp );
tmp.Printf( _( "KiCad has been run for the first time using the new %s library table for\n"
"accessing symbol libraries. In order for KiCad to access %s libraries,\n"
"you must configure your global %s library table. Please select from one\n"
"of the options below. If you are not sure which option to select, please\n"
"use the default selection." ), aTableName, aTableName, aTableName );
m_staticText1->SetLabel( tmp );
tmp.Printf( _( "Copy default global %s library table (recommended)"), aTableName );
m_defaultRb->SetLabel( tmp );
tmp.Printf( _( "Select this option if you not sure about configuring the global %s library "
"table" ), aTableName );
m_defaultRb->SetToolTip( tmp );
tmp.Printf( _( "Copy custom global %s library table" ), aTableName );
m_customRb->SetLabel( tmp );
tmp.Printf( _( "Select this option to copy a %s library table file other than the default" ),
aTableName );
m_customRb->SetToolTip( tmp );
tmp.Printf( _( "Create an empty global %s library table" ), aTableName );
m_emptyRb->SetLabel( tmp );
tmp.Printf( _( "Select this option to define %s libraries in project specific library tables" ),
aTableName );
m_emptyRb->SetToolTip( tmp );
tmp.Printf( _( "Select global %symbol library table file:" ), aTableName );
m_staticText2->SetLabel( tmp );
m_filePicker1->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_LIB_TABLE_CONFIG::onUpdateFilePicker ), NULL, this );
wxButton* okButton = (wxButton *) FindWindowById( wxID_OK );
if( okButton )
okButton->SetDefault();
FinishDialogSettings();
}
DIALOG_GLOBAL_LIB_TABLE_CONFIG::~DIALOG_GLOBAL_LIB_TABLE_CONFIG()
{
m_filePicker1->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_LIB_TABLE_CONFIG::onUpdateFilePicker ), NULL, this );
}
void DIALOG_GLOBAL_LIB_TABLE_CONFIG::onUpdateFilePicker( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_customRb->GetValue() );
}
void DIALOG_GLOBAL_LIB_TABLE_CONFIG::onUpdateDefaultSelection( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_defaultFileFound );
}
bool DIALOG_GLOBAL_LIB_TABLE_CONFIG::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
wxFileName fn = GetGlobalTableFileName();
// Attempt to find the default global file table from the KiCad template folder.
wxString fileName = Kiface().KifaceSearch().FindValidPath( fn.GetName() );
m_defaultFileFound = wxFileName::FileExists( fileName );
if( m_defaultFileFound )
{
m_filePicker1->SetFileName( wxFileName( fileName ) );
m_filePicker1->Enable( false );
}
else
{
m_customRb->SetValue( true );
}
return true;
}

View File

@ -0,0 +1,47 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2019 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_GLOBAL_LIB_TABLE_CONFIG_H_
#define _DIALOG_GLOBAL_LIB_TABLE_CONFIG_H_
#include "dialog_global_lib_table_config_base.h"
#include <wx/filename.h>
class DIALOG_GLOBAL_LIB_TABLE_CONFIG : public DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE
{
public:
DIALOG_GLOBAL_LIB_TABLE_CONFIG( wxWindow* aParent, const wxString& aTableName );
virtual ~DIALOG_GLOBAL_LIB_TABLE_CONFIG();
virtual wxFileName GetGlobalTableFileName() = 0;
virtual bool TransferDataToWindow() override;
protected:
virtual void onUpdateFilePicker( wxUpdateUIEvent& aEvent ) override;
virtual void onUpdateDefaultSelection( wxUpdateUIEvent& aEvent ) override;
wxString m_tableName;
bool m_defaultFileFound;
};
#endif // _DIALOG_GLOBAL_LIB_TABLE_CONFIG_H_

View File

@ -1,15 +1,15 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 23 2018) // C++ code generated with wxFormBuilder (version Jan 5 2019)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#include "dialog_global_sym_lib_table_config_base.h" #include "dialog_global_lib_table_config_base.h"
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE::DIALOG_GLOBAL_LIB_TABLE_CONFIG_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 ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
@ -18,33 +18,33 @@ DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE
bSizer2 = new wxBoxSizer( wxVERTICAL ); bSizer2 = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("KiCad has been run for the first time using the new symbol library table for accessing symbol libraries. In order for KiCad to access symbol libraries, you must configure your global symbol library table. Please select from one of the options below. If you are not sure which option to select, please use the default selection."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1 = new wxStaticText( this, wxID_ANY, _("Temp"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( 500 ); m_staticText1->Wrap( 500 );
bSizer2->Add( m_staticText1, 0, wxALL, 5 ); bSizer2->Add( m_staticText1, 0, wxALL, 5 );
bSizer2->Add( 0, 0, 0, wxALL|wxEXPAND, 5 ); bSizer2->Add( 0, 0, 0, wxALL|wxEXPAND, 5 );
m_defaultRb = new wxRadioButton( this, wxID_ANY, _("Copy default global symbol library table (recommended)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); m_defaultRb = new wxRadioButton( this, wxID_ANY, _("temp1"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_defaultRb->SetValue( true ); m_defaultRb->SetValue( true );
m_defaultRb->SetToolTip( _("Select this option if you not sure about configuring the global symbol library table") ); m_defaultRb->SetToolTip( _("Temp") );
bSizer2->Add( m_defaultRb, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); bSizer2->Add( m_defaultRb, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_customRb = new wxRadioButton( this, wxID_ANY, _("Copy custom global symbol library table"), wxDefaultPosition, wxDefaultSize, 0 ); m_customRb = new wxRadioButton( this, wxID_ANY, _("temp2"), wxDefaultPosition, wxDefaultSize, 0 );
m_customRb->SetToolTip( _("Select this option to copy a symbol library table file other than the default") ); m_customRb->SetToolTip( _("Temp") );
bSizer2->Add( m_customRb, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); bSizer2->Add( m_customRb, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_emptyRb = new wxRadioButton( this, wxID_ANY, _("Create an empty global symbol library table"), wxDefaultPosition, wxDefaultSize, 0 ); m_emptyRb = new wxRadioButton( this, wxID_ANY, _("temp3"), wxDefaultPosition, wxDefaultSize, 0 );
m_emptyRb->SetToolTip( _("Select this option to define symbol libraries in project specific library tables") ); m_emptyRb->SetToolTip( _("Temp") );
bSizer2->Add( m_emptyRb, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); bSizer2->Add( m_emptyRb, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
bSizer2->Add( 0, 0, 0, wxALL|wxEXPAND, 5 ); bSizer2->Add( 0, 0, 0, wxALL|wxEXPAND, 5 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Select global symbol library table file:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText2 = new wxStaticText( this, wxID_ANY, _("temp"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 ); m_staticText2->Wrap( -1 );
bSizer2->Add( m_staticText2, 0, wxALL, 5 ); bSizer2->Add( m_staticText2, 0, wxALL, 5 );
@ -74,14 +74,14 @@ DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
m_defaultRb->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE::onUpdateDefaultSelection ), NULL, this ); m_defaultRb->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE::onUpdateDefaultSelection ), NULL, this );
m_filePicker1->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE::onUpdateFilePicker ), NULL, this ); m_filePicker1->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE::onUpdateFilePicker ), NULL, this );
} }
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE::~DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE() DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE::~DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE()
{ {
// Disconnect Events // Disconnect Events
m_defaultRb->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE::onUpdateDefaultSelection ), NULL, this ); m_defaultRb->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE::onUpdateDefaultSelection ), NULL, this );
m_filePicker1->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE::onUpdateFilePicker ), NULL, this ); m_filePicker1->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE::onUpdateFilePicker ), NULL, this );
} }

View File

@ -11,12 +11,12 @@
<property name="embedded_files_path">res</property> <property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property> <property name="encoding">UTF-8</property>
<property name="event_generation">connect</property> <property name="event_generation">connect</property>
<property name="file">dialog_global_sym_lib_table_config_base</property> <property name="file">dialog_global_lib_table_config_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="indent_with_spaces"></property> <property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE</property> <property name="name">DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE</property>
<property name="namespace"></property> <property name="namespace"></property>
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="precompiled_header"></property>
@ -43,12 +43,12 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE</property> <property name="name">DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxCAPTION|wxRESIZE_BORDER</property> <property name="style">wxCAPTION|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Configure Global Symbol Library Table</property> <property name="title">Configure Global Library Table</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
@ -58,20 +58,20 @@
<property name="name">bSizer1</property> <property name="name">bSizer1</property>
<property name="orient">wxHORIZONTAL</property> <property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizer2</property> <property name="name">bSizer2</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -99,7 +99,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">KiCad has been run for the first time using the new symbol library table for accessing symbol libraries. In order for KiCad to access symbol libraries, you must configure your global symbol library table. Please select from one of the options below. If you are not sure which option to select, please use the default selection.</property> <property name="label">Temp</property>
<property name="markup">0</property> <property name="markup">0</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
@ -128,21 +128,21 @@
<property name="wrap">500</property> <property name="wrap">500</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="spacer" expanded="0">
<property name="height">0</property> <property name="height">0</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="width">0</property> <property name="width">0</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property> <property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="1"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -170,7 +170,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Copy default global symbol library table (recommended)</property> <property name="label">temp1</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
@ -191,7 +191,7 @@
<property name="style">wxRB_GROUP</property> <property name="style">wxRB_GROUP</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip">Select this option if you not sure about configuring the global symbol library table</property> <property name="tooltip">Temp</property>
<property name="validator_data_type"></property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
@ -203,11 +203,11 @@
<event name="OnUpdateUI">onUpdateDefaultSelection</event> <event name="OnUpdateUI">onUpdateDefaultSelection</event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property> <property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="1"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -235,7 +235,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Copy custom global symbol library table</property> <property name="label">temp2</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
@ -256,7 +256,7 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip">Select this option to copy a symbol library table file other than the default</property> <property name="tooltip">Temp</property>
<property name="validator_data_type"></property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
@ -267,11 +267,11 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property> <property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="1"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -299,7 +299,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Create an empty global symbol library table</property> <property name="label">temp3</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
@ -320,7 +320,7 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip">Select this option to define symbol libraries in project specific library tables</property> <property name="tooltip">Temp</property>
<property name="validator_data_type"></property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
@ -331,21 +331,21 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="spacer" expanded="0">
<property name="height">0</property> <property name="height">0</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="width">0</property> <property name="width">0</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -373,7 +373,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Select global symbol library table file:</property> <property name="label">temp</property>
<property name="markup">0</property> <property name="markup">0</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
@ -402,11 +402,11 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property> <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxFilePickerCtrl" expanded="1"> <object class="wxFilePickerCtrl" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -468,11 +468,11 @@
<event name="OnUpdateUI">onUpdateFilePicker</event> <event name="OnUpdateUI">onUpdateFilePicker</event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property> <property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticLine" expanded="1"> <object class="wxStaticLine" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -526,11 +526,11 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxStdDialogButtonSizer" expanded="1"> <object class="wxStdDialogButtonSizer" expanded="0">
<property name="Apply">0</property> <property name="Apply">0</property>
<property name="Cancel">0</property> <property name="Cancel">0</property>
<property name="ContextHelp">0</property> <property name="ContextHelp">0</property>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 23 2018) // C++ code generated with wxFormBuilder (version Jan 5 2019)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -28,9 +28,9 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE /// Class DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE : public DIALOG_SHIM class DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE : public DIALOG_SHIM
{ {
private: private:
@ -53,8 +53,8 @@ class DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE : public DIALOG_SHIM
public: public:
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure Global Symbol Library Table"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER ); DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure Global Library Table"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER );
~DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE(); ~DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE();
}; };

View File

@ -54,7 +54,6 @@ set( EESCHEMA_DLGS
dialogs/dialog_erc.cpp dialogs/dialog_erc.cpp
dialogs/dialog_erc_base.cpp dialogs/dialog_erc_base.cpp
dialogs/dialog_global_sym_lib_table_config.cpp dialogs/dialog_global_sym_lib_table_config.cpp
dialogs/dialog_global_sym_lib_table_config_base.cpp
dialogs/dialog_lib_edit_draw_item.cpp dialogs/dialog_lib_edit_draw_item.cpp
dialogs/dialog_lib_edit_draw_item_base.cpp dialogs/dialog_lib_edit_draw_item_base.cpp
dialogs/dialog_lib_edit_pin.cpp dialogs/dialog_lib_edit_pin.cpp

View File

@ -21,64 +21,26 @@
#include "dialog_global_sym_lib_table_config.h" #include "dialog_global_sym_lib_table_config.h"
#include <confirm.h> #include <confirm.h>
#include <grid_tricks.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <lib_table_grid.h>
#include <lib_table_lexer.h>
#include <macros.h> #include <macros.h>
#include <wx/filename.h>
#include "symbol_lib_table.h" #include "symbol_lib_table.h"
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG( wxWindow* aParent ) : DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG( wxWindow* aParent ) :
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE( aParent ) DIALOG_GLOBAL_LIB_TABLE_CONFIG( aParent, "symbol" )
{ {
wxFileName fn = SYMBOL_LIB_TABLE::GetGlobalTableFileName();
// Attempt to find the default global file table from the KiCad template folder.
wxString fileName = Kiface().KifaceSearch().FindValidPath( fn.GetName() );
m_defaultFileFound = wxFileName::FileExists( fileName );
m_filePicker_new = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, _( "Select a file" ),
wxFileSelectorDefaultWildcardStr, wxDefaultPosition, wxDefaultSize,
wxFLP_DEFAULT_STYLE | wxFLP_FILE_MUST_EXIST | wxFLP_OPEN );
m_filePicker_new->SetFileName( wxFileName( fileName ) );
m_filePicker_new->Enable( false );
m_filePicker_new->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::onUpdateFilePicker ), NULL, this );
bSizer2->Replace( m_filePicker1, m_filePicker_new, true );
bSizer2->Layout();
if( !m_defaultFileFound )
m_customRb->SetValue( true );
wxButton* okButton = (wxButton *) FindWindowById( wxID_OK );
if( okButton )
okButton->SetDefault();
FinishDialogSettings();
} }
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::~DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG() DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::~DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG()
{ {
m_filePicker_new->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::onUpdateFilePicker ), NULL, this );
} }
void DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::onUpdateFilePicker( wxUpdateUIEvent& aEvent ) wxFileName DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::GetGlobalTableFileName()
{ {
aEvent.Enable( m_customRb->GetValue() ); return SYMBOL_LIB_TABLE::GetGlobalTableFileName();
}
void DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::onUpdateDefaultSelection( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_defaultFileFound );
} }
@ -106,7 +68,7 @@ bool DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow()
return true; return true;
} }
wxString fileName = m_filePicker_new->GetPath(); wxString fileName = m_filePicker1->GetPath();
if( fileName.IsEmpty() ) if( fileName.IsEmpty() )
{ {

View File

@ -21,23 +21,18 @@
#ifndef _DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_H_ #ifndef _DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_H_
#define _DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_H_ #define _DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_H_
#include "dialog_global_sym_lib_table_config_base.h" #include "dialog_global_lib_table_config.h"
class DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG : public DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_BASE
class DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG : public DIALOG_GLOBAL_LIB_TABLE_CONFIG
{ {
private:
bool m_defaultFileFound;
wxFilePickerCtrl* m_filePicker_new;
public: public:
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG( wxWindow* aParent ); DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG( wxWindow* aParent );
virtual ~DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(); virtual ~DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG();
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
protected: virtual wxFileName GetGlobalTableFileName() override;
virtual void onUpdateFilePicker( wxUpdateUIEvent& aEvent ) override;
virtual void onUpdateDefaultSelection( wxUpdateUIEvent& aEvent ) override;
}; };
#endif // _DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_H_ #endif // _DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG_H_