KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_setup_annotation.cpp
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 The 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#include <refdes_tracker.h>
21#include <sch_edit_frame.h>
22#include <schematic.h>
23#include <schematic_settings.h>
25
27
28
31 m_frame( aFrame )
32{
33}
34
35int getRefStyleMenuIndex( int aSubpartIdSeparator, int aFirstSubpartId )
36{
37 // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
38 switch( aSubpartIdSeparator )
39 {
40 default:
41 case 0: return 0;
42 case '.': return aFirstSubpartId == '1' ? 4 : 1;
43 case '-': return aFirstSubpartId == '1' ? 5 : 2;
44 case '_': return aFirstSubpartId == '1' ? 6 : 3;
45 }
46}
47
48
50{
52
54 settings.m_SubpartFirstId ) );
55
56 m_checkReuseRefdes->SetValue( settings.m_refDesTracker->GetReuseRefDes() );
57
58 return true;
59}
60
61
63{
65
66 // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
67 switch( m_choiceSeparatorRefId->GetSelection() )
68 {
69 default:
70 case 0: settings.m_SubpartFirstId = 'A'; settings.m_SubpartIdSeparator = 0; break;
71 case 1: settings.m_SubpartFirstId = 'A'; settings.m_SubpartIdSeparator = '.'; break;
72 case 2: settings.m_SubpartFirstId = 'A'; settings.m_SubpartIdSeparator = '-'; break;
73 case 3: settings.m_SubpartFirstId = 'A'; settings.m_SubpartIdSeparator = '_'; break;
74 case 4: settings.m_SubpartFirstId = '1'; settings.m_SubpartIdSeparator = '.'; break;
75 case 5: settings.m_SubpartFirstId = '1'; settings.m_SubpartIdSeparator = '-'; break;
76 case 6: settings.m_SubpartFirstId = '1'; settings.m_SubpartIdSeparator = '_'; break;
77 }
78
79 settings.m_refDesTracker->SetReuseRefDes( m_checkReuseRefdes->GetValue() );
80 return true;
81}
82
83
85{
87 aSettings.m_SubpartFirstId ) );
88
89 m_checkReuseRefdes->SetValue( aSettings.m_refDesTracker->GetReuseRefDes() );
90}
91
92
94{
95 // Reset the panel to the default values
96 m_choiceSeparatorRefId->SetSelection( 0 );
97 m_checkReuseRefdes->SetValue( true );
98}
Class PANEL_SETUP_ANNOTATION_BASE.
PANEL_SETUP_ANNOTATION(wxWindow *aWindow, SCH_EDIT_FRAME *aFrame)
bool TransferDataFromWindow() override
void ResetPanel() override
Reset the contents of this panel.
void ImportSettingsFrom(SCHEMATIC_SETTINGS &aSettings)
These are loaded from Eeschema settings but then overwritten by the project settings.
std::shared_ptr< REFDES_TRACKER > m_refDesTracker
A list of previously used schematic reference designators.
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:356
Schematic editor (Eeschema) main window.
SCHEMATIC & Schematic() const
int getRefStyleMenuIndex(int aSubpartIdSeparator, int aFirstSubpartId)