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 Member Functions

bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 

Protected Attributes

wxCheckBox * m_magneticPads
 
wxCheckBox * m_magneticGraphics
 
wxCheckBox * m_flipLeftRight
 
wxStaticText * m_staticTextRotationAngle
 
wxTextCtrl * m_rotationAngle
 
wxStaticText * m_staticText32
 
wxCheckBox * m_allowFreePads
 
wxStaticBoxSizer * m_mouseCmdsWinLin
 
wxStaticText * m_staticText181
 
wxStaticBoxSizer * m_mouseCmdsOSX
 
wxStaticText * m_staticText1811
 
wxSimplebook * m_optionsBook
 
wxCheckBox * m_cbFpGraphic45Mode
 
wxStaticText * m_staticText2
 
wxChoice * m_magneticPadChoice
 
wxStaticText * m_staticText21
 
wxChoice * m_magneticTrackChoice
 
wxStaticText * m_staticText211
 
wxChoice * m_magneticGraphicsChoice
 
wxCheckBox * m_showSelectedRatsnest
 
wxCheckBox * m_OptDisplayCurvedRatsnestLines
 
wxStaticText * m_staticText5
 
wxRadioButton * m_rbTrackDragMove
 
wxRadioButton * m_rbTrackDrag45
 
wxRadioButton * m_rbTrackDragFree
 
wxCheckBox * m_cbPcbGraphic45Mode
 
wxCheckBox * m_showPageLimits
 
wxCheckBox * m_autoRefillZones
 

Private Attributes

PCB_BASE_EDIT_FRAMEm_frame
 

Detailed Description

Definition at line 34 of file panel_edit_options.h.

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() ), m_frame( aFrame )
39 {
40  m_magneticPads->Show( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) != nullptr );
41  m_magneticGraphics->Show( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) != nullptr );
42  m_flipLeftRight->Show( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) != nullptr );
43  m_allowFreePads->Show( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) != nullptr );
44 
45 #ifdef __WXOSX_MAC__
46  m_mouseCmdsOSX->Show( true );
47  m_mouseCmdsWinLin->Show( false );
48 #else
49  m_mouseCmdsWinLin->Show( true );
50  m_mouseCmdsOSX->Show( false );
51 #endif
52 
53  m_optionsBook->SetSelection( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) ? 1 : 0 );
54 }
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)
wxStaticBoxSizer * m_mouseCmdsWinLin
wxStaticBoxSizer * m_mouseCmdsOSX

References PANEL_EDIT_OPTIONS_BASE::m_allowFreePads, PANEL_EDIT_OPTIONS_BASE::m_flipLeftRight, m_frame, PANEL_EDIT_OPTIONS_BASE::m_magneticGraphics, PANEL_EDIT_OPTIONS_BASE::m_magneticPads, PANEL_EDIT_OPTIONS_BASE::m_mouseCmdsOSX, PANEL_EDIT_OPTIONS_BASE::m_mouseCmdsWinLin, and PANEL_EDIT_OPTIONS_BASE::m_optionsBook.

Member Function Documentation

◆ TransferDataFromWindow()

bool PANEL_EDIT_OPTIONS::TransferDataFromWindow ( )
overrideprotected

Definition at line 106 of file panel_edit_options.cpp.

