Consolidate common viewer actions across cvpcb and pcbnew frames

* Consolidate the measure tool into one tool (this gives cvpcb
  unit changing and snapping capabilities in its measure tool)
* Transition cvpcb to use actions for the sketch modes
* Replumb how magnetic items settings are stored and used
This commit is contained in:
Ian McInerney 2020-05-22 19:27:05 +01:00
parent 48ab1d1a93
commit 6692935808
42 changed files with 876 additions and 1129 deletions

View File

@ -490,6 +490,11 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/ratsnest_viewitem.cpp ${CMAKE_SOURCE_DIR}/pcbnew/ratsnest_viewitem.cpp
${CMAKE_SOURCE_DIR}/pcbnew/sel_layer.cpp ${CMAKE_SOURCE_DIR}/pcbnew/sel_layer.cpp
${CMAKE_SOURCE_DIR}/pcbnew/zone_settings.cpp ${CMAKE_SOURCE_DIR}/pcbnew/zone_settings.cpp
${CMAKE_SOURCE_DIR}/pcbnew/tools/grid_helper.cpp
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_actions.cpp
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_viewer_tools.cpp
widgets/net_selector.cpp widgets/net_selector.cpp
) )

View File

@ -28,7 +28,6 @@ set( CVPCB_DIALOGS
set( CVPCB_SRCS set( CVPCB_SRCS
${CMAKE_SOURCE_DIR}/common/base_units.cpp ${CMAKE_SOURCE_DIR}/common/base_units.cpp
${CMAKE_SOURCE_DIR}/pcbnew/tools/grid_helper.cpp
${CMAKE_SOURCE_DIR}/pcbnew/board_stackup_manager/stackup_predefined_prms.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_stackup_manager/stackup_predefined_prms.cpp
auto_associate.cpp auto_associate.cpp
cfg.cpp cfg.cpp
@ -45,7 +44,6 @@ set( CVPCB_SRCS
tools/cvpcb_actions.cpp tools/cvpcb_actions.cpp
tools/cvpcb_association_tool.cpp tools/cvpcb_association_tool.cpp
tools/cvpcb_control.cpp tools/cvpcb_control.cpp
tools/cvpcb_fpviewer_control.cpp
tools/cvpcb_fpviewer_selection_tool.cpp tools/cvpcb_fpviewer_selection_tool.cpp
) )

View File

@ -35,6 +35,10 @@ CVPCB_SETTINGS::CVPCB_SETTINGS() :
// Make Coverity happy: // Make Coverity happy:
m_FilterFootprint = 0; m_FilterFootprint = 0;
m_FootprintViewerMagneticSettings.pads = MAGNETIC_OPTIONS::NO_EFFECT;
m_FootprintViewerMagneticSettings.tracks = MAGNETIC_OPTIONS::NO_EFFECT;
m_FootprintViewerMagneticSettings.graphics = false;
// Init settings: // Init settings:
m_params.emplace_back( new PARAM<int>( "filter_footprint", &m_FilterFootprint, 0 ) ); m_params.emplace_back( new PARAM<int>( "filter_footprint", &m_FilterFootprint, 0 ) );
@ -52,6 +56,13 @@ CVPCB_SETTINGS::CVPCB_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.graphic_items_fill", m_params.emplace_back( new PARAM<bool>( "footprint_viewer.graphic_items_fill",
&m_FootprintViewerDisplayOptions.m_DisplayDrawItemsFill, true ) ); &m_FootprintViewerDisplayOptions.m_DisplayDrawItemsFill, true ) );
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.magnetic_graphics",
&m_FootprintViewerMagneticSettings.graphics, false ) );
m_params.emplace_back( new PARAM<int>( "footprint_viewer.magnetic_pads",
reinterpret_cast<int*>( &m_FootprintViewerMagneticSettings.pads ),
static_cast<int>( MAGNETIC_OPTIONS::NO_EFFECT ) ) );
} }

View File

@ -25,6 +25,7 @@
#define _CVPCB_SETTINGS_H #define _CVPCB_SETTINGS_H
#include <pcb_display_options.h> #include <pcb_display_options.h>
#include <pcbnew_settings.h>
#include <settings/app_settings.h> #include <settings/app_settings.h>
class CVPCB_SETTINGS : public APP_SETTINGS_BASE class CVPCB_SETTINGS : public APP_SETTINGS_BASE
@ -40,6 +41,8 @@ public:
PCB_DISPLAY_OPTIONS m_FootprintViewerDisplayOptions; PCB_DISPLAY_OPTIONS m_FootprintViewerDisplayOptions;
MAGNETIC_SETTINGS m_FootprintViewerMagneticSettings;
int m_FilterFootprint; int m_FilterFootprint;
protected: protected:

View File

