Commit cfb354cb authored by jean-pierre charras's avatar jean-pierre charras

Gerbview: export to pcbnew enhancements and fixes.

parents e3505ff5 57604b0a
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#endif #endif
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2011-04-17)" #define KICAD_BUILD_VERSION "(2011-04-24)"
#endif #endif
......
...@@ -17,6 +17,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ...@@ -17,6 +17,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
set(DIALOGS_SRCS set(DIALOGS_SRCS
dialogs/gerbview_dialog_display_options_frame_base.cpp dialogs/gerbview_dialog_display_options_frame_base.cpp
dialogs/gerbview_dialog_display_options_frame.cpp dialogs/gerbview_dialog_display_options_frame.cpp
dialogs/dialog_layers_select_to_pcb_base.cpp
dialogs/dialog_print_using_printer.cpp dialogs/dialog_print_using_printer.cpp
dialogs/dialog_print_using_printer_base.cpp dialogs/dialog_print_using_printer_base.cpp
) )
......
...@@ -419,7 +419,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, ...@@ -419,7 +419,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
break; break;
case GBR_ARC: case GBR_ARC:
// Currently, arcs plotted witha rectangular aperture are not supported. // Currently, arcs plotted with a rectangular aperture are not supported.
// a round pen only is expected. // a round pen only is expected.
#if 0 // for arc debug only #if 0 // for arc debug only
GRLine( &aPanel->m_ClipBox, aDC, GetABPosition( m_Start ), GRLine( &aPanel->m_ClipBox, aDC, GetABPosition( m_Start ),
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_layers_select_to_pcb_base.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( LAYERS_MAP_DIALOG_BASE, wxDialog )
EVT_COMBOBOX( ID_M_COMBOCOPPERLAYERSCOUNT, LAYERS_MAP_DIALOG_BASE::_wxFB_OnBrdLayersCountSelection )
EVT_BUTTON( ID_STORE_CHOICE, LAYERS_MAP_DIALOG_BASE::_wxFB_OnStoreSetup )
EVT_BUTTON( ID_GET_PREVIOUS_CHOICE, LAYERS_MAP_DIALOG_BASE::_wxFB_OnGetSetup )
EVT_BUTTON( ID_RESET_CHOICE, LAYERS_MAP_DIALOG_BASE::_wxFB_OnResetClick )
EVT_BUTTON( wxID_CANCEL, LAYERS_MAP_DIALOG_BASE::_wxFB_OnCancelClick )
EVT_BUTTON( wxID_OK, LAYERS_MAP_DIALOG_BASE::_wxFB_OnOkClick )
END_EVENT_TABLE()
LAYERS_MAP_DIALOG_BASE::LAYERS_MAP_DIALOG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* sbUpperSizer;
sbUpperSizer = new wxBoxSizer( wxHORIZONTAL );
sbSizerLayersTable = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layers selection:") ), wxHORIZONTAL );
m_flexLeftColumnBoxSizer = new wxFlexGridSizer( 16, 4, 0, 0 );
m_flexLeftColumnBoxSizer->AddGrowableCol( 0 );
m_flexLeftColumnBoxSizer->AddGrowableCol( 1 );
m_flexLeftColumnBoxSizer->AddGrowableCol( 2 );
m_flexLeftColumnBoxSizer->AddGrowableCol( 3 );
m_flexLeftColumnBoxSizer->SetFlexibleDirection( wxBOTH );
m_flexLeftColumnBoxSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
sbSizerLayersTable->Add( m_flexLeftColumnBoxSizer, 1, wxEXPAND, 5 );
m_staticlineSep = new wxStaticLine( this, ID_M_STATICLINESEP, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
sbSizerLayersTable->Add( m_staticlineSep, 0, wxEXPAND | wxALL, 5 );
sbUpperSizer->Add( sbSizerLayersTable, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerLyrCnt;
bSizerLyrCnt = new wxBoxSizer( wxVERTICAL );
m_staticTextCopperlayerCount = new wxStaticText( this, ID_M_STATICTEXTCOPPERLAYERCOUNT, _("Copper layers count:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCopperlayerCount->Wrap( -1 );
bSizerLyrCnt->Add( m_staticTextCopperlayerCount, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_comboCopperLayersCount = new wxComboBox( this, ID_M_COMBOCOPPERLAYERSCOUNT, _("2 Layers"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_comboCopperLayersCount->Append( _("2 Layers") );
m_comboCopperLayersCount->Append( _("4 Layers") );
m_comboCopperLayersCount->Append( _("6 Layers") );
m_comboCopperLayersCount->Append( _("8 Layers") );
m_comboCopperLayersCount->Append( _("10 Layers") );
m_comboCopperLayersCount->Append( _("12 Layers") );
m_comboCopperLayersCount->Append( _("14 Layers") );
m_comboCopperLayersCount->Append( _("16 Layers") );
bSizerLyrCnt->Add( m_comboCopperLayersCount, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bRightSizer->Add( bSizerLyrCnt, 0, wxEXPAND, 5 );
bRightSizer->Add( 5, 15, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxVERTICAL );
m_buttonStore = new wxButton( this, ID_STORE_CHOICE, _("Store Choice"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonStore, 0, wxALL|wxEXPAND, 5 );
m_buttonRetrieve = new wxButton( this, ID_GET_PREVIOUS_CHOICE, _("Get Stored Choice"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonRetrieve, 0, wxALL|wxEXPAND, 5 );
m_buttonReset = new wxButton( this, ID_RESET_CHOICE, _("Reset"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonReset, 0, wxALL|wxEXPAND, 5 );
bRightSizer->Add( bSizerButtons, 0, wxEXPAND, 5 );
sbUpperSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizerMain->Add( sbUpperSizer, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
bSizerMain->Add( m_sdbSizerButtons, 0, wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
}
LAYERS_MAP_DIALOG_BASE::~LAYERS_MAP_DIALOG_BASE()
{
}
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_python_events">0</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">table</property>
<property name="file">dialog_layers_select_to_pcb_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_layers_select_to_pcb_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" 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_managed">0</property>
<property name="aui_name"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center">wxBOTH</property>
<property name="center_pane">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="event_handler">impl_virtual</property>
<property name="extra_style"></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_LAYERS_MAP_DIALOG_BASE</property>
<property name="layer"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">LAYERS_MAP_DIALOG_BASE</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size">400,286</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Layer selection:</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="OnActivate"></event>
<event name="OnActivateApp"></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">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sbUpperSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Layers selection:</property>
<property name="minimum_size"></property>
<property name="name">sbSizerLayersTable</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">4</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">0,1,2,3</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">m_flexLeftColumnBoxSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="rows">16</property>
<property name="vgap">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" 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_name"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">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_M_STATICLINESEP</property>
<property name="layer"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticlineSep</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="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_VERTICAL</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="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">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bRightSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerLyrCnt</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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_name"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">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_M_STATICTEXTCOPPERLAYERCOUNT</property>
<property name="label">Copper layers count:</property>
<property name="layer"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextCopperlayerCount</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="position"></property>
<property name="resize">Resizable</property>
<property name="row"></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>
<property name="wrap">-1</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 class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxComboBox" 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_name"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;2 Layers&quot; &quot;4 Layers&quot; &quot;6 Layers&quot; &quot;8 Layers&quot; &quot;10 Layers&quot; &quot;12 Layers&quot; &quot;14 Layers&quot; &quot;16 Layers&quot;</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_M_COMBOCOPPERLAYERSCOUNT</property>
<property name="layer"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_comboCopperLayersCount</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="position"></property>
<property name="resize">Resizable</property>
<property name="row"></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="value">2 Layers</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCombobox">OnBrdLayersCountSelection</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="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">15</property>
<property name="permission">protected</property>
<property name="width">5</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerButtons</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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_name"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</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_STORE_CHOICE</property>
<property name="label">Store Choice</property>
<property name="layer"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonStore</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="position"></property>
<property name="resize">Resizable</property>
<property name="row"></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="OnButtonClick">OnStoreSetup</event>
<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 class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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_name"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</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_GET_PREVIOUS_CHOICE</property>
<property name="label">Get Stored Choice</property>
<property name="layer"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonRetrieve</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="position"></property>
<property name="resize">Resizable</property>
<property name="row"></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="OnButtonClick">OnGetSetup</event>
<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 class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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_name"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</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_RESET_CHOICE</property>
<property name="label">Reset</property>
<property name="layer"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonReset</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="position"></property>
<property name="resize">Resizable</property>
<property name="row"></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="OnButtonClick">OnResetClick</event>
<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>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticLine" 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_name"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">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="layer"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline1</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="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</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="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">wxALIGN_RIGHT|wxALL</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizerButtons</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelClick</event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOkClick</event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_layers_select_to_pcb_base__
#define __dialog_layers_select_to_pcb_base__
#include <wx/intl.h>
#include <wx/sizer.h>
#include <wx/gdicmn.h>
#include <wx/statline.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/combobox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class LAYERS_MAP_DIALOG_BASE
///////////////////////////////////////////////////////////////////////////////
class LAYERS_MAP_DIALOG_BASE : public wxDialog
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnBrdLayersCountSelection( wxCommandEvent& event ){ OnBrdLayersCountSelection( event ); }
void _wxFB_OnStoreSetup( wxCommandEvent& event ){ OnStoreSetup( event ); }
void _wxFB_OnGetSetup( wxCommandEvent& event ){ OnGetSetup( event ); }
void _wxFB_OnResetClick( wxCommandEvent& event ){ OnResetClick( event ); }
void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); }
protected:
enum
{
ID_LAYERS_MAP_DIALOG_BASE = 1000,
ID_M_STATICLINESEP,
ID_M_STATICTEXTCOPPERLAYERCOUNT,
ID_M_COMBOCOPPERLAYERSCOUNT,
ID_STORE_CHOICE,
ID_GET_PREVIOUS_CHOICE,
ID_RESET_CHOICE,
};
wxStaticBoxSizer* sbSizerLayersTable;
wxFlexGridSizer* m_flexLeftColumnBoxSizer;
wxStaticLine* m_staticlineSep;
wxStaticText* m_staticTextCopperlayerCount;
wxComboBox* m_comboCopperLayersCount;
wxButton* m_buttonStore;
wxButton* m_buttonRetrieve;
wxButton* m_buttonReset;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnBrdLayersCountSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnStoreSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGetSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnResetClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
LAYERS_MAP_DIALOG_BASE( wxWindow* parent, wxWindowID id = ID_LAYERS_MAP_DIALOG_BASE, const wxString& title = _("Layer selection:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,286 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~LAYERS_MAP_DIALOG_BASE();
};
#endif //__dialog_layers_select_to_pcb_base__
...@@ -10,13 +10,50 @@ ...@@ -10,13 +10,50 @@
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "trigo.h"
#include "gerbview.h" #include "gerbview.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "class_gerber_draw_item.h" #include "class_gerber_draw_item.h"
#include "select_layers_to_pcb.h"
/* A helper class to export a Gerber set of files to Pcbnew
*/
class GBR_TO_PCB_EXPORTER
{
GERBVIEW_FRAME* m_gerbview_frame; // the maint gerber frame
FILE * m_file; // .brd file to write to
BOARD* m_pcb; // the board to populate and export
public:
GBR_TO_PCB_EXPORTER(GERBVIEW_FRAME * aFrame, FILE * aFile );
~GBR_TO_PCB_EXPORTER();
bool ExportPcb( int* LayerLookUpTable );
BOARD* GetBoard() { return m_pcb; }
private:
bool WriteSetup( ); // Write the SETUP section data file
bool WriteGeneralDescrPcb( );
void export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void cleanBoard();
};
GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile )
{
m_gerbview_frame = aFrame;
m_file = aFile;
m_pcb = new BOARD( NULL, m_gerbview_frame );
}
GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER()
{
delete m_pcb;
}
static int SavePcbFormatAscii( GERBVIEW_FRAME* frame,
FILE* File, int* LayerLookUpTable );
/* Export data in pcbnew format /* Export data in pcbnew format
...@@ -45,8 +82,6 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) ...@@ -45,8 +82,6 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
wxString PcbExt( wxT( ".brd" ) ); wxString PcbExt( wxT( ".brd" ) );
FILE* dest;
msg = wxT( "*" ) + PcbExt; msg = wxT( "*" ) + PcbExt;
FullFileName = EDA_FileSelector( _( "Board file name:" ), FullFileName = EDA_FileSelector( _( "Board file name:" ),
wxEmptyString, wxEmptyString,
...@@ -60,61 +95,96 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) ...@@ -60,61 +95,96 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
if( FullFileName == wxEmptyString ) if( FullFileName == wxEmptyString )
return; return;
int* LayerLookUpTable; /* Install a dialog frame to choose the mapping
if( ( LayerLookUpTable = InstallDialogLayerPairChoice( ) ) != NULL ) * between gerber layers and pcbnew layers
*/
LAYERS_MAP_DIALOG* dlg = new LAYERS_MAP_DIALOG( this );
int ok = dlg->ShowModal();
dlg->Destroy();
if( ok != wxID_OK )
return;
if( wxFileExists( FullFileName ) )
{ {
if( wxFileExists( FullFileName ) ) if( !IsOK( this, _( "Ok to change the existing file ?" ) ) )
{
if( !IsOK( this, _( "Ok to change the existing file ?" ) ) )
return;
}
dest = wxFopen( FullFileName, wxT( "wt" ) );
if( dest == 0 )
{
msg = _( "Unable to create " ) + FullFileName;
DisplayError( this, msg );
return; return;
}
GetScreen()->SetFileName( FullFileName );
SavePcbFormatAscii( this, dest, LayerLookUpTable );
fclose( dest );
} }
}
FILE * file = wxFopen( FullFileName, wxT( "wt" ) );
if( file == NULL )
{
msg = _( "Unable to create " ) + FullFileName;
DisplayError( this, msg );
return;
}
GBR_TO_PCB_EXPORTER gbr_exporter( this, file );
gbr_exporter.ExportPcb( dlg->GetLayersLookUpTable() );
fclose( file );
}
static int WriteSetup( FILE* File, BOARD* Pcb ) void GBR_TO_PCB_EXPORTER::cleanBoard()
{ {
char text[1024]; // delete redundant vias
for( TRACK * track = m_pcb->m_Track; track; track = track->Next() )
{
if( track->m_Shape != VIA_THROUGH )
continue;
fprintf( File, "$SETUP\n" ); // Search and delete others vias
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT ); TRACK* next_track;
fprintf( File, "%s", text ); TRACK* alt_track = track->Next();
for( ; alt_track; alt_track = next_track )
{
next_track = alt_track->Next();
if( alt_track->m_Shape != VIA_THROUGH )
continue;
if( alt_track->m_Start != track->m_Start )
continue;
// delete track
alt_track->UnLink();
delete alt_track;
}
}
}
bool GBR_TO_PCB_EXPORTER::WriteSetup( )
{
fprintf( m_file, "$SETUP\n" );
fprintf( m_file, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( File, "Layers %d\n", Pcb->GetCopperLayerCount() ); fprintf( m_file, "Layers %d\n", m_pcb->GetCopperLayerCount() );
fprintf( File, "$EndSETUP\n\n" ); fprintf( m_file, "$EndSETUP\n\n" );
return 1; return true;
} }
static bool WriteGeneralDescrPcb( BOARD* Pcb, FILE* File ) bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( )
{ {
int NbLayers; int nbLayers;
/* Print the copper layer count */ /* Print the copper layer count */
NbLayers = Pcb->GetCopperLayerCount(); nbLayers = m_pcb->GetCopperLayerCount();
fprintf( File, "$GENERAL\n" ); if( nbLayers <= 1 ) // Minimal layers count in Pcbnew is 2
fprintf( File, "LayerCount %d\n", NbLayers ); {
nbLayers = 2;
m_pcb->SetCopperLayerCount(2);
}
fprintf( m_file, "$GENERAL\n" );
fprintf( m_file, "encoding utf-8\n");
fprintf( m_file, "LayerCount %d\n", nbLayers );
/* Compute and print the board bounding box */ /* Compute and print the board bounding box */
Pcb->ComputeBoundingBox(); m_pcb->ComputeBoundingBox();
fprintf( File, "Di %d %d %d %d\n", fprintf( m_file, "Di %d %d %d %d\n",
Pcb->m_BoundaryBox.GetX(), Pcb->m_BoundaryBox.GetY(), m_pcb->m_BoundaryBox.GetX(), m_pcb->m_BoundaryBox.GetY(),
Pcb->m_BoundaryBox.GetRight(), m_pcb->m_BoundaryBox.GetRight(),
Pcb->m_BoundaryBox.GetBottom() ); m_pcb->m_BoundaryBox.GetBottom() );
fprintf( File, "$EndGENERAL\n\n" ); fprintf( m_file, "$EndGENERAL\n\n" );
return TRUE; return true;
} }
...@@ -124,17 +194,12 @@ static bool WriteGeneralDescrPcb( BOARD* Pcb, FILE* File ) ...@@ -124,17 +194,12 @@ static bool WriteGeneralDescrPcb( BOARD* Pcb, FILE* File )
* @param LayerLookUpTable = look up table: pcbnew layer for each gerber layer * @param LayerLookUpTable = look up table: pcbnew layer for each gerber layer
* @return 1 if OK, 0 if fail * @return 1 if OK, 0 if fail
*/ */
static int SavePcbFormatAscii( GERBVIEW_FRAME* frame, FILE* aFile, bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
int* LayerLookUpTable )
{ {
char line[256]; char line[256];
BOARD* gerberPcb = frame->GetBoard(); BOARD* gerberPcb = m_gerbview_frame->GetBoard();
BOARD* pcb;
wxBeginBusyCursor();
// create an image of gerber data // create an image of gerber data
pcb = new BOARD( NULL, frame );
BOARD_ITEM* item = gerberPcb->m_Drawings; BOARD_ITEM* item = gerberPcb->m_Drawings;
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {
...@@ -145,105 +210,147 @@ static int SavePcbFormatAscii( GERBVIEW_FRAME* frame, FILE* aFile, ...@@ -145,105 +210,147 @@ static int SavePcbFormatAscii( GERBVIEW_FRAME* frame, FILE* aFile,
continue; continue;
if( pcb_layer_number > LAST_COPPER_LAYER ) if( pcb_layer_number > LAST_COPPER_LAYER )
{ export_non_copper_item( gerb_item, pcb_layer_number );
DRAWSEGMENT* drawitem = new DRAWSEGMENT( pcb, TYPE_DRAWSEGMENT );
drawitem->SetLayer( pcb_layer_number );
drawitem->m_Start = gerb_item->m_Start;
drawitem->m_End = gerb_item->m_End;
drawitem->m_Width = gerb_item->m_Size.x;
if( gerb_item->m_Shape == GBR_ARC )
{
double cx = gerb_item->m_ArcCentre.x;
double cy = gerb_item->m_ArcCentre.y;
double a = atan2( gerb_item->m_Start.y - cy,
gerb_item->m_Start.x - cx );
double b = atan2( gerb_item->m_End.y - cy, gerb_item->m_End.x - cx );
drawitem->m_Shape = S_ARC;
drawitem->m_Angle = (int) fmod(
(a - b) / M_PI * 1800.0 + 3600.0, 3600.0 );
drawitem->m_Start.x = (int) cx;
drawitem->m_Start.y = (int) cy;
}
pcb->Add( drawitem );
}
else
{
TRACK* newtrack;
// replace spots with vias when possible else
if( gerb_item->m_Shape == GBR_SPOT_CIRCLE export_copper_item( gerb_item, pcb_layer_number );
|| gerb_item->m_Shape == GBR_SPOT_RECT
|| gerb_item->m_Shape == GBR_SPOT_OVAL )
{
newtrack = new SEGVIA( pcb );
// A spot is found, and can be a via: change it to via, and
// delete other
// spots at same location
newtrack->m_Shape = VIA_THROUGH;
newtrack->SetLayer( 0x0F ); // Layers are 0 to 15 (Cu/Cmp)
newtrack->SetDrillDefault();
newtrack->m_Start = newtrack->m_End = gerb_item->m_Start;
newtrack->m_Width = (gerb_item->m_Size.x + gerb_item->m_Size.y) / 2;
}
else // a true TRACK
{
newtrack = new TRACK( pcb );
newtrack->SetLayer( pcb_layer_number );
newtrack->m_Start = gerb_item->m_Start;
newtrack->m_End = gerb_item->m_End;
newtrack->m_Width = gerb_item->m_Size.x;
}
pcb->Add( newtrack );
}
} }
// delete redundant vias cleanBoard();
for( TRACK * track = pcb->m_Track; track; track = track->Next() )
{
if( track->m_Shape != VIA_THROUGH )
continue;
// Search and delete others vias // Switch the locale to standard C (needed to print floating point numbers)
TRACK* next_track; SetLocaleTo_C_standard();
TRACK* alt_track = track->Next();
for( ; alt_track; alt_track = next_track )
{
next_track = alt_track->Next();
if( alt_track->m_Shape != VIA_THROUGH )
continue;
if( alt_track->m_Start != track->m_Start ) // write PCB header
continue; fprintf( m_file, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
DateAndTime( line ) );
WriteGeneralDescrPcb( );
WriteSetup( );
// delete track // write items on file
alt_track->UnLink(); m_pcb->Save( m_file );
delete alt_track;
SetLocaleTo_Default(); // revert to the current locale
return true;
}
void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
DRAWSEGMENT* drawitem = new DRAWSEGMENT( m_pcb, TYPE_DRAWSEGMENT );
drawitem->SetLayer( aLayer );
drawitem->m_Start = aGbrItem->m_Start;
drawitem->m_End = aGbrItem->m_End;
drawitem->m_Width = aGbrItem->m_Size.x;
if( aGbrItem->m_Shape == GBR_ARC )
{
double a = atan2( (double)( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y),
(double)( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
double b = atan2( (double)( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ),
(double)( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) );
drawitem->m_Shape = S_ARC;
drawitem->m_Angle = wxRound( (a - b) / M_PI * 1800.0 );
drawitem->m_Start = aGbrItem->m_ArcCentre;
if( drawitem->m_Angle < 0 )
{
NEGATE( drawitem->m_Angle );
drawitem->m_End = aGbrItem->m_Start;
} }
} }
// Switch the locale to standard C (needed to print floating point numbers m_pcb->Add( drawitem );
// like 1.3) }
SetLocaleTo_C_standard();
// write the PCB heading void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB, {
DateAndTime( line ) ); switch( aGbrItem->m_Shape )
WriteGeneralDescrPcb( pcb, aFile ); {
WriteSetup( aFile, pcb ); case GBR_SPOT_CIRCLE:
case GBR_SPOT_RECT:
case GBR_SPOT_OVAL:
// replace spots with vias when possible
export_flashed_copper_item( aGbrItem, aLayer );
break;
// write the useful part of the pcb case GBR_ARC:
pcb->Save( aFile ); // export_segarc_copper_item( aGbrItem, aLayer );
break;
// the destructor should destroy all owned sub-objects default:
delete pcb; export_segline_copper_item( aGbrItem, aLayer );
break;
}
}
SetLocaleTo_Default(); // revert to the current locale void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
wxEndBusyCursor(); {
return 1; TRACK * newtrack = new TRACK( m_pcb );
newtrack->SetLayer( aLayer );
newtrack->m_Start = aGbrItem->m_Start;
newtrack->m_End = aGbrItem->m_End;
newtrack->m_Width = aGbrItem->m_Size.x;
m_pcb->Add( newtrack );
}
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
double a = atan2( (double)( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
(double)( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
double b = atan2( (double)( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ),
(double)( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) );
int arc_angle = wxRound( ( (a - b) / M_PI * 1800.0 ) );
wxPoint start = aGbrItem->m_Start;
wxPoint end = aGbrItem->m_End;
/* Because Pcbnew does not know arcs in tracks,
* approximate arc by segments (16 segment per 360 deg)
*/
#define DELTA 3600/16
if( arc_angle < 0 )
{
NEGATE( arc_angle );
EXCHG( start, end );
}
wxPoint curr_start = start;
for( int rot = DELTA; rot < (arc_angle - DELTA); rot += DELTA )
{
TRACK * newtrack = new TRACK( m_pcb );
newtrack->SetLayer( aLayer );
newtrack->m_Start = curr_start;
wxPoint curr_end = start;
RotatePoint( &curr_end, aGbrItem->m_ArcCentre, rot );
newtrack->m_End = curr_end;
newtrack->m_Width = aGbrItem->m_Size.x;
m_pcb->Add( newtrack );
curr_start = curr_end;
}
if( end != curr_start )
{
TRACK * newtrack = new TRACK( m_pcb );
newtrack->SetLayer( aLayer );
newtrack->m_Start = curr_start;
newtrack->m_End = end;
newtrack->m_Width = aGbrItem->m_Size.x;
m_pcb->Add( newtrack );
}
}
/*
* creates a via from a flashed gerber item.
* Flashed items are usually pads or vias, so we try to export all of them
* using vias
*/
void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
SEGVIA * newtrack = new SEGVIA( m_pcb );
newtrack->m_Shape = VIA_THROUGH;
newtrack->SetLayer( 0x0F ); // Layers are 0 to 15 (Cu/Cmp)
newtrack->SetDrillDefault();
newtrack->m_Start = newtrack->m_End = aGbrItem->m_Start;
newtrack->m_Width = (aGbrItem->m_Size.x + aGbrItem->m_Size.y) / 2;
m_pcb->Add( newtrack );
} }
...@@ -509,14 +509,6 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title, ...@@ -509,14 +509,6 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
virtual void PrintPage( wxDC* aDC, int aPrintMasklayer, bool aPrintMirrorMode, virtual void PrintPage( wxDC* aDC, int aPrintMasklayer, bool aPrintMirrorMode,
void* aData = NULL ); void* aData = NULL );
/**
* Function InstallDialogLayerPairChoice
* Install a dialog frame to choose the equivalence
* between gerber layers and pcbnew layers
* @return the "lookup table" if ok, or NULL
*/
int* InstallDialogLayerPairChoice();
/** /**
* Function DrawItemsDCodeID * Function DrawItemsDCodeID
* Draw the DCode value (if exists) corresponding to gerber item * Draw the DCode value (if exists) corresponding to gerber item
......
...@@ -2,101 +2,63 @@ ...@@ -2,101 +2,63 @@
/* Dialog frame to choose gerber layers and pcb layers */ /* Dialog frame to choose gerber layers and pcb layers */
/*******************************************************/ /*******************************************************/
/* select_layers_to_pcb.cpp */ /**
* @file select_layers_to_pcb.cpp
*/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "appl_wxstruct.h"
#include "gerbview.h" #include "gerbview.h"
#include "gerbview_id.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "class_GERBER.h" #include "class_GERBER.h"
#include "wx/statline.h" #include "wx/statline.h"
#define LAYER_UNSELECTED NB_LAYERS #include "select_layers_to_pcb.h"
static int ButtonTable[32]; // Indexes buttons to Gerber layers #define LAYER_UNSELECTED NB_LAYERS
static int LayerLookUpTable[32]; // Indexes Gerber layers to PCB file layers
wxStaticText* layer_list[32]; // Indexes text strings to buttons
enum swap_layer_id { enum swap_layer_id {
ID_WINEDA_SWAPLAYERFRAME = 1800, ID_LAYERS_MAP_DIALOG = ID_GERBER_END_LIST,
ID_BUTTON_0, ID_BUTTON_0,
ID_TEXT_0 = ID_BUTTON_0 + 32 ID_TEXT_0 = ID_BUTTON_0 + 32
}; };
/*
* This dialog shows the gerber files loaded, and allows user to choose:
* what gerber file and what board layer are used
* the number of copper layers
*/
class SWAP_LAYERS_DIALOG : public wxDialog BEGIN_EVENT_TABLE( LAYERS_MAP_DIALOG, LAYERS_MAP_DIALOG_BASE )
{ EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + 31,
private: wxEVT_COMMAND_BUTTON_CLICKED,
GERBVIEW_FRAME* m_Parent; LAYERS_MAP_DIALOG::OnSelectLayer )
wxBoxSizer* OuterBoxSizer;
wxBoxSizer* MainBoxSizer;
wxFlexGridSizer* FlexColumnBoxSizer;
wxStaticText* label;
wxButton* Button;
wxStaticText* text;
wxStaticLine* Line;
wxStdDialogButtonSizer* StdDialogButtonSizer;
public:
SWAP_LAYERS_DIALOG( GERBVIEW_FRAME* parent );
~SWAP_LAYERS_DIALOG() {};
private:
void OnSelectLayer( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE( SWAP_LAYERS_DIALOG, wxDialog )
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + 31,
wxEVT_COMMAND_BUTTON_CLICKED,
SWAP_LAYERS_DIALOG::OnSelectLayer )
EVT_BUTTON( wxID_OK, SWAP_LAYERS_DIALOG::OnOkClick )
EVT_BUTTON( wxID_CANCEL, SWAP_LAYERS_DIALOG::OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
/* Install a dialog frame to choose the equivalence LAYERS_MAP_DIALOG::LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent ) :
* between gerber layers and pcbnew layers LAYERS_MAP_DIALOG_BASE( parent )
* return the "lookup table" if ok, or NULL
*/
int* GERBVIEW_FRAME::InstallDialogLayerPairChoice( )
{ {
SWAP_LAYERS_DIALOG* frame = new SWAP_LAYERS_DIALOG( this ); m_Parent = parent;
initDialog();
int ii = frame->ShowModal();
frame->Destroy(); // Resize the dialog
if( ii >= 0 ) GetSizer()->SetSizeHints( this );
return LayerLookUpTable; Centre();
else
return NULL;
} }
SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( GERBVIEW_FRAME* parent ) : void LAYERS_MAP_DIALOG::initDialog()
wxDialog( parent, -1, _( "Layer selection:" ), wxPoint( -1, -1 ),
wxDefaultSize, wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER )
{ {
OuterBoxSizer = NULL; wxStaticText* label;
MainBoxSizer = NULL; wxStaticText* text;
FlexColumnBoxSizer = NULL; int item_ID;
label = NULL; wxString msg;
Button = NULL; wxSize goodSize;
text = NULL;
Line = NULL;
StdDialogButtonSizer = NULL;
m_Parent = parent; m_flexRightColumnBoxSizer = NULL;
int item_ID, ii, nb_items;
wxString msg;
wxSize goodSize;
// Experimentation has shown that buttons in the Windows version can be 20 // Experimentation has shown that buttons in the Windows version can be 20
// pixels wide and 20 pixels high, but that they need to be 26 pixels wide // pixels wide and 20 pixels high, but that they need to be 26 pixels wide
...@@ -118,123 +80,111 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( GERBVIEW_FRAME* parent ) : ...@@ -118,123 +80,111 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( GERBVIEW_FRAME* parent ) :
// buttons should be some other size in that version. // buttons should be some other size in that version.
// Compute a reasonable number of copper layers // Compute a reasonable number of copper layers
int pcb_layer_number = 0; m_exportBoardCopperLayersCount = 0;
for( ii = 0; ii < 32; ii++ ) for( int ii = 0; ii < 32; ii++ )
{ {
if( g_GERBER_List[ii] != NULL ) if( g_GERBER_List[ii] != NULL )
pcb_layer_number++; m_exportBoardCopperLayersCount++;
// Specify the default value for each member of these arrays. // Specify the default value for each member of these arrays.
ButtonTable[ii] = -1; m_buttonTable[ii] = -1;
LayerLookUpTable[ii] = LAYER_UNSELECTED; m_layersLookUpTable[ii] = LAYER_UNSELECTED;
} }
m_Parent->GetBoard()->SetCopperLayerCount(pcb_layer_number);
pcb_layer_number = 0; // Ensure we have:
for( nb_items = 0, ii = 0; ii < 32; ii++ ) // at least 2 copper layers and NB_COPPER_LAYERS copper layers max
// an even layers count because board *must* have even layers count
// and maxi NB_COPPER_LAYERS copper layers count
normalizeBrdLayersCount();
int idx = ( m_exportBoardCopperLayersCount / 2 ) - 1;
m_comboCopperLayersCount->SetSelection( idx );
int pcb_layer_num = 0;
m_itemsCount = 0;
for( int ii = 0; ii < 32; ii++ )
{ {
if( g_GERBER_List[ii] == NULL ) if( g_GERBER_List[ii] == NULL )
continue; continue;
if( (pcb_layer_number == m_Parent->GetBoard()->GetCopperLayerCount() - 1) if( (pcb_layer_num == m_exportBoardCopperLayersCount - 1)
&& (m_Parent->GetBoard()->GetCopperLayerCount() > 1) ) && (m_exportBoardCopperLayersCount > 1) )
pcb_layer_number = LAYER_N_FRONT; pcb_layer_num = LAYER_N_FRONT;
ButtonTable[nb_items] = ii; m_buttonTable[m_itemsCount] = ii;
LayerLookUpTable[ii] = pcb_layer_number; m_layersLookUpTable[ii] = pcb_layer_num;
nb_items++; m_itemsCount++;
pcb_layer_number++; pcb_layer_num++;
} }
OuterBoxSizer = new wxBoxSizer( wxVERTICAL ); if( m_itemsCount <= 16 ) // Only one list is enough
SetSizer( OuterBoxSizer );
MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
for( ii = 0; ii < nb_items; ii++ )
{ {
// If more than 16 Gerber layers are used, provide a vertical line to m_staticlineSep->Hide();
// separate the two FlexGrid sizers }
if( (nb_items > 16) && (ii == 16) ) else // Add the second list of gerber files
{ {
Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, m_flexRightColumnBoxSizer = new wxFlexGridSizer( 16, 4, 0, 0 );
wxLI_VERTICAL ); for( int ii = 0; ii < 4; ii++ )
MainBoxSizer->Add( Line, 0, wxGROW | wxLEFT | wxRIGHT, 5 ); m_flexRightColumnBoxSizer->AddGrowableCol( ii );
} m_flexRightColumnBoxSizer->SetFlexibleDirection( wxBOTH );
m_flexRightColumnBoxSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
// Provide a separate FlexGrid sizer for every sixteen sets of controls }
if( ii % 16 == 0 )
{
// Each Gerber layer has an associated static text string (to
// identify that layer), a button (for invoking a child dialog
// box to change which pcbnew layer that the Gerber layer is
// mapped to), and a second static text string (to depict which
// pcbnew layer that the Gerber layer has been mapped to). Each
// of those items are placed into the left hand column, middle
// column, and right hand column (respectively) of the Flexgrid
// sizer, and the color of the second text string is set to
// fuchsia or blue (to respectively indicate whether the Gerber
// layer has been mapped to a pcbnew layer or is not being
// exported at all). (Experimentation has shown that if a text
// control is used to depict which pcbnew layer that each Gerber
// layer is mapped to (instead of a static text string), then
// those controls do not behave in a fully satisfactory manner
// in the Linux version. Even when the read-only attribute is
// specified for all of those controls, they can still be selected
// when the arrow keys or Tab key is used to step through all of
// the controls within the dialog box, and directives to set the
// foreground color of the text of each such control to blue (to
// indicate that the text is of a read-only nature) are disregarded.
// Specify a FlexGrid sizer with an appropriate number of rows
// and three columns. If nb_items < 16, then the number of rows
// is nb_items; otherwise, the number of rows is 16 (with two
// separate columns of controls being used if nb_items > 16).
if( nb_items < 16 )
FlexColumnBoxSizer = new wxFlexGridSizer( nb_items, 4, 0, 0 );
else
FlexColumnBoxSizer = new wxFlexGridSizer( 16, 4, 0, 0 );
// Specify that all of the rows can be expanded.
for( int jj = 0; jj < MIN( nb_items, 16 ); jj++ )
{
FlexColumnBoxSizer->AddGrowableRow( jj );
}
// Specify that (just) the right-hand column can be expanded.
FlexColumnBoxSizer->AddGrowableCol( 2 );
MainBoxSizer->Add( FlexColumnBoxSizer, 1, wxGROW | wxTOP, 5 ); wxFlexGridSizer* flexColumnBoxSizer = m_flexLeftColumnBoxSizer;
} for( int ii = 0; ii < m_itemsCount; ii++ )
{
// Each Gerber layer has an associated static text string (to
// identify that layer), a button (for invoking a child dialog
// box to change which pcbnew layer that the Gerber layer is
// mapped to), and a second static text string (to depict which
// pcbnew layer that the Gerber layer has been mapped to). Each
// of those items are placed into the left hand column, middle
// column, and right hand column (respectively) of the Flexgrid
// sizer, and the color of the second text string is set to
// fuchsia or blue (to respectively indicate whether the Gerber
// layer has been mapped to a pcbnew layer or is not being
// exported at all). (Experimentation has shown that if a text
// control is used to depict which pcbnew layer that each Gerber
// layer is mapped to (instead of a static text string), then
// those controls do not behave in a fully satisfactory manner
// in the Linux version. Even when the read-only attribute is
// specified for all of those controls, they can still be selected
// when the arrow keys or Tab key is used to step through all of
// the controls within the dialog box, and directives to set the
// foreground color of the text of each such control to blue (to
// indicate that the text is of a read-only nature) are disregarded.
// Specify a FlexGrid sizer with an appropriate number of rows
// and three columns. If nb_items < 16, then the number of rows
// is nb_items; otherwise, the number of rows is 16 (with two
// separate columns of controls being used if nb_items > 16).
if( ii == 16 )
flexColumnBoxSizer = m_flexRightColumnBoxSizer;
// Provide a text string to identify the Gerber layer // Provide a text string to identify the Gerber layer
msg = _( "Layer " ); msg.Printf( _( "Layer %d" ), m_buttonTable[ii] + 1 );
msg << ButtonTable[ii] + 1;
label = new wxStaticText( this, wxID_STATIC, msg, wxDefaultPosition, label = new wxStaticText( this, wxID_STATIC, msg, wxDefaultPosition,
wxDefaultSize, wxALIGN_RIGHT ); wxDefaultSize, wxALIGN_RIGHT );
FlexColumnBoxSizer->Add( label, 0, flexColumnBoxSizer->Add( label, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL |
wxALL, 5 ); wxRIGHT | wxLEFT, 5 );
/* Add file name and extension without path. */ /* Add file name and extension without path. */
wxFileName fn( g_GERBER_List[ii]->m_FileName ); wxFileName fn( g_GERBER_List[ii]->m_FileName );
label = new wxStaticText( this, wxID_STATIC, fn.GetFullName(), label = new wxStaticText( this, wxID_STATIC, fn.GetFullName(),
wxDefaultPosition, wxDefaultSize ); wxDefaultPosition, wxDefaultSize );
FlexColumnBoxSizer->Add( label, 0, flexColumnBoxSizer->Add( label, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL |
wxALL, 5 ); wxRIGHT | wxLEFT, 5 );
// Provide a button for this layer (which will invoke a child dialog box) // Provide a button for this layer (which will invoke a child dialog box)
item_ID = ID_BUTTON_0 + ii; item_ID = ID_BUTTON_0 + ii;
wxButton * Button = new wxButton( this, item_ID, wxT( "..." ),
wxDefaultPosition, wxSize( w, h ), 0 );
Button = new wxButton( this, item_ID, wxT( "..." ), flexColumnBoxSizer->Add( Button, 0,
wxDefaultPosition, wxSize( w, h ), 0 ); wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
FlexColumnBoxSizer->Add( Button, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
wxALL, 5 );
// Provide another text string to specify which pcbnew layer that this // Provide another text string to specify which pcbnew layer that this
// Gerber layer is initially mapped to, and set the initial text to // Gerber layer is initially mapped to, and set the initial text to
...@@ -251,7 +201,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( GERBVIEW_FRAME* parent ) : ...@@ -251,7 +201,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( GERBVIEW_FRAME* parent ) :
// layers are selected.) // layers are selected.)
if( ii == 0 ) if( ii == 0 )
{ {
msg = _( "Do not export" ); msg = _( "Do not export" );
text = new wxStaticText( this, item_ID, msg, wxDefaultPosition, text = new wxStaticText( this, item_ID, msg, wxDefaultPosition,
wxDefaultSize, 0 ); wxDefaultSize, 0 );
goodSize = text->GetSize(); goodSize = text->GetSize();
...@@ -263,67 +213,119 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( GERBVIEW_FRAME* parent ) : ...@@ -263,67 +213,119 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( GERBVIEW_FRAME* parent ) :
goodSize.x = text->GetSize().x; goodSize.x = text->GetSize().x;
} }
msg = BOARD::GetDefaultLayerName( LayerLookUpTable[ButtonTable[ii]] ); msg = BOARD::GetDefaultLayerName( m_layersLookUpTable[m_buttonTable[ii]] );
text->SetLabel( msg ); text->SetLabel( msg );
} }
else else
{ {
msg = BOARD::GetDefaultLayerName( LayerLookUpTable[ButtonTable[ii]] ); msg = BOARD::GetDefaultLayerName( m_layersLookUpTable[m_buttonTable[ii]] );
text = new wxStaticText( this, item_ID, msg, wxDefaultPosition, text = new wxStaticText( this, item_ID, msg, wxDefaultPosition,
wxDefaultSize, 0 ); wxDefaultSize, 0 );
} }
text->SetMinSize( goodSize ); text->SetMinSize( goodSize );
FlexColumnBoxSizer->Add( text, 1, flexColumnBoxSizer->Add( text, 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT,
5 ); 5 );
layer_list[ii] = text; m_layersList[ii] = text;
}
}
/* Ensure m_exportBoardCopperLayersCount = 2 to NB_COPPER_LAYERS
* and it is an even value because Boards have always an even layer count
*/
void LAYERS_MAP_DIALOG::normalizeBrdLayersCount()
{
if( ( m_exportBoardCopperLayersCount & 1 ) )
m_exportBoardCopperLayersCount++;
if( m_exportBoardCopperLayersCount > NB_COPPER_LAYERS )
m_exportBoardCopperLayersCount = NB_COPPER_LAYERS;
if( m_exportBoardCopperLayersCount < 2 )
m_exportBoardCopperLayersCount = 2;
}
/*
* Called when user change the current board copper layers count
*/
void LAYERS_MAP_DIALOG::OnBrdLayersCountSelection( wxCommandEvent& event )
{
int id = event.GetSelection();
m_exportBoardCopperLayersCount = (id+1) * 2;
}
/*
* reset pcb layers selection to the default value
*/
void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
{
wxString msg;
int ii, layer;
for( ii = 0, layer = 0; ii < m_itemsCount; ii++, layer++ )
{
if( (layer == m_exportBoardCopperLayersCount - 1)
&& (m_exportBoardCopperLayersCount > 1) )
layer = LAYER_N_FRONT;
m_layersLookUpTable[ii] = layer;
msg = BOARD::GetDefaultLayerName( layer );
m_layersList[ii]->SetLabel( msg );
m_layersList[ii]->SetForegroundColour( wxNullColour );
m_buttonTable[ii] = ii;
} }
}
// If required, provide spacers to occupy otherwise blank cells within the
// second FlexGrid sizer. (As it incorporates three columns, three spacers /* Stores the current mayers selection in config
// are thus required for each otherwise unused row.) */
if( 16 < nb_items && nb_items < 32 ) void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
{
wxConfig* config = wxGetApp().m_EDA_Config;
config->Write( wxT("BrdLayersCount"), m_itemsCount );
wxString key;
for( int ii = 0; ii < 32; ii++ )
{ {
for( ii = 4 * nb_items; ii < 96; ii++ ) key.Printf( wxT("GbrLyr%dToPcb"), ii );
{ config->Write( key, m_layersLookUpTable[ii] );
FlexColumnBoxSizer->Add( 5, h, 0,
wxALIGN_CENTER_HORIZONTAL |
wxALIGN_CENTER_VERTICAL | wxLEFT |
wxRIGHT | wxBOTTOM, 5 );
}
} }
}
// Provide a line to separate the controls which have been provided so far void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
// from the OK and Cancel buttons (which will be provided after this line) {
Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxConfig* config = wxGetApp().m_EDA_Config;
wxLI_HORIZONTAL );
OuterBoxSizer->Add( Line, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
// Provide a StdDialogButtonSizer to accommodate the OK and Cancel buttons; config->Read( wxT("BrdLayersCount"), &m_exportBoardCopperLayersCount );
// using that type of sizer results in those buttons being automatically normalizeBrdLayersCount();
// located in positions appropriate for each (OS) version of KiCad.
StdDialogButtonSizer = new wxStdDialogButtonSizer;
OuterBoxSizer->Add( StdDialogButtonSizer, 0, wxGROW | wxALL, 10 );
Button = new wxButton( this, wxID_OK, _( "&OK" ), wxDefaultPosition, int idx = ( m_exportBoardCopperLayersCount / 2 ) - 1;
wxDefaultSize, 0 ); m_comboCopperLayersCount->SetSelection( idx );
StdDialogButtonSizer->AddButton( Button );
Button = new wxButton( this, wxID_CANCEL, _( "&Cancel" ), wxString key;
wxDefaultPosition, wxDefaultSize, 0 ); for( int ii = 0; ii < 32; ii++ )
StdDialogButtonSizer->AddButton( Button ); {
StdDialogButtonSizer->Realize(); key.Printf( wxT("GbrLyr%dToPcb"), ii );
config->Read( key, &m_layersLookUpTable[ii] );
}
// Resize the dialog for( int ii = 0; ii < m_itemsCount; ii++ )
if( GetSizer() )
{ {
GetSizer()->SetSizeHints( this ); int layer = m_layersLookUpTable[ii];
if( layer == LAYER_UNSELECTED )
{
m_layersList[ii]->SetLabel( _( "Do not export" ) );
m_layersList[ii]->SetForegroundColour( *wxBLUE );
}
else
{
m_layersList[ii]->SetLabel( BOARD::GetDefaultLayerName( layer ) );
m_layersList[ii]->SetForegroundColour( wxColour( 255, 0, 128 ) );
}
} }
} }
void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
void SWAP_LAYERS_DIALOG::OnSelectLayer( wxCommandEvent& event )
{ {
int ii, jj; int ii, jj;
...@@ -334,71 +336,70 @@ void SWAP_LAYERS_DIALOG::OnSelectLayer( wxCommandEvent& event ) ...@@ -334,71 +336,70 @@ void SWAP_LAYERS_DIALOG::OnSelectLayer( wxCommandEvent& event )
ii = event.GetId() - ID_BUTTON_0; ii = event.GetId() - ID_BUTTON_0;
jj = LayerLookUpTable[ButtonTable[ii]]; jj = m_layersLookUpTable[m_buttonTable[ii]];
if( ( jj < 0 ) || ( jj > LAYER_UNSELECTED ) ) if( ( jj < 0 ) || ( jj > LAYER_UNSELECTED ) )
jj = 0; // (Defaults to "Copper" layer.) jj = LAYER_N_BACK; // (Defaults to "Copper" layer.)
jj = m_Parent->SelectLayer( jj, -1, -1, true ); jj = m_Parent->SelectLayer( jj, -1, -1, true );
if( ( jj < 0 ) || ( jj > LAYER_UNSELECTED ) ) if( ( jj < 0 ) || ( jj > LAYER_UNSELECTED ) )
return; return;
if( jj != LayerLookUpTable[ButtonTable[ii]] ) if( jj != m_layersLookUpTable[m_buttonTable[ii]] )
{ {
LayerLookUpTable[ButtonTable[ii]] = jj; m_layersLookUpTable[m_buttonTable[ii]] = jj;
if( jj == LAYER_UNSELECTED ) if( jj == LAYER_UNSELECTED )
{ {
layer_list[ii]->SetLabel( _( "Do not export" ) ); m_layersList[ii]->SetLabel( _( "Do not export" ) );
// Change the text color to blue (to highlight // Change the text color to blue (to highlight
// that this layer is *not* being exported) // that this layer is *not* being exported)
layer_list[ii]->SetForegroundColour( *wxBLUE ); m_layersList[ii]->SetForegroundColour( *wxBLUE );
} }
else else
{ {
layer_list[ii]->SetLabel( BOARD::GetDefaultLayerName( jj ) ); m_layersList[ii]->SetLabel( BOARD::GetDefaultLayerName( jj ) );
// Change the text color to fuchsia (to highlight // Change the text color to fuchsia (to highlight
// that this layer *is* being exported) // that this layer *is* being exported)
layer_list[ii]->SetForegroundColour( wxColour( 255, 0, 128 ) ); m_layersList[ii]->SetForegroundColour( wxColour( 255, 0, 128 ) );
} }
} }
} }
void SWAP_LAYERS_DIALOG::OnCancelClick( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnCancelClick( wxCommandEvent& event )
{ {
EndModal( -1 ); EndModal( wxID_CANCEL );
} }
void SWAP_LAYERS_DIALOG::OnOkClick( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
{ {
int ii; /* Make some test about copper layers:
bool AsCmpLayer = false; * Board must have enough copper layers to handle selected internal layers
/* Compute the number of copper layers
* this is the max layer number + 1 (if some internal layers exist)
*/ */
int layers_count = 1; normalizeBrdLayersCount();
for( ii = 0; ii < 32; ii++ )
int inner_layer_max = 0;
for( int ii = 0; ii < 32; ii++ )
{ {
if( LayerLookUpTable[ii] == LAYER_N_FRONT ) if( m_layersLookUpTable[ii] < LAYER_N_FRONT )
AsCmpLayer = true; {
else if( m_layersLookUpTable[ii ] > inner_layer_max )
{ inner_layer_max = m_layersLookUpTable[ii];
if( LayerLookUpTable[ii] >= LAST_COPPER_LAYER ) }
continue; // not a copper layer
if( LayerLookUpTable[ii] >= layers_count )
layers_count++;
}
} }
if( AsCmpLayer ) // inner_layer_max must be less than (or equal to) the number of
layers_count++; // internal copper layers
if( layers_count > NB_COPPER_LAYERS ) // should not occur. // internal copper layers = m_exportBoardCopperLayersCount-2
layers_count = NB_COPPER_LAYERS; if( inner_layer_max > m_exportBoardCopperLayersCount-2 )
{
m_Parent->GetBoard()->SetCopperLayerCount( layers_count ); wxMessageBox(
_("The exported board has not enough copper layers to handle selected inner layers") );
EndModal( 1 ); return;
}
m_layersLookUpTable[32] = m_exportBoardCopperLayersCount;
EndModal( wxID_OK );
} }
/*******************************************************/
/* Dialog frame to choose gerber layers and pcb layers */
/*******************************************************/
/**
* @file select_layers_to_pcb.h
*/
#ifndef _SELECT_LAYERS_TO_PCB_H_
#define _SELECT_LAYERS_TO_PCB_H_
#include "wx/statline.h"
#include "dialogs/dialog_layers_select_to_pcb_base.h"
#define LAYER_UNSELECTED NB_LAYERS
/*
* This dialog shows the gerber files loaded, and allows user to choose:
* what gerber file and what board layer are used
* the number of copper layers
*/
class LAYERS_MAP_DIALOG : public LAYERS_MAP_DIALOG_BASE
{
private:
GERBVIEW_FRAME* m_Parent;
int m_itemsCount;
int m_exportBoardCopperLayersCount;
wxFlexGridSizer* m_flexRightColumnBoxSizer; // An extra wxFlexGridSizer used
// when we have more than 16 gerber files loaded
int m_layersLookUpTable[32+1]; // Indexes Gerber layers to PCB file layers
// the last value in table is the number of copper layers
int m_buttonTable[32]; // Indexes buttons to Gerber layers
wxStaticText* m_layersList[32]; // Indexes text strings to buttons
public: LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent );
~LAYERS_MAP_DIALOG() {};
int * GetLayersLookUpTable() { return m_layersLookUpTable; }
int GetCopperLayersCount() { return m_exportBoardCopperLayersCount; }
private:
void initDialog();
void normalizeBrdLayersCount();
void OnBrdLayersCountSelection( wxCommandEvent& event );
void OnSelectLayer( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnStoreSetup( wxCommandEvent& event );
void OnGetSetup( wxCommandEvent& event );
void OnResetClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
#endif // _SELECT_LAYERS_TO_PCB_H_
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
; General Product Description Definitions ; General Product Description Definitions
!define PRODUCT_NAME "KiCad" !define PRODUCT_NAME "KiCad"
!define PRODUCT_VERSION "2011.04.17" !define PRODUCT_VERSION "2011.04.24"
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" !define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/" !define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
!define COMPANY_NAME "" !define COMPANY_NAME ""
......
/* Set up the basic primitives for Layer control */ /* Set up the basic primitives for Layer control */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "protos.h"
enum layer_sel_id { enum layer_sel_id {
...@@ -18,7 +16,7 @@ enum layer_sel_id { ...@@ -18,7 +16,7 @@ enum layer_sel_id {
}; };
class WinEDA_SelLayerFrame : public wxDialog class SELECT_LAYER_DIALOG : public wxDialog
{ {
private: private:
PCB_BASE_FRAME* m_Parent; PCB_BASE_FRAME* m_Parent;
...@@ -28,9 +26,9 @@ private: ...@@ -28,9 +26,9 @@ private:
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_SelLayerFrame( PCB_BASE_FRAME* parent, int default_layer, SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent, int default_layer,
int min_layer, int max_layer, bool null_layer ); int min_layer, int max_layer, bool null_layer );
~WinEDA_SelLayerFrame() { }; ~SELECT_LAYER_DIALOG() { };
private: private:
void Sel_Layer( wxCommandEvent& event ); void Sel_Layer( wxCommandEvent& event );
...@@ -40,10 +38,10 @@ private: ...@@ -40,10 +38,10 @@ private:
}; };
BEGIN_EVENT_TABLE( WinEDA_SelLayerFrame, wxDialog ) BEGIN_EVENT_TABLE( SELECT_LAYER_DIALOG, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_SelLayerFrame::Sel_Layer ) EVT_BUTTON( wxID_OK, SELECT_LAYER_DIALOG::Sel_Layer )
EVT_BUTTON( wxID_CANCEL, WinEDA_SelLayerFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, SELECT_LAYER_DIALOG::OnCancelClick )
EVT_RADIOBOX( ID_LAYER_SELECT, WinEDA_SelLayerFrame::Sel_Layer ) EVT_RADIOBOX( ID_LAYER_SELECT, SELECT_LAYER_DIALOG::Sel_Layer )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -70,7 +68,7 @@ int PCB_BASE_FRAME::SelectLayer( int default_layer, ...@@ -70,7 +68,7 @@ int PCB_BASE_FRAME::SelectLayer( int default_layer,
bool null_layer ) bool null_layer )
{ {
int layer; int layer;
WinEDA_SelLayerFrame* frame = new WinEDA_SelLayerFrame( this, SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this,
default_layer, default_layer,
min_layer, min_layer,
max_layer, max_layer,
...@@ -88,7 +86,7 @@ int PCB_BASE_FRAME::SelectLayer( int default_layer, ...@@ -88,7 +86,7 @@ int PCB_BASE_FRAME::SelectLayer( int default_layer,
* radiobuttons, in which case they are positioned (in a vertical line) * radiobuttons, in which case they are positioned (in a vertical line)
* to the right of that radiobox. * to the right of that radiobox.
*/ */
WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( PCB_BASE_FRAME* parent, SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent,
int default_layer, int min_layer, int default_layer, int min_layer,
int max_layer, bool null_layer ) : int max_layer, bool null_layer ) :
wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ), wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ),
...@@ -165,14 +163,11 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( PCB_BASE_FRAME* parent, ...@@ -165,14 +163,11 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( PCB_BASE_FRAME* parent,
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) ); Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
if( GetSizer() ) GetSizer()->SetSizeHints( this );
{
GetSizer()->SetSizeHints( this );
}
} }
void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event ) void SELECT_LAYER_DIALOG::Sel_Layer( wxCommandEvent& event )
{ {
int ii = m_LayerId[m_LayerList->GetSelection()]; int ii = m_LayerId[m_LayerList->GetSelection()];
...@@ -180,7 +175,7 @@ void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event ) ...@@ -180,7 +175,7 @@ void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event )
} }
void WinEDA_SelLayerFrame::OnCancelClick( wxCommandEvent& event ) void SELECT_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event )
{ {
EndModal( -1 ); EndModal( -1 );
} }
...@@ -190,7 +185,7 @@ void WinEDA_SelLayerFrame::OnCancelClick( wxCommandEvent& event ) ...@@ -190,7 +185,7 @@ void WinEDA_SelLayerFrame::OnCancelClick( wxCommandEvent& event )
/* Dialog for the selecting pairs of layers. */ /* Dialog for the selecting pairs of layers. */
/*********************************************/ /*********************************************/
class WinEDA_SelLayerPairFrame : public wxDialog class SELECT_LAYERS_PAIR_DIALOG : public wxDialog
{ {
private: private:
PCB_BASE_FRAME* m_Parent; PCB_BASE_FRAME* m_Parent;
...@@ -198,8 +193,8 @@ private: ...@@ -198,8 +193,8 @@ private:
wxRadioBox* m_LayerListBOTTOM; wxRadioBox* m_LayerListBOTTOM;
int m_LayerId[NB_COPPER_LAYERS]; int m_LayerId[NB_COPPER_LAYERS];
public: WinEDA_SelLayerPairFrame( PCB_BASE_FRAME* parent ); public: SELECT_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* parent );
~WinEDA_SelLayerPairFrame() { }; ~SELECT_LAYERS_PAIR_DIALOG() { };
private: private:
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
...@@ -209,9 +204,9 @@ private: ...@@ -209,9 +204,9 @@ private:
}; };
BEGIN_EVENT_TABLE( WinEDA_SelLayerPairFrame, wxDialog ) BEGIN_EVENT_TABLE( SELECT_LAYERS_PAIR_DIALOG, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_SelLayerPairFrame::OnOkClick ) EVT_BUTTON( wxID_OK, SELECT_LAYERS_PAIR_DIALOG::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SelLayerPairFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, SELECT_LAYERS_PAIR_DIALOG::OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -232,8 +227,8 @@ void PCB_BASE_FRAME::SelectLayerPair() ...@@ -232,8 +227,8 @@ void PCB_BASE_FRAME::SelectLayerPair()
return; return;
} }
WinEDA_SelLayerPairFrame* frame = SELECT_LAYERS_PAIR_DIALOG* frame =
new WinEDA_SelLayerPairFrame( this ); new SELECT_LAYERS_PAIR_DIALOG( this );
int result = frame->ShowModal(); int result = frame->ShowModal();
frame->Destroy(); frame->Destroy();
...@@ -248,7 +243,7 @@ void PCB_BASE_FRAME::SelectLayerPair() ...@@ -248,7 +243,7 @@ void PCB_BASE_FRAME::SelectLayerPair()
} }
WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( PCB_BASE_FRAME* parent ) : SELECT_LAYERS_PAIR_DIALOG::SELECT_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* parent ) :
wxDialog( parent, -1, _( "Select Layer Pair:" ), wxPoint( -1, -1 ), wxDialog( parent, -1, _( "Select Layer Pair:" ), wxPoint( -1, -1 ),
wxSize( 470, 250 ), DIALOG_STYLE ) wxSize( 470, 250 ), DIALOG_STYLE )
{ {
...@@ -325,7 +320,7 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( PCB_BASE_FRAME* parent ) : ...@@ -325,7 +320,7 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( PCB_BASE_FRAME* parent ) :
} }
void WinEDA_SelLayerPairFrame::OnOkClick( wxCommandEvent& event ) void SELECT_LAYERS_PAIR_DIALOG::OnOkClick( wxCommandEvent& event )
{ {
// select the same layer for top and bottom is allowed (normal in some // select the same layer for top and bottom is allowed (normal in some
// boards) // boards)
...@@ -343,7 +338,7 @@ void WinEDA_SelLayerPairFrame::OnOkClick( wxCommandEvent& event ) ...@@ -343,7 +338,7 @@ void WinEDA_SelLayerPairFrame::OnOkClick( wxCommandEvent& event )
} }
void WinEDA_SelLayerPairFrame::OnCancelClick( wxCommandEvent& event ) void SELECT_LAYERS_PAIR_DIALOG::OnCancelClick( wxCommandEvent& event )
{ {
EndModal( -1 ); EndModal( -1 );
} }
release version: release version:
2011 apr 17 2011 apr 24
files (.zip,.tgz): files (.zip,.tgz):
kicad-2011-04-17 kicad-2011-04-24
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment