Commit 81947a4f authored by jean-pierre charras's avatar jean-pierre charras

Gerbview: export_to_pcbnew enhancements.

parent a7a4dab4
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( LAYERS_TABLE_DIALOG_BASE, wxDialog ) BEGIN_EVENT_TABLE( LAYERS_TABLE_DIALOG_BASE, wxDialog )
EVT_BUTTON( ID_STORE_CHOICE, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnStoreSetup )
EVT_BUTTON( ID_GET_PREVIOUS_CHOICE, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnGetSetup )
EVT_BUTTON( ID_RESET_CHOICE, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnResetClick )
EVT_BUTTON( wxID_CANCEL, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnCancelClick ) EVT_BUTTON( wxID_CANCEL, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnCancelClick )
EVT_BUTTON( wxID_OK, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnOkClick ) EVT_BUTTON( wxID_OK, LAYERS_TABLE_DIALOG_BASE::_wxFB_OnOkClick )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -54,12 +57,15 @@ LAYERS_TABLE_DIALOG_BASE::LAYERS_TABLE_DIALOG_BASE( wxWindow* parent, wxWindowID ...@@ -54,12 +57,15 @@ LAYERS_TABLE_DIALOG_BASE::LAYERS_TABLE_DIALOG_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bSizerButtons; wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxVERTICAL ); bSizerButtons = new wxBoxSizer( wxVERTICAL );
m_buttonStore = new wxButton( this, wxID_ANY, _("Store Choice"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonStore = new wxButton( this, ID_STORE_CHOICE, _("Store Choice"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonStore, 0, wxALL|wxEXPAND, 5 ); bSizerButtons->Add( m_buttonStore, 0, wxALL|wxEXPAND, 5 );
m_buttonRetrieve = new wxButton( this, wxID_ANY, _("Get Stored Choice"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonRetrieve = new wxButton( this, ID_GET_PREVIOUS_CHOICE, _("Get Stored Choice"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonRetrieve, 0, wxALL|wxEXPAND, 5 ); 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 );
sbUpperSizer->Add( bSizerButtons, 0, wxALIGN_CENTER_VERTICAL, 5 ); sbUpperSizer->Add( bSizerButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizerMain->Add( sbUpperSizer, 1, wxEXPAND, 5 ); bSizerMain->Add( sbUpperSizer, 1, wxEXPAND, 5 );
......
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
<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_STORE_CHOICE</property>
<property name="label">Store Choice</property> <property name="label">Store Choice</property>
<property name="layer"></property> <property name="layer"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
...@@ -322,7 +322,7 @@ ...@@ -322,7 +322,7 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnButtonClick"></event> <event name="OnButtonClick">OnStoreSetup</event>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
...@@ -376,7 +376,7 @@ ...@@ -376,7 +376,7 @@
<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_GET_PREVIOUS_CHOICE</property>
<property name="label">Get Stored Choice</property> <property name="label">Get Stored Choice</property>
<property name="layer"></property> <property name="layer"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
...@@ -407,7 +407,92 @@ ...@@ -407,7 +407,92 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnButtonClick"></event> <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="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
......
...@@ -32,6 +32,9 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog ...@@ -32,6 +32,9 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog
private: private:
// Private event handlers // Private event handlers
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_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); } void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); }
...@@ -40,6 +43,9 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog ...@@ -40,6 +43,9 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog
enum enum
{ {
ID_M_STATICLINESEP = 1000, ID_M_STATICLINESEP = 1000,
ID_STORE_CHOICE,
ID_GET_PREVIOUS_CHOICE,
ID_RESET_CHOICE,
}; };
wxStaticBoxSizer* sbSizerLayersTable; wxStaticBoxSizer* sbSizerLayersTable;
...@@ -48,12 +54,16 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog ...@@ -48,12 +54,16 @@ class LAYERS_TABLE_DIALOG_BASE : public wxDialog
wxFlexGridSizer* m_flexRightColumnBoxSizer; wxFlexGridSizer* m_flexRightColumnBoxSizer;
wxButton* m_buttonStore; wxButton* m_buttonStore;
wxButton* m_buttonRetrieve; wxButton* m_buttonRetrieve;
wxButton* m_buttonReset;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButtons; wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK; wxButton* m_sdbSizerButtonsOK;
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 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 OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "appl_wxstruct.h"
#include "gerbview.h" #include "gerbview.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "class_GERBER.h" #include "class_GERBER.h"
...@@ -22,7 +23,7 @@ static int LayerLookUpTable[32]; // Indexes Gerber layers to PCB file layers ...@@ -22,7 +23,7 @@ static int LayerLookUpTable[32]; // Indexes Gerber layers to PCB file layers
wxStaticText* layer_list[32]; // Indexes text strings to buttons wxStaticText* layer_list[32]; // Indexes text strings to buttons
enum swap_layer_id { enum swap_layer_id {
ID_WINEDA_SWAPLAYERFRAME = 1800, ID_LAYERS_TABLE_DIALOG = 1800,
ID_BUTTON_0, ID_BUTTON_0,
ID_TEXT_0 = ID_BUTTON_0 + 32 ID_TEXT_0 = ID_BUTTON_0 + 32
}; };
...@@ -32,26 +33,27 @@ class LAYERS_TABLE_DIALOG : public LAYERS_TABLE_DIALOG_BASE ...@@ -32,26 +33,27 @@ class LAYERS_TABLE_DIALOG : public LAYERS_TABLE_DIALOG_BASE
{ {
private: private:
GERBVIEW_FRAME* m_Parent; GERBVIEW_FRAME* m_Parent;
wxStaticText* label; int m_itemsCount;
wxButton* Button;
wxStaticText* text;
public: public: LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent );
LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent );
~LAYERS_TABLE_DIALOG() {}; ~LAYERS_TABLE_DIALOG() {};
private: private:
void initDialog();
void OnSelectLayer( wxCommandEvent& event ); void OnSelectLayer( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void OnStoreSetup( wxCommandEvent& event );
void OnGetSetup( wxCommandEvent& event );
void OnResetClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
BEGIN_EVENT_TABLE( LAYERS_TABLE_DIALOG, wxDialog ) 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_TABLE_DIALOG::OnSelectLayer )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -61,8 +63,7 @@ END_EVENT_TABLE() ...@@ -61,8 +63,7 @@ END_EVENT_TABLE()
* between gerber layers and pcbnew layers * between gerber layers and pcbnew layers
* return the "lookup table" if ok, or NULL * return the "lookup table" if ok, or NULL
*/ */
int* GERBVIEW_FRAME::InstallDialogLayerPairChoice( ) int* GERBVIEW_FRAME::InstallDialogLayerPairChoice() {
{
LAYERS_TABLE_DIALOG* frame = new LAYERS_TABLE_DIALOG( this ); LAYERS_TABLE_DIALOG* frame = new LAYERS_TABLE_DIALOG( this );
int ii = frame->ShowModal(); int ii = frame->ShowModal();
...@@ -78,13 +79,20 @@ int* GERBVIEW_FRAME::InstallDialogLayerPairChoice( ) ...@@ -78,13 +79,20 @@ int* GERBVIEW_FRAME::InstallDialogLayerPairChoice( )
LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) : LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) :
LAYERS_TABLE_DIALOG_BASE( parent ) LAYERS_TABLE_DIALOG_BASE( parent )
{ {
label = NULL;
Button = NULL;
text = NULL;
m_Parent = parent; m_Parent = parent;
initDialog();
int item_ID, ii, nb_items; // Resize the dialog
GetSizer()->SetSizeHints( this );
Centre();
}
void LAYERS_TABLE_DIALOG::initDialog()
{
wxStaticText* label;
wxStaticText* text;
int item_ID, ii;
wxString msg; wxString msg;
wxSize goodSize; wxSize goodSize;
...@@ -124,10 +132,11 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) : ...@@ -124,10 +132,11 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) :
pcb_copper_layer_count = 2; pcb_copper_layer_count = 2;
if( pcb_copper_layer_count > NB_COPPER_LAYERS ) if( pcb_copper_layer_count > NB_COPPER_LAYERS )
pcb_copper_layer_count = NB_COPPER_LAYERS; pcb_copper_layer_count = NB_COPPER_LAYERS;
m_Parent->GetBoard()->SetCopperLayerCount(pcb_copper_layer_count); m_Parent->GetBoard()->SetCopperLayerCount( pcb_copper_layer_count );
int pcb_layer_num = 0; int pcb_layer_num = 0;
for( nb_items = 0, ii = 0; ii < 32; ii++ ) m_itemsCount = 0;
for( ii = 0; ii < 32; ii++ )
{ {
if( g_GERBER_List[ii] == NULL ) if( g_GERBER_List[ii] == NULL )
continue; continue;
...@@ -136,17 +145,19 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) : ...@@ -136,17 +145,19 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) :
&& (m_Parent->GetBoard()->GetCopperLayerCount() > 1) ) && (m_Parent->GetBoard()->GetCopperLayerCount() > 1) )
pcb_layer_num = LAYER_N_FRONT; pcb_layer_num = LAYER_N_FRONT;
ButtonTable[nb_items] = ii; ButtonTable[m_itemsCount] = ii;
LayerLookUpTable[ii] = pcb_layer_num; LayerLookUpTable[ii] = pcb_layer_num;
nb_items++; m_itemsCount++;
pcb_layer_num++; pcb_layer_num++;
} }
if( nb_items <= 16 ) if( m_itemsCount <= 16 ) // Only one list is enough
{
m_staticlineSep->Hide(); m_staticlineSep->Hide();
}
wxFlexGridSizer* flexColumnBoxSizer = m_flexLeftColumnBoxSizer; wxFlexGridSizer* flexColumnBoxSizer = m_flexLeftColumnBoxSizer;
for( ii = 0; ii < nb_items; ii++ ) for( 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
...@@ -183,7 +194,7 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) : ...@@ -183,7 +194,7 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) :
wxDefaultSize, wxALIGN_RIGHT ); wxDefaultSize, wxALIGN_RIGHT );
flexColumnBoxSizer->Add( label, 0, flexColumnBoxSizer->Add( label, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL |
wxRIGHT|wxLEFT, 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 );
...@@ -191,17 +202,15 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) : ...@@ -191,17 +202,15 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) :
wxDefaultPosition, wxDefaultSize ); wxDefaultPosition, wxDefaultSize );
flexColumnBoxSizer->Add( label, 0, flexColumnBoxSizer->Add( label, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL |
wxRIGHT|wxLEFT, 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( "..." ),
Button = new wxButton( this, item_ID, wxT( "..." ),
wxDefaultPosition, wxSize( w, h ), 0 ); wxDefaultPosition, wxSize( w, h ), 0 );
flexColumnBoxSizer->Add( Button, 0, flexColumnBoxSizer->Add( Button, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
wxRIGHT|wxLEFT, 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
...@@ -241,18 +250,86 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) : ...@@ -241,18 +250,86 @@ LAYERS_TABLE_DIALOG::LAYERS_TABLE_DIALOG( GERBVIEW_FRAME* parent ) :
} }
text->SetMinSize( goodSize ); text->SetMinSize( goodSize );
flexColumnBoxSizer->Add( text, 1, flexColumnBoxSizer->Add( text, 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxRIGHT| wxLEFT, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT,
5 ); 5 );
layer_list[ii] = text; layer_list[ii] = text;
} }
}
// Resize the dialog
GetSizer()->SetSizeHints( this ); /*
Centre(); * reset pcb layers selection to the default value
*/
void LAYERS_TABLE_DIALOG::OnResetClick( wxCommandEvent& event )
{
wxString msg;
int ii, layer;
for( ii = 0, layer = 0; ii < m_itemsCount; ii++, layer++ )
{
if( (layer == m_Parent->GetBoard()->GetCopperLayerCount() - 1)
&& (m_Parent->GetBoard()->GetCopperLayerCount() > 1) )
layer = LAYER_N_FRONT;
LayerLookUpTable[ii] = layer;
msg = BOARD::GetDefaultLayerName( layer );
layer_list[ii]->SetLabel( msg );
layer_list[ii]->SetForegroundColour( wxNullColour );
ButtonTable[ii] = ii;
}
} }
/* Stores the current mayers selection in config
*/
void LAYERS_TABLE_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++ )
{
key.Printf( wxT("GbrLyr%dToPcb"), ii );
config->Write( key, LayerLookUpTable[ii] );
}
}
void LAYERS_TABLE_DIALOG::OnGetSetup( wxCommandEvent& event )
{
wxConfig* config = wxGetApp().m_EDA_Config;
int lyrcnt = 0;
config->Read( wxT("BrdLayersCount"), &lyrcnt );
if( lyrcnt == 0 || lyrcnt != m_itemsCount )
{
wxString msg;
msg.Printf( _("Previous stored setup as %d layers, and there are %d loaded layers"),
lyrcnt, m_itemsCount );
wxMessageBox( msg );
return;
}
wxString key;
for( int ii = 0; ii < 32; ii++ )
{
key.Printf( wxT("GbrLyr%dToPcb"), ii );
config->Read( key, &LayerLookUpTable[ii] );
}
for( int ii = 0; ii < m_itemsCount; ii++ )
{
int layer = LayerLookUpTable[ii];
if( layer == LAYER_UNSELECTED )
{
layer_list[ii]->SetLabel( _( "Do not export" ) );
layer_list[ii]->SetForegroundColour( *wxBLUE );
}
else
{
layer_list[ii]->SetLabel( BOARD::GetDefaultLayerName( layer ) );
layer_list[ii]->SetForegroundColour( wxColour( 255, 0, 128 ) );
}
}
}
void LAYERS_TABLE_DIALOG::OnSelectLayer( wxCommandEvent& event ) void LAYERS_TABLE_DIALOG::OnSelectLayer( wxCommandEvent& event )
{ {
int ii, jj; int ii, jj;
...@@ -310,6 +387,7 @@ void LAYERS_TABLE_DIALOG::OnOkClick( wxCommandEvent& event ) ...@@ -310,6 +387,7 @@ void LAYERS_TABLE_DIALOG::OnOkClick( wxCommandEvent& event )
* this is the max layer number + 1 (if some internal layers exist) * this is the max layer number + 1 (if some internal layers exist)
*/ */
int layers_count = 1; int layers_count = 1;
for( ii = 0; ii < 32; ii++ ) for( ii = 0; ii < 32; ii++ )
{ {
if( LayerLookUpTable[ii] == LAYER_N_FRONT ) if( LayerLookUpTable[ii] == LAYER_N_FRONT )
......
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