@ -57,11 +57,13 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
auto& displ_opts = m_Parent->GetDisplayOptions(); auto& displ_opts = m_Parent->GetDisplayOptions();
m_EdgesDisplayOption->SetValue( not displ_opts.m_DisplayModEdgeFill );
m_TextDisplayOption->SetValue( not displ_opts.m_DisplayModTextFill );
m_ShowPadSketch->SetValue( not displ_opts.m_DisplayPadFill );
m_ShowPadNum->SetValue( displ_opts.m_DisplayPadNum ); m_ShowPadNum->SetValue( displ_opts.m_DisplayPadNum );
MAGNETIC_SETTINGS* magSettings = m_Parent->GetMagneticItemsSettings();
m_MagneticPads->SetValue( magSettings->pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS );
m_MagneticGraphics->SetValue( magSettings->graphics );
m_autoZoomOption->SetValue( m_Parent->GetAutoZoom() ); m_autoZoomOption->SetValue( m_Parent->GetAutoZoom() );
} }
@ -70,13 +72,17 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
{ {
PCB_DISPLAY_OPTIONS displ_opts = m_Parent->GetDisplayOptions(); PCB_DISPLAY_OPTIONS displ_opts = m_Parent->GetDisplayOptions();
displ_opts.m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue();
displ_opts.m_DisplayModTextFill = not m_TextDisplayOption->GetValue();
displ_opts.m_DisplayPadNum = m_ShowPadNum->GetValue(); displ_opts.m_DisplayPadNum = m_ShowPadNum->GetValue();
displ_opts.m_DisplayPadFill = not m_ShowPadSketch->GetValue();
m_Parent->ApplyDisplaySettingsToGAL(); m_Parent->ApplyDisplaySettingsToGAL();
m_Parent->SetDisplayOptions( displ_opts ); m_Parent->SetDisplayOptions( displ_opts );
MAGNETIC_SETTINGS* magSettings = m_Parent->GetMagneticItemsSettings();
magSettings->pads = m_MagneticPads->GetValue() ? MAGNETIC_OPTIONS::CAPTURE_ALWAYS
: MAGNETIC_OPTIONS::NO_EFFECT;
magSettings->graphics = m_MagneticGraphics->GetValue();
m_Parent->SetAutoZoom( m_autoZoomOption->GetValue() ); m_Parent->SetAutoZoom( m_autoZoomOption->GetValue() );
} }

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017) // C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -12,50 +12,56 @@
DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain; wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL ); bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperSizer; wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerLeft;
bSizerLeft = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbMagneticPoints;
sbMagneticPoints = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Magnetic Points") ), wxVERTICAL );
m_MagneticPads = new wxCheckBox( sbMagneticPoints->GetStaticBox(), wxID_ANY, _("Snap to pads"), wxDefaultPosition, wxDefaultSize, 0 );
sbMagneticPoints->Add( m_MagneticPads, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_MagneticGraphics = new wxCheckBox( sbMagneticPoints->GetStaticBox(), wxID_ANY, _("Snap to graphics"), wxDefaultPosition, wxDefaultSize, 0 );
sbMagneticPoints->Add( m_MagneticGraphics, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
bSizerLeft->Add( sbMagneticPoints, 1, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerDrawMode; wxStaticBoxSizer* sbSizerDrawMode;
sbSizerDrawMode = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Drawing Options") ), wxVERTICAL ); sbSizerDrawMode = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Drawing Options") ), wxVERTICAL );
m_EdgesDisplayOption = new wxCheckBox( sbSizerDrawMode->GetStaticBox(), wxID_ANY, _("Graphic items sketch mode"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerDrawMode->Add( m_EdgesDisplayOption, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_TextDisplayOption = new wxCheckBox( sbSizerDrawMode->GetStaticBox(), wxID_ANY, _("Texts sketch mode"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerDrawMode->Add( m_TextDisplayOption, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_ShowPadSketch = new wxCheckBox( sbSizerDrawMode->GetStaticBox(), ID_PADFILL_OPT, _("Pad sketch mode"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerDrawMode->Add( m_ShowPadSketch, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
sbSizerDrawMode->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_ShowPadNum = new wxCheckBox( sbSizerDrawMode->GetStaticBox(), wxID_ANY, _("Show pad &numbers"), wxDefaultPosition, wxDefaultSize, 0 ); m_ShowPadNum = new wxCheckBox( sbSizerDrawMode->GetStaticBox(), wxID_ANY, _("Show pad &numbers"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerDrawMode->Add( m_ShowPadNum, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbSizerDrawMode->Add( m_ShowPadNum, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bUpperSizer->Add( sbSizerDrawMode, 1, wxEXPAND|wxALL, 5 ); bSizerLeft->Add( sbSizerDrawMode, 1, wxEXPAND|wxALL, 5 );
bUpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerViewOpt; wxStaticBoxSizer* sbSizerViewOpt;
sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Auto-zoom") ), wxVERTICAL ); sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Auto-zoom") ), wxVERTICAL );
m_autoZoomOption = new wxCheckBox( sbSizerViewOpt->GetStaticBox(), wxID_ANY, _("Zoom to fit when changing footprint"), wxDefaultPosition, wxDefaultSize, 0 ); m_autoZoomOption = new wxCheckBox( sbSizerViewOpt->GetStaticBox(), wxID_ANY, _("Zoom to fit when changing footprint"), wxDefaultPosition, wxDefaultSize, 0 );
m_autoZoomOption->SetValue(true); m_autoZoomOption->SetValue(true);
sbSizerViewOpt->Add( m_autoZoomOption, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbSizerViewOpt->Add( m_autoZoomOption, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bUpperSizer->Add( sbSizerViewOpt, 1, wxALL|wxEXPAND, 5 ); bUpperSizer->Add( sbSizerViewOpt, 1, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bUpperSizer, 1, wxEXPAND|wxALL, 5 ); bSizerMain->Add( bUpperSizer, 1, wxEXPAND|wxALL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK ); m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK ); m_sdbSizer->AddButton( m_sdbSizerOK );
@ -64,14 +70,14 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize(); m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );
this->Layout(); this->Layout();
bSizerMain->Fit( this ); bSizerMain->Fit( this );
// Connect Events // Connect Events
m_sdbSizerApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); m_sdbSizerApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this );
} }
@ -80,5 +86,5 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(
{ {
// Disconnect Events // Disconnect Events
m_sdbSizerApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); m_sdbSizerApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this );
} }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="13" /> <FileVersion major="1" minor="15" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration"></property> <property name="class_decoration"></property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
@ -14,6 +14,7 @@
<property name="file">dialog_display_options_base</property> <property name="file">dialog_display_options_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">dialog_display_options_base</property> <property name="name">dialog_display_options_base</property>
<property name="namespace"></property> <property name="namespace"></property>
@ -52,42 +53,6 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizerMain</property> <property name="name">bSizerMain</property>
@ -104,377 +69,231 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Drawing Options</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">sbSizerDrawMode</property> <property name="name">bSizerLeft</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Graphic items sketch mode</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_EdgesDisplayOption</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Texts sketch mode</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_TextDisplayOption</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_PADFILL_OPT</property>
<property name="label">Pad sketch mode</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_ShowPadSketch</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="spacer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="height">0</property> <property name="id">wxID_ANY</property>
<property name="permission">protected</property> <property name="label">Magnetic Points</property>
<property name="width">0</property> <property name="minimum_size"></property>
<property name="name">sbMagneticPoints</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Snap to pads</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_MagneticPads</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Snap to graphics</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_MagneticGraphics</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">1</property>
<object class="wxCheckBox" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Show pad &amp;numbers</property> <property name="label">Drawing Options</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="name">sbSizerDrawMode</property>
<property name="name">m_ShowPadNum</property> <property name="orient">wxVERTICAL</property>
<property name="pane_border">1</property> <property name="parent">1</property>
<property name="pane_position"></property> <property name="permission">none</property>
<property name="pane_size"></property> <object class="sizeritem" expanded="1">
<property name="permission">protected</property> <property name="border">5</property>
<property name="pin_button">1</property> <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="pos"></property> <property name="proportion">0</property>
<property name="resize">Resizable</property> <object class="wxCheckBox" expanded="1">
<property name="show">1</property> <property name="BottomDockable">1</property>
<property name="size"></property> <property name="LeftDockable">1</property>
<property name="style"></property> <property name="RightDockable">1</property>
<property name="subclass"></property> <property name="TopDockable">1</property>
<property name="toolbar_pane">0</property> <property name="aui_layer"></property>
<property name="tooltip"></property> <property name="aui_name"></property>
<property name="validator_data_type"></property> <property name="aui_position"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="aui_row"></property>
<property name="validator_type">wxDefaultValidator</property> <property name="best_size"></property>
<property name="validator_variable"></property> <property name="bg"></property>
<property name="window_extra_style"></property> <property name="caption"></property>
<property name="window_name"></property> <property name="caption_visible">1</property>
<property name="window_style"></property> <property name="center_pane">0</property>
<event name="OnChar"></event> <property name="checked">0</property>
<event name="OnCheckBox"></event> <property name="close_button">1</property>
<event name="OnEnterWindow"></event> <property name="context_help"></property>
<event name="OnEraseBackground"></event> <property name="context_menu">1</property>
<event name="OnKeyDown"></event> <property name="default_pane">0</property>
<event name="OnKeyUp"></event> <property name="dock">Dock</property>
<event name="OnKillFocus"></event> <property name="dock_fixed">0</property>
<event name="OnLeaveWindow"></event> <property name="docking">Left</property>
<event name="OnLeftDClick"></event> <property name="enabled">1</property>
<event name="OnLeftDown"></event> <property name="fg"></property>
<event name="OnLeftUp"></event> <property name="floatable">1</property>
<event name="OnMiddleDClick"></event> <property name="font"></property>
<event name="OnMiddleDown"></event> <property name="gripper">0</property>
<event name="OnMiddleUp"></event> <property name="hidden">0</property>
<event name="OnMotion"></event> <property name="id">wxID_ANY</property>
<event name="OnMouseEvents"></event> <property name="label">Show pad &amp;numbers</property>
<event name="OnMouseWheel"></event> <property name="max_size"></property>
<event name="OnPaint"></event> <property name="maximize_button">0</property>
<event name="OnRightDClick"></event> <property name="maximum_size"></property>
<event name="OnRightDown"></event> <property name="min_size"></property>
<event name="OnRightUp"></event> <property name="minimize_button">0</property>
<event name="OnSetFocus"></event> <property name="minimum_size"></property>
<event name="OnSize"></event> <property name="moveable">1</property>
<event name="OnUpdateUI"></event> <property name="name">m_ShowPadNum</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>
@ -491,7 +310,6 @@
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
@ -554,30 +372,6 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
</object> </object>
@ -640,29 +434,6 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
@ -682,13 +453,6 @@
<property name="name">m_sdbSizer</property> <property name="name">m_sdbSizer</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<event name="OnApplyButtonClick">OnApplyClick</event> <event name="OnApplyButtonClick">OnApplyClick</event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object> </object>
</object> </object>
</object> </object>

View File

@ -1,12 +1,11 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017) // C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_DISPLAY_OPTIONS_BASE_H__ #pragma once
#define __DIALOG_DISPLAY_OPTIONS_BASE_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
@ -26,7 +25,6 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#define ID_PADFILL_OPT 1000
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE /// Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE
@ -34,11 +32,10 @@
class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM
{ {
private: private:
protected: protected:
wxCheckBox* m_EdgesDisplayOption; wxCheckBox* m_MagneticPads;
wxCheckBox* m_TextDisplayOption; wxCheckBox* m_MagneticGraphics;
wxCheckBox* m_ShowPadSketch;
wxCheckBox* m_ShowPadNum; wxCheckBox* m_ShowPadNum;
wxCheckBox* m_autoZoomOption; wxCheckBox* m_autoZoomOption;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
@ -46,16 +43,15 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerOK; wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerApply; wxButton* m_sdbSizerApply;
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(); ~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE();
}; };
#endif //__DIALOG_DISPLAY_OPTIONS_BASE_H__

View File

@ -32,6 +32,7 @@
#include <footprint_editor_settings.h> #include <footprint_editor_settings.h>
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <id.h> #include <id.h>
#include <kiface_i.h>
#include <lib_id.h> #include <lib_id.h>
#include <macros.h> #include <macros.h>
#include <msgpanel.h> #include <msgpanel.h>
@ -47,7 +48,8 @@
#include <cvpcb_mainframe.h> #include <cvpcb_mainframe.h>
#include <display_footprints_frame.h> #include <display_footprints_frame.h>
#include <tools/cvpcb_actions.h> #include <tools/cvpcb_actions.h>
#include <tools/cvpcb_fpviewer_control.h> #include <tools/pcb_actions.h>
#include <tools/pcb_viewer_tools.h> // shared tools with other pcbnew frames
#include <tools/cvpcb_fpviewer_selection_tool.h> #include <tools/cvpcb_fpviewer_selection_tool.h>
@ -113,8 +115,11 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
m_toolManager->RegisterTool( new COMMON_TOOLS ); m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new ZOOM_TOOL ); m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_CONTROL );
m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL ); m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL );
m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
m_toolManager->InitTools(); m_toolManager->InitTools();
// Run the control tool, it is supposed to be always active // Run the control tool, it is supposed to be always active
@ -190,28 +195,20 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
// TODO: these can be moved to the 'proper' right vertical toolbar if and when there are // TODO: these can be moved to the 'proper' right vertical toolbar if and when there are
// actual tools to put there. That, or I'll get around to implementing configurable // actual tools to put there. That, or I'll get around to implementing configurable
// toolbars. // toolbars.
m_optionsToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator(); m_optionsToolBar->AddSeparator();
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator(); m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
KiScaledBitmap( pad_sketch_xpm, this ), m_optionsToolBar->Add( PCB_ACTIONS::moduleTextOutlines, ACTION_TOOLBAR::TOGGLE );
_( "Show pads in outline mode" ), wxITEM_CHECK ); m_optionsToolBar->Add( PCB_ACTIONS::moduleEdgeOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString,
KiScaledBitmap( text_sketch_xpm, this ),
_( "Show texts in line mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString,
KiScaledBitmap( show_mod_edge_xpm, this ),
_( "Show outlines in line mode" ), wxITEM_CHECK );
m_optionsToolBar->Realize(); m_optionsToolBar->Realize();
} }
@ -296,6 +293,14 @@ WINDOW_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetWindowSettings( APP_SETTINGS_BASE*
} }
MAGNETIC_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetMagneticItemsSettings()
{
auto cfg = dynamic_cast<CVPCB_SETTINGS*>( Kiface().KifaceSettings() );
wxCHECK( cfg, nullptr );
return &cfg->m_FootprintViewerMagneticSettings;
}
void DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL() void DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL()
{ {
auto painter = static_cast<KIGFX::PCB_PAINTER*>( GetCanvas()->GetView()->GetPainter() ); auto painter = static_cast<KIGFX::PCB_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
@ -449,7 +454,7 @@ void DISPLAY_FOOTPRINTS_FRAME::SyncToolbars()
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::selectionTool, IsCurrentTool( ACTIONS::selectionTool ) ); m_optionsToolBar->Toggle( ACTIONS::selectionTool, IsCurrentTool( ACTIONS::selectionTool ) );
m_optionsToolBar->Toggle( ACTIONS::measureTool, IsCurrentTool( ACTIONS::measureTool ) ); m_optionsToolBar->Toggle( ACTIONS::measureTool, IsCurrentTool( ACTIONS::measureTool ) );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES ); m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES ); m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES );
m_optionsToolBar->Refresh(); m_optionsToolBar->Refresh();
} }
@ -464,3 +469,9 @@ COLOR_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetColorSettings()
else else
return Pgm().GetSettingsManager().GetColorSettings(); return Pgm().GetSettingsManager().GetColorSettings();
} }
BOARD_ITEM_CONTAINER* DISPLAY_FOOTPRINTS_FRAME::GetModel() const
{
return GetBoard()->GetFirstModule();
}

