KiCad PCB EDA Suite
PANEL_SETUP_FORMATTING Class Reference

#include <panel_setup_formatting.h>

Inheritance diagram for PANEL_SETUP_FORMATTING:
PANEL_SETUP_FORMATTING_BASE

Public Member Functions

 PANEL_SETUP_FORMATTING (wxWindow *aWindow, SCH_EDIT_FRAME *aFrame)
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
void ImportSettingsFrom (SCHEMATIC_SETTINGS &aSettings)
 

Protected Member Functions

void onCheckBoxIref (wxCommandEvent &event) override
 

Protected Attributes

wxStaticText * m_staticText26
 
wxChoice * m_choiceSeparatorRefId
 
wxStaticText * m_textSizeLabel
 
wxTextCtrl * m_textSizeCtrl
 
wxStaticText * m_textSizeUnits
 
wxStaticText * m_textOffsetRatioLabel
 
wxTextCtrl * m_textOffsetRatioCtrl
 
wxStaticText * m_offsetRatioUnits
 
wxStaticText * m_labelSizeRatioLabel
 
wxTextCtrl * m_labelSizeRatioCtrl
 
wxStaticText * m_labelSizeRatioUnits
 
wxStaticText * m_lineWidthLabel
 
wxTextCtrl * m_lineWidthCtrl
 
wxStaticText * m_lineWidthUnits
 
wxStaticText * m_pinSymbolSizeLabel
 
wxTextCtrl * m_pinSymbolSizeCtrl
 
wxStaticText * m_pinSymbolSizeUnits
 
wxStaticText * m_staticText261
 
wxChoice * m_choiceJunctionDotSize
 
wxCheckBox * m_showIntersheetsReferences
 
wxCheckBox * m_listOwnPage
 
wxRadioButton * m_radioFormatStandard
 
wxRadioButton * m_radioFormatAbbreviated
 
wxStaticText * m_prefixLabel
 
wxTextCtrl * m_prefixCtrl
 
wxStaticText * m_suffixLabel
 
wxTextCtrl * m_suffixCtrl
 

Private Attributes

SCH_EDIT_FRAMEm_frame
 
UNIT_BINDER m_textSize
 
UNIT_BINDER m_lineWidth
 
UNIT_BINDER m_pinSymbolSize
 

Detailed Description

Definition at line 31 of file panel_setup_formatting.h.

Constructor & Destructor Documentation

◆ PANEL_SETUP_FORMATTING()

PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING ( wxWindow *  aWindow,
SCH_EDIT_FRAME aFrame 
)

Definition at line 35 of file panel_setup_formatting.cpp.

35  :
36  PANEL_SETUP_FORMATTING_BASE( aWindow ),
37  m_frame( aFrame ),
41 {
42 }
PANEL_SETUP_FORMATTING_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)

Member Function Documentation

◆ ImportSettingsFrom()

void PANEL_SETUP_FORMATTING::ImportSettingsFrom ( SCHEMATIC_SETTINGS aSettings)

Definition at line 169 of file panel_setup_formatting.cpp.

