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 #include <gr_text.h>
35 
37  wxWindow* aWindow ) :
39  m_frame( aFrame ),
40  m_busWidth( aFrame, m_busWidthLabel, m_busWidthCtrl, m_busWidthUnits, true ),
41  m_wireWidth( aFrame, m_wireWidthLabel, m_wireWidthCtrl, m_wireWidthUnits, true ),
42  m_junctionSize( aFrame, m_jctSizeLabel, m_jctSizeCtrl, m_jctSizeUnits, true )
43 {
45  m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions );
46 
47  m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
48 
49  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
50  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
51  m_highlightColorNote->SetFont( infoFont );
52 }
53 
54 
56 {
57  // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
58  int refStyleSelection;
59 
61  {
62  default:
63  case 0: refStyleSelection = 0; break;
64  case '.': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 4 : 1; break;
65  case '-': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 5 : 2; break;
66  case '_': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 6 : 3; break;
67  }
68 
69  m_choiceSeparatorRefId->SetSelection( refStyleSelection );
70 
74 
79 
81 
82  m_checkSuperSub->SetValue( GetTextMarkupFlags() & superSubFlags );
83 
85 
90 
92 
93  return true;
94 }
95 
96 
98 {
99  // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
100  int firstRefId, refSeparator;
101 
102  switch( m_choiceSeparatorRefId->GetSelection() )
103  {
104  default:
105  case 0: firstRefId = 'A'; refSeparator = 0; break;
106  case 1: firstRefId = 'A'; refSeparator = '.'; break;
107  case 2: firstRefId = 'A'; refSeparator = '-'; break;
108  case 3: firstRefId = 'A'; refSeparator = '_'; break;
109  case 4: firstRefId = '1'; refSeparator = '.'; break;
110  case 5: firstRefId = '1'; refSeparator = '-'; break;
111  case 6: firstRefId = '1'; refSeparator = '_'; break;
112  }
113 
114  if( refSeparator != LIB_PART::GetSubpartIdSeparator() ||
115  firstRefId != LIB_PART::GetSubpartFirstId() )
116  {
117  LIB_PART::SetSubpartIdNotation( refSeparator, firstRefId );
118  m_frame->SaveProjectSettings( false );
119  }
120 
129  SetSelectionThickness( m_selWidthCtrl->GetValue() );
130 
131  // Update canvas
133 
135 
136  if( m_checkSuperSub->GetValue() )
137  SetTextMarkupFlags( GetTextMarkupFlags() | superSubFlags );
138  else
139  SetTextMarkupFlags( GetTextMarkupFlags() & ~superSubFlags );
140 
144  m_frame->GetCanvas()->Refresh();
145 
147 
148  return true;
149 }
150 
151 
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
bool GetSelectionTextAsBox()
Draw selected text items as box.
int GetDefaultWireThickness()
Default line thickness used to draw/plot wires.
void SetSelectionDrawChildItems(bool aBool)
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
void SetSelectionTextAsBox(bool aBool)
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
Schematic editor (Eeschema) main window.
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:55
bool ShowPageLimits() const
static int GetSubpartIdSeparator()
int GetTextMarkupFlags()
Definition: gr_text.cpp:55
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()
void SetSelectionFillShapes(bool aBool)
Class LIB_PIN definition.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
int GetSelectionThickness()
Selection highlight thickness.
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...
void SetSelectionThickness(int aThickness)
bool GetSelectionFillShapes()
Draw selected shapes as filled or not.
bool GetSelectionDrawChildItems()
Draw selected child items or not.
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:54
virtual long long int GetValue()
Function GetValue Returns the current value in Internal Units.
void SetShowPageLimits(bool aShow)
BASE_SCREEN class implementation.
void SetTextMarkupFlags(int aMarkupFlags)
Definition: gr_text.cpp:49
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
virtual void SetUnits(EDA_UNITS aUnits, bool aUseMils=false)
Function SetUnits Normally not needed (as the UNIT_BINDER inherits from the parent frame),...
Definition: unit_binder.cpp:68
bool TransferDataFromWindow() override
Read the options set in the UI into the given options object.