2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file sel_layer.cpp
|
|
|
|
* @brief Set up the basic primitives for Layer control.
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <wxBasePcbFrame.h>
|
|
|
|
#include <pcbcommon.h>
|
|
|
|
|
|
|
|
#include <class_board.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
enum layer_sel_id {
|
2007-10-07 03:08:24 +00:00
|
|
|
ID_LAYER_SELECT_TOP = 1800,
|
2007-08-10 19:14:51 +00:00
|
|
|
ID_LAYER_SELECT_BOTTOM,
|
|
|
|
ID_LAYER_SELECT
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-04-26 08:30:16 +00:00
|
|
|
class SELECT_LAYER_DIALOG : public wxDialog
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
private:
|
2011-03-01 19:26:17 +00:00
|
|
|
PCB_BASE_FRAME* m_Parent;
|
|
|
|
wxRadioBox* m_LayerList;
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM m_LayerId[int(NB_PCB_LAYERS) + 1]; // One extra element for "(Deselect)" radiobutton
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-10 19:14:51 +00:00
|
|
|
// Constructor and destructor
|
2013-03-31 13:27:46 +00:00
|
|
|
SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent, LAYER_NUM default_layer,
|
|
|
|
LAYER_NUM min_layer, LAYER_NUM max_layer, bool null_layer );
|
2011-04-26 08:30:16 +00:00
|
|
|
~SELECT_LAYER_DIALOG() { };
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
private:
|
2011-09-19 16:29:46 +00:00
|
|
|
void OnLayerSelected( wxCommandEvent& event );
|
2009-11-20 14:55:20 +00:00
|
|
|
void OnCancelClick( wxCommandEvent& event );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
|
2011-04-26 08:30:16 +00:00
|
|
|
BEGIN_EVENT_TABLE( SELECT_LAYER_DIALOG, wxDialog )
|
2011-09-19 16:29:46 +00:00
|
|
|
EVT_BUTTON( wxID_OK, SELECT_LAYER_DIALOG::OnLayerSelected )
|
2011-04-26 08:30:16 +00:00
|
|
|
EVT_BUTTON( wxID_CANCEL, SELECT_LAYER_DIALOG::OnCancelClick )
|
2011-09-19 16:29:46 +00:00
|
|
|
EVT_RADIOBOX( ID_LAYER_SELECT, SELECT_LAYER_DIALOG::OnLayerSelected )
|
2007-05-06 16:03:28 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2007-11-20 10:08:07 +00:00
|
|
|
/** Install the dialog box for layer selection
|
2013-03-31 13:27:46 +00:00
|
|
|
* @param default_layer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
|
2007-09-13 11:28:58 +00:00
|
|
|
* @param min_layer = min layer value (-1 if no min value)
|
2007-10-07 03:08:24 +00:00
|
|
|
* @param max_layer = max layer value (-1 if no max value)
|
|
|
|
* @param null_layer = display a "(Deselect)" radiobutton (when set to true)
|
2013-03-31 13:27:46 +00:00
|
|
|
* @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected),
|
2009-11-20 14:55:20 +00:00
|
|
|
* or -1 if canceled
|
2007-10-07 03:08:24 +00:00
|
|
|
*
|
|
|
|
* Providing the option to also display a "(Deselect)" radiobutton makes the
|
|
|
|
* "Swap Layers" command (and GerbView's "Export to Pcbnew" command) more "user
|
|
|
|
* friendly", by permitting any layer to be "deselected" immediately after its
|
|
|
|
* corresponding radiobutton has been clicked on. (It would otherwise be
|
|
|
|
* necessary to first cancel the "Select Layer:" dialog box (invoked after a
|
2009-11-20 14:55:20 +00:00
|
|
|
* different radiobutton is clicked on) prior to then clicking on the
|
|
|
|
* "Deselect"
|
2007-10-07 03:08:24 +00:00
|
|
|
* button provided within the "Swap Layers:" or "Layer selection:" dialog box).
|
2007-08-10 19:14:51 +00:00
|
|
|
*/
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM PCB_BASE_FRAME::SelectLayer( LAYER_NUM default_layer,
|
|
|
|
LAYER_NUM min_layer,
|
|
|
|
LAYER_NUM max_layer,
|
2013-04-06 12:28:02 +00:00
|
|
|
bool null_layer )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-04-26 08:30:16 +00:00
|
|
|
SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this,
|
2009-11-20 14:55:20 +00:00
|
|
|
default_layer,
|
|
|
|
min_layer,
|
|
|
|
max_layer,
|
|
|
|
null_layer );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM layer = frame->ShowModal();
|
2007-10-07 03:08:24 +00:00
|
|
|
frame->Destroy();
|
2007-08-10 19:14:51 +00:00
|
|
|
return layer;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-07 03:08:24 +00:00
|
|
|
/*
|
|
|
|
* The "OK" and "Cancel" buttons are positioned (in a horizontal line)
|
|
|
|
* beneath the "Layer" radiobox, unless that contains only one column of
|
|
|
|
* radiobuttons, in which case they are positioned (in a vertical line)
|
|
|
|
* to the right of that radiobox.
|
|
|
|
*/
|
2011-04-26 08:30:16 +00:00
|
|
|
SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent,
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM default_layer, LAYER_NUM min_layer,
|
|
|
|
LAYER_NUM max_layer, bool null_layer ) :
|
2009-11-20 14:55:20 +00:00
|
|
|
wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ),
|
|
|
|
wxSize( 470, 250 ),
|
|
|
|
DIALOG_STYLE )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
BOARD* board = parent->GetBoard();
|
2007-08-10 19:14:51 +00:00
|
|
|
wxButton* Button;
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM ii;
|
|
|
|
wxString LayerList[NB_PCB_LAYERS + 1]; // One extra element for "(Deselect)"
|
2009-11-20 14:55:20 +00:00
|
|
|
// radiobutton
|
2007-08-10 19:14:51 +00:00
|
|
|
int LayerCount, LayerSelect = -1;
|
2009-11-20 14:55:20 +00:00
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
m_Parent = parent;
|
|
|
|
|
2013-04-07 11:55:18 +00:00
|
|
|
// Build the layer list
|
2007-08-10 19:14:51 +00:00
|
|
|
LayerCount = 0;
|
2013-03-30 17:24:04 +00:00
|
|
|
LAYER_MSK Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
|
|
|
|
Masque_Layer |= ALL_NO_CU_LAYERS;
|
2011-03-14 19:17:42 +00:00
|
|
|
|
2013-03-31 13:27:46 +00:00
|
|
|
for( ii = FIRST_LAYER; ii < NB_PCB_LAYERS; ++ii )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2013-03-31 13:27:46 +00:00
|
|
|
m_LayerId[ii] = FIRST_LAYER;
|
2009-11-20 14:55:20 +00:00
|
|
|
|
2011-12-06 08:35:13 +00:00
|
|
|
if( GetLayerMask( ii ) & Masque_Layer )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
|
|
|
if( min_layer > ii )
|
|
|
|
continue;
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
if( ( max_layer >= 0 ) && ( max_layer < ii ) )
|
2007-08-10 19:14:51 +00:00
|
|
|
break;
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
LayerList[LayerCount] = board->GetLayerName( ii );
|
2011-03-14 19:17:42 +00:00
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
if( ii == default_layer )
|
|
|
|
LayerSelect = LayerCount;
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
m_LayerId[LayerCount] = ii;
|
|
|
|
LayerCount++;
|
|
|
|
}
|
|
|
|
}
|
2009-11-20 14:55:20 +00:00
|
|
|
|
2007-10-07 03:08:24 +00:00
|
|
|
// When appropriate, also provide a "(Deselect)" radiobutton
|
|
|
|
if( null_layer )
|
|
|
|
{
|
|
|
|
LayerList[LayerCount] = _( "(Deselect)" );
|
2011-03-14 19:17:42 +00:00
|
|
|
|
2013-03-31 13:27:46 +00:00
|
|
|
if( NB_PCB_LAYERS == default_layer )
|
2007-10-07 03:08:24 +00:00
|
|
|
LayerSelect = LayerCount;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2013-03-31 13:27:46 +00:00
|
|
|
m_LayerId[LayerCount] = NB_PCB_LAYERS;
|
2007-10-07 03:08:24 +00:00
|
|
|
LayerCount++;
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
m_LayerList = new wxRadioBox( this, ID_LAYER_SELECT, _( "Layer" ),
|
|
|
|
wxPoint( -1, -1 ), wxSize( -1, -1 ),
|
|
|
|
LayerCount, LayerList,
|
|
|
|
(LayerCount < 8) ? LayerCount : 8,
|
|
|
|
wxRA_SPECIFY_ROWS );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
if( LayerSelect >= 0 )
|
|
|
|
m_LayerList->SetSelection( LayerSelect );
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
wxBoxSizer* FrameBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
SetSizer( FrameBoxSizer );
|
|
|
|
FrameBoxSizer->Add( m_LayerList, 0, wxALIGN_TOP | wxALL, 5 );
|
|
|
|
wxBoxSizer* ButtonBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
FrameBoxSizer->Add( ButtonBoxSizer, 0, wxALIGN_BOTTOM | wxALL, 0 );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
Button = new wxButton( this, wxID_OK, _( "OK" ) );
|
2011-03-14 19:17:42 +00:00
|
|
|
Button->SetDefault();
|
2009-11-20 14:55:20 +00:00
|
|
|
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
|
|
|
|
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-09-19 16:29:46 +00:00
|
|
|
SetFocus();
|
|
|
|
|
2011-04-26 08:30:16 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
2011-09-19 16:29:46 +00:00
|
|
|
|
|
|
|
Center();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-19 16:29:46 +00:00
|
|
|
void SELECT_LAYER_DIALOG::OnLayerSelected( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
int ii = m_LayerId[m_LayerList->GetSelection()];
|
|
|
|
|
|
|
|
EndModal( ii );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2011-04-26 08:30:16 +00:00
|
|
|
void SELECT_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
EndModal( -1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/*********************************************/
|
|
|
|
/* Dialog for the selecting pairs of layers. */
|
|
|
|
/*********************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-04-26 08:30:16 +00:00
|
|
|
class SELECT_LAYERS_PAIR_DIALOG : public wxDialog
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
private:
|
2011-03-01 19:26:17 +00:00
|
|
|
PCB_BASE_FRAME* m_Parent;
|
|
|
|
wxRadioBox* m_LayerListTOP;
|
|
|
|
wxRadioBox* m_LayerListBOTTOM;
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM m_LayerId[NB_COPPER_LAYERS];
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-04-26 08:30:16 +00:00
|
|
|
public: SELECT_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* parent );
|
|
|
|
~SELECT_LAYERS_PAIR_DIALOG() { };
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
private:
|
2009-11-20 14:55:20 +00:00
|
|
|
void OnOkClick( wxCommandEvent& event );
|
|
|
|
void OnCancelClick( wxCommandEvent& event );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
2011-04-26 08:30:16 +00:00
|
|
|
BEGIN_EVENT_TABLE( SELECT_LAYERS_PAIR_DIALOG, wxDialog )
|
|
|
|
EVT_BUTTON( wxID_OK, SELECT_LAYERS_PAIR_DIALOG::OnOkClick )
|
|
|
|
EVT_BUTTON( wxID_CANCEL, SELECT_LAYERS_PAIR_DIALOG::OnCancelClick )
|
2007-05-06 16:03:28 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Display a list of two copper layers for selection of a pair of layers
|
|
|
|
* for auto-routing, vias ...
|
2007-08-10 19:14:51 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::SelectLayerPair()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-10-07 03:08:24 +00:00
|
|
|
// Check whether more than one copper layer has been enabled for the
|
|
|
|
// current PCB file, as Layer Pairs can only meaningfully be defined
|
|
|
|
// within PCB files which contain at least two copper layers.
|
2010-01-31 20:01:46 +00:00
|
|
|
if( GetBoard()->GetCopperLayerCount() < 2 )
|
2007-10-07 03:08:24 +00:00
|
|
|
{
|
|
|
|
wxString InfoMsg;
|
|
|
|
InfoMsg = _( "Less than two copper layers are being used." );
|
2009-11-20 14:55:20 +00:00
|
|
|
InfoMsg << wxT( "\n" ) << _( "Hence layer pairs cannot be specified." );
|
2009-04-17 08:51:02 +00:00
|
|
|
DisplayInfoMessage( this, InfoMsg );
|
2007-10-07 03:08:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
SELECT_LAYERS_PAIR_DIALOG* frame = new SELECT_LAYERS_PAIR_DIALOG( this );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2007-10-12 13:56:22 +00:00
|
|
|
int result = frame->ShowModal();
|
2007-10-07 03:08:24 +00:00
|
|
|
frame->Destroy();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-10-12 13:56:22 +00:00
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
// if user changed colors and we are in high contrast mode, then redraw
|
|
|
|
// because the PAD_SMD pads may change color.
|
2007-10-12 13:56:22 +00:00
|
|
|
if( result >= 0 && DisplayOpt.ContrastModeDisplay )
|
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2007-10-12 13:56:22 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-26 08:30:16 +00:00
|
|
|
SELECT_LAYERS_PAIR_DIALOG::SELECT_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* parent ) :
|
2009-11-20 14:55:20 +00:00
|
|
|
wxDialog( parent, -1, _( "Select Layer Pair:" ), wxPoint( -1, -1 ),
|
2007-08-10 19:14:51 +00:00
|
|
|
wxSize( 470, 250 ), DIALOG_STYLE )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
BOARD* board = parent->GetBoard();
|
2007-08-10 19:14:51 +00:00
|
|
|
wxButton* Button;
|
|
|
|
wxString LayerList[NB_COPPER_LAYERS];
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM LayerTopSelect = FIRST_LAYER, LayerBottomSelect = FIRST_LAYER;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
m_Parent = parent;
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
|
2013-03-30 17:24:04 +00:00
|
|
|
LAYER_MSK Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
|
|
|
|
Masque_Layer |= ALL_NO_CU_LAYERS;
|
2009-11-20 14:55:20 +00:00
|
|
|
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM LayerCount = FIRST_LAYER;
|
|
|
|
for( LAYER_NUM ii = FIRST_COPPER_LAYER; ii < NB_COPPER_LAYERS; ++ii )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2013-03-31 13:27:46 +00:00
|
|
|
m_LayerId[ii] = FIRST_LAYER;
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2011-12-06 08:35:13 +00:00
|
|
|
if( (GetLayerMask( ii ) & Masque_Layer) )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2008-03-04 04:22:27 +00:00
|
|
|
LayerList[LayerCount] = board->GetLayerName( ii );
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
if( ii == screen->m_Route_Layer_TOP )
|
|
|
|
LayerTopSelect = LayerCount;
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
if( ii == screen->m_Route_Layer_BOTTOM )
|
|
|
|
LayerBottomSelect = LayerCount;
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
m_LayerId[LayerCount] = ii;
|
2013-03-31 13:27:46 +00:00
|
|
|
++LayerCount;
|
2007-08-10 19:14:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
m_LayerListTOP = new wxRadioBox( this, ID_LAYER_SELECT_TOP,
|
|
|
|
_( "Top Layer" ),
|
|
|
|
wxPoint( -1, -1 ), wxSize( -1, -1 ),
|
|
|
|
LayerCount, LayerList,
|
|
|
|
(LayerCount < 8) ? LayerCount : 8,
|
|
|
|
wxRA_SPECIFY_ROWS );
|
2007-08-10 19:14:51 +00:00
|
|
|
m_LayerListTOP->SetSelection( LayerTopSelect );
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
m_LayerListBOTTOM = new wxRadioBox( this, ID_LAYER_SELECT_BOTTOM,
|
|
|
|
_( "Bottom Layer" ),
|
|
|
|
wxPoint( -1, -1 ), wxSize( -1, -1 ),
|
|
|
|
LayerCount, LayerList,
|
|
|
|
(LayerCount < 8) ? LayerCount : 8,
|
|
|
|
wxRA_SPECIFY_ROWS );
|
2007-08-10 19:14:51 +00:00
|
|
|
m_LayerListBOTTOM->SetSelection( LayerBottomSelect );
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
wxBoxSizer* FrameBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
SetSizer( FrameBoxSizer );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
wxBoxSizer* RadioBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
FrameBoxSizer->Add( RadioBoxSizer, 0, wxALIGN_LEFT | wxALL, 0 );
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
wxBoxSizer* ButtonBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
FrameBoxSizer->Add( ButtonBoxSizer, 0, wxALIGN_RIGHT | wxALL, 0 );
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
RadioBoxSizer->Add( m_LayerListTOP, 0, wxALIGN_TOP | wxALL, 5 );
|
|
|
|
RadioBoxSizer->Add( m_LayerListBOTTOM, 0, wxALIGN_TOP | wxALL, 5 );
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
Button = new wxButton( this, wxID_OK, _( "OK" ) );
|
2011-03-14 15:17:18 +00:00
|
|
|
Button->SetDefault();
|
2009-11-20 14:55:20 +00:00
|
|
|
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
|
|
|
|
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
2011-09-19 16:29:46 +00:00
|
|
|
SetFocus();
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2011-09-19 16:29:46 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
|
|
|
Center();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-26 08:30:16 +00:00
|
|
|
void SELECT_LAYERS_PAIR_DIALOG::OnOkClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-11-20 14:55:20 +00:00
|
|
|
// select the same layer for top and bottom is allowed (normal in some
|
|
|
|
// boards)
|
2008-04-30 11:52:34 +00:00
|
|
|
// but could be a mistake. So display an info message
|
2011-03-14 15:17:18 +00:00
|
|
|
if( m_LayerId[m_LayerListTOP->GetSelection()] == m_LayerId[m_LayerListBOTTOM->GetSelection()] )
|
2009-11-20 14:55:20 +00:00
|
|
|
DisplayInfoMessage( this,
|
|
|
|
_( "Warning: The Top Layer and Bottom Layer are same." ) );
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
screen->m_Route_Layer_TOP = m_LayerId[m_LayerListTOP->GetSelection()];
|
2011-03-14 15:17:18 +00:00
|
|
|
screen->m_Route_Layer_BOTTOM = m_LayerId[m_LayerListBOTTOM->GetSelection()];
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
EndModal( 0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2011-04-26 08:30:16 +00:00
|
|
|
void SELECT_LAYERS_PAIR_DIALOG::OnCancelClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
EndModal( -1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|