107 {
109 
110  m_frame->SetRotationAngle( wxRound( 10.0 * wxAtof( m_rotationAngle->GetValue() ) ) );
111 
112  if( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) )
113  {
114  PCBNEW_SETTINGS& pcbnewSettings = m_frame->Settings();
115  MAGNETIC_SETTINGS& mag_opts = pcbnewSettings.m_MagneticItems;
116 
118  displ_opts.m_ShowModuleRatsnest = m_showSelectedRatsnest->GetValue();
119 
120  mag_opts.pads = static_cast<MAGNETIC_OPTIONS>( m_magneticPadChoice->GetSelection() );
121  mag_opts.tracks = static_cast<MAGNETIC_OPTIONS>( m_magneticTrackChoice->GetSelection() );
122  mag_opts.graphics = !m_magneticGraphicsChoice->GetSelection();
123 
124  pcbnewSettings.m_FlipLeftRight = m_flipLeftRight->GetValue();
125  pcbnewSettings.m_AutoRefillZones = m_autoRefillZones->GetValue();
126  pcbnewSettings.m_AllowFreePads = m_allowFreePads->GetValue();
127 
129 
130  if( m_rbTrackDragMove->GetValue() )
132  else if( m_rbTrackDrag45->GetValue() )
134  else if( m_rbTrackDragFree->GetValue() )
136 
137  pcbnewSettings.m_PcbUse45DegreeLimit = m_cbPcbGraphic45Mode->GetValue();
138  }
139  else if( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) )
140  {
142 
143  mag_opts->pads = m_magneticPads->GetValue() ? MAGNETIC_OPTIONS::CAPTURE_ALWAYS
145  mag_opts->graphics = m_magneticGraphics->GetValue();
146 
148  }
149 
150 
151  // Apply changes to the GAL
152  KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
153  KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
154  KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
155 
156  m_frame->SetDisplayOptions( displ_opts, false );
157  settings->LoadDisplayOptions( displ_opts, m_frame->ShowPageLimits() );
158 
160  []( KIGFX::VIEW_ITEM* aItem ) -> bool
161  {
162  return dynamic_cast<RATSNEST_VIEW_ITEM*>( aItem );
163  } );
165 
166  m_frame->GetCanvas()->Refresh();
167 
168  return true;
169 }
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1494
PCB_BASE_EDIT_FRAME * m_frame
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:76
Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:241
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
bool ShowPageLimits() const
Auxiliary rendering target (noncached)
Definition: definitions.h:49
PCB specific render settings.
Definition: pcb_painter.h:64
wxCheckBox * m_OptDisplayCurvedRatsnestLines
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
Container for display options like enable/disable some optional drawings.
Item needs to be redrawn.
Definition: view_item.h:52
TRACK_DRAG_ACTION m_TrackDragAction
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: pcb_painter.h:247
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:609
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
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...
MAGNETIC_OPTIONS pads
PCBNEW_SETTINGS & Settings()
void SetShowPageLimits(bool aShow)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
MAGNETIC_SETTINGS m_MagneticItems
void SetRotationAngle(int aRotationAngle)
Set the angle used for rotate operations.
MAGNETIC_OPTIONS tracks

References CAPTURE_ALWAYS, DRAG, DRAG_FREE_ANGLE, PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetDisplayOptions(), PCB_BASE_FRAME::GetMagneticItemsSettings(), KIGFX::VIEW::GetPainter(), KIGFX::PCB_PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), MAGNETIC_SETTINGS::graphics, PANEL_EDIT_OPTIONS_BASE::m_allowFreePads, PCBNEW_SETTINGS::m_AllowFreePads, PANEL_EDIT_OPTIONS_BASE::m_autoRefillZones, PCBNEW_SETTINGS::m_AutoRefillZones, PANEL_EDIT_OPTIONS_BASE::m_cbFpGraphic45Mode, PANEL_EDIT_OPTIONS_BASE::m_cbPcbGraphic45Mode, PCB_DISPLAY_OPTIONS::m_DisplayRatsnestLinesCurved, PANEL_EDIT_OPTIONS_BASE::m_flipLeftRight, PCBNEW_SETTINGS::m_FlipLeftRight, PCBNEW_SETTINGS::m_FpeditUse45DegreeLimit, m_frame, PANEL_EDIT_OPTIONS_BASE::m_magneticGraphics, 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, PCBNEW_SETTINGS::m_PcbUse45DegreeLimit, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDrag45, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDragFree, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDragMove, PANEL_EDIT_OPTIONS_BASE::m_rotationAngle, PCB_DISPLAY_OPTIONS::m_ShowModuleRatsnest, PANEL_EDIT_OPTIONS_BASE::m_showPageLimits, PANEL_EDIT_OPTIONS_BASE::m_showSelectedRatsnest, PCBNEW_SETTINGS::m_TrackDragAction, KIGFX::VIEW::MarkTargetDirty(), MOVE, NO_EFFECT, MAGNETIC_SETTINGS::pads, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::REPAINT, PCB_BASE_FRAME::SetDisplayOptions(), PCB_BASE_EDIT_FRAME::SetRotationAngle(), EDA_DRAW_FRAME::SetShowPageLimits(), PCB_BASE_FRAME::Settings(), EDA_DRAW_FRAME::ShowPageLimits(), KIGFX::TARGET_NONCACHED, MAGNETIC_SETTINGS::tracks, and KIGFX::VIEW::UpdateAllItemsConditionally().

