KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_filedlg_save_as.h
Go to the documentation of this file.
1/*
2* This program source code file is part of KiCad, a free EDA CAD application.
3*
4* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
5*
6* This program is free software: you can redistribute it and/or modify it
7* under the terms of the GNU General Public License as published by the
8* Free Software Foundation, either version 3 of the License, or (at your
9* option) any later version.
10*
11* This program is distributed in the hope that it will be useful, but
12* WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14* General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License along
17* with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef SYMBOL_FILEDLG_SAVE_AS_
21#define SYMBOL_FILEDLG_SAVE_AS_
22
24#include <wx/filedlgcustomize.h>
25
26class SYMBOL_FILEDLG_SAVE_AS : public wxFileDialogCustomizeHook
27{
28public:
30
31 virtual void AddCustomControls( wxFileDialogCustomize& customizer ) override
32 {
33 m_simpleSaveAs = customizer.AddRadioButton( _( "Do not update library tables" ) );
35 customizer.AddRadioButton( _( "Update existing library table entry" ) );
37 customizer.AddRadioButton( _( "Add new global library table entry" ) );
39 customizer.AddRadioButton( _( "Add new project library table entry" ) );
40
41 // Note, due to windows api, wx does not actually support calling SetValue( false ) (it asserts)
42 if( m_option == SYMBOL_SAVEAS_TYPE::NORMAL_SAVE_AS )
43 m_simpleSaveAs->SetValue( true );
44
45 if( m_option == SYMBOL_SAVEAS_TYPE::REPLACE_TABLE_ENTRY )
46 m_replaceTableEntry->SetValue( true );
47
48 if( m_option == SYMBOL_SAVEAS_TYPE::ADD_GLOBAL_TABLE_ENTRY )
49 m_addGlobalTableEntry->SetValue( true );
50
51 if( m_option == SYMBOL_SAVEAS_TYPE::ADD_PROJECT_TABLE_ENTRY )
52 m_addProjectTableEntry->SetValue( true );
53 }
54
55 virtual void TransferDataFromCustomControls() override
56 {
57 if( m_replaceTableEntry->GetValue() )
58 m_option = SYMBOL_SAVEAS_TYPE::REPLACE_TABLE_ENTRY;
59 else if( m_addGlobalTableEntry->GetValue() )
60 m_option = SYMBOL_SAVEAS_TYPE::ADD_GLOBAL_TABLE_ENTRY;
61 else if( m_addProjectTableEntry->GetValue() )
62 m_option = SYMBOL_SAVEAS_TYPE::ADD_PROJECT_TABLE_ENTRY;
63 else
64 m_option = SYMBOL_SAVEAS_TYPE::NORMAL_SAVE_AS;
65 }
66
68
69private:
70 SYMBOL_SAVEAS_TYPE m_option = SYMBOL_SAVEAS_TYPE::NORMAL_SAVE_AS;
71
72 wxFileDialogRadioButton* m_simpleSaveAs = nullptr;
73 wxFileDialogRadioButton* m_replaceTableEntry = nullptr;
74 wxFileDialogRadioButton* m_addGlobalTableEntry = nullptr;
75 wxFileDialogRadioButton* m_addProjectTableEntry = nullptr;
76
78};
79
80#endif
virtual void AddCustomControls(wxFileDialogCustomize &customizer) override
wxDECLARE_NO_COPY_CLASS(SYMBOL_FILEDLG_SAVE_AS)
SYMBOL_SAVEAS_TYPE GetOption() const
wxFileDialogRadioButton * m_addGlobalTableEntry
wxFileDialogRadioButton * m_simpleSaveAs
virtual void TransferDataFromCustomControls() override
wxFileDialogRadioButton * m_replaceTableEntry
wxFileDialogRadioButton * m_addProjectTableEntry
SYMBOL_FILEDLG_SAVE_AS(SYMBOL_SAVEAS_TYPE aOption)
#define _(s)
SYMBOL_SAVEAS_TYPE