Commit 945551b8 authored by dickelbeck's avatar dickelbeck

more layer setup dialog work

parent 860fbb16
......@@ -36,11 +36,12 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
};
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust thist.
m_VisibleLayers = 0xffffffff; // IMB: All layers visible at first. TODO: Use a macro for the initial value.
m_VisibleElements = 0x00000fff; // IMB: All elements visible at first. TODO: Use a macro for the initial value.
// SetCopperLayerCount() will adjust this.
m_VisibleLayers = 0xffffffff; // All layers visible at first.
m_VisibleElements = 0x00000fff; // All elements visible at first. TODO: Use a macro for the initial value.
SetCopperLayerCount( 2 ); // Default design is a double sided board
m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width
m_MicroViasAllowed = false; // true to allow micro vias
......@@ -53,6 +54,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter
m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter
// Global mask margins:
m_SolderMaskMargin = 150; // Solder mask margin
m_SolderPasteMargin = 0; // Solder paste margin absolute value
......@@ -111,11 +113,6 @@ void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool a
}
/**
* Function SetCopperLayerCount
* do what its name says...
* @param aNewLayerCount = The new number of enabled copper layers
*/
void EDA_BoardDesignSettings::SetCopperLayerCount( int aNewLayerCount )
{
m_CopperLayerCount = aNewLayerCount;
......
......@@ -48,12 +48,6 @@ wxSize DIALOG_LAYERS_SETUP::s_LastSize;
/*
// Layer order on the list panel
// Real board order
static const int LayerOrder[NB_LAYERS] =
{ 17, 19, 21, 23, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4,
3, 2, 1, 0, 22, 20, 18, 16, 28, 27, 26, 25, 24 };
// This function translates from the dialog's layer order to Kicad's layer order.
static int GetLayerNumber( int aRow )
......@@ -127,6 +121,104 @@ static const int CopperMasks[] =
};
// The sequence of the layer oriented rows in the scrollPanel:
static const short layerOrder[NB_LAYERS] = {
ADHESIVE_N_CMP,
SOLDERPASTE_N_CMP,
SILKSCREEN_N_CMP,
SOLDERMASK_N_CMP,
LAYER_N_FRONT,
LAYER_N_2,
LAYER_N_3,
LAYER_N_4,
LAYER_N_5,
LAYER_N_6,
LAYER_N_7,
LAYER_N_8,
LAYER_N_9,
LAYER_N_10,
LAYER_N_11,
LAYER_N_12,
LAYER_N_13,
LAYER_N_14,
LAYER_N_15,
LAYER_N_BACK,
SOLDERMASK_N_CU,
SILKSCREEN_N_CU,
SOLDERPASTE_N_CU,
ADHESIVE_N_CU,
EDGE_N,
ECO2_N,
ECO1_N,
COMMENT_N,
DRAW_N,
};
struct IDs
{
IDs( int aName, int aCheckBox, int aChoice )
{
name = aName;
checkbox = aCheckBox;
choice = aChoice;
}
short name;
short checkbox;
short choice;
};
/**
* Function getIDs
* maps \a aLayerNumber to the two wx IDs for that layer which are
* the layer name control ID and the checkbox control ID.
*/
static IDs getIDs( int aLayerNumber )
{
#define RET(x) return IDs( x##NAME, x##CHECKBOX, x##CHOICE );
switch( aLayerNumber )
{
case ADHESIVE_N_CMP: RET( ID_ADHESFRONT );
case SOLDERPASTE_N_CMP: RET( ID_SOLDPFRONT );
case SILKSCREEN_N_CMP: RET( ID_SILKSFRONT );
case SOLDERMASK_N_CMP: RET( ID_MASKFRONT );
case LAYER_N_FRONT: RET( ID_FRONT );
case LAYER_N_2: RET( ID_INNER2 );
case LAYER_N_3: RET( ID_INNER3 );
case LAYER_N_4: RET( ID_INNER4 );
case LAYER_N_5: RET( ID_INNER5 );
case LAYER_N_6: RET( ID_INNER6 );
case LAYER_N_7: RET( ID_INNER7 );
case LAYER_N_8: RET( ID_INNER8 );
case LAYER_N_9: RET( ID_INNER9 );
case LAYER_N_10: RET( ID_INNER10 );
case LAYER_N_11: RET( ID_INNER11 );
case LAYER_N_12: RET( ID_INNER12 );
case LAYER_N_13: RET( ID_INNER13 );
case LAYER_N_14: RET( ID_INNER14 );
case LAYER_N_15: RET( ID_INNER15 );
case LAYER_N_BACK: RET( ID_BACK );
case SOLDERMASK_N_CU: RET( ID_MASKBACK );
case SILKSCREEN_N_CU: RET( ID_SILKSBACK );
case SOLDERPASTE_N_CU: RET( ID_SOLDPBACK );
case ADHESIVE_N_CU: RET( ID_ADHESBACK );
case EDGE_N: RET( ID_PCBEDGES );
case ECO2_N: RET( ID_ECO2 );
case ECO1_N: RET( ID_ECO1 );
case COMMENT_N: RET( ID_COMMENTS );
case DRAW_N: RET( ID_DRAWINGS );
default:
// wxDEBUGMSG( "bad layer id" );
return IDs( 0, 0, 0 );
}
#undef RET
}
// Names for the types of copper layers
/*
......@@ -160,6 +252,100 @@ DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP( WinEDA_PcbFrame* parent ) :
}
bool DIALOG_LAYERS_SETUP::Show( bool show )
{
bool ret;
if( show )
{
if( s_LastPos.x != -1 )
{
SetSize( s_LastPos.x, s_LastPos.y, s_LastSize.x, s_LastSize.y, 0 );
}
ret = DIALOG_LAYERS_SETUP_BASE2::Show( show );
}
else
{
// Save the dialog's position before hiding
s_LastPos = GetPosition();
s_LastSize = GetSize();
ret = DIALOG_LAYERS_SETUP_BASE2::Show( show );
}
return ret;
}
void DIALOG_LAYERS_SETUP::showBoardLayerNames()
{
// Establish all the board's layer names into the dialog presentation, by
// obtaining them from BOARD::GetLayerName() which calls
// BOARD::GetDefaultLayerName() for non-coppers.
for( unsigned i=0; i<DIM(layerOrder); ++i )
{
int layer = layerOrder[i];
int nameId = getIDs( layer ).name;
wxControl* ctl = (wxControl*) FindWindowById( nameId );
wxASSERT( ctl );
if( ctl )
{
wxString lname = m_Pcb->GetLayerName( layer );
D(printf("layerName[%d]=%s\n", layer, CONV_TO_UTF8( lname ) );)
if( ctl->IsKindOf( CLASSINFO(wxTextCtrl) ) )
((wxTextCtrl*)ctl)->SetValue( lname ); // wxTextCtrl
else
ctl->SetLabel( lname ); // wxStaticText
}
}
}
void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes()
{
int enabledLayers = m_Pcb->GetEnabledLayers();
for( unsigned i=0; i<DIM(layerOrder); ++i )
{
int layer = layerOrder[i];
int checkBoxId = getIDs( layer ).checkbox;
wxCheckBox* ctl = (wxCheckBox*) FindWindowById( checkBoxId );
wxASSERT( ctl );
if( ctl )
ctl->SetValue( (1<<layer) & enabledLayers );
}
}
void DIALOG_LAYERS_SETUP::showLayerTypes()
{
for( int copperLayer = FIRST_COPPER_LAYER;
copperLayer <= LAST_COPPER_LAYER; ++copperLayer )
{
int choiceId = getIDs( copperLayer ).choice;
wxChoice* ctl = (wxChoice*) FindWindowById( choiceId );
wxASSERT( ctl );
if( ctl )
ctl->SetSelection( m_Pcb->GetLayerType( copperLayer ) );
}
}
/********************************************************************/
void DIALOG_LAYERS_SETUP::init()
/********************************************************************/
......@@ -183,91 +369,11 @@ void DIALOG_LAYERS_SETUP::init()
}
}
showBoardLayerNames();
// Establish all the board's layer names into the dialog presentation, by
// obtaining them from BOARD::GetLayerName() which calls
// BOARD::GetDefaultLayerName() for non-coppers.
static const short nameIds[] = {
ID_ADHESFRONTNAME,
ID_SOLDPFRONTNAME,
ID_SILKSFRONTNAME,
ID_MASKFRONTNAME,
ID_FRONTNAME,
ID_INNER2NAME,
ID_INNER3NAME,
ID_INNER4NAME,
ID_INNER5NAME,
ID_INNER6NAME,
ID_INNER7NAME,
ID_INNER8NAME,
ID_INNER9NAME,
ID_INNER10NAME,
ID_INNER11NAME,
ID_INNER12NAME,
ID_INNER13NAME,
ID_INNER14NAME,
ID_INNER15NAME,
ID_BACKNAME,
ID_MASKBACKNAME,
ID_SILKSBACKNAME,
ID_SOLDPBACKNAME,
ID_ADHESBACKNAME,
ID_PCBEDGESNAME,
ID_ECO2NAME,
ID_ECO1NAME,
ID_COMMENTSNAME,
ID_DRAWINGSNAME,
};
for( unsigned i=0; i<DIM(nameIds); ++i )
{
int layer;
switch( nameIds[i] )
{
case ID_ADHESFRONTNAME: layer = ADHESIVE_N_CMP; break;
case ID_SOLDPFRONTNAME: layer = SOLDERPASTE_N_CMP; break;
case ID_SILKSFRONTNAME: layer = SILKSCREEN_N_CMP; break;
case ID_MASKFRONTNAME: layer = SOLDERMASK_N_CMP; break;
case ID_FRONTNAME: layer = LAYER_N_FRONT; break;
case ID_INNER2NAME: layer = LAYER_N_2; break;
case ID_INNER3NAME: layer = LAYER_N_3; break;
case ID_INNER4NAME: layer = LAYER_N_4; break;
case ID_INNER5NAME: layer = LAYER_N_5; break;
case ID_INNER6NAME: layer = LAYER_N_6; break;
case ID_INNER7NAME: layer = LAYER_N_7; break;
case ID_INNER8NAME: layer = LAYER_N_8; break;
case ID_INNER9NAME: layer = LAYER_N_9; break;
case ID_INNER10NAME: layer = LAYER_N_10; break;
case ID_INNER11NAME: layer = LAYER_N_11; break;
case ID_INNER12NAME: layer = LAYER_N_12; break;
case ID_INNER13NAME: layer = LAYER_N_13; break;
case ID_INNER14NAME: layer = LAYER_N_14; break;
case ID_INNER15NAME: layer = LAYER_N_15; break;
case ID_BACKNAME: layer = LAYER_N_BACK; break;
case ID_MASKBACKNAME: layer = SOLDERMASK_N_CU; break;
case ID_SILKSBACKNAME: layer = SILKSCREEN_N_CU; break;
case ID_SOLDPBACKNAME: layer = SOLDERPASTE_N_CU; break;
case ID_ADHESBACKNAME: layer = ADHESIVE_N_CU; break;
case ID_PCBEDGESNAME: layer = EDGE_N; break;
case ID_ECO2NAME: layer = ECO2_N; break;
case ID_ECO1NAME: layer = ECO1_N; break;
case ID_COMMENTSNAME: layer = COMMENT_N; break;
case ID_DRAWINGSNAME: layer = DRAW_N; break;
default: continue;
}
// both wxStaticText and wxTextControl are derived from wxControl,
// which has a SetLabel() function.
wxControl* ctl = (wxControl*) FindWindowById( nameIds[i] )
wxASSERT( ctl );
if( ctl )
ctl->SetLabel( m_Pcb->GetLayerName( layer ) );
}
showSelectedLayerCheckBoxes();
showLayerTypes();
/* names only:
ID_ADHESFRONTNAME
......
......@@ -42,23 +42,28 @@ private:
BOARD* m_Pcb;
private:
void init();
void showBoardLayerNames();
void showSelectedLayerCheckBoxes();
void showLayerTypes();
void OnCancelButtonClick( wxCommandEvent& event );
void OnOkButtonClick( wxCommandEvent& event );
void OnLayerCountClick( wxCommandEvent& event );
// void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
// void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
void SetRoutableLayerStatus( );
bool TestDataValidity();
public:
DIALOG_LAYERS_SETUP( WinEDA_PcbFrame* parent );
~DIALOG_LAYERS_SETUP( ) { };
bool Show( bool show ); // overload stock function
};
#endif //__dialog_layers_setup2_h_
This diff is collapsed.
This diff is collapsed.
......@@ -30,77 +30,91 @@
#define ID_ADHESFRONTNAME 1000
#define ID_ADHESFRONTCHECKBOX 1001
#define ID_SOLDPFRONTNAME 1002
#define ID_SOLDPFRONTCHECKBOX 1003
#define ID_SILKSFRONTNAME 1004
#define ID_SILKSFRONTCHECKBOX 1005
#define ID_MASKFRONTNAME 1006
#define ID_MASKFRONTCHECKBOX 1007
#define ID_FRONTNAME 1008
#define ID_FRONTCHECKBOX 1009
#define ID_FRONTCHOICE 1010
#define ID_INNER2NAME 1011
#define ID_INNER2CHECKBOX 1012
#define ID_INNER2CHOICE 1013
#define ID_INNER3NAME 1014
#define ID_INNER3CHECKBOX 1015
#define ID_INNER3CHOICE 1016
#define ID_INNER4NAME 1017
#define ID_INNER4CHECKBOX 1018
#define ID_INNER4CHOICE 1019
#define ID_INNER5NAME 1020
#define ID_INNER5CHECKBOX 1021
#define ID_INNER5CHOICE 1022
#define ID_INNER6NAME 1023
#define ID_INNER6CHECKBOX 1024
#define ID_INNER6CHOICE 1025
#define ID_INNER7NAME 1026
#define ID_INNER7CHECKBOX 1027
#define ID_INNER7CHOICE 1028
#define ID_INNER8NAME 1029
#define ID_INNER8CHECKBOX 1030
#define ID_INNER8CHOICE 1031
#define ID_INNER9NAME 1032
#define ID_INNER9CHECKBOX 1033
#define ID_INNER9CHOICE 1034
#define ID_INNER10NAME 1035
#define ID_INNER10CHECKBOX 1036
#define ID_INNER10CHOICE 1037
#define ID_INNER11NAME 1038
#define ID_INNER11CHECKBOX 1039
#define ID_INNER11CHOICE 1040
#define ID_INNER12NAME 1041
#define ID_INNER12CHECKBOX 1042
#define ID_INNER12CHOICE 1043
#define ID_INNER13NAME 1044
#define ID_INNER13CHECKBOX 1045
#define ID_INNER13CHOICE 1046
#define ID_INNER14NAME 1047
#define ID_INNER14CHECKBOX 1048
#define ID_INNER14CHOICE 1049
#define ID_INNER15NAME 1050
#define ID_INNER15CHECKBOX 1051
#define ID_INNER15CHOICE 1052
#define ID_BACKNAME 1053
#define ID_BACKCHECKBOX 1054
#define ID_BACKCHOICE 1055
#define ID_MASKBACKNAME 1056
#define ID_SILKSBACKNAME 1057
#define ID_SILKSBACKCHECKBOX 1058
#define ID_SOLDPBACKNAME 1059
#define ID_SOLDPBACKCHECKBOX 1060
#define ID_ADHESBACKNAME 1061
#define ID_ADHESBACKCHECKBOX 1062
#define ID_PCBEDGESNAME 1063
#define ID_PCBEDGESCHECKBOX 1064
#define ID_ECO2NAME 1065
#define ID_ECHO2CHECKBOX 1066
#define ID_ECO1NAME 1067
#define ID_ECO1CHECKBOX 1068
#define ID_COMMENTSNAME 1069
#define ID_COMMENTSCHECKBOX 1070
#define ID_DRAWINGSNAME 1071
#define ID_DRAWINGSCHECKBOX 1072
#define ID_ADHESFRONTCHOICE 1002
#define ID_SOLDPFRONTNAME 1003
#define ID_SOLDPFRONTCHECKBOX 1004
#define ID_SOLDPFRONTCHOICE 1005
#define ID_SILKSFRONTNAME 1006
#define ID_SILKSFRONTCHECKBOX 1007
#define ID_SILKSFRONTCHOICE 1008
#define ID_MASKFRONTNAME 1009
#define ID_MASKFRONTCHECKBOX 1010
#define ID_MASKFRONTCHOICE 1011
#define ID_FRONTNAME 1012
#define ID_FRONTCHECKBOX 1013
#define ID_FRONTCHOICE 1014
#define ID_INNER2NAME 1015
#define ID_INNER2CHECKBOX 1016
#define ID_INNER2CHOICE 1017
#define ID_INNER3NAME 1018
#define ID_INNER3CHECKBOX 1019
#define ID_INNER3CHOICE 1020
#define ID_INNER4NAME 1021
#define ID_INNER4CHECKBOX 1022
#define ID_INNER4CHOICE 1023
#define ID_INNER5NAME 1024
#define ID_INNER5CHECKBOX 1025
#define ID_INNER5CHOICE 1026
#define ID_INNER6NAME 1027
#define ID_INNER6CHECKBOX 1028
#define ID_INNER6CHOICE 1029
#define ID_INNER7NAME 1030
#define ID_INNER7CHECKBOX 1031
#define ID_INNER7CHOICE 1032
#define ID_INNER8NAME 1033
#define ID_INNER8CHECKBOX 1034
#define ID_INNER8CHOICE 1035
#define ID_INNER9NAME 1036
#define ID_INNER9CHECKBOX 1037
#define ID_INNER9CHOICE 1038
#define ID_INNER10NAME 1039
#define ID_INNER10CHECKBOX 1040
#define ID_INNER10CHOICE 1041
#define ID_INNER11NAME 1042
#define ID_INNER11CHECKBOX 1043
#define ID_INNER11CHOICE 1044
#define ID_INNER12NAME 1045
#define ID_INNER12CHECKBOX 1046
#define ID_INNER12CHOICE 1047
#define ID_INNER13NAME 1048
#define ID_INNER13CHECKBOX 1049
#define ID_INNER13CHOICE 1050
#define ID_INNER14NAME 1051
#define ID_INNER14CHECKBOX 1052
#define ID_INNER14CHOICE 1053
#define ID_INNER15NAME 1054
#define ID_INNER15CHECKBOX 1055
#define ID_INNER15CHOICE 1056
#define ID_BACKNAME 1057
#define ID_BACKCHECKBOX 1058
#define ID_BACKCHOICE 1059
#define ID_MASKBACKNAME 1060
#define ID_MASKBACKCHECKBOX 1061
#define ID_MASKBACKCHOICE 1062
#define ID_SILKSBACKNAME 1063
#define ID_SILKSBACKCHECKBOX 1064
#define ID_SILKSBACKCHOICE 1065
#define ID_SOLDPBACKNAME 1066
#define ID_SOLDPBACKCHECKBOX 1067
#define ID_SOLDPBACKCHOICE 1068
#define ID_ADHESBACKNAME 1069
#define ID_ADHESBACKCHECKBOX 1070
#define ID_ADHESBACKCHOICE 1071
#define ID_PCBEDGESNAME 1072
#define ID_PCBEDGESCHECKBOX 1073
#define ID_PCBEDGESCHOICE 1074
#define ID_ECO2NAME 1075
#define ID_ECO2CHECKBOX 1076
#define ID_ECO2CHOICE 1077
#define ID_ECO1NAME 1078
#define ID_ECO1CHECKBOX 1079
#define ID_ECO1CHOICE 1080
#define ID_COMMENTSNAME 1081
#define ID_COMMENTSCHECKBOX 1082
#define ID_COMMENTSCHOICE 1083
#define ID_DRAWINGSNAME 1084
#define ID_DRAWINGSCHECKBOX 1085
#define ID_DRAWINGSCHOICE 1086
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LAYERS_SETUP_BASE2
......
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