170 {
174 
175  m_showIntersheetsReferences->SetValue( aSettings.m_IntersheetRefsShow );
176  m_radioFormatStandard->SetValue( aSettings.m_IntersheetRefsFormatShort );
178  m_prefixCtrl->ChangeValue( aSettings.m_IntersheetRefsPrefix );
179  m_suffixCtrl->ChangeValue( aSettings.m_IntersheetRefsSuffix );
180  m_listOwnPage->SetValue( aSettings.m_IntersheetRefsListOwnPage );
181 
182  wxString offsetRatio = wxString::Format( "%f", aSettings.m_TextOffsetRatio * 100.0 );
183  m_textOffsetRatioCtrl->SetValue( offsetRatio );
184 
185  wxString labelSizeRatio = wxString::Format( "%f", aSettings.m_LabelSizeRatio * 100.0 );
186  m_labelSizeRatioCtrl->SetValue( labelSizeRatio );
187 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.

References Format(), SCHEMATIC_SETTINGS::m_DefaultLineWidth, SCHEMATIC_SETTINGS::m_DefaultTextSize, SCHEMATIC_SETTINGS::m_IntersheetRefsFormatShort, SCHEMATIC_SETTINGS::m_IntersheetRefsListOwnPage, SCHEMATIC_SETTINGS::m_IntersheetRefsPrefix, SCHEMATIC_SETTINGS::m_IntersheetRefsShow, SCHEMATIC_SETTINGS::m_IntersheetRefsSuffix, SCHEMATIC_SETTINGS::m_LabelSizeRatio, PANEL_SETUP_FORMATTING_BASE::m_labelSizeRatioCtrl, m_lineWidth, PANEL_SETUP_FORMATTING_BASE::m_listOwnPage, m_pinSymbolSize, SCHEMATIC_SETTINGS::m_PinSymbolSize, PANEL_SETUP_FORMATTING_BASE::m_prefixCtrl, PANEL_SETUP_FORMATTING_BASE::m_radioFormatAbbreviated, PANEL_SETUP_FORMATTING_BASE::m_radioFormatStandard, PANEL_SETUP_FORMATTING_BASE::m_showIntersheetsReferences, PANEL_SETUP_FORMATTING_BASE::m_suffixCtrl, SCHEMATIC_SETTINGS::m_TextOffsetRatio, PANEL_SETUP_FORMATTING_BASE::m_textOffsetRatioCtrl, m_textSize, and UNIT_BINDER::SetValue().

Referenced by DIALOG_SCHEMATIC_SETUP::OnAuxiliaryAction().

◆ onCheckBoxIref()

void PANEL_SETUP_FORMATTING::onCheckBoxIref ( wxCommandEvent &  event)
overrideprotectedvirtual

◆ TransferDataFromWindow()

bool PANEL_SETUP_FORMATTING::TransferDataFromWindow ( )
override

Definition at line 107 of file panel_setup_formatting.cpp.

108 {
109  SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings();
110 
111  // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
112  int firstRefId, refSeparator;
113 
114  switch( m_choiceSeparatorRefId->GetSelection() )
115  {
116  default:
117  case 0: firstRefId = 'A'; refSeparator = 0; break;
118  case 1: firstRefId = 'A'; refSeparator = '.'; break;
119  case 2: firstRefId = 'A'; refSeparator = '-'; break;
120  case 3: firstRefId = 'A'; refSeparator = '_'; break;
121  case 4: firstRefId = '1'; refSeparator = '.'; break;
122  case 5: firstRefId = '1'; refSeparator = '-'; break;
123  case 6: firstRefId = '1'; refSeparator = '_'; break;
124  }
125 
126  if( refSeparator != LIB_SYMBOL::GetSubpartIdSeparator() ||
127  firstRefId != LIB_SYMBOL::GetSubpartFirstId() )
128  {
129  LIB_SYMBOL::SetSubpartIdNotation( refSeparator, firstRefId );
130  }
131 
132  settings.m_DefaultTextSize = (int) m_textSize.GetValue();
133  settings.m_DefaultLineWidth = (int) m_lineWidth.GetValue();
134  settings.m_PinSymbolSize = (int) m_pinSymbolSize.GetValue();
135 
136  if( m_choiceJunctionDotSize->GetSelection() != wxNOT_FOUND )
137  settings.m_JunctionSizeChoice = m_choiceJunctionDotSize->GetSelection();
138 
140 
141  settings.m_IntersheetRefsShow = m_showIntersheetsReferences->GetValue();
142  settings.m_IntersheetRefsFormatShort = !m_radioFormatStandard->GetValue();
143  settings.m_IntersheetRefsPrefix = m_prefixCtrl->GetValue();
144  settings.m_IntersheetRefsSuffix = m_suffixCtrl->GetValue();
145  settings.m_IntersheetRefsListOwnPage = m_listOwnPage->GetValue();
146 
147  double dtmp = DEFAULT_TEXT_OFFSET_RATIO;
148  m_textOffsetRatioCtrl->GetValue().ToDouble( &dtmp );
149  settings.m_TextOffsetRatio = dtmp / 100.0;
150 
152  m_labelSizeRatioCtrl->GetValue().ToDouble( &dtmp );
153  settings.m_LabelSizeRatio = dtmp / 100.0;
154 
160 
163  m_frame->GetCanvas()->Refresh();
164 
165  return true;
166 }
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
#define DEFAULT_LABEL_SIZE_RATIO
The offset of the pin name string from the end of the pin in mils.
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:167
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1430
int GetSchematicJunctionSize()
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
static int GetSubpartFirstId()
Definition: lib_symbol.h:520
Item needs to be redrawn.
Definition: view_item.h:57
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCHEMATIC & Schematic() const
static int GetSubpartIdSeparator()
Definition: lib_symbol.h:514
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
These settings were stored in SCH_BASE_FRAME previously.
virtual long long int GetValue()
Return the current value in Internal Units.
void SetDefaultPenWidth(int aWidth)
static void SetSubpartIdNotation(int aSep, int aFirstId)
Set the separator char between the subpart id and the reference 0 (no separator) or '.
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:633
#define DEFAULT_TEXT_OFFSET_RATIO
Ratio of the font height to space around global labels.

References DEFAULT_LABEL_SIZE_RATIO, DEFAULT_TEXT_OFFSET_RATIO, SCH_BASE_FRAME::GetCanvas(), SCH_BASE_FRAME::GetRenderSettings(), SCH_EDIT_FRAME::GetSchematicJunctionSize(), LIB_SYMBOL::GetSubpartFirstId(), LIB_SYMBOL::GetSubpartIdSeparator(), UNIT_BINDER::GetValue(), SCH_DRAW_PANEL::GetView(), PANEL_SETUP_FORMATTING_BASE::m_choiceJunctionDotSize, PANEL_SETUP_FORMATTING_BASE::m_choiceSeparatorRefId, SCHEMATIC_SETTINGS::m_DefaultLineWidth, SCHEMATIC_SETTINGS::m_DefaultTextSize, m_frame, SCHEMATIC_SETTINGS::m_IntersheetRefsFormatShort, SCHEMATIC_SETTINGS::m_IntersheetRefsListOwnPage, SCHEMATIC_SETTINGS::m_IntersheetRefsPrefix, SCHEMATIC_SETTINGS::m_IntersheetRefsShow, SCHEMATIC_SETTINGS::m_IntersheetRefsSuffix, SCHEMATIC_SETTINGS::m_JunctionSize, KIGFX::SCH_RENDER_SETTINGS::m_JunctionSize, SCHEMATIC_SETTINGS::m_JunctionSizeChoice, SCHEMATIC_SETTINGS::m_LabelSizeRatio, KIGFX::SCH_RENDER_SETTINGS::m_LabelSizeRatio, PANEL_SETUP_FORMATTING_BASE::m_labelSizeRatioCtrl, m_lineWidth, PANEL_SETUP_FORMATTING_BASE::m_listOwnPage, m_pinSymbolSize, SCHEMATIC_SETTINGS::m_PinSymbolSize, KIGFX::SCH_RENDER_SETTINGS::m_PinSymbolSize, PANEL_SETUP_FORMATTING_BASE::m_prefixCtrl, PANEL_SETUP_FORMATTING_BASE::m_radioFormatStandard, PANEL_SETUP_FORMATTING_BASE::m_showIntersheetsReferences, PANEL_SETUP_FORMATTING_BASE::m_suffixCtrl, SCHEMATIC_SETTINGS::m_TextOffsetRatio, KIGFX::SCH_RENDER_SETTINGS::m_TextOffsetRatio, PANEL_SETUP_FORMATTING_BASE::m_textOffsetRatioCtrl, m_textSize, KIGFX::VIEW::MarkDirty(), EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::REPAINT, SCH_EDIT_FRAME::Schematic(), KIGFX::RENDER_SETTINGS::SetDefaultPenWidth(), LIB_SYMBOL::SetSubpartIdNotation(), SCHEMATIC::Settings(), and KIGFX::VIEW::UpdateAllItems().

◆ TransferDataToWindow()

bool PANEL_SETUP_FORMATTING::TransferDataToWindow ( )
override

Definition at line 56 of file panel_setup_formatting.cpp.

57 {
59 
60  // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
61  int refStyleSelection;
62 
64  {
65  default:
66  case 0: refStyleSelection = 0; break;
67  case '.': refStyleSelection = LIB_SYMBOL::GetSubpartFirstId() == '1' ? 4 : 1; break;
68  case '-': refStyleSelection = LIB_SYMBOL::GetSubpartFirstId() == '1' ? 5 : 2; break;
69  case '_': refStyleSelection = LIB_SYMBOL::GetSubpartFirstId() == '1' ? 6 : 3; break;
70  }
71 
72  m_choiceSeparatorRefId->SetSelection( refStyleSelection );
73 
77 
81  m_choiceJunctionDotSize->SetSelection( settings.m_JunctionSizeChoice );
82 
84 
85  m_radioFormatStandard->Enable( settings.m_IntersheetRefsShow );
87  m_prefixCtrl->Enable( settings.m_IntersheetRefsShow );
88  m_suffixCtrl->Enable( settings.m_IntersheetRefsShow );
89  m_listOwnPage->Enable( settings.m_IntersheetRefsShow );
90 
93  m_prefixCtrl->ChangeValue( settings.m_IntersheetRefsPrefix );
94  m_suffixCtrl->ChangeValue( settings.m_IntersheetRefsSuffix );
95  m_listOwnPage->SetValue( settings.m_IntersheetRefsListOwnPage );
96 
97  wxString offsetRatio = wxString::Format( "%f", settings.m_TextOffsetRatio * 100.0 );
98  m_textOffsetRatioCtrl->SetValue( offsetRatio );
99 
100  wxString labelSizeRatio = wxString::Format( "%f", settings.m_LabelSizeRatio * 100.0 );
101  m_labelSizeRatioCtrl->SetValue( labelSizeRatio );
102 
103  return true;
104 }
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:167
static int GetSubpartFirstId()
Definition: lib_symbol.h:520
SCHEMATIC & Schematic() const
static int GetSubpartIdSeparator()
Definition: lib_symbol.h:514
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
Definition: unit_binder.cpp:92
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
These settings were stored in SCH_BASE_FRAME previously.

References Format(), LIB_SYMBOL::GetSubpartFirstId(), LIB_SYMBOL::GetSubpartIdSeparator(), PANEL_SETUP_FORMATTING_BASE::m_choiceJunctionDotSize, PANEL_SETUP_FORMATTING_BASE::m_choiceSeparatorRefId, SCHEMATIC_SETTINGS::m_DefaultLineWidth, SCHEMATIC_SETTINGS::m_DefaultTextSize, m_frame, SCHEMATIC_SETTINGS::m_IntersheetRefsFormatShort, SCHEMATIC_SETTINGS::m_IntersheetRefsListOwnPage, SCHEMATIC_SETTINGS::m_IntersheetRefsPrefix, SCHEMATIC_SETTINGS::m_IntersheetRefsShow, SCHEMATIC_SETTINGS::m_IntersheetRefsSuffix, SCHEMATIC_SETTINGS::m_JunctionSizeChoice, SCHEMATIC_SETTINGS::m_LabelSizeRatio, PANEL_SETUP_FORMATTING_BASE::m_labelSizeRatioCtrl, m_lineWidth, PANEL_SETUP_FORMATTING_BASE::m_listOwnPage, m_pinSymbolSize, SCHEMATIC_SETTINGS::m_PinSymbolSize, PANEL_SETUP_FORMATTING_BASE::m_prefixCtrl, PANEL_SETUP_FORMATTING_BASE::m_radioFormatAbbreviated, PANEL_SETUP_FORMATTING_BASE::m_radioFormatStandard, PANEL_SETUP_FORMATTING_BASE::m_showIntersheetsReferences, PANEL_SETUP_FORMATTING_BASE::m_suffixCtrl, SCHEMATIC_SETTINGS::m_TextOffsetRatio, PANEL_SETUP_FORMATTING_BASE::m_textOffsetRatioCtrl, m_textSize, MILS, SCH_EDIT_FRAME::Schematic(), SCHEMATIC::Settings(), UNIT_BINDER::SetUnits(), and UNIT_BINDER::SetValue().

Member Data Documentation

◆ m_choiceJunctionDotSize

wxChoice* PANEL_SETUP_FORMATTING_BASE::m_choiceJunctionDotSize
protectedinherited

Definition at line 60 of file panel_setup_formatting_base.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ m_choiceSeparatorRefId

wxChoice* PANEL_SETUP_FORMATTING_BASE::m_choiceSeparatorRefId
protectedinherited

Definition at line 43 of file panel_setup_formatting_base.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ m_frame

SCH_EDIT_FRAME* PANEL_SETUP_FORMATTING::m_frame
private

Definition at line 45 of file panel_setup_formatting.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ m_labelSizeRatioCtrl

wxTextCtrl* PANEL_SETUP_FORMATTING_BASE::m_labelSizeRatioCtrl
protectedinherited

◆ m_labelSizeRatioLabel

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_labelSizeRatioLabel
protectedinherited

Definition at line 50 of file panel_setup_formatting_base.h.

◆ m_labelSizeRatioUnits

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_labelSizeRatioUnits
protectedinherited

Definition at line 52 of file panel_setup_formatting_base.h.

◆ m_lineWidth

UNIT_BINDER PANEL_SETUP_FORMATTING::m_lineWidth
private

◆ m_lineWidthCtrl

wxTextCtrl* PANEL_SETUP_FORMATTING_BASE::m_lineWidthCtrl
protectedinherited

Definition at line 54 of file panel_setup_formatting_base.h.

◆ m_lineWidthLabel

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_lineWidthLabel
protectedinherited

Definition at line 53 of file panel_setup_formatting_base.h.

◆ m_lineWidthUnits

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_lineWidthUnits
protectedinherited

Definition at line 55 of file panel_setup_formatting_base.h.

◆ m_listOwnPage

wxCheckBox* PANEL_SETUP_FORMATTING_BASE::m_listOwnPage
protectedinherited

◆ m_offsetRatioUnits

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_offsetRatioUnits
protectedinherited

Definition at line 49 of file panel_setup_formatting_base.h.

◆ m_pinSymbolSize

UNIT_BINDER PANEL_SETUP_FORMATTING::m_pinSymbolSize
private

◆ m_pinSymbolSizeCtrl

wxTextCtrl* PANEL_SETUP_FORMATTING_BASE::m_pinSymbolSizeCtrl
protectedinherited

Definition at line 57 of file panel_setup_formatting_base.h.

◆ m_pinSymbolSizeLabel

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_pinSymbolSizeLabel
protectedinherited

Definition at line 56 of file panel_setup_formatting_base.h.

◆ m_pinSymbolSizeUnits

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_pinSymbolSizeUnits
protectedinherited

Definition at line 58 of file panel_setup_formatting_base.h.

◆ m_prefixCtrl

wxTextCtrl* PANEL_SETUP_FORMATTING_BASE::m_prefixCtrl
protectedinherited

◆ m_prefixLabel

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_prefixLabel
protectedinherited

Definition at line 65 of file panel_setup_formatting_base.h.

◆ m_radioFormatAbbreviated

wxRadioButton* PANEL_SETUP_FORMATTING_BASE::m_radioFormatAbbreviated
protectedinherited

◆ m_radioFormatStandard

wxRadioButton* PANEL_SETUP_FORMATTING_BASE::m_radioFormatStandard
protectedinherited

◆ m_showIntersheetsReferences

wxCheckBox* PANEL_SETUP_FORMATTING_BASE::m_showIntersheetsReferences
protectedinherited

◆ m_staticText26

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_staticText26
protectedinherited

Definition at line 42 of file panel_setup_formatting_base.h.

◆ m_staticText261

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_staticText261
protectedinherited

Definition at line 59 of file panel_setup_formatting_base.h.

◆ m_suffixCtrl

wxTextCtrl* PANEL_SETUP_FORMATTING_BASE::m_suffixCtrl
protectedinherited

◆ m_suffixLabel

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_suffixLabel
protectedinherited

Definition at line 67 of file panel_setup_formatting_base.h.

◆ m_textOffsetRatioCtrl

wxTextCtrl* PANEL_SETUP_FORMATTING_BASE::m_textOffsetRatioCtrl
protectedinherited

◆ m_textOffsetRatioLabel

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_textOffsetRatioLabel
protectedinherited

Definition at line 47 of file panel_setup_formatting_base.h.

◆ m_textSize

UNIT_BINDER PANEL_SETUP_FORMATTING::m_textSize
private

◆ m_textSizeCtrl

wxTextCtrl* PANEL_SETUP_FORMATTING_BASE::m_textSizeCtrl
protectedinherited

Definition at line 45 of file panel_setup_formatting_base.h.

◆ m_textSizeLabel

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_textSizeLabel
protectedinherited

Definition at line 44 of file panel_setup_formatting_base.h.

◆ m_textSizeUnits

wxStaticText* PANEL_SETUP_FORMATTING_BASE::m_textSizeUnits
protectedinherited

Definition at line 46 of file panel_setup_formatting_base.h.


The documentation for this class was generated from the following files: