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 {
41  m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions );
42 
43  m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
44 }
45 
46 
48 {
49  // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
50  int refStyleSelection;
51 
53  {
54  default:
55  case 0: refStyleSelection = 0; break;
56  case '.': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 4 : 1; break;
57  case '-': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 5 : 2; break;
58  case '_': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 6 : 3; break;
59  }
60 
61  m_choiceSeparatorRefId->SetSelection( refStyleSelection );
62 
63  m_busWidthCtrl->SetValue( StringFromValue( INCHES, GetDefaultBusThickness(), false, true ) );
64  m_lineWidthCtrl->SetValue( StringFromValue( INCHES, GetDefaultLineThickness(), false, true ) );
65  m_jctSizeCtrl->SetValue( StringFromValue( INCHES, SCH_JUNCTION::GetSymbolSize(), false, true ) );
68 
70 
71  return true;
72 }
73 
74 
76 {
77  // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
78  int firstRefId, refSeparator;
79 
80  switch( m_choiceSeparatorRefId->GetSelection() )
81  {
82  default:
83  case 0: firstRefId = 'A'; refSeparator = 0; break;
84  case 1: firstRefId = 'A'; refSeparator = '.'; break;
85  case 2: firstRefId = 'A'; refSeparator = '-'; break;
86  case 3: firstRefId = 'A'; refSeparator = '_'; break;
87  case 4: firstRefId = '1'; refSeparator = '.'; break;
88  case 5: firstRefId = '1'; refSeparator = '-'; break;
89  case 6: firstRefId = '1'; refSeparator = '_'; break;
90  }
91 
92  if( refSeparator != LIB_PART::GetSubpartIdSeparator() ||
93  firstRefId != LIB_PART::GetSubpartFirstId() )
94  {
95  LIB_PART::SetSubpartIdNotation( refSeparator, firstRefId );
96  m_frame->SaveProjectSettings( false );
97  }
98 
104 
105  // Update canvas
109  m_frame->GetCanvas()->Refresh();
110 
112 
113  return true;
114 }
115 
116 
bool ShowPageLimits() const
Definition: draw_frame.h:385
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:946
void SetDefaultBusThickness(int aThickness)
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
Schematic editor (Eeschema) main window.
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...
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Definition: base_units.cpp:409
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:54
void SetDefaultLineThickness(int aThickness)
static int GetSubpartIdSeparator()
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_ITEM definition.
bool GetShowAllPins() const
Definition: common.h:160
SCH_DRAW_PANEL * GetCanvas() const override
KIGFX::SCH_VIEW * GetView() const
static void SetSubpartIdNotation(int aSep, int aFirstId)
Set the separator char between the subpart id and the reference 0 (no separator) or &#39;...
static int GetSymbolSize()
Definition: sch_junction.h:53
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:210
void SetShowPageLimits(bool aShow)
Definition: draw_frame.h:386
BASE_SCREEN class implementation.
Class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE.
int GetDefaultBusThickness()
Default line thickness used to draw/plot busses.
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:621
void SetShowAllPins(bool aEnable)
void SetShowPageLimits(bool aDraw)
Definition: painter.h:186
bool TransferDataFromWindow() override
Read the options set in the UI into the given options object.