KiCad PCB EDA Suite
PANEL_EDIT_OPTIONS Class Reference

#include <panel_edit_options.h>

Inheritance diagram for PANEL_EDIT_OPTIONS:
PANEL_EDIT_OPTIONS_BASE

Public Member Functions

 PANEL_EDIT_OPTIONS (PCB_BASE_EDIT_FRAME *aFrame, PAGED_DIALOG *aWindow)
 

Protected Types

enum  { wxID_POLAR_CTRL = 1000, wxID_UNITS, wxID_SEGMENTS45 }
 

Protected Member Functions

bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 

Protected Attributes

wxRadioBox * m_PolarDisplay
 
wxRadioBox * m_UnitsSelection
 
wxCheckBox * m_MagneticPads
 
wxCheckBox * m_Segments_45_Only_Ctrl
 
wxCheckBox * m_FlipLeftRight
 
wxStaticText * m_staticTextRotationAngle
 
wxTextCtrl * m_RotationAngle
 
wxSimplebook * m_optionsBook
 
wxStaticText * m_staticText2
 
wxChoice * m_magneticPadChoice
 
wxStaticText * m_staticText21
 
wxChoice * m_magneticTrackChoice
 
wxStaticText * m_staticText211
 
wxChoice * m_magneticGraphicsChoice
 
wxCheckBox * m_showGlobalRatsnest
 
wxCheckBox * m_showSelectedRatsnest
 
wxCheckBox * m_OptDisplayCurvedRatsnestLines
 
wxCheckBox * m_Show_Page_Limits
 
wxStaticText * m_staticText5
 
wxRadioButton * m_rbTrackDragMove
 
wxRadioButton * m_rbTrackDrag45
 
wxRadioButton * m_rbTrackDragFree
 

Private Attributes

PCB_BASE_EDIT_FRAMEm_Frame
 

Detailed Description

Definition at line 34 of file panel_edit_options.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protectedinherited

Constructor & Destructor Documentation

◆ PANEL_EDIT_OPTIONS()

PANEL_EDIT_OPTIONS::PANEL_EDIT_OPTIONS ( PCB_BASE_EDIT_FRAME aFrame,
PAGED_DIALOG aWindow 
)

Definition at line 37 of file panel_edit_options.cpp.

37  :
38  PANEL_EDIT_OPTIONS_BASE( aParent->GetTreebook() ),
39  m_Frame( aFrame )
40 {
41  m_MagneticPads->Show( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_Frame ) != nullptr );
42  m_FlipLeftRight->Show( dynamic_cast<PCB_EDIT_FRAME*>( m_Frame ) != nullptr );\
43 
44  m_optionsBook->SetSelection( dynamic_cast<PCB_EDIT_FRAME*>( m_Frame ) ? 1 : 0 );
45 }
PCB_BASE_EDIT_FRAME * m_Frame
PANEL_EDIT_OPTIONS_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)

References PANEL_EDIT_OPTIONS_BASE::m_FlipLeftRight, m_Frame, and PANEL_EDIT_OPTIONS_BASE::m_MagneticPads.

Member Function Documentation

◆ TransferDataFromWindow()

bool PANEL_EDIT_OPTIONS::TransferDataFromWindow ( )
overrideprotected

Definition at line 94 of file panel_edit_options.cpp.

95 {
96  m_Frame->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 );
99 
100  m_Frame->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) );
101 
103 
105  static_cast<MAGNETIC_OPTIONS>( m_magneticPadChoice->GetSelection() );
107  static_cast<MAGNETIC_OPTIONS>( m_magneticTrackChoice->GetSelection() );
109 
111 
113 
114  if( dynamic_cast<PCB_EDIT_FRAME*>( m_Frame ) )
115  {
116  PCBNEW_SETTINGS& settings = m_Frame->Settings();
117 
118  if( m_rbTrackDragMove->GetValue() )
120  else if( m_rbTrackDrag45->GetValue() )
122  else if( m_rbTrackDragFree->GetValue() )
124  }
125 
126  // Apply changes to the GAL
128  KIGFX::VIEW* view = m_Frame->GetCanvas()->GetView();
129  KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
130  KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
131 
133  displ_opts.m_ShowGlobalRatsnest = m_showGlobalRatsnest->GetValue();
134  displ_opts.m_ShowModuleRatsnest = m_showSelectedRatsnest->GetValue();
135 
136  m_Frame->SetDisplayOptions( displ_opts );
137  settings->LoadDisplayOptions( displ_opts, m_Frame->ShowPageLimits() );
138  view->RecacheAllItems();
140 
141  m_Frame->GetCanvas()->Refresh();
142 
143  return true;
144 }
void SetShowPolarCoords(bool aShow)
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1406
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:274
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions Display options control the way tracks, vias, outlines and other things ar...
PCB_BASE_EDIT_FRAME * m_Frame
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
bool ShowPageLimits() const
Auxiliary rendering target (noncached)
Definition: definitions.h:49
PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:63
bool m_Use45DegreeGraphicSegments
wxCheckBox * m_OptDisplayCurvedRatsnestLines
PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
TRACK_DRAG_ACTION m_TrackDragAction
virtual PCB_RENDER_SETTINGS * GetSettings() override
Definition: pcb_painter.h:286
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
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...
MAGNETIC_OPTIONS pads
PCBNEW_SETTINGS & Settings()
void SetUserUnits(EDA_UNITS aUnits)
void SetShowPageLimits(bool aShow)
VIEW.
Definition: view.h:61
MAGNETIC_SETTINGS m_MagneticItems
void SetRotationAngle(int aRotationAngle)
Function SetRotationAngle() Sets the angle used for rotate operations.
MAGNETIC_OPTIONS tracks

References DRAG, DRAG_FREE_ANGLE, PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetDisplayOptions(), KIGFX::VIEW::GetPainter(), KIGFX::PCB_PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), MAGNETIC_SETTINGS::graphics, INCHES, PCB_DISPLAY_OPTIONS::m_DisplayRatsnestLinesCurved, PANEL_EDIT_OPTIONS_BASE::m_FlipLeftRight, PCBNEW_SETTINGS::m_FlipLeftRight, m_Frame, PANEL_EDIT_OPTIONS_BASE::m_magneticGraphicsChoice, PCBNEW_SETTINGS::m_MagneticItems, PANEL_EDIT_OPTIONS_BASE::m_magneticPadChoice, PANEL_EDIT_OPTIONS_BASE::m_magneticTrackChoice, PANEL_EDIT_OPTIONS_BASE::m_OptDisplayCurvedRatsnestLines, PANEL_EDIT_OPTIONS_BASE::m_PolarDisplay, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDrag45, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDragFree, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDragMove, PANEL_EDIT_OPTIONS_BASE::m_RotationAngle, PANEL_EDIT_OPTIONS_BASE::m_Segments_45_Only_Ctrl, PANEL_EDIT_OPTIONS_BASE::m_Show_Page_Limits, PANEL_EDIT_OPTIONS_BASE::m_showGlobalRatsnest, PCB_DISPLAY_OPTIONS::m_ShowGlobalRatsnest, PCB_DISPLAY_OPTIONS::m_ShowModuleRatsnest, PANEL_EDIT_OPTIONS_BASE::m_showSelectedRatsnest, PCBNEW_SETTINGS::m_TrackDragAction, PANEL_EDIT_OPTIONS_BASE::m_UnitsSelection, PCBNEW_SETTINGS::m_Use45DegreeGraphicSegments, KIGFX::VIEW::MarkTargetDirty(), MILLIMETRES, MOVE, MAGNETIC_SETTINGS::pads, KIGFX::VIEW::RecacheAllItems(), EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetDisplayOptions(), PCB_BASE_EDIT_FRAME::SetRotationAngle(), EDA_DRAW_FRAME::SetShowPageLimits(), EDA_DRAW_FRAME::SetShowPolarCoords(), PCB_BASE_FRAME::Settings(), EDA_BASE_FRAME::SetUserUnits(), EDA_DRAW_FRAME::ShowPageLimits(), KIGFX::TARGET_NONCACHED, and MAGNETIC_SETTINGS::tracks.

◆ TransferDataToWindow()

bool PANEL_EDIT_OPTIONS::TransferDataToWindow ( )
overrideprotected

Definition at line 48 of file panel_edit_options.cpp.

49 {
50  const PCB_DISPLAY_OPTIONS& displ_opts = m_Frame->GetDisplayOptions();
51  const PCBNEW_SETTINGS& general_opts = m_Frame->Settings();
52 
53  m_PolarDisplay->SetSelection( m_Frame->GetShowPolarCoords() ? 1 : 0 );
54  m_UnitsSelection->SetSelection( m_Frame->GetUserUnits() == EDA_UNITS::INCHES ? 0 : 1 );
55 
56  m_Segments_45_Only_Ctrl->SetValue( general_opts.m_Use45DegreeGraphicSegments );
57 
58  wxString rotationAngle;
59  rotationAngle = AngleToStringDegrees( (double)m_Frame->GetRotationAngle() );
60  m_RotationAngle->SetValue( rotationAngle );
61 
62  if( dynamic_cast<PCB_EDIT_FRAME*>( m_Frame ) )
63  {
64  /* Set display options */
66  m_showGlobalRatsnest->SetValue( displ_opts.m_ShowGlobalRatsnest );
67  m_showSelectedRatsnest->SetValue( displ_opts.m_ShowModuleRatsnest );
69 
70  m_magneticPadChoice->SetSelection( static_cast<int>( general_opts.m_MagneticItems.pads ) );
71  m_magneticTrackChoice->SetSelection( static_cast<int>( general_opts.m_MagneticItems.tracks ) );
72  m_magneticGraphicsChoice->SetSelection( !general_opts.m_MagneticItems.graphics );
73  m_FlipLeftRight->SetValue( general_opts.m_FlipLeftRight );
74 
76 
77  switch( general_opts.m_TrackDragAction )
78  {
79  case TRACK_DRAG_ACTION::MOVE: m_rbTrackDragMove->SetValue( true ); break;
80  case TRACK_DRAG_ACTION::DRAG: m_rbTrackDrag45->SetValue( true ); break;
81  case TRACK_DRAG_ACTION::DRAG_FREE_ANGLE: m_rbTrackDragFree->SetValue( true ); break;
82  }
83  }
84  else if( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_Frame ) )
85  {
86  m_MagneticPads->SetValue(
88  }
89 
90  return true;
91 }
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions Display options control the way tracks, vias, outlines and other things ar...
PCB_BASE_EDIT_FRAME * m_Frame
bool ShowPageLimits() const
bool m_Use45DegreeGraphicSegments
wxCheckBox * m_OptDisplayCurvedRatsnestLines
PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
TRACK_DRAG_ACTION m_TrackDragAction
wxString AngleToStringDegrees(double aAngle)
Function AngleToStringDegrees is a helper to convert the double aAngle (in internal unit) to a string...
Definition: base_units.cpp:484
int GetRotationAngle() const
Function GetRotationAngle() Returns the angle used for rotate operations.
bool GetShowPolarCoords() const
For those frames that support polar coordinates.
MAGNETIC_OPTIONS pads
PCBNEW_SETTINGS & Settings()
MAGNETIC_SETTINGS m_MagneticItems
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
MAGNETIC_OPTIONS tracks

References AngleToStringDegrees(), CAPTURE_ALWAYS, DRAG, DRAG_FREE_ANGLE, PCB_BASE_FRAME::GetDisplayOptions(), PCB_BASE_FRAME::GetMagneticItemsSettings(), PCB_BASE_EDIT_FRAME::GetRotationAngle(), EDA_DRAW_FRAME::GetShowPolarCoords(), EDA_BASE_FRAME::GetUserUnits(), MAGNETIC_SETTINGS::graphics, INCHES, PCB_DISPLAY_OPTIONS::m_DisplayRatsnestLinesCurved, PANEL_EDIT_OPTIONS_BASE::m_FlipLeftRight, PCBNEW_SETTINGS::m_FlipLeftRight, m_Frame, PANEL_EDIT_OPTIONS_BASE::m_magneticGraphicsChoice, PCBNEW_SETTINGS::m_MagneticItems, PANEL_EDIT_OPTIONS_BASE::m_magneticPadChoice, PANEL_EDIT_OPTIONS_BASE::m_MagneticPads, PANEL_EDIT_OPTIONS_BASE::m_magneticTrackChoice, PANEL_EDIT_OPTIONS_BASE::m_OptDisplayCurvedRatsnestLines, PANEL_EDIT_OPTIONS_BASE::m_PolarDisplay, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDrag45, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDragFree, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDragMove, PANEL_EDIT_OPTIONS_BASE::m_RotationAngle, PANEL_EDIT_OPTIONS_BASE::m_Segments_45_Only_Ctrl, PANEL_EDIT_OPTIONS_BASE::m_Show_Page_Limits, PANEL_EDIT_OPTIONS_BASE::m_showGlobalRatsnest, PCB_DISPLAY_OPTIONS::m_ShowGlobalRatsnest, PCB_DISPLAY_OPTIONS::m_ShowModuleRatsnest, PANEL_EDIT_OPTIONS_BASE::m_showSelectedRatsnest, PCBNEW_SETTINGS::m_TrackDragAction, PANEL_EDIT_OPTIONS_BASE::m_UnitsSelection, PCBNEW_SETTINGS::m_Use45DegreeGraphicSegments, MOVE, MAGNETIC_SETTINGS::pads, PCB_BASE_FRAME::Settings(), EDA_DRAW_FRAME::ShowPageLimits(), and MAGNETIC_SETTINGS::tracks.

Member Data Documentation

◆ m_FlipLeftRight

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_FlipLeftRight
protectedinherited

◆ m_Frame

PCB_BASE_EDIT_FRAME* PANEL_EDIT_OPTIONS::m_Frame
private

◆ m_magneticGraphicsChoice

wxChoice* PANEL_EDIT_OPTIONS_BASE::m_magneticGraphicsChoice
protectedinherited

◆ m_magneticPadChoice

wxChoice* PANEL_EDIT_OPTIONS_BASE::m_magneticPadChoice
protectedinherited

◆ m_MagneticPads

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_MagneticPads
protectedinherited

◆ m_magneticTrackChoice

wxChoice* PANEL_EDIT_OPTIONS_BASE::m_magneticTrackChoice
protectedinherited

◆ m_OptDisplayCurvedRatsnestLines

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_OptDisplayCurvedRatsnestLines
protectedinherited

◆ m_optionsBook

wxSimplebook* PANEL_EDIT_OPTIONS_BASE::m_optionsBook
protectedinherited

◆ m_PolarDisplay

wxRadioBox* PANEL_EDIT_OPTIONS_BASE::m_PolarDisplay
protectedinherited

◆ m_rbTrackDrag45

wxRadioButton* PANEL_EDIT_OPTIONS_BASE::m_rbTrackDrag45
protectedinherited

◆ m_rbTrackDragFree

wxRadioButton* PANEL_EDIT_OPTIONS_BASE::m_rbTrackDragFree
protectedinherited

◆ m_rbTrackDragMove

wxRadioButton* PANEL_EDIT_OPTIONS_BASE::m_rbTrackDragMove
protectedinherited

◆ m_RotationAngle

wxTextCtrl* PANEL_EDIT_OPTIONS_BASE::m_RotationAngle
protectedinherited

◆ m_Segments_45_Only_Ctrl

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_Segments_45_Only_Ctrl
protectedinherited

◆ m_Show_Page_Limits

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_Show_Page_Limits
protectedinherited

◆ m_showGlobalRatsnest

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_showGlobalRatsnest
protectedinherited

◆ m_showSelectedRatsnest

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_showSelectedRatsnest
protectedinherited

◆ m_staticText2

wxStaticText* PANEL_EDIT_OPTIONS_BASE::m_staticText2
protectedinherited

◆ m_staticText21

wxStaticText* PANEL_EDIT_OPTIONS_BASE::m_staticText21
protectedinherited

◆ m_staticText211

wxStaticText* PANEL_EDIT_OPTIONS_BASE::m_staticText211
protectedinherited

◆ m_staticText5

wxStaticText* PANEL_EDIT_OPTIONS_BASE::m_staticText5
protectedinherited

◆ m_staticTextRotationAngle

wxStaticText* PANEL_EDIT_OPTIONS_BASE::m_staticTextRotationAngle
protectedinherited

◆ m_UnitsSelection

wxRadioBox* PANEL_EDIT_OPTIONS_BASE::m_UnitsSelection
protectedinherited

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