KiCad PCB EDA Suite
panel_eeschema_display_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) 2009 Wayne Stambaugh <stambaughw@verizon.net>
5  * Copyright (C) 1992-2018 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 <fctsys.h>
26 #include <base_screen.h>
27 #include <sch_view.h>
28 #include <sch_edit_frame.h>
29 #include <sch_painter.h>
30 #include <class_libentry.h>
33 #include <sch_junction.h>
34 
36  wxWindow* aWindow ) :
38  m_frame( aFrame ),
39  m_busWidth( aFrame, m_busWidthLabel, m_busWidthCtrl, m_busWidthUnits, true ),
40  m_wireWidth( aFrame, m_wireWidthLabel, m_wireWidthCtrl, m_wireWidthUnits, true ),
41  m_junctionSize( aFrame, m_jctSizeLabel, m_jctSizeCtrl, m_jctSizeUnits, true )
42 {
44  m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions );
45 
46  m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
47 }
48 
49 
51 {
52  // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
53  int refStyleSelection;
54 
56  {
57  default:
58  case 0: refStyleSelection = 0; break;
59  case '.': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 4 : 1; break;
60  case '-': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 5 : 2; break;
61  case '_': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 6 : 3; break;
62  }
63 
64  m_choiceSeparatorRefId->SetSelection( refStyleSelection );
65 
66  m_busWidth.SetUnits( INCHES, true );
67  m_wireWidth.SetUnits( INCHES, true );
69 
75 
77 
78  return true;
79 }
80 
81 
83 {
84  // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
85  int firstRefId, refSeparator;
86 
87  switch( m_choiceSeparatorRefId->GetSelection() )
88  {
89  default:
90  case 0: firstRefId = 'A'; refSeparator = 0; break;
91  case 1: firstRefId = 'A'; refSeparator = '.'; break;
92  case 2: firstRefId = 'A'; refSeparator = '-'; break;
93  case 3: firstRefId = 'A'; refSeparator = '_'; break;
94  case 4: firstRefId = '1'; refSeparator = '.'; break;
95  case 5: firstRefId = '1'; refSeparator = '-'; break;
96  case 6: firstRefId = '1'; refSeparator = '_'; break;
97  }
98 
99  if( refSeparator != LIB_PART::GetSubpartIdSeparator() ||
100  firstRefId != LIB_PART::GetSubpartFirstId() )
101  {
102  LIB_PART::SetSubpartIdNotation( refSeparator, firstRefId );
103  m_frame->SaveProjectSettings( false );
104  }
105 
111 
112  // Update canvas
117  m_frame->GetCanvas()->Refresh();
118 
120 
121  return true;
122 }
123 
124 
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
int GetDefaultWireThickness()
Default line thickness used to draw/plot wires.
void SetDefaultWireThickness(int aThickness)
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
void SetDefaultBusThickness(int aThickness)
void UpdateAllItems(int aUpdateFlags)
Updates all items in the view according to the given flags.
Definition: view.cpp:1444
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
Schematic editor (Eeschema) main window.
virtual void SetUnits(EDA_UNITS_T aUnits, bool aUseMils=false)
Function SetUnits Normally not needed (as the UNIT_BINDER inherits from the parent frame),...
Definition: unit_binder.cpp:65
void SaveProjectSettings(bool aAskForSave) override
Save changes to the project settings to the project (.pro) file.
static void SetSymbolSize(int aSize)
Definition: sch_junction.h:50
bool ShowPageLimits() const
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
static int GetSubpartIdSeparator()
Item is being added to the view.
Definition: view_item.h:60
PANEL_EESCHEMA_DISPLAY_OPTIONS(SCH_EDIT_FRAME *aFrame, wxWindow *aWindow)
bool TransferDataToWindow() override
Load the panel controls from the given opt.
static int GetSubpartFirstId()
Class LIB_PIN definition.
Definition: common.h:155
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
static void SetSubpartIdNotation(int aSep, int aFirstId)
Set the separator char between the subpart id and the reference 0 (no separator) or '.
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
static int GetSymbolSize()
Definition: sch_junction.h:49
void SetShowPageLimits(bool aShow)
BASE_SCREEN class implementation.
Class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE.
int GetDefaultBusThickness()
Default line thickness used to draw/plot busses.
bool GetShowAllPins() const override
Allow some frames to show/hide hidden pins.
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610
void SetShowAllPins(bool aEnable)
void SetShowPageLimits(bool aDraw)
Definition: painter.h:188
bool TransferDataFromWindow() override
Read the options set in the UI into the given options object.