Commit 57604b0a authored by jean-pierre charras's avatar jean-pierre charras

Gerbview: export_to_pcbnew enhancement and fixes.

parent 81947a4f
...@@ -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
......
...@@ -9,15 +9,16 @@ ...@@ -9,15 +9,16 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( LAYERS_TABLE_DIALOG_BASE, wxDialog ) BEGIN_EVENT_TABLE( LAYERS_MAP_DIALOG_BASE, wxDialog )
EVT_BUTTON( ID_STORE_CHOICE, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnStoreSetup ) EVT_COMBOBOX( ID_M_COMBOCOPPERLAYERSCOUNT, LAYERS_MAP_DIALOG_BASE::_wxFB_OnBrdLayersCountSelection )
EVT_BUTTON( ID_GET_PREVIOUS_CHOICE, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnGetSetup ) EVT_BUTTON( ID_STORE_CHOICE, LAYERS_MAP_DIALOG_BASE::_wxFB_OnStoreSetup )
EVT_BUTTON( ID_RESET_CHOICE, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnResetClick ) EVT_BUTTON( ID_GET_PREVIOUS_CHOICE, LAYERS_MAP_DIALOG_BASE::_wxFB_OnGetSetup )
EVT_BUTTON( wxID_CANCEL, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnCancelClick ) EVT_BUTTON( ID_RESET_CHOICE, LAYERS_MAP_DIALOG_BASE::_wxFB_OnResetClick )
EVT_BUTTON( wxID_OK, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnOkClick ) EVT_BUTTON( wxID_CANCEL, LAYERS_MAP_DIALOG_BASE::_wxFB_OnCancelClick )
EVT_BUTTON( wxID_OK, LAYERS_MAP_DIALOG_BASE::_wxFB_OnOkClick )
END_EVENT_TABLE() END_EVENT_TABLE()
LAYERS_TABLE_DIALOG_BASE::LAYERS_TABLE_DIALOG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) 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 ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -42,17 +43,33 @@ LAYERS_TABLE_DIALOG_BASE::LAYERS_TABLE_DIALOG_BASE( wxWindow* parent, wxWindowID ...@@ -42,17 +43,33 @@ LAYERS_TABLE_DIALOG_BASE::LAYERS_TABLE_DIALOG_BASE( wxWindow* parent, wxWindowID
m_staticlineSep = new wxStaticLine( this, ID_M_STATICLINESEP, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); m_staticlineSep = new wxStaticLine( this, ID_M_STATICLINESEP, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
sbSizerLayersTable->Add( m_staticlineSep, 0, wxEXPAND | wxALL, 5 ); sbSizerLayersTable->Add( m_staticlineSep, 0, wxEXPAND | wxALL, 5 );
m_flexRightColumnBoxSizer = new wxFlexGridSizer( 16, 4, 0, 0 ); sbUpperSizer->Add( sbSizerLayersTable, 1, wxEXPAND, 5 );
m_flexRightColumnBoxSizer->AddGrowableCol( 0 );
m_flexRightColumnBoxSizer->AddGrowableCol( 1 );
m_flexRightColumnBoxSizer->AddGrowableCol( 2 );
m_flexRightColumnBoxSizer->AddGrowableCol( 3 );
m_flexRightColumnBoxSizer->SetFlexibleDirection( wxBOTH );
m_flexRightColumnBoxSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
sbSizerLayersTable->Add( m_flexRightColumnBoxSizer, 1, wxEXPAND, 5 ); wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
sbUpperSizer->Add( sbSizerLayersTable, 1, wxEXPAND, 5 ); 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; wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxVERTICAL ); bSizerButtons = new wxBoxSizer( wxVERTICAL );
...@@ -66,7 +83,9 @@ LAYERS_TABLE_DIALOG_BASE::LAYERS_TABLE_DIALOG_BASE( wxWindow* parent, wxWindowID ...@@ -66,7 +83,9 @@ LAYERS_TABLE_DIALOG_BASE::LAYERS_TABLE_DIALOG_BASE( wxWindow* parent, wxWindowID
m_buttonReset = new wxButton( this, ID_RESET_CHOICE, _("Reset"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonReset = new wxButton( this, ID_RESET_CHOICE, _("Reset"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonReset, 0, wxALL|wxEXPAND, 5 ); bSizerButtons->Add( m_buttonReset, 0, wxALL|wxEXPAND, 5 );
sbUpperSizer->Add( bSizerButtons, 0, wxALIGN_CENTER_VERTICAL, 5 ); bRightSizer->Add( bSizerButtons, 0, wxEXPAND, 5 );
sbUpperSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizerMain->Add( sbUpperSizer, 1, wxEXPAND, 5 ); bSizerMain->Add( sbUpperSizer, 1, wxEXPAND, 5 );
...@@ -87,6 +106,6 @@ LAYERS_TABLE_DIALOG_BASE::LAYERS_TABLE_DIALOG_BASE( wxWindow* parent, wxWindowID ...@@ -87,6 +106,6 @@ LAYERS_TABLE_DIALOG_BASE::LAYERS_TABLE_DIALOG_BASE( wxWindow* parent, wxWindowID
this->Centre( wxBOTH ); this->Centre( wxBOTH );
} }
LAYERS_TABLE_DIALOG_BASE::~LAYERS_TABLE_DIALOG_BASE() LAYERS_MAP_DIALOG_BASE::~LAYERS_MAP_DIALOG_BASE()
{ {
} }
...@@ -48,14 +48,14 @@ ...@@ -48,14 +48,14 @@
<property name="font"></property> <property name="font"></property>
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">ID_LAYERS_MAP_DIALOG_BASE</property>
<property name="layer"></property> <property name="layer"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">LAYERS_TABLE_DIALOG_BASE</property> <property name="name">LAYERS_MAP_DIALOG_BASE</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
...@@ -234,24 +234,6 @@ ...@@ -234,24 +234,6 @@
<event name="OnUpdateUI"></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="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_flexRightColumnBoxSizer</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> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
...@@ -260,262 +242,465 @@ ...@@ -260,262 +242,465 @@
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizerButtons</property> <property name="name">bRightSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxBoxSizer" 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="minimum_size"></property>
<property name="moveable">1</property> <property name="name">bSizerLyrCnt</property>
<property name="name">m_buttonStore</property> <property name="orient">wxVERTICAL</property>
<property name="pane_border">1</property> <property name="permission">none</property>
<property name="pane_position"></property> <object class="sizeritem" expanded="1">
<property name="pane_size"></property> <property name="border">5</property>
<property name="permission">protected</property> <property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="pin_button">1</property> <property name="proportion">0</property>
<property name="pos"></property> <object class="wxStaticText" expanded="1">
<property name="position"></property> <property name="BottomDockable">1</property>
<property name="resize">Resizable</property> <property name="LeftDockable">1</property>
<property name="row"></property> <property name="RightDockable">1</property>
<property name="show">1</property> <property name="TopDockable">1</property>
<property name="size"></property> <property name="aui_name"></property>
<property name="style"></property> <property name="bg"></property>
<property name="subclass"></property> <property name="caption"></property>
<property name="toolbar_pane">0</property> <property name="caption_visible">1</property>
<property name="tooltip"></property> <property name="center_pane">0</property>
<property name="validator_data_type"></property> <property name="close_button">1</property>
<property name="validator_style">wxFILTER_NONE</property> <property name="context_help"></property>
<property name="validator_type">wxDefaultValidator</property> <property name="context_menu">1</property>
<property name="validator_variable"></property> <property name="default_pane">0</property>
<property name="window_extra_style"></property> <property name="dock">Dock</property>
<property name="window_name"></property> <property name="dock_fixed">0</property>
<property name="window_style"></property> <property name="docking">Left</property>
<event name="OnButtonClick">OnStoreSetup</event> <property name="enabled">1</property>
<event name="OnChar"></event> <property name="fg"></property>
<event name="OnEnterWindow"></event> <property name="floatable">1</property>
<event name="OnEraseBackground"></event> <property name="font"></property>
<event name="OnKeyDown"></event> <property name="gripper">0</property>
<event name="OnKeyUp"></event> <property name="hidden">0</property>
<event name="OnKillFocus"></event> <property name="id">ID_M_STATICTEXTCOPPERLAYERCOUNT</property>
<event name="OnLeaveWindow"></event> <property name="label">Copper layers count:</property>
<event name="OnLeftDClick"></event> <property name="layer"></property>
<event name="OnLeftDown"></event> <property name="maximize_button">0</property>
<event name="OnLeftUp"></event> <property name="maximum_size"></property>
<event name="OnMiddleDClick"></event> <property name="minimize_button">0</property>
<event name="OnMiddleDown"></event> <property name="minimum_size"></property>
<event name="OnMiddleUp"></event> <property name="moveable">1</property>
<event name="OnMotion"></event> <property name="name">m_staticTextCopperlayerCount</property>
<event name="OnMouseEvents"></event> <property name="pane_border">1</property>
<event name="OnMouseWheel"></event> <property name="pane_position"></property>
<event name="OnPaint"></event> <property name="pane_size"></property>
<event name="OnRightDClick"></event> <property name="permission">protected</property>
<event name="OnRightDown"></event> <property name="pin_button">1</property>
<event name="OnRightUp"></event> <property name="pos"></property>
<event name="OnSetFocus"></event> <property name="position"></property>
<event name="OnSize"></event> <property name="resize">Resizable</property>
<event name="OnUpdateUI"></event> <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> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">1</property>
<object class="wxButton" expanded="1"> <object class="spacer" expanded="1">
<property name="BottomDockable">1</property> <property name="height">15</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="permission">protected</property>
<property name="pin_button">1</property> <property name="width">5</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> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxBoxSizer" 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="minimum_size"></property>
<property name="moveable">1</property> <property name="name">bSizerButtons</property>
<property name="name">m_buttonReset</property> <property name="orient">wxVERTICAL</property>
<property name="pane_border">1</property> <property name="permission">none</property>
<property name="pane_position"></property> <object class="sizeritem" expanded="1">
<property name="pane_size"></property> <property name="border">5</property>
<property name="permission">protected</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="pin_button">1</property> <property name="proportion">0</property>
<property name="pos"></property> <object class="wxButton" expanded="1">
<property name="position"></property> <property name="BottomDockable">1</property>
<property name="resize">Resizable</property> <property name="LeftDockable">1</property>
<property name="row"></property> <property name="RightDockable">1</property>
<property name="show">1</property> <property name="TopDockable">1</property>
<property name="size"></property> <property name="aui_name"></property>
<property name="style"></property> <property name="bg"></property>
<property name="subclass"></property> <property name="caption"></property>
<property name="toolbar_pane">0</property> <property name="caption_visible">1</property>
<property name="tooltip"></property> <property name="center_pane">0</property>
<property name="validator_data_type"></property> <property name="close_button">1</property>
<property name="validator_style">wxFILTER_NONE</property> <property name="context_help"></property>
<property name="validator_type">wxDefaultValidator</property> <property name="context_menu">1</property>
<property name="validator_variable"></property> <property name="default">0</property>
<property name="window_extra_style"></property> <property name="default_pane">0</property>
<property name="window_name"></property> <property name="dock">Dock</property>
<property name="window_style"></property> <property name="dock_fixed">0</property>
<event name="OnButtonClick">OnResetClick</event> <property name="docking">Left</property>
<event name="OnChar"></event> <property name="enabled">1</property>
<event name="OnEnterWindow"></event> <property name="fg"></property>
<event name="OnEraseBackground"></event> <property name="floatable">1</property>
<event name="OnKeyDown"></event> <property name="font"></property>
<event name="OnKeyUp"></event> <property name="gripper">0</property>
<event name="OnKillFocus"></event> <property name="hidden">0</property>
<event name="OnLeaveWindow"></event> <property name="id">ID_STORE_CHOICE</property>
<event name="OnLeftDClick"></event> <property name="label">Store Choice</property>
<event name="OnLeftDown"></event> <property name="layer"></property>
<event name="OnLeftUp"></event> <property name="maximize_button">0</property>
<event name="OnMiddleDClick"></event> <property name="maximum_size"></property>
<event name="OnMiddleDown"></event> <property name="minimize_button">0</property>
<event name="OnMiddleUp"></event> <property name="minimum_size"></property>
<event name="OnMotion"></event> <property name="moveable">1</property>
<event name="OnMouseEvents"></event> <property name="name">m_buttonStore</property>
<event name="OnMouseWheel"></event> <property name="pane_border">1</property>
<event name="OnPaint"></event> <property name="pane_position"></property>
<event name="OnRightDClick"></event> <property name="pane_size"></property>
<event name="OnRightDown"></event> <property name="permission">protected</property>
<event name="OnRightUp"></event> <property name="pin_button">1</property>
<event name="OnSetFocus"></event> <property name="pos"></property>
<event name="OnSize"></event> <property name="position"></property>
<event name="OnUpdateUI"></event> <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>
......
...@@ -18,20 +18,23 @@ ...@@ -18,20 +18,23 @@
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/combobox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class LAYERS_TABLE_DIALOG_BASE /// Class LAYERS_MAP_DIALOG_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class LAYERS_TABLE_DIALOG_BASE : public wxDialog class LAYERS_MAP_DIALOG_BASE : public wxDialog
{ {
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:
// Private event handlers // Private event handlers
void _wxFB_OnBrdLayersCountSelection( wxCommandEvent& event ){ OnBrdLayersCountSelection( event ); }
void _wxFB_OnStoreSetup( wxCommandEvent& event ){ OnStoreSetup( event ); } void _wxFB_OnStoreSetup( wxCommandEvent& event ){ OnStoreSetup( event ); }
void _wxFB_OnGetSetup( wxCommandEvent& event ){ OnGetSetup( event ); } void _wxFB_OnGetSetup( wxCommandEvent& event ){ OnGetSetup( event ); }
void _wxFB_OnResetClick( wxCommandEvent& event ){ OnResetClick( event ); } void _wxFB_OnResetClick( wxCommandEvent& event ){ OnResetClick( event ); }
...@@ -42,7 +45,10 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog ...@@ -42,7 +45,10 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog
protected: protected:
enum enum
{ {
ID_M_STATICLINESEP = 1000, ID_LAYERS_MAP_DIALOG_BASE = 1000,
ID_M_STATICLINESEP,
ID_M_STATICTEXTCOPPERLAYERCOUNT,
ID_M_COMBOCOPPERLAYERSCOUNT,
ID_STORE_CHOICE, ID_STORE_CHOICE,
ID_GET_PREVIOUS_CHOICE, ID_GET_PREVIOUS_CHOICE,
ID_RESET_CHOICE, ID_RESET_CHOICE,
...@@ -51,7 +57,9 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog ...@@ -51,7 +57,9 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog
wxStaticBoxSizer* sbSizerLayersTable; wxStaticBoxSizer* sbSizerLayersTable;
wxFlexGridSizer* m_flexLeftColumnBoxSizer; wxFlexGridSizer* m_flexLeftColumnBoxSizer;
wxStaticLine* m_staticlineSep; wxStaticLine* m_staticlineSep;
wxFlexGridSizer* m_flexRightColumnBoxSizer; wxStaticText* m_staticTextCopperlayerCount;
wxComboBox* m_comboCopperLayersCount;
wxButton* m_buttonStore; wxButton* m_buttonStore;
wxButton* m_buttonRetrieve; wxButton* m_buttonRetrieve;
wxButton* m_buttonReset; wxButton* m_buttonReset;
...@@ -61,6 +69,7 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog ...@@ -61,6 +69,7 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog
wxButton* m_sdbSizerButtonsCancel; wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class // 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 OnStoreSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGetSetup( wxCommandEvent& event ) { event.Skip(); } virtual void OnGetSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnResetClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnResetClick( wxCommandEvent& event ) { event.Skip(); }
...@@ -70,8 +79,8 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog ...@@ -70,8 +79,8 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog
public: public:
LAYERS_TABLE_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, 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( 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_TABLE_DIALOG_BASE(); ~LAYERS_MAP_DIALOG_BASE();
}; };
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#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 /* A helper class to export a Gerber set of files to Pcbnew
*/ */
...@@ -29,6 +29,7 @@ public: ...@@ -29,6 +29,7 @@ public:
GBR_TO_PCB_EXPORTER(GERBVIEW_FRAME * aFrame, FILE * aFile ); GBR_TO_PCB_EXPORTER(GERBVIEW_FRAME * aFrame, FILE * aFile );
~GBR_TO_PCB_EXPORTER(); ~GBR_TO_PCB_EXPORTER();
bool ExportPcb( int* LayerLookUpTable ); bool ExportPcb( int* LayerLookUpTable );
BOARD* GetBoard() { return m_pcb; }
private: private:
bool WriteSetup( ); // Write the SETUP section data file bool WriteSetup( ); // Write the SETUP section data file
...@@ -45,12 +46,11 @@ GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile ...@@ -45,12 +46,11 @@ GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile
{ {
m_gerbview_frame = aFrame; m_gerbview_frame = aFrame;
m_file = aFile; m_file = aFile;
m_pcb = NULL; m_pcb = new BOARD( NULL, m_gerbview_frame );
} }
GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER() GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER()
{ {
// the destructor should destroy all owned sub-objects
delete m_pcb; delete m_pcb;
} }
...@@ -95,26 +95,31 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) ...@@ -95,26 +95,31 @@ 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;
}
FILE * file = wxFopen( FullFileName, wxT( "wt" ) );
if( file == NULL )
{
msg = _( "Unable to create " ) + FullFileName;
DisplayError( this, msg );
return; return;
}
GetScreen()->SetFileName( FullFileName );
GBR_TO_PCB_EXPORTER gbr_exporter( this, file );
gbr_exporter.ExportPcb( LayerLookUpTable );
fclose( file );
} }
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 );
} }
void GBR_TO_PCB_EXPORTER::cleanBoard() void GBR_TO_PCB_EXPORTER::cleanBoard()
...@@ -195,7 +200,6 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable ) ...@@ -195,7 +200,6 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
BOARD* gerberPcb = m_gerbview_frame->GetBoard(); BOARD* gerberPcb = m_gerbview_frame->GetBoard();
// create an image of gerber data // create an image of gerber data
m_pcb = new BOARD( NULL, m_gerbview_frame );
BOARD_ITEM* item = gerberPcb->m_Drawings; BOARD_ITEM* item = gerberPcb->m_Drawings;
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {
......
...@@ -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
......
...@@ -10,74 +10,36 @@ ...@@ -10,74 +10,36 @@
#include "common.h" #include "common.h"
#include "appl_wxstruct.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"
#include "dialogs/dialog_layers_select_to_pcb_base.h" #include "select_layers_to_pcb.h"
#define LAYER_UNSELECTED NB_LAYERS #define LAYER_UNSELECTED NB_LAYERS
static int ButtonTable[32]; // Indexes buttons to Gerber 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_LAYERS_TABLE_DIALOG = 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 LAYERS_TABLE_DIALOG : public LAYERS_TABLE_DIALOG_BASE BEGIN_EVENT_TABLE( LAYERS_MAP_DIALOG, LAYERS_MAP_DIALOG_BASE )
{
private:
GERBVIEW_FRAME* m_Parent;
int m_itemsCount;
public: LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent );
~LAYERS_TABLE_DIALOG() {};
private:
void initDialog();
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()
};
BEGIN_EVENT_TABLE( LAYERS_TABLE_DIALOG, LAYERS_TABLE_DIALOG_BASE )
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + 31, EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + 31,
wxEVT_COMMAND_BUTTON_CLICKED, wxEVT_COMMAND_BUTTON_CLICKED,
LAYERS_TABLE_DIALOG::OnSelectLayer ) LAYERS_MAP_DIALOG::OnSelectLayer )
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() {
LAYERS_TABLE_DIALOG* frame = new LAYERS_TABLE_DIALOG( this );
int ii = frame->ShowModal();
frame->Destroy();
if( ii == wxID_OK )
return LayerLookUpTable;
else
return NULL;
}
LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) :
LAYERS_TABLE_DIALOG_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
initDialog(); initDialog();
...@@ -88,14 +50,16 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) : ...@@ -88,14 +50,16 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) :
} }
void LAYERS_TABLE_DIALOG::initDialog() void LAYERS_MAP_DIALOG::initDialog()
{ {
wxStaticText* label; wxStaticText* label;
wxStaticText* text; wxStaticText* text;
int item_ID, ii; int item_ID;
wxString msg; wxString msg;
wxSize goodSize; wxSize goodSize;
m_flexRightColumnBoxSizer = NULL;
// 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
// and 26 pixels high in the Linux version. (And although the dimensions // and 26 pixels high in the Linux version. (And although the dimensions
...@@ -116,37 +80,39 @@ void LAYERS_TABLE_DIALOG::initDialog() ...@@ -116,37 +80,39 @@ void LAYERS_TABLE_DIALOG::initDialog()
// 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_copper_layer_count = 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_copper_layer_count++; 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;
} }
// Ensure we have at least 2 copper layers and NB_COPPER_LAYERS copper layers max // Ensure we have:
if( pcb_copper_layer_count < 2 ) // at least 2 copper layers and NB_COPPER_LAYERS copper layers max
pcb_copper_layer_count = 2; // an even layers count because board *must* have even layers count
if( pcb_copper_layer_count > NB_COPPER_LAYERS ) // and maxi NB_COPPER_LAYERS copper layers count
pcb_copper_layer_count = NB_COPPER_LAYERS; normalizeBrdLayersCount();
m_Parent->GetBoard()->SetCopperLayerCount( pcb_copper_layer_count );
int idx = ( m_exportBoardCopperLayersCount / 2 ) - 1;
m_comboCopperLayersCount->SetSelection( idx );
int pcb_layer_num = 0; int pcb_layer_num = 0;
m_itemsCount = 0; m_itemsCount = 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 )
continue; continue;
if( (pcb_layer_num == m_Parent->GetBoard()->GetCopperLayerCount() - 1) if( (pcb_layer_num == m_exportBoardCopperLayersCount - 1)
&& (m_Parent->GetBoard()->GetCopperLayerCount() > 1) ) && (m_exportBoardCopperLayersCount > 1) )
pcb_layer_num = LAYER_N_FRONT; pcb_layer_num = LAYER_N_FRONT;
ButtonTable[m_itemsCount] = ii; m_buttonTable[m_itemsCount] = ii;
LayerLookUpTable[ii] = pcb_layer_num; m_layersLookUpTable[ii] = pcb_layer_num;
m_itemsCount++; m_itemsCount++;
pcb_layer_num++; pcb_layer_num++;
} }
...@@ -155,9 +121,17 @@ void LAYERS_TABLE_DIALOG::initDialog() ...@@ -155,9 +121,17 @@ void LAYERS_TABLE_DIALOG::initDialog()
{ {
m_staticlineSep->Hide(); m_staticlineSep->Hide();
} }
else // Add the second list of gerber files
{
m_flexRightColumnBoxSizer = new wxFlexGridSizer( 16, 4, 0, 0 );
for( int ii = 0; ii < 4; ii++ )
m_flexRightColumnBoxSizer->AddGrowableCol( ii );
m_flexRightColumnBoxSizer->SetFlexibleDirection( wxBOTH );
m_flexRightColumnBoxSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
}
wxFlexGridSizer* flexColumnBoxSizer = m_flexLeftColumnBoxSizer; wxFlexGridSizer* flexColumnBoxSizer = m_flexLeftColumnBoxSizer;
for( ii = 0; ii < m_itemsCount; ii++ ) for( int ii = 0; ii < m_itemsCount; ii++ )
{ {
// Each Gerber layer has an associated static text string (to // Each Gerber layer has an associated static text string (to
// identify that layer), a button (for invoking a child dialog // identify that layer), a button (for invoking a child dialog
...@@ -188,7 +162,7 @@ void LAYERS_TABLE_DIALOG::initDialog() ...@@ -188,7 +162,7 @@ void LAYERS_TABLE_DIALOG::initDialog()
flexColumnBoxSizer = m_flexRightColumnBoxSizer; flexColumnBoxSizer = m_flexRightColumnBoxSizer;
// Provide a text string to identify the Gerber layer // Provide a text string to identify the Gerber layer
msg.Printf( _( "Layer %d" ), ButtonTable[ii] + 1 ); msg.Printf( _( "Layer %d" ), m_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 );
...@@ -239,12 +213,12 @@ void LAYERS_TABLE_DIALOG::initDialog() ...@@ -239,12 +213,12 @@ void LAYERS_TABLE_DIALOG::initDialog()
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 );
} }
...@@ -253,35 +227,59 @@ void LAYERS_TABLE_DIALOG::initDialog() ...@@ -253,35 +227,59 @@ void LAYERS_TABLE_DIALOG::initDialog()
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 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 * reset pcb layers selection to the default value
*/ */
void LAYERS_TABLE_DIALOG::OnResetClick( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
{ {
wxString msg; wxString msg;
int ii, layer; int ii, layer;
for( ii = 0, layer = 0; ii < m_itemsCount; ii++, layer++ ) for( ii = 0, layer = 0; ii < m_itemsCount; ii++, layer++ )
{ {
if( (layer == m_Parent->GetBoard()->GetCopperLayerCount() - 1) if( (layer == m_exportBoardCopperLayersCount - 1)
&& (m_Parent->GetBoard()->GetCopperLayerCount() > 1) ) && (m_exportBoardCopperLayersCount > 1) )
layer = LAYER_N_FRONT; layer = LAYER_N_FRONT;
LayerLookUpTable[ii] = layer; m_layersLookUpTable[ii] = layer;
msg = BOARD::GetDefaultLayerName( layer ); msg = BOARD::GetDefaultLayerName( layer );
layer_list[ii]->SetLabel( msg ); m_layersList[ii]->SetLabel( msg );
layer_list[ii]->SetForegroundColour( wxNullColour ); m_layersList[ii]->SetForegroundColour( wxNullColour );
ButtonTable[ii] = ii; m_buttonTable[ii] = ii;
} }
} }
/* Stores the current mayers selection in config /* Stores the current mayers selection in config
*/ */
void LAYERS_TABLE_DIALOG::OnStoreSetup( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().m_EDA_Config;
config->Write( wxT("BrdLayersCount"), m_itemsCount ); config->Write( wxT("BrdLayersCount"), m_itemsCount );
...@@ -290,47 +288,44 @@ void LAYERS_TABLE_DIALOG::OnStoreSetup( wxCommandEvent& event ) ...@@ -290,47 +288,44 @@ void LAYERS_TABLE_DIALOG::OnStoreSetup( wxCommandEvent& event )
for( int ii = 0; ii < 32; ii++ ) for( int ii = 0; ii < 32; ii++ )
{ {
key.Printf( wxT("GbrLyr%dToPcb"), ii ); key.Printf( wxT("GbrLyr%dToPcb"), ii );
config->Write( key, LayerLookUpTable[ii] ); config->Write( key, m_layersLookUpTable[ii] );
} }
} }
void LAYERS_TABLE_DIALOG::OnGetSetup( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().m_EDA_Config;
int lyrcnt = 0;
config->Read( wxT("BrdLayersCount"), &lyrcnt ); config->Read( wxT("BrdLayersCount"), &m_exportBoardCopperLayersCount );
if( lyrcnt == 0 || lyrcnt != m_itemsCount ) normalizeBrdLayersCount();
{
wxString msg; int idx = ( m_exportBoardCopperLayersCount / 2 ) - 1;
msg.Printf( _("Previous stored setup as %d layers, and there are %d loaded layers"), m_comboCopperLayersCount->SetSelection( idx );
lyrcnt, m_itemsCount );
wxMessageBox( msg );
return;
}
wxString key; wxString key;
for( int ii = 0; ii < 32; ii++ ) for( int ii = 0; ii < 32; ii++ )
{ {
key.Printf( wxT("GbrLyr%dToPcb"), ii ); key.Printf( wxT("GbrLyr%dToPcb"), ii );
config->Read( key, &LayerLookUpTable[ii] ); config->Read( key, &m_layersLookUpTable[ii] );
} }
for( int ii = 0; ii < m_itemsCount; ii++ ) for( int ii = 0; ii < m_itemsCount; ii++ )
{ {
int layer = LayerLookUpTable[ii]; int layer = m_layersLookUpTable[ii];
if( layer == LAYER_UNSELECTED ) if( layer == LAYER_UNSELECTED )
{ {
layer_list[ii]->SetLabel( _( "Do not export" ) ); m_layersList[ii]->SetLabel( _( "Do not export" ) );
layer_list[ii]->SetForegroundColour( *wxBLUE ); m_layersList[ii]->SetForegroundColour( *wxBLUE );
} }
else else
{ {
layer_list[ii]->SetLabel( BOARD::GetDefaultLayerName( layer ) ); m_layersList[ii]->SetLabel( BOARD::GetDefaultLayerName( layer ) );
layer_list[ii]->SetForegroundColour( wxColour( 255, 0, 128 ) ); m_layersList[ii]->SetForegroundColour( wxColour( 255, 0, 128 ) );
} }
} }
} }
void LAYERS_TABLE_DIALOG::OnSelectLayer( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
{ {
int ii, jj; int ii, jj;
...@@ -341,76 +336,70 @@ void LAYERS_TABLE_DIALOG::OnSelectLayer( wxCommandEvent& event ) ...@@ -341,76 +336,70 @@ void LAYERS_TABLE_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 LAYERS_TABLE_DIALOG::OnCancelClick( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnCancelClick( wxCommandEvent& event )
{ {
EndModal( wxID_CANCEL ); EndModal( wxID_CANCEL );
} }
void LAYERS_TABLE_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
// internal copper layers = m_exportBoardCopperLayersCount-2
if( layers_count > NB_COPPER_LAYERS ) // should not occur. if( inner_layer_max > m_exportBoardCopperLayersCount-2 )
layers_count = NB_COPPER_LAYERS; {
wxMessageBox(
if( layers_count < 2 ) _("The exported board has not enough copper layers to handle selected inner layers") );
layers_count = 2; return;
}
m_Parent->GetBoard()->SetCopperLayerCount( layers_count ); m_layersLookUpTable[32] = m_exportBoardCopperLayersCount;
EndModal( wxID_OK ); 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