◆ TransferDataToWindow()

bool PANEL_EDIT_OPTIONS::TransferDataToWindow ( )
overrideprotected

Definition at line 57 of file panel_edit_options.cpp.

58 {
59  const PCB_DISPLAY_OPTIONS& displ_opts = m_frame->GetDisplayOptions();
60  const PCBNEW_SETTINGS& general_opts = m_frame->Settings();
61 
62  wxString rotationAngle;
63  rotationAngle = AngleToStringDegrees( (double) m_frame->GetRotationAngle() );
64  m_rotationAngle->SetValue( rotationAngle );
65 
66  if( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) )
67  {
68  const MAGNETIC_SETTINGS& mag_opts = general_opts.m_MagneticItems;
69 
70  /* Set display options */
72  m_showSelectedRatsnest->SetValue( displ_opts.m_ShowModuleRatsnest );
73 
74  m_magneticPadChoice->SetSelection( static_cast<int>( mag_opts.pads ) );
75  m_magneticTrackChoice->SetSelection( static_cast<int>( mag_opts.tracks ) );
76  m_magneticGraphicsChoice->SetSelection( !mag_opts.graphics );
77 
78  m_flipLeftRight->SetValue( general_opts.m_FlipLeftRight );
79 
80  switch( general_opts.m_TrackDragAction )
81  {
82  case TRACK_DRAG_ACTION::MOVE: m_rbTrackDragMove->SetValue( true ); break;
83  case TRACK_DRAG_ACTION::DRAG: m_rbTrackDrag45->SetValue( true ); break;
84  case TRACK_DRAG_ACTION::DRAG_FREE_ANGLE: m_rbTrackDragFree->SetValue( true ); break;
85  }
86 
87  m_showPageLimits->SetValue( m_frame->ShowPageLimits() );
88  m_autoRefillZones->SetValue( general_opts.m_AutoRefillZones );
89  m_allowFreePads->SetValue( general_opts.m_AllowFreePads );
90 
91  m_cbPcbGraphic45Mode->SetValue( general_opts.m_PcbUse45DegreeLimit );
92  }
93  else if( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) )
94  {
96 
97  m_magneticPads->SetValue( mag_opts->pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS );
98  m_magneticGraphics->SetValue( mag_opts->graphics );
99  m_cbFpGraphic45Mode->SetValue( general_opts.m_FpeditUse45DegreeLimit );
100  }
101 
102  return true;
103 }
wxString AngleToStringDegrees(double aAngle)
A helper to convert the double aAngle (in internal unit) to a string in degrees.
PCB_BASE_EDIT_FRAME * m_frame
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
bool ShowPageLimits() const
wxCheckBox * m_OptDisplayCurvedRatsnestLines
Container for display options like enable/disable some optional drawings.
TRACK_DRAG_ACTION m_TrackDragAction
int GetRotationAngle() const
Return the angle used for rotate operations.
MAGNETIC_OPTIONS pads
PCBNEW_SETTINGS & Settings()
MAGNETIC_SETTINGS m_MagneticItems
MAGNETIC_OPTIONS tracks

References AngleToStringDegrees(), CAPTURE_ALWAYS, DRAG, DRAG_FREE_ANGLE, PCB_BASE_FRAME::GetDisplayOptions(), PCB_BASE_FRAME::GetMagneticItemsSettings(), PCB_BASE_EDIT_FRAME::GetRotationAngle(), MAGNETIC_SETTINGS::graphics, PANEL_EDIT_OPTIONS_BASE::m_allowFreePads, PCBNEW_SETTINGS::m_AllowFreePads, PANEL_EDIT_OPTIONS_BASE::m_autoRefillZones, PCBNEW_SETTINGS::m_AutoRefillZones, PANEL_EDIT_OPTIONS_BASE::m_cbFpGraphic45Mode, PANEL_EDIT_OPTIONS_BASE::m_cbPcbGraphic45Mode, PCB_DISPLAY_OPTIONS::m_DisplayRatsnestLinesCurved, PANEL_EDIT_OPTIONS_BASE::m_flipLeftRight, PCBNEW_SETTINGS::m_FlipLeftRight, PCBNEW_SETTINGS::m_FpeditUse45DegreeLimit, m_frame, PANEL_EDIT_OPTIONS_BASE::m_magneticGraphics, 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, PCBNEW_SETTINGS::m_PcbUse45DegreeLimit, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDrag45, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDragFree, PANEL_EDIT_OPTIONS_BASE::m_rbTrackDragMove, PANEL_EDIT_OPTIONS_BASE::m_rotationAngle, PCB_DISPLAY_OPTIONS::m_ShowModuleRatsnest, PANEL_EDIT_OPTIONS_BASE::m_showPageLimits, PANEL_EDIT_OPTIONS_BASE::m_showSelectedRatsnest, PCBNEW_SETTINGS::m_TrackDragAction, MOVE, MAGNETIC_SETTINGS::pads, PCB_BASE_FRAME::Settings(), EDA_DRAW_FRAME::ShowPageLimits(), and MAGNETIC_SETTINGS::tracks.

Member Data Documentation

◆ m_allowFreePads

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_allowFreePads
protectedinherited

◆ m_autoRefillZones

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_autoRefillZones
protectedinherited

◆ m_cbFpGraphic45Mode

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_cbFpGraphic45Mode
protectedinherited

◆ m_cbPcbGraphic45Mode

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_cbPcbGraphic45Mode
protectedinherited

◆ m_flipLeftRight

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_flipLeftRight
protectedinherited

◆ m_frame

PCB_BASE_EDIT_FRAME* PANEL_EDIT_OPTIONS::m_frame
private

◆ m_magneticGraphics

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_magneticGraphics
protectedinherited

◆ 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_mouseCmdsOSX

wxStaticBoxSizer* PANEL_EDIT_OPTIONS_BASE::m_mouseCmdsOSX
protectedinherited

◆ m_mouseCmdsWinLin

wxStaticBoxSizer* PANEL_EDIT_OPTIONS_BASE::m_mouseCmdsWinLin
protectedinherited

◆ m_OptDisplayCurvedRatsnestLines

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_OptDisplayCurvedRatsnestLines
protectedinherited

◆ m_optionsBook

wxSimplebook* PANEL_EDIT_OPTIONS_BASE::m_optionsBook
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_showPageLimits

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_showPageLimits
protectedinherited

◆ m_showSelectedRatsnest

wxCheckBox* PANEL_EDIT_OPTIONS_BASE::m_showSelectedRatsnest
protectedinherited

◆ m_staticText181

wxStaticText* PANEL_EDIT_OPTIONS_BASE::m_staticText181
protectedinherited

◆ m_staticText1811

wxStaticText* PANEL_EDIT_OPTIONS_BASE::m_staticText1811
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_staticText32

wxStaticText* PANEL_EDIT_OPTIONS_BASE::m_staticText32
protectedinherited

◆ m_staticText5

wxStaticText* PANEL_EDIT_OPTIONS_BASE::m_staticText5
protectedinherited

◆ m_staticTextRotationAngle

wxStaticText* PANEL_EDIT_OPTIONS_BASE::m_staticTextRotationAngle
protectedinherited

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