View File

@ -29,6 +29,7 @@
#define DISPLAY_FOOTPRINTS_FRAME_H #define DISPLAY_FOOTPRINTS_FRAME_H
#include <pcb_base_frame.h> #include <pcb_base_frame.h>
#include <pcbnew_settings.h>
// The name (for wxWidgets) of the footprint viewer frame // The name (for wxWidgets) of the footprint viewer frame
#define FOOTPRINTVIEWER_FRAME_NAME wxT( "FootprintViewerFrame" ) #define FOOTPRINTVIEWER_FRAME_NAME wxT( "FootprintViewerFrame" )
@ -61,6 +62,9 @@ public:
*/ */
void InitDisplay(); void InitDisplay();
///> @copydoc PCB_BASE_FRAME::GetModel()
BOARD_ITEM_CONTAINER* GetModel() const override;
/** /**
* update the gal canvas (view, colors ...) * update the gal canvas (view, colors ...)
*/ */
@ -71,6 +75,8 @@ public:
WINDOW_SETTINGS* GetWindowSettings( APP_SETTINGS_BASE* aCfg ) override; WINDOW_SETTINGS* GetWindowSettings( APP_SETTINGS_BASE* aCfg ) override;
MAGNETIC_SETTINGS* GetMagneticItemsSettings() override;
/// Updates the GAL with display settings changes /// Updates the GAL with display settings changes
void ApplyDisplaySettingsToGAL(); void ApplyDisplaySettingsToGAL();

View File

@ -1,56 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2016 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 2007-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <functional>
using namespace std::placeholders;
#include <tool/actions.h>
#include <tools/cvpcb_fpviewer_control.h>
CVPCB_FOOTPRINT_VIEWER_CONTROL::CVPCB_FOOTPRINT_VIEWER_CONTROL() :
TOOL_INTERACTIVE( "cvpcb.FootprintViewerControl" ),
m_frame( nullptr )
{
}
void CVPCB_FOOTPRINT_VIEWER_CONTROL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<DISPLAY_FOOTPRINTS_FRAME>();
}
int CVPCB_FOOTPRINT_VIEWER_CONTROL::Show3DViewer( const TOOL_EVENT& aEvent )
{
m_frame->CreateAndShow3D_Frame();
return 0;
}
void CVPCB_FOOTPRINT_VIEWER_CONTROL::setTransitions()
{
Go( &CVPCB_FOOTPRINT_VIEWER_CONTROL::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() );
}

View File

@ -1,59 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2016 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 2007-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef CVPCB_FOOTPRINT_VIEWER_CONTROL_H_
#define CVPCB_FOOTPRINT_VIEWER_CONTROL_H_
#include <display_footprints_frame.h>
#include <tool/tool_interactive.h>
/**
* CVPCB_FOOTPRINT_VIEWER_CONTROL
*
* Handles control actions for the cvpcb footprint display frame.
*/
class CVPCB_FOOTPRINT_VIEWER_CONTROL : public TOOL_INTERACTIVE
{
public:
CVPCB_FOOTPRINT_VIEWER_CONTROL();
~CVPCB_FOOTPRINT_VIEWER_CONTROL() {}
/// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override;
///> Show the 3D viewer with the currently selected footprint
int Show3DViewer( const TOOL_EVENT& aEvent );
///> Sets up handlers for various events.
void setTransitions() override;
private:
///> Pointer to the currently used edit/draw frame.
DISPLAY_FOOTPRINTS_FRAME* m_frame;
};
#endif

View File

@ -96,130 +96,24 @@ int CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
} }
int CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent ) int CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::UpdateMenu( const TOOL_EVENT& aEvent )
{ {
auto& view = *getView(); ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
auto& controls = *getViewControls(); CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
auto previous_settings = controls.GetSettings();
std::string tool = aEvent.GetCommandStr().get(); if( conditionalMenu )
m_frame->PushTool( tool ); conditionalMenu->Evaluate( m_selection );
Activate();
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr; if( actionMenu )
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() ); actionMenu->UpdateAll();
view.Add( &ruler );
view.SetVisible( &ruler, false );
bool originSet = false;
controls.ShowCursor( true );
controls.SetSnapping( true );
controls.SetAdditionalPanButtons( false, true );
while( TOOL_EVENT* evt = Wait() )
{
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
const VECTOR2I cursorPos = controls.GetCursorPosition();
auto clearRuler = [&]() {
view.SetVisible( &ruler, false );
controls.SetAutoPan( false );
controls.CaptureCursor( false );
originSet = false;
};
if( evt->IsCancelInteractive() )
{
if( originSet )
clearRuler();
else
{
m_frame->PopTool( tool );
break;
}
}
else if( evt->IsActivate() )
{
if( originSet )
clearRuler();
if( evt->IsMoveTool() )
{
// leave ourselves on the stack so we come back after the move
break;
}
else
{
m_frame->PopTool( tool );
break;
}
}
// click or drag starts
else if( !originSet && ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
{
if( !evt->IsDrag( BUT_LEFT ) )
{
twoPtMgr.SetOrigin( cursorPos );
twoPtMgr.SetEnd( cursorPos );
}
controls.CaptureCursor( true );
controls.SetAutoPan( true );
originSet = true;
}
else if( !originSet && evt->IsMotion() )
{
// make sure the origin is set before a drag starts
// otherwise you can miss a step
twoPtMgr.SetOrigin( cursorPos );
twoPtMgr.SetEnd( cursorPos );
}
// second click or mouse up after drag ends
else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
{
originSet = false;
controls.SetAutoPan( false );
controls.CaptureCursor( false );
view.SetVisible( &ruler, false );
}
// move or drag when origin set updates rules
else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
{
twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
twoPtMgr.SetEnd( cursorPos );
view.SetVisible( &ruler, true );
view.Update( &ruler, KIGFX::GEOMETRY );
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu( m_selection );
}
else
evt->SetPassEvent();
}
view.SetVisible( &ruler, false );
view.Remove( &ruler );
controls.ApplySettings( previous_settings );
return 0; return 0;
} }
void CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions() void CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions()
{ {
Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main, Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main,
CVPCB_ACTIONS::selectionActivate.MakeEvent() ); CVPCB_ACTIONS::selectionActivate.MakeEvent() );
Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool, ACTIONS::measureTool.MakeEvent() );
} }

View File

@ -62,8 +62,12 @@ public:
void clearSelection() {} void clearSelection() {}
///> Launches a tool to measure between points /**
int MeasureTool( const TOOL_EVENT& aEvent ); * Update the menu to reflect the current tool states.
*
* @param aEvent is the event generated by the tool framework
*/
int UpdateMenu( const TOOL_EVENT& aEvent );
///> Sets up handlers for various events. ///> Sets up handlers for various events.
void setTransitions() override; void setTransitions() override;

View File

@ -46,7 +46,8 @@ public:
BOARD_DESIGN_SETTINGS m_DesignSettings; BOARD_DESIGN_SETTINGS m_DesignSettings;
MAGNETIC_OPTIONS m_MagneticPads; // Only the magneticPads element is used
MAGNETIC_SETTINGS m_MagneticItems;
PCB_DISPLAY_OPTIONS m_Display; PCB_DISPLAY_OPTIONS m_Display;

View File

@ -210,16 +210,10 @@ enum main_id
ID_OFFCENTER_ZOOM_OUT, ID_OFFCENTER_ZOOM_OUT,
ID_ZOOM_END, ID_ZOOM_END,
// KiFace server for standalone operation
ID_EDA_SOCKET_EVENT_SERV, ID_EDA_SOCKET_EVENT_SERV,
ID_EDA_SOCKET_EVENT, ID_EDA_SOCKET_EVENT,
// Common to Pcbnew and CvPcb
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH,
ID_TB_OPTIONS_SHOW_PADS_SKETCH,
ID_DIALOG_ERC, ///< eeschema ERC modeless dialog ID ID_DIALOG_ERC, ///< eeschema ERC modeless dialog ID
// IDs specifics to a sub-application (Eeschema, Kicad manager....) start here // IDs specifics to a sub-application (Eeschema, Kicad manager....) start here

View File

@ -61,6 +61,7 @@ class PCB_PLOT_PARAMS;
class FP_LIB_TABLE; class FP_LIB_TABLE;
class PCBNEW_SETTINGS; class PCBNEW_SETTINGS;
class FOOTPRINT_EDITOR_SETTINGS; class FOOTPRINT_EDITOR_SETTINGS;
struct MAGNETIC_SETTINGS;
wxDECLARE_EVENT( BOARD_CHANGED, wxCommandEvent ); wxDECLARE_EVENT( BOARD_CHANGED, wxCommandEvent );
@ -219,6 +220,12 @@ public:
return m_Pcb; return m_Pcb;
} }
/**
* Function GetModel()
* @return the primary data model.
*/
virtual BOARD_ITEM_CONTAINER* GetModel() const = 0;
EDA_ITEM* GetItem( const KIID& aId ) override; EDA_ITEM* GetItem( const KIID& aId ) override;
void FocusOnItem( BOARD_ITEM* aItem ); void FocusOnItem( BOARD_ITEM* aItem );
@ -414,12 +421,9 @@ public:
FOOTPRINT_EDITOR_SETTINGS* GetFootprintEditorSettings(); FOOTPRINT_EDITOR_SETTINGS* GetFootprintEditorSettings();
void CommonSettingsChanged( bool aEnvVarsChanged ) override; virtual MAGNETIC_SETTINGS* GetMagneticItemsSettings();
void OnTogglePadDrawMode( wxCommandEvent& aEvent ); void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void OnToggleGraphicDrawMode( wxCommandEvent& aEvent );
void OnToggleEdgeDrawMode( wxCommandEvent& aEvent );
void OnToggleTextDrawMode( wxCommandEvent& aEvent );
// User interface update event handlers. // User interface update event handlers.
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent ); void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );

View File

@ -317,10 +317,8 @@ set( PCBNEW_CLASS_SRCS
tools/drawing_tool.cpp tools/drawing_tool.cpp
tools/edit_tool.cpp tools/edit_tool.cpp
tools/global_edit_tool.cpp tools/global_edit_tool.cpp
tools/grid_helper.cpp
tools/footprint_editor_tools.cpp tools/footprint_editor_tools.cpp
tools/pad_tool.cpp tools/pad_tool.cpp
tools/pcb_actions.cpp
tools/pcb_bright_box.cpp tools/pcb_bright_box.cpp
tools/pcb_editor_control.cpp tools/pcb_editor_control.cpp
tools/pcb_inspection_tool.cpp tools/pcb_inspection_tool.cpp

View File

@ -48,7 +48,7 @@ bool PANEL_MODEDIT_SETTINGS::TransferDataToWindow()
// Editing options // Editing options
m_Segments_45_Only_Ctrl->SetValue( m_frame->Settings().m_Use45DegreeGraphicSegments ); m_Segments_45_Only_Ctrl->SetValue( m_frame->Settings().m_Use45DegreeGraphicSegments );
m_MagneticPads->SetValue( m_MagneticPads->SetValue(
m_frame->Settings().m_MagneticPads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS ); m_frame->GetMagneticItemsSettings()->pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS );
return true; return true;
} }
@ -63,7 +63,7 @@ bool PANEL_MODEDIT_SETTINGS::TransferDataFromWindow()
// Editing options // Editing options
m_frame->Settings().m_Use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue(); m_frame->Settings().m_Use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue();
m_frame->Settings().m_MagneticPads = m_MagneticPads->GetValue() ? m_frame->GetMagneticItemsSettings()->pads = m_MagneticPads->GetValue() ?
MAGNETIC_OPTIONS::CAPTURE_ALWAYS : MAGNETIC_OPTIONS::NO_EFFECT; MAGNETIC_OPTIONS::CAPTURE_ALWAYS : MAGNETIC_OPTIONS::NO_EFFECT;
return true; return true;

View File

@ -57,9 +57,9 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow()
m_RotationAngle->SetValue( rotationAngle ); m_RotationAngle->SetValue( rotationAngle );
m_Segments_45_Only_Ctrl->SetValue( general_opts.m_Use45DegreeGraphicSegments ); m_Segments_45_Only_Ctrl->SetValue( general_opts.m_Use45DegreeGraphicSegments );
m_magneticPadChoice->SetSelection( static_cast<int>( general_opts.m_MagneticPads ) ); m_magneticPadChoice->SetSelection( static_cast<int>( general_opts.m_MagneticItems.pads ) );
m_magneticTrackChoice->SetSelection( static_cast<int>( general_opts.m_MagneticTracks ) ); m_magneticTrackChoice->SetSelection( static_cast<int>( general_opts.m_MagneticItems.tracks ) );
m_magneticGraphicsChoice->SetSelection( !general_opts.m_MagneticGraphics ); m_magneticGraphicsChoice->SetSelection( !general_opts.m_MagneticItems.graphics );
m_FlipLeftRight->SetValue( general_opts.m_FlipLeftRight ); m_FlipLeftRight->SetValue( general_opts.m_FlipLeftRight );
m_Show_Page_Limits->SetValue( m_Frame->ShowPageLimits() ); m_Show_Page_Limits->SetValue( m_Frame->ShowPageLimits() );
@ -76,12 +76,14 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow()
m_Frame->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) ); m_Frame->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) );
/* Updating the combobox to display the active layer. */
m_Frame->Settings().m_Use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue(); m_Frame->Settings().m_Use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue();
m_Frame->Settings().m_MagneticPads = (MAGNETIC_OPTIONS) m_magneticPadChoice->GetSelection();
m_Frame->Settings().m_MagneticTracks = (MAGNETIC_OPTIONS) m_magneticTrackChoice->GetSelection(); m_Frame->Settings().m_MagneticItems.pads =
m_Frame->Settings().m_MagneticGraphics = !m_magneticGraphicsChoice->GetSelection(); static_cast<MAGNETIC_OPTIONS>( m_magneticPadChoice->GetSelection() );
m_Frame->Settings().m_MagneticItems.tracks =
static_cast<MAGNETIC_OPTIONS>( m_magneticTrackChoice->GetSelection() );
m_Frame->Settings().m_MagneticItems.graphics = !m_magneticGraphicsChoice->GetSelection();
m_Frame->Settings().m_FlipLeftRight = m_FlipLeftRight->GetValue(); m_Frame->Settings().m_FlipLeftRight = m_FlipLeftRight->GetValue();
m_Frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() ); m_Frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() );

View File

@ -64,6 +64,7 @@
#include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/zoom_tool.h> #include <tool/zoom_tool.h>
#include <tools/pcb_viewer_tools.h>
#include <tools/position_relative_tool.h> #include <tools/position_relative_tool.h>
#include <widgets/infobar.h> #include <widgets/infobar.h>
#include <widgets/lib_tree.h> #include <widgets/lib_tree.h>
@ -476,6 +477,15 @@ COLOR_SETTINGS* FOOTPRINT_EDIT_FRAME::GetColorSettings()
} }
MAGNETIC_SETTINGS* FOOTPRINT_EDIT_FRAME::GetMagneticItemsSettings()
{
// Get the actual frame settings for magnetic items
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
wxCHECK( cfg, nullptr );
return &cfg->m_MagneticItems;
}
const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents() const const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents() const
{ {
MODULE* module = GetBoard()->GetFirstModule(); MODULE* module = GetBoard()->GetFirstModule();
@ -868,6 +878,7 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL ); m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
m_toolManager->RegisterTool( new PCBNEW_PICKER_TOOL ); m_toolManager->RegisterTool( new PCBNEW_PICKER_TOOL );
m_toolManager->RegisterTool( new POSITION_RELATIVE_TOOL ); m_toolManager->RegisterTool( new POSITION_RELATIVE_TOOL );
m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
m_toolManager->GetTool<SELECTION_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<SELECTION_TOOL>()->SetEditModules( true );
m_toolManager->GetTool<EDIT_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<EDIT_TOOL>()->SetEditModules( true );
@ -878,6 +889,7 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
m_toolManager->GetTool<PCBNEW_PICKER_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<PCBNEW_PICKER_TOOL>()->SetEditModules( true );
m_toolManager->GetTool<POSITION_RELATIVE_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<POSITION_RELATIVE_TOOL>()->SetEditModules( true );
m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
m_toolManager->InitTools(); m_toolManager->InitTools();
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );

View File

@ -59,7 +59,7 @@ public:
*/ */
static const wxChar* GetFootprintEditorFrameName(); static const wxChar* GetFootprintEditorFrameName();
///> @copydoc PCB_BASE_EDIT_FRAME::GetModel() ///> @copydoc PCB_BASE_FRAME::GetModel()
BOARD_ITEM_CONTAINER* GetModel() const override; BOARD_ITEM_CONTAINER* GetModel() const override;
/** /**
@ -79,6 +79,8 @@ public:
const PCB_PLOT_PARAMS& GetPlotSettings() const override; const PCB_PLOT_PARAMS& GetPlotSettings() const override;
void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ) override; void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ) override;
MAGNETIC_SETTINGS* GetMagneticItemsSettings() override;
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override; void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override; void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;

View File

@ -38,7 +38,7 @@ const int fpEditSchemaVersion = 1;
FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() : FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
APP_SETTINGS_BASE( "fpedit", fpEditSchemaVersion ), APP_SETTINGS_BASE( "fpedit", fpEditSchemaVersion ),
m_DesignSettings(), m_DesignSettings(),
m_MagneticPads(), m_MagneticItems(),
m_Display(), m_Display(),
m_UserGrid(), m_UserGrid(),
m_PolarCoords( false ), m_PolarCoords( false ),
@ -47,6 +47,10 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
m_LastImportExportPath(), m_LastImportExportPath(),
m_FootprintTextShownColumns() m_FootprintTextShownColumns()
{ {
m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL;
m_MagneticItems.tracks = MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL;
m_MagneticItems.graphics = false;
m_params.emplace_back( new PARAM<int>( "window.lib_width", m_params.emplace_back( new PARAM<int>( "window.lib_width",
&m_LibWidth, 250 ) ); &m_LibWidth, 250 ) );
@ -57,7 +61,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
&m_FootprintTextShownColumns, "0 1 2 3 4 5 6" ) ); &m_FootprintTextShownColumns, "0 1 2 3 4 5 6" ) );
m_params.emplace_back( new PARAM<int>( "editing.magnetic_pads", m_params.emplace_back( new PARAM<int>( "editing.magnetic_pads",
reinterpret_cast<int*>( &m_MagneticPads ), reinterpret_cast<int*>( &m_MagneticItems.pads ),
static_cast<int>( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ) ) ); static_cast<int>( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ) ) );
m_params.emplace_back( new PARAM<bool>( "editing.polar_coords", &m_PolarCoords, false ) ); m_params.emplace_back( new PARAM<bool>( "editing.polar_coords", &m_PolarCoords, false ) );

View File

@ -1014,3 +1014,9 @@ void FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer( wxCommandEvent& event )
{ {
Close( false ); Close( false );
} }
BOARD_ITEM_CONTAINER* FOOTPRINT_VIEWER_FRAME::GetModel() const
{
return GetBoard()->GetFirstModule();
}

View File

@ -50,6 +50,9 @@ protected:
public: public:
~FOOTPRINT_VIEWER_FRAME(); ~FOOTPRINT_VIEWER_FRAME();
///> @copydoc PCB_BASE_FRAME::GetModel()
BOARD_ITEM_CONTAINER* GetModel() const override;
/// Updates the GAL with display settings changes /// Updates the GAL with display settings changes
void ApplyDisplaySettingsToGAL(); void ApplyDisplaySettingsToGAL();

View File

@ -646,6 +646,12 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
} }
BOARD_ITEM_CONTAINER* FOOTPRINT_WIZARD_FRAME::GetModel() const
{
return GetBoard()->GetFirstModule();
}
void FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar() void FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar()
{ {
// Currently, there is no vertical toolbar // Currently, there is no vertical toolbar

View File

@ -76,6 +76,9 @@ public:
~FOOTPRINT_WIZARD_FRAME(); ~FOOTPRINT_WIZARD_FRAME();
///> @copydoc PCB_BASE_FRAME::GetModel()
BOARD_ITEM_CONTAINER* GetModel() const override;
MODULE* GetBuiltFootprint(); MODULE* GetBuiltFootprint();
/** /**

View File

@ -117,9 +117,6 @@ void PCB_BASE_EDIT_FRAME::unitsChangeRefresh()
PCB_BASE_FRAME::unitsChangeRefresh(); PCB_BASE_FRAME::unitsChangeRefresh();
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
if( m_toolManager )
m_toolManager->RunAction( PCB_ACTIONS::updateUnits, true );
} }

View File

@ -42,12 +42,6 @@ public:
virtual ~PCB_BASE_EDIT_FRAME(); virtual ~PCB_BASE_EDIT_FRAME();
/**
* Function GetModel()
* @return the primary data model.
*/
virtual BOARD_ITEM_CONTAINER* GetModel() const = 0;
/** /**
* Function CreateNewLibrary * Function CreateNewLibrary
* If a library name is given, creates a new footprint library in the project folder * If a library name is given, creates a new footprint library in the project folder

View File

@ -54,15 +54,11 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h>
#include <tools/pcb_actions.h> #include <tools/pcb_actions.h>
#include <pcbnew_settings.h>
wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent ); wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent );
BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME ) BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnTogglePadDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH, PCB_BASE_FRAME::OnToggleGraphicDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, PCB_BASE_FRAME::OnToggleEdgeDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, PCB_BASE_FRAME::OnToggleTextDrawMode )
EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid ) EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid )
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom ) EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom )
END_EVENT_TABLE() END_EVENT_TABLE()
@ -467,77 +463,6 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
} }
void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
{
auto displ_opts = GetDisplayOptions();
displ_opts.m_DisplayPadFill = !displ_opts.m_DisplayPadFill;
if( GetCanvas() )
{
// Apply new display options to the GAL canvas
auto view = static_cast<KIGFX::PCB_VIEW*>( GetCanvas()->GetView() );
view->UpdateDisplayOptions( displ_opts );
// Update pads
BOARD* board = GetBoard();
for( auto module : board->Modules() )
{
for( auto pad : module->Pads() )
view->Update( pad, KIGFX::GEOMETRY );
}
}
SetDisplayOptions( displ_opts );
GetCanvas()->Refresh();
}
void PCB_BASE_FRAME::OnToggleGraphicDrawMode( wxCommandEvent& aEvent )
{
auto displ_opts = GetDisplayOptions();
displ_opts.m_DisplayDrawItemsFill = !displ_opts.m_DisplayDrawItemsFill;
SetDisplayOptions( displ_opts );
GetCanvas()->Refresh();
}
void PCB_BASE_FRAME::OnToggleEdgeDrawMode( wxCommandEvent& aEvent )
{
auto displ_opts = GetDisplayOptions();
displ_opts.m_DisplayModEdgeFill = !displ_opts.m_DisplayModEdgeFill;
if( GetCanvas() )
{
// Apply new display options to the GAL canvas
auto view = static_cast<KIGFX::PCB_VIEW*>( GetCanvas()->GetView() );
view->UpdateDisplayOptions( displ_opts );
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
SetDisplayOptions( displ_opts );
GetCanvas()->Refresh();
}
void PCB_BASE_FRAME::OnToggleTextDrawMode( wxCommandEvent& aEvent )
{
auto displ_opts = GetDisplayOptions();
displ_opts.m_DisplayModTextFill = !displ_opts.m_DisplayModTextFill;
if( GetCanvas() )
{
// Apply new display options to the canvas
auto view = static_cast<KIGFX::PCB_VIEW*>( GetCanvas()->GetView() );
view->UpdateDisplayOptions( displ_opts );
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
SetDisplayOptions( displ_opts );
GetCanvas()->Refresh();
}
void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent ) void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
{ {
if( m_zoomSelectBox == NULL || m_zoomSelectBox->GetParent() == NULL ) if( m_zoomSelectBox == NULL || m_zoomSelectBox->GetParent() == NULL )
@ -717,6 +642,10 @@ void PCB_BASE_FRAME::unitsChangeRefresh()
{ {
EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar. EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar.
// Notify all tools the units have changed
if( m_toolManager )
m_toolManager->RunAction( PCB_ACTIONS::updateUnits, true );
UpdateGridSelectBox(); UpdateGridSelectBox();
} }
@ -775,6 +704,12 @@ FOOTPRINT_EDITOR_SETTINGS* PCB_BASE_FRAME::GetFootprintEditorSettings()
return Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>(); return Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
} }
MAGNETIC_SETTINGS* PCB_BASE_FRAME::GetMagneticItemsSettings()
{
wxCHECK( m_Settings, nullptr );
return &m_Settings->m_MagneticItems;
}
void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged ) void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
{ {

View File

@ -71,6 +71,7 @@
#include <tools/pcbnew_control.h> #include <tools/pcbnew_control.h>
#include <tools/pcb_editor_control.h> #include <tools/pcb_editor_control.h>
#include <tools/pcb_inspection_tool.h> #include <tools/pcb_inspection_tool.h>
#include <tools/pcb_viewer_tools.h>
#include <tools/placement_tool.h> #include <tools/placement_tool.h>
#include <tools/pad_tool.h> #include <tools/pad_tool.h>
#include <microwave/microwave_tool.h> #include <microwave/microwave_tool.h>
@ -455,6 +456,7 @@ void PCB_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new ZONE_FILLER_TOOL ); m_toolManager->RegisterTool( new ZONE_FILLER_TOOL );
m_toolManager->RegisterTool( new AUTOPLACE_TOOL ); m_toolManager->RegisterTool( new AUTOPLACE_TOOL );
m_toolManager->RegisterTool( new DRC ); m_toolManager->RegisterTool( new DRC );
m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
m_toolManager->InitTools(); m_toolManager->InitTools();
// Run the selection tool, it is supposed to be always active // Run the selection tool, it is supposed to be always active

View File

@ -668,7 +668,7 @@ public:
///> @copydoc PCB_BASE_FRAME::SetBoard() ///> @copydoc PCB_BASE_FRAME::SetBoard()
void SetBoard( BOARD* aBoard ) override; void SetBoard( BOARD* aBoard ) override;
///> @copydoc PCB_BASE_EDIT_FRAME::GetModel() ///> @copydoc PCB_BASE_FRAME::GetModel()
BOARD_ITEM_CONTAINER* GetModel() const override; BOARD_ITEM_CONTAINER* GetModel() const override;
///> @copydoc EDA_BASE_FRAME::GetSeverity() ///> @copydoc EDA_BASE_FRAME::GetSeverity()

View File

@ -47,11 +47,12 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() : APP_SETTINGS_BASE( "pcbnew", pcbnewSchemaVe
m_Use45DegreeGraphicSegments( false ), m_Use45DegreeGraphicSegments( false ),
m_FlipLeftRight( false ), m_FlipLeftRight( false ),
m_ShowPageLimits( true ), m_ShowPageLimits( true ),
m_MagneticPads( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ),
m_MagneticTracks( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ),
m_MagneticGraphics( true ),
m_PnsSettings( nullptr ) m_PnsSettings( nullptr )
{ {
m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL;
m_MagneticItems.tracks = MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL;
m_MagneticItems.graphics = false;
m_params.emplace_back( new PARAM<bool>( "aui.show_layer_manager", m_params.emplace_back( new PARAM<bool>( "aui.show_layer_manager",
&m_AuiPanels.show_layer_manager, true ) ); &m_AuiPanels.show_layer_manager, true ) );
@ -81,14 +82,14 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() : APP_SETTINGS_BASE( "pcbnew", pcbnewSchemaVe
m_params.emplace_back( new PARAM<bool>( "editing.flip_left_right", &m_FlipLeftRight, true ) ); m_params.emplace_back( new PARAM<bool>( "editing.flip_left_right", &m_FlipLeftRight, true ) );
m_params.emplace_back( m_params.emplace_back(
new PARAM<bool>( "editing.magnetic_graphics", &m_MagneticGraphics, true ) ); new PARAM<bool>( "editing.magnetic_graphics", &m_MagneticItems.graphics, true ) );
m_params.emplace_back( new PARAM<int>( "editing.magnetic_pads", m_params.emplace_back( new PARAM<int>( "editing.magnetic_pads",
reinterpret_cast<int*>( &m_MagneticPads ), reinterpret_cast<int*>( &m_MagneticItems.pads ),
static_cast<int>( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ) ) ); static_cast<int>( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ) ) );
m_params.emplace_back( new PARAM<int>( "editing.magnetic_tracks", m_params.emplace_back( new PARAM<int>( "editing.magnetic_tracks",
reinterpret_cast<int*>( &m_MagneticTracks ), reinterpret_cast<int*>( &m_MagneticItems.tracks ),
static_cast<int>( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ) ) ); static_cast<int>( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ) ) );
m_params.emplace_back( new PARAM<bool>( "editing.polar_coords", &m_PolarCoords, false ) ); m_params.emplace_back( new PARAM<bool>( "editing.polar_coords", &m_PolarCoords, false ) );

View File

@ -36,6 +36,20 @@ enum class MAGNETIC_OPTIONS
CAPTURE_ALWAYS CAPTURE_ALWAYS
}; };
struct MAGNETIC_SETTINGS
{
MAGNETIC_OPTIONS pads;
MAGNETIC_OPTIONS tracks;
bool graphics;
MAGNETIC_SETTINGS()
: pads( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ),
tracks( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ),
graphics( false )
{
}
};
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU) #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
typedef std::vector<std::pair<wxString, bool>> ACTION_PLUGIN_SETTINGS_LIST; typedef std::vector<std::pair<wxString, bool>> ACTION_PLUGIN_SETTINGS_LIST;
#endif #endif
@ -235,6 +249,8 @@ public:
PCB_DISPLAY_OPTIONS m_Display; PCB_DISPLAY_OPTIONS m_Display;
MAGNETIC_SETTINGS m_MagneticItems;
int m_FastGrid1; int m_FastGrid1;
int m_FastGrid2; int m_FastGrid2;
@ -254,12 +270,6 @@ public:
wxString m_FootprintTextShownColumns; wxString m_FootprintTextShownColumns;
MAGNETIC_OPTIONS m_MagneticPads;
MAGNETIC_OPTIONS m_MagneticTracks;
bool m_MagneticGraphics;
std::unique_ptr<PNS::ROUTING_SETTINGS> m_PnsSettings; std::unique_ptr<PNS::ROUTING_SETTINGS> m_PnsSettings;
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU) #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)

View File

@ -251,12 +251,12 @@ bool TOOL_BASE::checkSnap( ITEM *aItem )
auto& pnss = m_router->Settings(); auto& pnss = m_router->Settings();
pnss.SetSnapToPads( pnss.SetSnapToPads(
frame()->Settings().m_MagneticPads == MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL || frame()->GetMagneticItemsSettings()->pads == MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ||
frame()->Settings().m_MagneticPads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS ); frame()->GetMagneticItemsSettings()->pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS );
pnss.SetSnapToTracks( pnss.SetSnapToTracks(
frame()->Settings().m_MagneticTracks == MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL frame()->GetMagneticItemsSettings()->tracks == MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL
|| frame()->Settings().m_MagneticTracks == MAGNETIC_OPTIONS::CAPTURE_ALWAYS ); || frame()->GetMagneticItemsSettings()->tracks == MAGNETIC_OPTIONS::CAPTURE_ALWAYS );
if( aItem ) if( aItem )
{ {

View File

@ -56,7 +56,6 @@ using namespace std::placeholders;
#include <router/router_tool.h> #include <router/router_tool.h>
#include <dialogs/dialog_move_exact.h> #include <dialogs/dialog_move_exact.h>
#include <dialogs/dialog_track_via_properties.h> #include <dialogs/dialog_track_via_properties.h>
#include <preview_items/ruler_item.h>
#include <board_commit.h> #include <board_commit.h>
#include <zone_filler.h> #include <zone_filler.h>
@ -203,7 +202,7 @@ bool EDIT_TOOL::Init()
// Populate the context menu displayed during the edit tool (primarily the measure tool) // Populate the context menu displayed during the edit tool (primarily the measure tool)
auto activeToolCondition = [ this ] ( const SELECTION& aSel ) { auto activeToolCondition = [ this ] ( const SELECTION& aSel ) {
return frame()->ToolStackIsEmpty(); return !frame()->ToolStackIsEmpty();
}; };
auto frame = getEditFrame<PCB_BASE_FRAME>(); auto frame = getEditFrame<PCB_BASE_FRAME>();
@ -1286,134 +1285,6 @@ void EDIT_TOOL::FootprintFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector
} }
int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
{
if( EditingModules() && !frame()->GetModel())
return 0;
auto& view = *getView();
auto& controls = *getViewControls();
std::string tool = aEvent.GetCommandStr().get();
frame()->PushTool( tool );
Activate();
EDA_UNITS units = frame()->GetUserUnits();
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, units );
view.Add( &ruler );
view.SetVisible( &ruler, false );
GRID_HELPER grid( frame() );
bool originSet = false;
controls.ShowCursor( true );
controls.SetAutoPan( false );
controls.CaptureCursor( false );
while( auto evt = Wait() )
{
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
controls.SetSnapping( !evt->Modifier( MD_ALT ) );
const VECTOR2I cursorPos = grid.BestSnapAnchor( controls.GetMousePosition(), nullptr );
controls.ForceCursorPosition(true, cursorPos );
auto clearRuler = [&] () {
view.SetVisible( &ruler, false );
controls.SetAutoPan( false );
controls.CaptureCursor( false );
originSet = false;
};
if( evt->IsCancelInteractive() )
{
if( originSet )
clearRuler();
else
{
frame()->PopTool( tool );
break;
}
}
else if( evt->IsActivate() )
{
if( originSet )
clearRuler();
if( evt->IsMoveTool() )
{
// leave ourselves on the stack so we come back after the move
break;
}
else
{
frame()->PopTool( tool );
break;
}
}
// click or drag starts
else if( !originSet && ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
{
twoPtMgr.SetOrigin( cursorPos );
twoPtMgr.SetEnd( cursorPos );
controls.CaptureCursor( true );
controls.SetAutoPan( true );
originSet = true;
}
// second click or mouse up after drag ends
else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
{
originSet = false;
controls.SetAutoPan( false );
controls.CaptureCursor( false );
}
// move or drag when origin set updates rules
else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
{
twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
twoPtMgr.SetEnd( cursorPos );
view.SetVisible( &ruler, true );
view.Update( &ruler, KIGFX::GEOMETRY );
}
else if( evt->IsAction( &ACTIONS::toggleUnits )
|| evt->IsAction( &PCB_ACTIONS::updateUnits ) )
{
if( frame()->GetUserUnits() != units )
{
units = frame()->GetUserUnits();
ruler.SwitchUnits();
view.Update( &ruler, KIGFX::GEOMETRY );
}
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
}
else
evt->SetPassEvent();
}
view.SetVisible( &ruler, false );
view.Remove( &ruler );
return 0;
}
bool EDIT_TOOL::updateModificationPoint( PCBNEW_SELECTION& aSelection ) bool EDIT_TOOL::updateModificationPoint( PCBNEW_SELECTION& aSelection )
{ {
if( m_dragging && aSelection.HasReferencePoint() ) if( m_dragging && aSelection.HasReferencePoint() )
@ -1589,7 +1460,6 @@ void EDIT_TOOL::setTransitions()
Go( &EDIT_TOOL::ChangeTrackWidth, PCB_ACTIONS::changeTrackWidth.MakeEvent() ); Go( &EDIT_TOOL::ChangeTrackWidth, PCB_ACTIONS::changeTrackWidth.MakeEvent() );
Go( &EDIT_TOOL::EditFpInFpEditor, PCB_ACTIONS::editFootprintInFpEditor.MakeEvent() ); Go( &EDIT_TOOL::EditFpInFpEditor, PCB_ACTIONS::editFootprintInFpEditor.MakeEvent() );
Go( &EDIT_TOOL::MeasureTool, ACTIONS::measureTool.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, ACTIONS::copy.MakeEvent() ); Go( &EDIT_TOOL::copyToClipboard, ACTIONS::copy.MakeEvent() );
Go( &EDIT_TOOL::cutToClipboard, ACTIONS::cut.MakeEvent() ); Go( &EDIT_TOOL::cutToClipboard, ACTIONS::cut.MakeEvent() );

View File

@ -140,9 +140,6 @@ public:
*/ */
int CreateArray( const TOOL_EVENT& aEvent ); int CreateArray( const TOOL_EVENT& aEvent );
///> Launches a tool to measure between points
int MeasureTool( const TOOL_EVENT& aEvent );
/** /**
* Function FootprintFilter() * Function FootprintFilter()
* A selection filter which prunes the selection to contain only items of type PCB_MODULE_T * A selection filter which prunes the selection to contain only items of type PCB_MODULE_T

View File

@ -403,7 +403,7 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
{ {
// Getting pads from the module requires re-checking that the pad is shown // Getting pads from the module requires re-checking that the pad is shown
if( ( aFrom || if( ( aFrom ||
m_frame->Settings().m_MagneticPads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS ) m_frame->GetMagneticItemsSettings()->pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS )
&& pad->GetBoundingBox().Contains( wxPoint( aRefPos.x, aRefPos.y ) ) && pad->GetBoundingBox().Contains( wxPoint( aRefPos.x, aRefPos.y ) )
&& view->IsVisible( pad ) && view->IsVisible( pad )
&& ( !isHighContrast || activeLayers.count( pad->GetLayer() ) ) && ( !isHighContrast || activeLayers.count( pad->GetLayer() ) )
@ -421,7 +421,7 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
case PCB_PAD_T: case PCB_PAD_T:
{ {
if( aFrom || m_frame->Settings().m_MagneticPads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS ) if( aFrom || m_frame->GetMagneticItemsSettings()->pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS )
{ {
D_PAD* pad = static_cast<D_PAD*>( aItem ); D_PAD* pad = static_cast<D_PAD*>( aItem );
addAnchor( pad->GetPosition(), CORNER | SNAPPABLE, pad ); addAnchor( pad->GetPosition(), CORNER | SNAPPABLE, pad );
@ -433,7 +433,7 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
case PCB_LINE_T: case PCB_LINE_T:
{ {
if( !m_frame->Settings().m_MagneticGraphics ) if( !m_frame->GetMagneticItemsSettings()->graphics )
break; break;
DRAWSEGMENT* dseg = static_cast<DRAWSEGMENT*>( aItem ); DRAWSEGMENT* dseg = static_cast<DRAWSEGMENT*>( aItem );
@ -498,7 +498,7 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_ARC_T: case PCB_ARC_T:
{ {
if( aFrom || m_frame->Settings().m_MagneticTracks == MAGNETIC_OPTIONS::CAPTURE_ALWAYS ) if( aFrom || m_frame->GetMagneticItemsSettings()->tracks == MAGNETIC_OPTIONS::CAPTURE_ALWAYS )
{ {
TRACK* track = static_cast<TRACK*>( aItem ); TRACK* track = static_cast<TRACK*>( aItem );
VECTOR2I start = track->GetStart(); VECTOR2I start = track->GetStart();
@ -520,7 +520,7 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
case PCB_VIA_T: case PCB_VIA_T:
{ {
if( aFrom || m_frame->Settings().m_MagneticTracks == MAGNETIC_OPTIONS::CAPTURE_ALWAYS ) if( aFrom || m_frame->GetMagneticItemsSettings()->tracks == MAGNETIC_OPTIONS::CAPTURE_ALWAYS )
addAnchor( aItem->GetPosition(), ORIGIN | CORNER | SNAPPABLE, aItem ); addAnchor( aItem->GetPosition(), ORIGIN | CORNER | SNAPPABLE, aItem );
break; break;

View File

@ -0,0 +1,300 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pcb_base_frame.h>
#include <pcbnew_settings.h>
#include <preview_items/ruler_item.h>
#include <tool/actions.h>
#include <tools/grid_helper.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_viewer_tools.h>
#include <view/view_controls.h>
#include <wx/debug.h>
bool PCB_VIEWER_TOOLS::Init()
{
// Populate the context menu displayed during the tool (primarily the measure tool)
auto activeToolCondition =
[ this ] ( const SELECTION& aSel )
{
return !frame()->ToolStackIsEmpty();
};
auto& ctxMenu = m_menu.GetMenu();
// "Cancel" goes at the top of the context menu when a tool is active
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
ctxMenu.AddSeparator( 1 );
frame()->AddStandardSubMenus( m_menu );
return true;
}
void PCB_VIEWER_TOOLS::Reset( RESET_REASON aReason )
{
}
int PCB_VIEWER_TOOLS::Show3DViewer( const TOOL_EVENT& aEvent )
{
EDA_3D_VIEWER* draw3DFrame = frame()->CreateAndShow3D_Frame();
// Suppress warnings on non-Mac systems
[&draw3DFrame] {}();
if( frame()->IsType( FRAME_FOOTPRINT_VIEWER )
|| frame()->IsType( FRAME_FOOTPRINT_VIEWER_MODAL )
|| frame()->IsType( FRAME_FOOTPRINT_WIZARD ) )
{
frame()->Update3DView( true );
#ifdef __WXMAC__
// A stronger version of Raise() which promotes the window to its parent's level.
draw3DFrame->ReparentQuasiModal();
#endif
}
return 0;
}
template<class T> void Flip( T& aValue )
{
aValue = !aValue;
}
int PCB_VIEWER_TOOLS::PadDisplayMode( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
Flip( opts.m_DisplayPadFill );
frame()->SetDisplayOptions( opts );
view()->UpdateDisplayOptions( opts );
for( auto module : board()->Modules() )
{
for( auto pad : module->Pads() )
view()->Update( pad, KIGFX::GEOMETRY );
}
canvas()->Refresh();
return 0;
}
int PCB_VIEWER_TOOLS::ModuleEdgeOutlines( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
Flip( opts.m_DisplayModEdgeFill );
frame()->SetDisplayOptions( opts );
view()->UpdateDisplayOptions( opts );
for( auto module : board()->Modules() )
{
for( auto item : module->GraphicalItems() )
{
if( item->Type() == PCB_MODULE_EDGE_T )
view()->Update( item, KIGFX::GEOMETRY );
}
}
canvas()->Refresh();
return 0;
}
int PCB_VIEWER_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
Flip( opts.m_DisplayModTextFill );
frame()->SetDisplayOptions( opts );
view()->UpdateDisplayOptions( opts );
for( auto module : board()->Modules() )
{
view()->Update( &module->Reference(), KIGFX::GEOMETRY );
view()->Update( &module->Value(), KIGFX::GEOMETRY );
for( auto item : module->GraphicalItems() )
{
if( item->Type() == PCB_MODULE_TEXT_T )
view()->Update( item, KIGFX::GEOMETRY );
}
}
canvas()->Refresh();
return 0;
}
int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
{
if( IsFootprintFrame() && !frame()->GetModel() )
return 0;
auto& view = *getView();
auto& controls = *getViewControls();
std::string tool = aEvent.GetCommandStr().get();
frame()->PushTool( tool );
Activate();
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
EDA_UNITS units = frame()->GetUserUnits();
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, units );
view.Add( &ruler );
view.SetVisible( &ruler, false );
GRID_HELPER grid( frame() );
bool originSet = false;
controls.ShowCursor( true );
controls.SetAutoPan( false );
controls.CaptureCursor( false );
while( auto evt = Wait() )
{
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
controls.SetSnapping( !evt->Modifier( MD_ALT ) );
const VECTOR2I cursorPos = grid.BestSnapAnchor( controls.GetMousePosition(), nullptr );
controls.ForceCursorPosition(true, cursorPos );
auto clearRuler =
[&] ()
{
view.SetVisible( &ruler, false );
controls.SetAutoPan( false );
controls.CaptureCursor( false );
originSet = false;
};
if( evt->IsCancelInteractive() )
{
if( originSet )
clearRuler();
else
{
frame()->PopTool( tool );
break;
}
}
else if( evt->IsActivate() )
{
if( originSet )
clearRuler();
if( evt->IsMoveTool() )
{
// leave ourselves on the stack so we come back after the move
break;
}
else
{
frame()->PopTool( tool );
break;
}
}
// click or drag starts
else if( !originSet && ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
{
twoPtMgr.SetOrigin( cursorPos );
twoPtMgr.SetEnd( cursorPos );
controls.CaptureCursor( true );
controls.SetAutoPan( true );
originSet = true;
}
// second click or mouse up after drag ends
else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
{
originSet = false;
controls.SetAutoPan( false );
controls.CaptureCursor( false );
}
// move or drag when origin set updates rules
else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
{
twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
twoPtMgr.SetEnd( cursorPos );
view.SetVisible( &ruler, true );
view.Update( &ruler, KIGFX::GEOMETRY );
}
else if( evt->IsAction( &ACTIONS::toggleUnits )
|| evt->IsAction( &PCB_ACTIONS::updateUnits ) )
{
if( frame()->GetUserUnits() != units )
{
units = frame()->GetUserUnits();
ruler.SwitchUnits();
view.Update( &ruler, KIGFX::GEOMETRY );
canvas()->Refresh();
}
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
}
else
evt->SetPassEvent();
}
view.SetVisible( &ruler, false );
view.Remove( &ruler );
return 0;
}
void PCB_VIEWER_TOOLS::setTransitions()
{
Go( &PCB_VIEWER_TOOLS::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() );
// Display modes
Go( &PCB_VIEWER_TOOLS::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
Go( &PCB_VIEWER_TOOLS::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() );
Go( &PCB_VIEWER_TOOLS::ModuleTextOutlines, PCB_ACTIONS::moduleTextOutlines.MakeEvent() );
Go( &PCB_VIEWER_TOOLS::MeasureTool, ACTIONS::measureTool.MakeEvent() );
}

View File

@ -0,0 +1,117 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PCB_VIEWER_TOOLS_H_
#define PCB_VIEWER_TOOLS_H_
#include <class_board.h>
#include <tool/tool_interactive.h>
class PCB_BASE_FRAME;
/**
* PCB_VIEWER_TOOLS
*
* Tools useful for viewing footprints.
* This tool is designed to be lighter-weight so that it doesn't
* bring in as many pcbnew dependencies (since it is used in cvpcb).
*/
class PCB_VIEWER_TOOLS : public TOOL_INTERACTIVE
{
public:
PCB_VIEWER_TOOLS() :
TOOL_INTERACTIVE( "pcbnew.PCBViewerTools" ),
m_footprintFrame( false )
{}
~PCB_VIEWER_TOOLS() override {}
bool Init() override;
/// @copydoc TOOL_BASE::Reset()
void Reset( RESET_REASON aReason ) override;
///> Launches a tool to measure between points
int MeasureTool( const TOOL_EVENT& aEvent );
// Display modes
int PadDisplayMode( const TOOL_EVENT& aEvent );
int ModuleEdgeOutlines( const TOOL_EVENT& aEvent );
int ModuleTextOutlines( const TOOL_EVENT& aEvent );
/// Show the 3D viewer
int Show3DViewer( const TOOL_EVENT& aEvent );
///> Sets up handlers for various events.
void setTransitions() override;
/**
* Toggles edit module mode. When enabled, one may select parts of modules individually
* (graphics, pads, etc.), so they can be modified.
* @param aEnabled decides if the mode should be enabled.
*/
void SetFootprintFrame( bool aIsFrame )
{
m_footprintFrame = aIsFrame;
}
bool IsFootprintFrame() const
{
return m_footprintFrame;
}
protected:
bool m_footprintFrame; ///< Is this tool associated with a footprint frame
PCB_BASE_FRAME* frame() const
{
return getEditFrame<PCB_BASE_FRAME>();
}
KIGFX::PCB_VIEW* view() const
{
return static_cast<KIGFX::PCB_VIEW*>( getView() );
}
const PCB_DISPLAY_OPTIONS& displayOptions() const
{
return frame()->GetDisplayOptions();
}
PCB_DRAW_PANEL_GAL* canvas() const
{
return static_cast<PCB_DRAW_PANEL_GAL*>( frame()->GetCanvas() );
}
BOARD* board() const
{
return getModel<BOARD>();
}
MODULE* module() const
{
return board()->GetFirstModule();
}
};
#endif

View File

@ -169,26 +169,6 @@ int PCBNEW_CONTROL::ToggleRatsnest( const TOOL_EVENT& aEvent )
} }
int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
Flip( opts.m_DisplayPadFill );
m_frame->SetDisplayOptions( opts );
view()->UpdateDisplayOptions( opts );
for( auto module : board()->Modules() ) // fixme: move to PCB_VIEW
{
for( auto pad : module->Pads() )
view()->Update( pad, KIGFX::GEOMETRY );
}
canvas()->Refresh();
return 0;
}
int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
{ {
auto opts = displayOptions(); auto opts = displayOptions();
@ -228,55 +208,6 @@ int PCBNEW_CONTROL::GraphicDisplayMode( const TOOL_EVENT& aEvent )
} }
int PCBNEW_CONTROL::ModuleEdgeOutlines( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
Flip( opts.m_DisplayModEdgeFill );
m_frame->SetDisplayOptions( opts );
view()->UpdateDisplayOptions( opts );
for( auto module : board()->Modules() )
{
for( auto item : module->GraphicalItems() )
{
if( item->Type() == PCB_MODULE_EDGE_T )
view()->Update( item, KIGFX::GEOMETRY );
}
}
canvas()->Refresh();
return 0;
}
int PCBNEW_CONTROL::ModuleTextOutlines( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
Flip( opts.m_DisplayModTextFill );
m_frame->SetDisplayOptions( opts );
view()->UpdateDisplayOptions( opts );
for( auto module : board()->Modules() )
{
view()->Update( &module->Reference(), KIGFX::GEOMETRY );
view()->Update( &module->Value(), KIGFX::GEOMETRY );
for( auto item : module->GraphicalItems() )
{
if( item->Type() == PCB_MODULE_TEXT_T )
view()->Update( item, KIGFX::GEOMETRY );
}
}
canvas()->Refresh();
return 0;
}
int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
{ {
auto opts = displayOptions(); auto opts = displayOptions();
@ -1049,29 +980,6 @@ int PCBNEW_CONTROL::Redo( const TOOL_EVENT& aEvent )
} }
int PCBNEW_CONTROL::Show3DViewer( const TOOL_EVENT& aEvent )
{
EDA_3D_VIEWER* draw3DFrame = m_frame->CreateAndShow3D_Frame();
// Suppress warnings on non-Mac systems
[&draw3DFrame] {}();
if( m_frame->IsType( FRAME_FOOTPRINT_VIEWER )
|| m_frame->IsType( FRAME_FOOTPRINT_VIEWER_MODAL )
|| m_frame->IsType( FRAME_FOOTPRINT_WIZARD ) )
{
m_frame->Update3DView( true );
#ifdef __WXMAC__
// A stronger version of Raise() which promotes the window to its parent's level.
draw3DFrame->ReparentQuasiModal();
#endif
}
return 0;
}
void PCBNEW_CONTROL::updateGrid() void PCBNEW_CONTROL::updateGrid()
{ {
BASE_SCREEN* screen = m_frame->GetScreen(); BASE_SCREEN* screen = m_frame->GetScreen();
@ -1157,11 +1065,8 @@ void PCBNEW_CONTROL::setTransitions()
Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() ); Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() );
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() ); Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() );
Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::ModuleTextOutlines, PCB_ACTIONS::moduleTextOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() );
@ -1218,7 +1123,6 @@ void PCBNEW_CONTROL::setTransitions()
// Miscellaneous // Miscellaneous
Go( &PCBNEW_CONTROL::DeleteItemCursor, ACTIONS::deleteTool.MakeEvent() ); Go( &PCBNEW_CONTROL::DeleteItemCursor, ACTIONS::deleteTool.MakeEvent() );
Go( &PCBNEW_CONTROL::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() );
// Append control // Append control
Go( &PCBNEW_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() ); Go( &PCBNEW_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() );

