Gerbview, Excellon reader: add preference to configure default coordinates format. In Excellon drill files, the coordinate format is not specified, and sometimes units and zero option are even not specified, so some drill files cannot be read. In Preferences, default setting options are now added to specify by hand missing info.

This commit is contained in:
jean-pierre charras 2021-08-02 10:27:06 +02:00
parent f2241d25c6
commit 210671b10a
17 changed files with 1824 additions and 311 deletions

View File

@ -18,6 +18,8 @@ include_directories(
set( DIALOGS_SRCS
dialogs/panel_gerbview_display_options.cpp
dialogs/panel_gerbview_display_options_base.cpp
dialogs/panel_gerbview_excellon_settings.cpp
dialogs/panel_gerbview_excellon_settings_base.cpp
dialogs/panel_gerbview_settings.cpp
dialogs/panel_gerbview_settings_base.cpp
dialogs/dialog_layers_select_to_pcb.cpp

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/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -9,53 +9,53 @@
///////////////////////////////////////////////////////////////////////////
PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE::PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE::PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bDialogSizer;
bDialogSizer = new wxBoxSizer( wxVERTICAL );
m_UpperSizer = new wxBoxSizer( wxHORIZONTAL );
m_galOptionsSizer = new wxBoxSizer( wxVERTICAL );
m_UpperSizer->Add( m_galOptionsSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Annotations") ), wxVERTICAL );
m_OptDisplayDCodes = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show D codes"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptDisplayDCodes->SetValue(true);
m_OptDisplayDCodes->SetValue(true);
sbSizer1->Add( m_OptDisplayDCodes, 0, wxBOTTOM|wxLEFT, 5 );
bRightSizer->Add( sbSizer1, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Drawing Mode") ), wxVERTICAL );
m_OptDisplayFlashedItems = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Sketch flashed items"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_OptDisplayFlashedItems, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_OptDisplayLines = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Sketch lines"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_OptDisplayLines, 0, wxALL, 5 );
m_OptDisplayPolygons = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Sketch polygons"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_OptDisplayPolygons, 0, wxALL, 5 );
bRightSizer->Add( sbSizer2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_UpperSizer->Add( bRightSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bDialogSizer->Add( m_UpperSizer, 1, wxEXPAND, 5 );
this->SetSizer( bDialogSizer );
this->Layout();
bDialogSizer->Fit( this );

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="class_decoration" />
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
@ -16,9 +16,9 @@
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">PanelGerbviewDisplayOptions</property>
<property name="namespace"></property>
<property name="namespace" />
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="precompiled_header" />
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
@ -29,57 +29,57 @@
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="bg" />
<property name="context_help" />
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="font"></property>
<property name="fg" />
<property name="font" />
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="maximum_size" />
<property name="minimum_size" />
<property name="name">PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE</property>
<property name="pos"></property>
<property name="pos" />
<property name="size">-1,-1</property>
<property name="subclass">; forward_declare</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="tooltip" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style">wxTAB_TRAVERSAL</property>
<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="OnEnterWindow"></event>
<event name="OnEraseBackground"></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>
<event name="OnAuiFindManager" />
<event name="OnAuiPaneButton" />
<event name="OnAuiPaneClose" />
<event name="OnAuiPaneMaximize" />
<event name="OnAuiPaneRestore" />
<event name="OnAuiRender" />
<event name="OnChar" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnInitDialog" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="name">bDialogSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
@ -88,7 +88,7 @@
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="name">m_UpperSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
@ -97,7 +97,7 @@
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="name">m_galOptionsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
@ -108,7 +108,7 @@
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="name">bRightSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
@ -119,12 +119,12 @@
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Annotations</property>
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="name">sbSizer1</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<event name="OnUpdateUI" />
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT</property>
@ -134,83 +134,83 @@
<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="aui_layer" />
<property name="aui_name" />
<property name="aui_position" />
<property name="aui_row" />
<property name="best_size" />
<property name="bg" />
<property name="caption" />
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_help" />
<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="fg" />
<property name="floatable">1</property>
<property name="font"></property>
<property name="font" />
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show D codes</property>
<property name="max_size"></property>
<property name="max_size" />
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="maximum_size" />
<property name="min_size" />
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="moveable">1</property>
<property name="name">m_OptDisplayDCodes</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pane_position" />
<property name="pane_size" />
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="pos" />
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="size" />
<property name="style" />
<property name="subclass" />
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="tooltip" />
<property name="validator_data_type" />
<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>
<property name="validator_variable" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<event name="OnChar" />
<event name="OnCheckBox" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
</object>
</object>
</object>
@ -222,12 +222,12 @@
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Drawing Mode</property>
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="name">sbSizer2</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<event name="OnUpdateUI" />
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
@ -237,83 +237,83 @@
<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="aui_layer" />
<property name="aui_name" />
<property name="aui_position" />
<property name="aui_row" />
<property name="best_size" />
<property name="bg" />
<property name="caption" />
<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_help" />
<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="fg" />
<property name="floatable">1</property>
<property name="font"></property>
<property name="font" />
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Sketch flashed items</property>
<property name="max_size"></property>
<property name="max_size" />
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="maximum_size" />
<property name="min_size" />
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="moveable">1</property>
<property name="name">m_OptDisplayFlashedItems</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pane_position" />
<property name="pane_size" />
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="pos" />
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="size" />
<property name="style" />
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="tooltip" />
<property name="validator_data_type" />
<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>
<property name="validator_variable" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<event name="OnChar" />
<event name="OnCheckBox" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
</object>
</object>
<object class="sizeritem" expanded="1">
@ -325,83 +325,83 @@
<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="aui_layer" />
<property name="aui_name" />
<property name="aui_position" />
<property name="aui_row" />
<property name="best_size" />
<property name="bg" />
<property name="caption" />
<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_help" />
<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="fg" />
<property name="floatable">1</property>
<property name="font"></property>
<property name="font" />
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Sketch lines</property>
<property name="max_size"></property>
<property name="max_size" />
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="maximum_size" />
<property name="min_size" />
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="moveable">1</property>
<property name="name">m_OptDisplayLines</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pane_position" />
<property name="pane_size" />
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="pos" />
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="size" />
<property name="style" />
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="tooltip" />
<property name="validator_data_type" />
<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>
<property name="validator_variable" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<event name="OnChar" />
<event name="OnCheckBox" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
</object>
</object>
<object class="sizeritem" expanded="1">
@ -413,83 +413,83 @@
<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="aui_layer" />
<property name="aui_name" />
<property name="aui_position" />
<property name="aui_row" />
<property name="best_size" />
<property name="bg" />
<property name="caption" />
<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_help" />
<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="fg" />
<property name="floatable">1</property>
<property name="font"></property>
<property name="font" />
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Sketch polygons</property>
<property name="max_size"></property>
<property name="max_size" />
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="maximum_size" />
<property name="min_size" />
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="moveable">1</property>
<property name="name">m_OptDisplayPolygons</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pane_position" />
<property name="pane_size" />
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="pos" />
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="size" />
<property name="style" />
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="tooltip" />
<property name="validator_data_type" />
<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>
<property name="validator_variable" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<event name="OnChar" />
<event name="OnCheckBox" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
</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/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE_H__
#define __PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -27,10 +26,10 @@
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE : public wxPanel
class PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE : public wxPanel
{
private:
protected:
wxBoxSizer* m_UpperSizer;
wxBoxSizer* m_galOptionsSizer;
@ -38,12 +37,11 @@ class PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE : public wxPanel
wxCheckBox* m_OptDisplayFlashedItems;
wxCheckBox* m_OptDisplayLines;
wxCheckBox* m_OptDisplayPolygons;
public:
PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE();
};
#endif //__PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE_H__

View File

@ -0,0 +1,85 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2021 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerbview_settings.h>
#include "panel_gerbview_excellon_settings.h"
#include <widgets/paged_dialog.h>
PANEL_GERBVIEW_EXCELLON_SETTINGS::PANEL_GERBVIEW_EXCELLON_SETTINGS(
GERBVIEW_FRAME *aFrame, wxWindow* aWindow ) :
PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE( aWindow, wxID_ANY ),
m_Parent( aFrame )
{
}
bool PANEL_GERBVIEW_EXCELLON_SETTINGS::TransferDataToWindow( )
{
GERBVIEW_SETTINGS* config = static_cast<GERBVIEW_SETTINGS*>( m_Parent->config() );
EXCELLON_DEFAULTS curr_settings;
config->GetExcellonDefaults( curr_settings );
applySettingsToPanel( curr_settings );
return true;
}
bool PANEL_GERBVIEW_EXCELLON_SETTINGS::TransferDataFromWindow()
{
GERBVIEW_SETTINGS* config = static_cast<GERBVIEW_SETTINGS*>( m_Parent->config() );
config->m_ExcellonDefaults.m_UnitsMM = m_rbUnits->GetSelection() != 0;
config->m_ExcellonDefaults.m_LeadingZero = m_rbZeroFormat->GetSelection();
// The first value of these param is 2, not 0
#define FIRST_VALUE 2
config->m_ExcellonDefaults.m_MmIntegerLen = m_choiceIntegerMM->GetSelection()+FIRST_VALUE;
config->m_ExcellonDefaults.m_MmMantissaLen = m_choiceMantissaMM->GetSelection()+FIRST_VALUE;
config->m_ExcellonDefaults.m_InchIntegerLen = m_choiceIntegerInch->GetSelection()+FIRST_VALUE;
config->m_ExcellonDefaults.m_InchMantissaLen = m_choiceMantissaInch->GetSelection()+FIRST_VALUE;
return true;
}
void PANEL_GERBVIEW_EXCELLON_SETTINGS::ResetPanel()
{
EXCELLON_DEFAULTS defaults;
applySettingsToPanel( defaults );
}
void PANEL_GERBVIEW_EXCELLON_SETTINGS::applySettingsToPanel( const EXCELLON_DEFAULTS& aSettings )
{
m_rbUnits->SetSelection( aSettings.m_UnitsMM ? 1 : 0 );
m_rbZeroFormat->SetSelection( aSettings.m_LeadingZero );
// The first value of these param is 2, not 0
#define FIRST_VALUE 2
m_choiceIntegerMM->SetSelection( aSettings.m_MmIntegerLen-FIRST_VALUE );
m_choiceMantissaMM->SetSelection( aSettings.m_MmMantissaLen-FIRST_VALUE );
m_choiceIntegerInch->SetSelection( aSettings.m_InchIntegerLen-FIRST_VALUE );
m_choiceMantissaInch->SetSelection( aSettings.m_InchMantissaLen-FIRST_VALUE );
}

View File

@ -0,0 +1,49 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2021 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
*/
#pragma once
#include "panel_gerbview_excellon_settings_base.h"
class GERBVIEW_FRAME;
class GAL_OPTIONS_PANEL;
struct EXCELLON_DEFAULTS;
class PANEL_GERBVIEW_EXCELLON_SETTINGS : public PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE
{
public:
PANEL_GERBVIEW_EXCELLON_SETTINGS( GERBVIEW_FRAME* aFrame, wxWindow* aWindow );
~PANEL_GERBVIEW_EXCELLON_SETTINGS() {};
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void ResetPanel() override;
void applySettingsToPanel( const EXCELLON_DEFAULTS& aSettings );
GERBVIEW_FRAME* m_Parent;
};

View File

@ -0,0 +1,131 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "panel_gerbview_excellon_settings_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE::PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name )
{
wxBoxSizer* bDialogSizer;
bDialogSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerFileFormat;
sbSizerFileFormat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("File Format") ), wxVERTICAL );
m_staticText11 = new wxStaticText( sbSizerFileFormat->GetStaticBox(), wxID_ANY, _("These parameters are usually specified in files, but not always."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 );
sbSizerFileFormat->Add( m_staticText11, 0, wxALL, 5 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
wxString m_rbUnitsChoices[] = { _("Inches"), _("mm") };
int m_rbUnitsNChoices = sizeof( m_rbUnitsChoices ) / sizeof( wxString );
m_rbUnits = new wxRadioBox( sbSizerFileFormat->GetStaticBox(), wxID_ANY, _("File units"), wxDefaultPosition, wxDefaultSize, m_rbUnitsNChoices, m_rbUnitsChoices, 1, wxRA_SPECIFY_COLS );
m_rbUnits->SetSelection( 0 );
bSizer8->Add( m_rbUnits, 1, wxALL, 5 );
wxString m_rbZeroFormatChoices[] = { _("No leading zeros (TZ format)"), _("No trailing zeros (LZ format)") };
int m_rbZeroFormatNChoices = sizeof( m_rbZeroFormatChoices ) / sizeof( wxString );
m_rbZeroFormat = new wxRadioBox( sbSizerFileFormat->GetStaticBox(), wxID_ANY, _("Zero format"), wxDefaultPosition, wxDefaultSize, m_rbZeroFormatNChoices, m_rbZeroFormatChoices, 1, wxRA_SPECIFY_COLS );
m_rbZeroFormat->SetSelection( 0 );
m_rbZeroFormat->SetToolTip( _("Integers in files can have their zeros stripped.\nNo leading zeros format means the leading zeros are stripped\nNo trailing zeros format means the trainling zeros are stripped") );
bSizer8->Add( m_rbZeroFormat, 1, wxALL, 5 );
sbSizerFileFormat->Add( bSizer8, 1, wxEXPAND, 5 );
bDialogSizer->Add( sbSizerFileFormat, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bDialogSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
wxStaticBoxSizer* sbSizerCoordinates;
sbSizerCoordinates = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Coordinates Format") ), wxVERTICAL );
m_staticText6 = new wxStaticText( sbSizerCoordinates->GetStaticBox(), wxID_ANY, _("The coordinates format is not specified in Excellon format."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
sbSizerCoordinates->Add( m_staticText6, 0, wxALL, 5 );
m_staticText10 = new wxStaticText( sbSizerCoordinates->GetStaticBox(), wxID_ANY, _("(The decimal format does not use these settings)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText10->Wrap( -1 );
sbSizerCoordinates->Add( m_staticText10, 0, wxALL, 5 );
m_staticText7 = new wxStaticText( sbSizerCoordinates->GetStaticBox(), wxID_ANY, _("Usually: 3:3 in mm and 2:4 in inches"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
sbSizerCoordinates->Add( m_staticText7, 0, wxALL, 5 );
wxFlexGridSizer* fgSizerFmt;
fgSizerFmt = new wxFlexGridSizer( 0, 4, 0, 0 );
fgSizerFmt->SetFlexibleDirection( wxBOTH );
fgSizerFmt->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextUnitsmm = new wxStaticText( sbSizerCoordinates->GetStaticBox(), wxID_ANY, _("Format for mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitsmm->Wrap( -1 );
fgSizerFmt->Add( m_staticTextUnitsmm, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_choiceIntegerMMChoices[] = { _("2"), _("3"), _("4"), _("5"), _("6") };
int m_choiceIntegerMMNChoices = sizeof( m_choiceIntegerMMChoices ) / sizeof( wxString );
m_choiceIntegerMM = new wxChoice( sbSizerCoordinates->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceIntegerMMNChoices, m_choiceIntegerMMChoices, 0 );
m_choiceIntegerMM->SetSelection( 1 );
fgSizerFmt->Add( m_choiceIntegerMM, 0, wxALL, 5 );
m_staticText8 = new wxStaticText( sbSizerCoordinates->GetStaticBox(), wxID_ANY, _(":"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText8->Wrap( -1 );
fgSizerFmt->Add( m_staticText8, 0, wxALL, 5 );
wxString m_choiceMantissaMMChoices[] = { _("2"), _("3"), _("4"), _("5"), _("6") };
int m_choiceMantissaMMNChoices = sizeof( m_choiceMantissaMMChoices ) / sizeof( wxString );
m_choiceMantissaMM = new wxChoice( sbSizerCoordinates->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceMantissaMMNChoices, m_choiceMantissaMMChoices, 0 );
m_choiceMantissaMM->SetSelection( 1 );
fgSizerFmt->Add( m_choiceMantissaMM, 0, wxALL, 5 );
m_staticTextUnitsInch = new wxStaticText( sbSizerCoordinates->GetStaticBox(), wxID_ANY, _("Format for inches"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitsInch->Wrap( -1 );
fgSizerFmt->Add( m_staticTextUnitsInch, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_choiceIntegerInchChoices[] = { _("2"), _("3"), _("4"), _("5"), _("6") };
int m_choiceIntegerInchNChoices = sizeof( m_choiceIntegerInchChoices ) / sizeof( wxString );
m_choiceIntegerInch = new wxChoice( sbSizerCoordinates->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceIntegerInchNChoices, m_choiceIntegerInchChoices, 0 );
m_choiceIntegerInch->SetSelection( 0 );
fgSizerFmt->Add( m_choiceIntegerInch, 0, wxALL, 5 );
m_staticText9 = new wxStaticText( sbSizerCoordinates->GetStaticBox(), wxID_ANY, _(":"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9->Wrap( -1 );
fgSizerFmt->Add( m_staticText9, 0, wxALL, 5 );
wxString m_choiceMantissaInchChoices[] = { _("2"), _("3"), _("4"), _("5"), _("6") };
int m_choiceMantissaInchNChoices = sizeof( m_choiceMantissaInchChoices ) / sizeof( wxString );
m_choiceMantissaInch = new wxChoice( sbSizerCoordinates->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceMantissaInchNChoices, m_choiceMantissaInchChoices, 0 );
m_choiceMantissaInch->SetSelection( 2 );
fgSizerFmt->Add( m_choiceMantissaInch, 0, wxALL, 5 );
sbSizerCoordinates->Add( fgSizerFmt, 1, wxEXPAND, 5 );
bDialogSizer->Add( sbSizerCoordinates, 1, wxEXPAND, 5 );
this->SetSizer( bDialogSizer );
this->Layout();
// Connect Events
m_choiceIntegerMM->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE::onUnitsChange ), NULL, this );
m_choiceIntegerInch->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE::onUnitsChange ), NULL, this );
}
PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE::~PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE()
{
// Disconnect Events
m_choiceIntegerMM->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE::onUnitsChange ), NULL, this );
m_choiceIntegerInch->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE::onUnitsChange ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,64 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "widgets/resettable_panel.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/radiobox.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/statline.h>
#include <wx/choice.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE : public RESETTABLE_PANEL
{
private:
protected:
wxStaticText* m_staticText11;
wxRadioBox* m_rbUnits;
wxRadioBox* m_rbZeroFormat;
wxStaticLine* m_staticline1;
wxStaticText* m_staticText6;
wxStaticText* m_staticText10;
wxStaticText* m_staticText7;
wxStaticText* m_staticTextUnitsmm;
wxChoice* m_choiceIntegerMM;
wxStaticText* m_staticText8;
wxChoice* m_choiceMantissaMM;
wxStaticText* m_staticTextUnitsInch;
wxChoice* m_choiceIntegerInch;
wxStaticText* m_staticText9;
wxChoice* m_choiceMantissaInch;
// Virtual event handlers, overide them in your derived class
virtual void onUnitsChange( wxCommandEvent& event ) { event.Skip(); }
public:
PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 440,336 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE();
};

View File

@ -0,0 +1,60 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2021 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// Default format for coordinates: they are the default values, not the actual values
// defaut format is 3:3 in mm and 2:4 in inch
//
// number of digits in mantissa:
#define FMT_MANTISSA_MM 3
#define FMT_MANTISSA_INCH 4
// number of digits, integer part:
#define FMT_INTEGER_MM 3
#define FMT_INTEGER_INCH 2
/**
* management of default values used to read a Excellon (.nc) drill file
* Some important parameters are not defined in drill files, and some others
* can be missing in poor drill files.
* These default values are used when parameter is not found in file
*/
struct EXCELLON_DEFAULTS
{
bool m_UnitsMM; // false = inch, true = mm
bool m_LeadingZero; // True = LZ false = TZ
int m_MmIntegerLen; // number of digits for the integer part of a coordinate in mm
int m_MmMantissaLen; // number of digits for the mantissa part of a coordinate in mm
int m_InchIntegerLen; // number of digits for the integer part of a coordinate in inch
int m_InchMantissaLen; // number of digits for the mantissa part of a coordinate in inch
EXCELLON_DEFAULTS() { ResetToDefaults(); }
void ResetToDefaults()
{
m_UnitsMM = false;
m_LeadingZero = true;
m_MmIntegerLen = FMT_INTEGER_MM;
m_MmMantissaLen = FMT_MANTISSA_MM;
m_InchIntegerLen = FMT_INTEGER_INCH;
m_InchMantissaLen = FMT_MANTISSA_INCH;
}
};

View File

@ -25,6 +25,8 @@
#ifndef EXCELLON_IMAGE_H
#define EXCELLON_IMAGE_H
struct EXCELLON_DEFAULTS;
enum drill_M_code_t {
DRILL_M_UNKNOWN,
@ -155,10 +157,11 @@ public: EXCELLON_IMAGE( int layer ) :
*
* When the file cannot be loaded, warning and info messages are stored in m_Messages.
*
* @param aFullFileName is the full filename of the Gerber file.
* @param aFullFileName is the full filename of the Excellon file.
* @param aDefaults is the default values when not found in file.
* @return true if OK, false if the gerber file was not loaded.
*/
bool LoadFile( const wxString& aFullFileName );
bool LoadFile( const wxString& aFullFileName, EXCELLON_DEFAULTS* aDefaults );
private:
bool Execute_HEADER_And_M_Command( char*& text );
@ -190,7 +193,10 @@ private:
*/
void FinishRouteCommand();
void SelectUnits( bool aMetric );
/**
* Switch unit selection, and the coordinate format (nn:mm) if not yet set
*/
void SelectUnits( bool aMetric, EXCELLON_DEFAULTS* aDefaults );
private:
enum EXCELLON_STATE {
@ -204,6 +210,12 @@ private:
bool m_RouteModeOn; // true during a route mode (for instance a oval hole) or
// a cutout.
std::vector<EXCELLON_ROUTE_COORD> m_RoutePositions; // The list of points in a route mode
/// Excellon file do not have a format statement to specify the coordinate format
/// like nn:mm.
/// However Altium files have a comment to specify it (";FILE_FORMET_"
/// m_hasFormat is set to true if this comment is found, and coordinate format is known.
bool m_hasFormat;
};

View File

@ -69,24 +69,18 @@
#include <gerber_file_image.h>
#include <gerber_file_image_list.h>
#include <excellon_image.h>
#include <excellon_defaults.h>
#include <macros.h>
#include <string_utils.h>
#include <locale_io.h>
#include <X2_gerber_attributes.h>
#include <view/view.h>
#include <gerbview_settings.h>
#include <cmath>
#include <dialogs/html_messagebox.h>
// Default format for dimensions: they are the default values, not the actual values
// number of digits in mantissa:
static const int fmtMantissaMM = 3;
static const int fmtMantissaInch = 4;
// number of digits, integer part:
static const int fmtIntegerMM = 3;
static const int fmtIntegerInch = 2;
// A helper function to calculate the arc center of an arc
// known by 2 end points, the radius, and the angle direction (CW or CCW)
// Arc angles are <= 180 degrees in circular interpol.
@ -257,8 +251,12 @@ bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
std::unique_ptr<EXCELLON_IMAGE> drill_layer_uptr = std::make_unique<EXCELLON_IMAGE>( layerId );
EXCELLON_DEFAULTS nc_defaults;
GERBVIEW_SETTINGS* cfg = static_cast<GERBVIEW_SETTINGS*>( config() );
cfg->GetExcellonDefaults( nc_defaults );
// Read the Excellon drill file:
bool success = drill_layer_uptr->LoadFile( aFullFileName );
bool success = drill_layer_uptr->LoadFile( aFullFileName, &nc_defaults );
if( !success )
{
@ -300,7 +298,9 @@ bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
void EXCELLON_IMAGE::ResetDefaultValues()
{
GERBER_FILE_IMAGE::ResetDefaultValues();
SelectUnits( false ); // Default unit = inch
SelectUnits( false, nullptr ); // Default unit = inch
m_hasFormat = false; // will be true if a Altium file containing
// the nn:mm file format is read
// Files using non decimal can use No Trailing zeros or No leading Zeros
// Unfortunately, the identifier (INCH,TZ or INCH,LZ for instance) is not
@ -321,7 +321,7 @@ void EXCELLON_IMAGE::ResetDefaultValues()
* integer 2.4 format in imperial units,
* integer 3.2 or 3.3 format (metric units).
*/
bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName, EXCELLON_DEFAULTS* aDefaults )
{
// Set the default parameter values:
ResetDefaultValues();
@ -332,6 +332,10 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
if( m_Current_File == nullptr )
return false;
// Initial format setting, usualy defined in file, but not always...
m_NoTrailingZeros = aDefaults->m_LeadingZero;
m_GerbMetric = aDefaults->m_UnitsMM;
wxString msg;
m_FileName = aFullFileName;
@ -354,6 +358,9 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
if( m_State == EXCELLON_IMAGE::READ_HEADER_STATE )
{
Execute_HEADER_And_M_Command( text );
// Now units (inch/mm) are known, set the coordinate format
SelectUnits( m_GerbMetric, aDefaults );
}
else
{
@ -486,12 +493,12 @@ bool EXCELLON_IMAGE::Execute_HEADER_And_M_Command( char*& text )
break;
case DRILL_M_METRIC:
SelectUnits( true );
SelectUnits( true, nullptr );
break;
case DRILL_IMPERIAL_HEADER: // command like INCH,TZ or INCH,LZ
case DRILL_METRIC_HEADER: // command like METRIC,TZ or METRIC,LZ
SelectUnits( cmd->m_Code == DRILL_METRIC_HEADER ? true : false );
SelectUnits( cmd->m_Code == DRILL_METRIC_HEADER ? true : false, nullptr );
if( *text != ',' )
{
@ -915,7 +922,7 @@ bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text )
return success;
}
void EXCELLON_IMAGE::SelectUnits( bool aMetric )
void EXCELLON_IMAGE::SelectUnits( bool aMetric, EXCELLON_DEFAULTS* aDefaults )
{
/* Coordinates are measured either in inch or metric (millimeters).
* Inch coordinates are in six digits (00.0000) with increments
@ -928,6 +935,8 @@ void EXCELLON_IMAGE::SelectUnits( bool aMetric )
*
* Inches: Default fmt = 2.4 for X and Y axis: 6 digits with 0.0001 resolution
* metric: Default fmt = 3.3 for X and Y axis: 6 digits, 1 micron resolution
*
* However some drill files do not use standard values.
*/
if( aMetric )
{
@ -935,10 +944,19 @@ void EXCELLON_IMAGE::SelectUnits( bool aMetric )
if( !m_hasFormat )
{
// number of digits in mantissa
m_FmtScale.x = m_FmtScale.y = fmtMantissaMM;
// number of digits (mantissa+integer)
m_FmtLen.x = m_FmtLen.y = fmtIntegerMM + fmtMantissaMM;
if( aDefaults )
{
// number of digits in mantissa
m_FmtScale.x = m_FmtScale.y = aDefaults->m_MmMantissaLen;
// number of digits (mantissa+integer)
m_FmtLen.x = m_FmtLen.y = aDefaults->m_MmIntegerLen
+ aDefaults->m_MmMantissaLen;
}
else
{
m_FmtScale.x = m_FmtScale.y = FMT_MANTISSA_MM;
m_FmtLen.x = m_FmtLen.y = FMT_INTEGER_MM + FMT_MANTISSA_MM;
}
}
}
else
@ -947,8 +965,17 @@ void EXCELLON_IMAGE::SelectUnits( bool aMetric )
if( !m_hasFormat )
{
m_FmtScale.x = m_FmtScale.y = fmtMantissaInch;
m_FmtLen.x = m_FmtLen.y = fmtIntegerInch + fmtMantissaInch;
if( aDefaults )
{
m_FmtScale.x = m_FmtScale.y = aDefaults->m_InchMantissaLen;
m_FmtLen.x = m_FmtLen.y = aDefaults->m_InchIntegerLen
+ aDefaults->m_InchMantissaLen;
}
else
{
m_FmtScale.x = m_FmtScale.y = FMT_MANTISSA_INCH;
m_FmtLen.x = m_FmtLen.y = FMT_INTEGER_INCH + FMT_MANTISSA_INCH;
}
}
}
}

View File

@ -183,7 +183,6 @@ void GERBER_FILE_IMAGE::ResetDefaultValues()
m_ImageJustifyXCenter = false; // Image Justify Center on X axis (default = false)
m_ImageJustifyYCenter = false; // Image Justify Center on Y axis (default = false)
m_GerbMetric = false; // false = Inches (default), true = metric
m_hasFormat = false;
m_Relative = false; // false = absolute Coord,
// true = relative Coord
m_NoTrailingZeros = false; // true: trailing zeros deleted

View File

@ -379,7 +379,6 @@ public:
///< Image Justify Offset on XY axis (default = 0,0).
wxPoint m_ImageJustifyOffset;
bool m_GerbMetric; // false = Inches, true = metric
bool m_hasFormat;
///< false = absolute Coord, true = relative Coord.
bool m_Relative;

View File

@ -55,6 +55,7 @@
#include <widgets/paged_dialog.h>
#include <dialogs/panel_gerbview_settings.h>
#include <dialogs/panel_gerbview_display_options.h>
#include <dialogs/panel_gerbview_excellon_settings.h>
#include <panel_hotkeys_editor.h>
#include <wx/wupdlock.h>
#include <wx/treebook.h>
@ -1015,8 +1016,11 @@ void GERBVIEW_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
wxTreebook* book = aParent->GetTreebook();
book->AddPage( new wxPanel( book ), _( "GerbView" ) );
book->AddSubPage( new PANEL_GERBVIEW_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
book->AddSubPage( new PANEL_GERBVIEW_DISPLAY_OPTIONS( this, book ),
_( "Display Options" ) );
book->AddSubPage( new PANEL_GERBVIEW_SETTINGS( this, book ), _( "Editing Options" ) );
book->AddSubPage( new PANEL_GERBVIEW_EXCELLON_SETTINGS( this, book ),
_( "Excellon Options" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021 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
@ -67,6 +67,24 @@ GERBVIEW_SETTINGS::GERBVIEW_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "gerber_to_pcb_copperlayers_count",
&m_BoardLayersCount, 2 ) );
m_params.emplace_back( new PARAM<bool>( "excellon_defaults.unit_mm",
&m_ExcellonDefaults.m_UnitsMM, false ) );
m_params.emplace_back( new PARAM<bool>( "excellon_defaults.lz_format",
&m_ExcellonDefaults.m_LeadingZero, true ) );
m_params.emplace_back( new PARAM<int>( "excellon_defaults.mm_integer_len",
&m_ExcellonDefaults.m_MmIntegerLen, FMT_INTEGER_MM, 2 , 6 ) );
m_params.emplace_back( new PARAM<int>( "excellon_defaults.mm_mantissa_len",
&m_ExcellonDefaults.m_MmMantissaLen, FMT_MANTISSA_MM, 2 , 6 ) );
m_params.emplace_back( new PARAM<int>( "excellon_defaults.inch_integer_len",
&m_ExcellonDefaults.m_InchIntegerLen, FMT_INTEGER_INCH, 2 , 6 ) );
m_params.emplace_back( new PARAM<int>( "excellon_defaults.inch_mantissa_len",
&m_ExcellonDefaults.m_InchMantissaLen, FMT_MANTISSA_INCH, 2 , 6 ) );
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021 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
@ -25,6 +25,7 @@
#define _GERBVIEW_SETTINGS_H
#include <settings/app_settings.h>
#include <excellon_defaults.h>
class GERBVIEW_SETTINGS : public APP_SETTINGS_BASE
@ -44,6 +45,15 @@ public:
virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
/**
* return the Excellon default values to read a drill file
* @param aNCDefaults is the EXCELLON_DEFAULTS to store these prms
*/
void GetExcellonDefaults( EXCELLON_DEFAULTS& aNCDefaults )
{
aNCDefaults = m_ExcellonDefaults;
}
public:
APPEARANCE m_Appearance;
@ -62,6 +72,8 @@ public:
*/
std::vector<int> m_GerberToPcbLayerMapping;
EXCELLON_DEFAULTS m_ExcellonDefaults;
protected:
virtual std::string getLegacyFrameName() const override { return "GerberFrame"; }