KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_eeschema_annotation_options.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 (C) 2022 Mike Williams <[email protected]>
5 * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <pgm_base.h>
28#include <eeschema_settings.h>
29#include <schematic.h>
30#include <schematic_settings.h>
31#include <sch_edit_frame.h>
33
34
36 wxWindow* aWindow, EDA_BASE_FRAME* schSettingsProvider ) :
38 m_schSettingsProvider( schSettingsProvider )
39{
40}
41
42
44{
46
47 switch( aCfg->m_AnnotatePanel.sort_order )
48 {
49 default:
50 case 0: m_rbSortBy_X_Position->SetValue( true ); break;
51 case 1: m_rbSortBy_Y_Position->SetValue( true ); break;
52 }
53
54 switch( aCfg->m_AnnotatePanel.method )
55 {
56 default:
57 case 0: m_rbFirstFree->SetValue( true ); break;
58 case 1: m_rbSheetX100->SetValue( true ); break;
59 case 2: m_rbSheetX1000->SetValue( true ); break;
60 }
61
62
63 int annotateStartNum = 0; // Default "start after" value for annotation
64
65 // See if we can get a "start after" value from the project settings
66 SCH_EDIT_FRAME* schFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_schSettingsProvider );
67
68 if( schFrame )
69 {
70 SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings();
71 annotateStartNum = projSettings.m_AnnotateStartNum;
72 }
73
74 m_textNumberAfter->SetValue( wxString::Format( wxT( "%d" ), annotateStartNum ) );
75
76 annotate_down_right_bitmap->SetBitmap( KiBitmap( BITMAPS::annotate_down_right ) );
77 annotate_right_down_bitmap->SetBitmap( KiBitmap( BITMAPS::annotate_right_down ) );
78}
79
80
82{
83 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
85
87
88 return true;
89}
90
91
93{
94 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
96
98
100 ? ANNOTATE_ORDER_T::SORT_BY_Y_POSITION
101 : ANNOTATE_ORDER_T::SORT_BY_X_POSITION;
102
103 if( m_rbSheetX100->GetValue() )
104 cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::SHEET_NUMBER_X_100;
105 else if( m_rbSheetX1000->GetValue() )
106 cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::SHEET_NUMBER_X_1000;
107 else
108 cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::INCREMENTAL_BY_REF;
109
110
111 SCH_EDIT_FRAME* schFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_schSettingsProvider );
112
113 if( schFrame )
114 {
115 SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings();
117 }
118
119 return true;
120}
121
122
124{
126 cfg.Load(); // Loading without a file will init to defaults
127
128 loadEEschemaSettings( &cfg );
129}
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:106
The base frame for deriving all KiCad main window classes.
PANEL_ANNOTATE m_AnnotatePanel
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
Class PANEL_EESCHEMA_ANNOTATION_OPTIONS_BASE.
void ResetPanel() override
Reset the contents of this panel.
PANEL_EESCHEMA_ANNOTATION_OPTIONS(wxWindow *aWindow, EDA_BASE_FRAME *schSettingsProvider)
These settings were stored in SCH_BASE_FRAME previously.
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:205
Schematic editor (Eeschema) main window.
SCHEMATIC & Schematic() const
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
long long int ValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: eda_units.cpp:525
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:115