View File

@ -58,11 +58,8 @@ public:
int ToggleRatsnest( const TOOL_EVENT& aEvent ); int ToggleRatsnest( const TOOL_EVENT& aEvent );
int ZoneDisplayMode( const TOOL_EVENT& aEvent ); int ZoneDisplayMode( const TOOL_EVENT& aEvent );
int TrackDisplayMode( const TOOL_EVENT& aEvent ); int TrackDisplayMode( const TOOL_EVENT& aEvent );
int PadDisplayMode( const TOOL_EVENT& aEvent );
int ViaDisplayMode( const TOOL_EVENT& aEvent ); int ViaDisplayMode( const TOOL_EVENT& aEvent );
int GraphicDisplayMode( const TOOL_EVENT& aEvent ); int GraphicDisplayMode( const TOOL_EVENT& aEvent );
int ModuleEdgeOutlines( const TOOL_EVENT& aEvent );
int ModuleTextOutlines( const TOOL_EVENT& aEvent );
int HighContrastMode( const TOOL_EVENT& aEvent ); int HighContrastMode( const TOOL_EVENT& aEvent );
// Layer control // Layer control
@ -91,7 +88,6 @@ public:
int Paste( const TOOL_EVENT& aEvent ); int Paste( const TOOL_EVENT& aEvent );
int AppendBoardFromFile( const TOOL_EVENT& aEvent ); int AppendBoardFromFile( const TOOL_EVENT& aEvent );
int AppendBoard( PLUGIN& pi, wxString& fileName ); int AppendBoard( PLUGIN& pi, wxString& fileName );
int Show3DViewer( const TOOL_EVENT& aEvent );
int UpdateMessagePanel( const TOOL_EVENT& aEvent ); int UpdateMessagePanel( const TOOL_EVENT& aEvent );
///> Sets up handlers for various events. ///> Sets up handlers for various events.