Commit b4fe26a3 authored by dickelbeck's avatar dickelbeck

Isaac's next color/layer work step

parent 12fa5f02
...@@ -316,12 +316,14 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track ) ...@@ -316,12 +316,14 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
{ {
double zpos; double zpos;
int layer = track->GetLayer(); int layer = track->GetLayer();
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
double ox, oy, fx, fy; double ox, oy, fx, fy;
double w; double w;
if( color & ITEM_NOT_SHOW ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return; return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
if( layer == LAST_COPPER_LAYER ) if( layer == LAST_COPPER_LAYER )
layer = g_Parm_3D_Visu.m_Layers - 1; layer = g_Parm_3D_Visu.m_Layers - 1;
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
...@@ -363,11 +365,17 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via ) ...@@ -363,11 +365,17 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
{ {
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
if( layer < g_Parm_3D_Visu.m_Layers - 1 ) if( layer < g_Parm_3D_Visu.m_Layers - 1 )
{
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
}
else else
{
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( CMP_N ) == false )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N]; color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N];
if( color & ITEM_NOT_SHOW ) }
continue;
SetGLColor( color ); SetGLColor( color );
...@@ -394,14 +402,16 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via ) ...@@ -394,14 +402,16 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment ) void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
/*************************************************************/ /*************************************************************/
{ {
int layer;
double x, y, xf, yf; double x, y, xf, yf;
double zpos, w; double zpos, w;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
if( color & ITEM_NOT_SHOW ) int layer = segment->GetLayer();
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return; return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
SetGLColor( color ); SetGLColor( color );
w = segment->m_Width * g_Parm_3D_Visu.m_BoardScale; w = segment->m_Width * g_Parm_3D_Visu.m_BoardScale;
x = segment->m_Start.x * g_Parm_3D_Visu.m_BoardScale; x = segment->m_Start.x * g_Parm_3D_Visu.m_BoardScale;
...@@ -409,7 +419,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment ) ...@@ -409,7 +419,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
xf = segment->m_End.x * g_Parm_3D_Visu.m_BoardScale; xf = segment->m_End.x * g_Parm_3D_Visu.m_BoardScale;
yf = segment->m_End.y * g_Parm_3D_Visu.m_BoardScale; yf = segment->m_End.y * g_Parm_3D_Visu.m_BoardScale;
if( segment->GetLayer() == EDGE_N ) if( layer == EDGE_N )
{ {
for( layer = 0; layer < g_Parm_3D_Visu.m_Layers; layer++ ) for( layer = 0; layer < g_Parm_3D_Visu.m_Layers; layer++ )
{ {
...@@ -434,7 +444,6 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment ) ...@@ -434,7 +444,6 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
} }
else else
{ {
layer = segment->GetLayer();
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) ); glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
if( Get3DLayerEnable( layer ) ) if( Get3DLayerEnable( layer ) )
...@@ -623,11 +632,13 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -623,11 +632,13 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
wxString s; wxString s;
int dx, dy; int dx, dy;
double scale, x, y, fx, fy, w, zpos; double scale, x, y, fx, fy, w, zpos;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
if( color & ITEM_NOT_SHOW ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( m_Layer ) == false )
return; return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
SetGLColor( color ); SetGLColor( color );
glNormal3f( 0.0, 0.0, (m_Layer == COPPER_LAYER_N) ? -1.0 : 1.0 ); glNormal3f( 0.0, 0.0, (m_Layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
scale = g_Parm_3D_Visu.m_BoardScale; scale = g_Parm_3D_Visu.m_BoardScale;
...@@ -737,7 +748,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -737,7 +748,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both ) if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
continue; continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
if( color & ITEM_NOT_SHOW ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
continue; continue;
SetGLColor( color ); SetGLColor( color );
...@@ -787,7 +798,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -787,7 +798,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
continue; continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 ); glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
if( color & ITEM_NOT_SHOW ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
continue; continue;
SetGLColor( color ); SetGLColor( color );
...@@ -862,7 +873,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -862,7 +873,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
continue; continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 ); glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
if( color & ITEM_NOT_SHOW ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
continue; continue;
SetGLColor( color ); SetGLColor( color );
......
...@@ -338,7 +338,8 @@ static PARAM_CFG_SETCOLOR ColorpcbGrilleCfg ...@@ -338,7 +338,8 @@ static PARAM_CFG_SETCOLOR ColorpcbGrilleCfg
( (
INSETUP, INSETUP,
wxT("CoPcbGr"), /* identification */ wxT("CoPcbGr"), /* identification */
&g_DesignSettings.m_PcbGridColor, /* Adresse du parametre */ //@@IMB: Wrong object &g_DesignSettings.m_PcbGridColor, /* Adresse du parametre */
&g_GridColor, //@@IMB: This is the real variable.
DARKGRAY /* Valeur par defaut */ DARKGRAY /* Valeur par defaut */
); );
......
...@@ -213,10 +213,10 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -213,10 +213,10 @@ void WinEDA_SetColorsFrame::CreateControls()
if( laytool_list[lyr]->m_NoDisplayIsColor ) if( laytool_list[lyr]->m_NoDisplayIsColor )
{ {
if( *laytool_list[lyr]->m_Color & ITEM_NOT_SHOW ) if( g_DesignSettings.IsLayerVisible( lyr ))
CheckBox->SetValue( FALSE );
else
CheckBox->SetValue( TRUE ); CheckBox->SetValue( TRUE );
else
CheckBox->SetValue( FALSE );
} }
else else
CheckBox->SetValue( *laytool_list[lyr]->m_NoDisplay ); CheckBox->SetValue( *laytool_list[lyr]->m_NoDisplay );
...@@ -427,25 +427,24 @@ void WinEDA_SetColorsFrame::SetColor(wxCommandEvent& event) ...@@ -427,25 +427,24 @@ void WinEDA_SetColorsFrame::SetColor(wxCommandEvent& event)
void WinEDA_SetColorsFrame::UpdateLayerSettings() void WinEDA_SetColorsFrame::UpdateLayerSettings()
/******************************************************************/ /******************************************************************/
{ {
for( int lyr = 0; lyr < NB_BUTT; lyr++ ) for( int lyr = 0; lyr < NB_BUTT - 2; lyr++ )
{ {
if( laytool_list[lyr]->m_NoDisplayIsColor ) g_DesignSettings.SetLayerVisibility( lyr, laytool_list[lyr]->m_CheckBox->GetValue() );
{ *laytool_list[lyr]->m_Color = CurrentColor[lyr];
if( laytool_list[lyr]->m_CheckBox->GetValue() )
*laytool_list[lyr]->m_Color = CurrentColor[lyr] & ~ITEM_NOT_SHOW;
else
*laytool_list[lyr]->m_Color = CurrentColor[lyr] | ITEM_NOT_SHOW;
}
else
{
// (As a bitmap button and a checkbox have been provided for *every*
// layer, it is not necessary to check whether each of those items
// actually has been provided for each of those layers.)
*laytool_list[lyr]->m_Color = CurrentColor[lyr];
*laytool_list[lyr]->m_NoDisplay = laytool_list[lyr]->m_CheckBox->GetValue();
}
} }
// Additional command required for updating visibility of grid.
// (As a bitmap button and a checkbox have been provided for *every*
// layer, it is not necessary to check whether each of those items
// actually has been provided for each of those layers.)
g_GridColor = CurrentColor[32];
s_showGrid = laytool_list[32]->m_CheckBox->GetValue();
g_DCodesColor = CurrentColor[33];
DisplayOpt.DisplayPadNum = laytool_list[33]->m_CheckBox->GetValue();
// Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = s_showGrid; m_Parent->m_Draw_Grid = s_showGrid;
} }
......
...@@ -85,112 +85,112 @@ static ColorButton Layer_1_Butt= ...@@ -85,112 +85,112 @@ static ColorButton Layer_1_Butt=
{ {
_("Layer 1"), // Title _("Layer 1"), // Title
ADR(0), // Address of optional parameter ADR(0), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_2_Butt= static ColorButton Layer_2_Butt=
{ {
_("Layer 2"), // Title _("Layer 2"), // Title
ADR(1), // Address of optional parameter ADR(1), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_3_Butt= static ColorButton Layer_3_Butt=
{ {
_("Layer 3"), // Title _("Layer 3"), // Title
ADR(2), // Address of optional parameter ADR(2), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_4_Butt= static ColorButton Layer_4_Butt=
{ {
_("Layer 4"), // Title _("Layer 4"), // Title
ADR(3), // Address of optional parameter ADR(3), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_5_Butt= static ColorButton Layer_5_Butt=
{ {
_("Layer 5"), // Title _("Layer 5"), // Title
ADR(4), // Address of optional parameter ADR(4), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_6_Butt= static ColorButton Layer_6_Butt=
{ {
_("Layer 6"), // Title _("Layer 6"), // Title
ADR(5), // Address of optional parameter ADR(5), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_7_Butt= static ColorButton Layer_7_Butt=
{ {
_("Layer 7"), // Title _("Layer 7"), // Title
ADR(6), // Address of optional parameter ADR(6), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_8_Butt= static ColorButton Layer_8_Butt=
{ {
_("Layer 8"), // Title _("Layer 8"), // Title
ADR(7), // Address of optional parameter ADR(7), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_9_Butt= static ColorButton Layer_9_Butt=
{ {
_("Layer 9"), // Title _("Layer 9"), // Title
ADR(8), // Address of optional parameter ADR(8), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_10_Butt= static ColorButton Layer_10_Butt=
{ {
_("Layer 10"), // Title _("Layer 10"), // Title
ADR(9), // Address of optional parameter ADR(9), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_11_Butt= static ColorButton Layer_11_Butt=
{ {
_("Layer 11"), // Title _("Layer 11"), // Title
ADR(10), // Address of optional parameter ADR(10), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_12_Butt= static ColorButton Layer_12_Butt=
{ {
_("Layer 12"), // Title _("Layer 12"), // Title
ADR(11), // Address of optional parameter ADR(11), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_13_Butt= static ColorButton Layer_13_Butt=
{ {
_("Layer 13"), // Title _("Layer 13"), // Title
ADR(12), // Address of optional parameter ADR(12), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_14_Butt= static ColorButton Layer_14_Butt=
{ {
_("Layer 14"), // Title _("Layer 14"), // Title
ADR(13), // Address of optional parameter ADR(13), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_15_Butt= static ColorButton Layer_15_Butt=
{ {
_("Layer 15"), // Title _("Layer 15"), // Title
ADR(14), // Address of optional parameter ADR(14), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_16_Butt= static ColorButton Layer_16_Butt=
{ {
_("Layer 16"), // Title _("Layer 16"), // Title
ADR(15), // Address of optional parameter ADR(15), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
...@@ -204,112 +204,112 @@ static ColorButton Layer_17_Butt= ...@@ -204,112 +204,112 @@ static ColorButton Layer_17_Butt=
{ {
_("Layer 17"), // Title _("Layer 17"), // Title
ADR(16), // Address of optional parameter ADR(16), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_18_Butt= static ColorButton Layer_18_Butt=
{ {
_("Layer 18"), // Title _("Layer 18"), // Title
ADR(17), // Address of optional parameter ADR(17), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_19_Butt= static ColorButton Layer_19_Butt=
{ {
_("Layer 19"), // Title _("Layer 19"), // Title
ADR(18), // Address of optional parameter ADR(18), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_20_Butt= static ColorButton Layer_20_Butt=
{ {
_("Layer 20"), // Title _("Layer 20"), // Title
ADR(19), // Address of optional parameter ADR(19), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_21_Butt= static ColorButton Layer_21_Butt=
{ {
_("Layer 21"), // Title _("Layer 21"), // Title
ADR(20), // Address of optional parameter ADR(20), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_22_Butt= static ColorButton Layer_22_Butt=
{ {
_("Layer 22"), // Title _("Layer 22"), // Title
ADR(21), // Address of optional parameter ADR(21), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_23_Butt= static ColorButton Layer_23_Butt=
{ {
_("Layer 23"), // Title _("Layer 23"), // Title
ADR(22), // Address of optional parameter ADR(22), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_24_Butt= static ColorButton Layer_24_Butt=
{ {
_("Layer 24"), // Title _("Layer 24"), // Title
ADR(23), // Address of optional parameter ADR(23), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_25_Butt= static ColorButton Layer_25_Butt=
{ {
_("Layer 25"), // Title _("Layer 25"), // Title
ADR(24), // Address of optional parameter ADR(24), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_26_Butt= static ColorButton Layer_26_Butt=
{ {
_("Layer 26"), // Title _("Layer 26"), // Title
ADR(25), // Address of optional parameter ADR(25), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_27_Butt= static ColorButton Layer_27_Butt=
{ {
_("Layer 27"), // Title _("Layer 27"), // Title
ADR(26), // Address of optional parameter ADR(26), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_28_Butt= static ColorButton Layer_28_Butt=
{ {
_("Layer 28"), // Title _("Layer 28"), // Title
ADR(27), // Address of optional parameter ADR(27), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_29_Butt= static ColorButton Layer_29_Butt=
{ {
_("Layer 29"), // Title _("Layer 29"), // Title
ADR(28), // Address of optional parameter ADR(28), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_30_Butt= static ColorButton Layer_30_Butt=
{ {
_("Layer 30"), // Title _("Layer 30"), // Title
ADR(29), // Address of optional parameter ADR(29), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_31_Butt= static ColorButton Layer_31_Butt=
{ {
_("Layer 31"), // Title _("Layer 31"), // Title
ADR(30), // Address of optional parameter ADR(30), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
static ColorButton Layer_32_Butt= static ColorButton Layer_32_Butt=
{ {
_("Layer 32"), // Title _("Layer 32"), // Title
ADR(31), // Address of optional parameter ADR(31), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
}; };
......
...@@ -78,10 +78,11 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo ...@@ -78,10 +78,11 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
} }
else else
{ {
color = g_DesignSettings.m_LayerColor[track->GetLayer()]; if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false )
if( color & ITEM_NOT_SHOW )
return; return;
color = g_DesignSettings.m_LayerColor[track->GetLayer()];
if( draw_mode & GR_SURBRILL ) if( draw_mode & GR_SURBRILL )
{ {
if( draw_mode & GR_AND ) if( draw_mode & GR_AND )
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#define MASKCOLOR 31 ///< mask for color index into ColorRefs[] #define MASKCOLOR 31 ///< mask for color index into ColorRefs[]
/// bit indicateur d'affichage (vu / non vu) des items : (defini dans les valeurs des couleurs /// bit indicateur d'affichage (vu / non vu) des items : (defini dans les valeurs des couleurs
#define ITEM_NOT_SHOW (1<<18) // 0x40000 //IMB: Not used anymore #define ITEM_NOT_SHOW (1<<18) // 0x40000
/// Definition du bit de surbrillance /// Definition du bit de surbrillance
#define HIGHT_LIGHT_FLAG (1<<19) // 0x80000 #define HIGHT_LIGHT_FLAG (1<<19) // 0x80000
......
...@@ -134,6 +134,23 @@ class RATSNEST_ITEM; ...@@ -134,6 +134,23 @@ class RATSNEST_ITEM;
/* Class to handle a board */ /* Class to handle a board */
#include "class_board.h" #include "class_board.h"
enum ELEMENTS_NUMBERS
{
VIAS_VISIBLE = 0,
VIA_NOT_DEFINED_VISIBLE = VIAS_VISIBLE,
VIA_MICROVIA_VISIBLE,
VIA_BLIND_BURIED_VISIBLE,
VIA_THROUGH_VISIBLE,
MODULE_TEXT_CMP_VISIBLE,
MODULE_TEXT_CU_VISIBLE,
MODULE_TEXT_NOV_VISIBLE,
ANCHOR_VISIBLE,
PAD_CU_VISIBLE,
PAD_CMP_VISIBLE
};
// Class for handle current printed board design settings // Class for handle current printed board design settings
class EDA_BoardDesignSettings class EDA_BoardDesignSettings
{ {
...@@ -160,21 +177,28 @@ public: ...@@ -160,21 +177,28 @@ public:
int m_LayerThickness; // Layer Thickness for 3D viewer int m_LayerThickness; // Layer Thickness for 3D viewer
// Color options for screen display of the Printed Board: // Color options for screen display of the Printed Board:
int m_PcbGridColor; // Grid color //@@IMB: Not used int m_PcbGridColor; // Grid color
int m_EnabledLayers; // IMB: Paving the road
int m_VisibleLayers; // IMB: Bit-mask for layer visibility
int m_VisibleElements; // IMB: Bit-mask for elements visibility
int m_LayerColor[32]; // Layer colors (tracks and graphic items)
int m_LayerColor[32]; // Layer colors (tracks and graphic items) int m_ViaColor[4]; // Via color (depending on is type)
int m_ViaColor[4]; // Via color (depending on is type) //@@IMB: Not used int m_ModuleTextCMPColor; // Text module color for modules on the COMPONENT layer
int m_ModuleTextCMPColor; // Text module color for modules on the COMPONENT layer //@@IMB: Not used int m_ModuleTextCUColor; // Text module color for modules on the COPPER layer
int m_ModuleTextCUColor; // Text module color for modules on the COPPER layer //@@IMB: Not used int m_ModuleTextNOVColor; // Text module color for "invisible" texts (must be BLACK if really not displayed)
int m_ModuleTextNOVColor; // Text module color for "invisible" texts (must be BLACK if really not displayed) //@@IMB: Not used int m_AnchorColor; // Anchor color for modules and texts
int m_AnchorColor; // Anchor color for modules and texts
//@@IMB: Not used int m_PadCUColor; // Pad color for the COPPER side of the pad
//@@IMB: Not used int m_PadCMPColor; // Pad color for the COMPONENT side of the pad
int m_PadCUColor; // Pad color for the COPPER side of the pad
int m_PadCMPColor; // Pad color for the COMPONENT side of the pad
// Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors) // Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors)
int m_RatsnestColor; // Ratsnest color int m_RatsnestColor; // Ratsnest color
public: public:
EDA_BoardDesignSettings(); EDA_BoardDesignSettings();
...@@ -185,6 +209,36 @@ public: ...@@ -185,6 +209,36 @@ public:
* @return int - the visible layers in bit-mapped form. * @return int - the visible layers in bit-mapped form.
*/ */
int GetVisibleLayers() const; int GetVisibleLayers() const;
void SetVisibleLayers( int Mask );
/**
* Function IsLayerVisible
* @param LayerNumber The number of the layer to be tested.
* @return bool - true if the layer is visible.
*/
inline bool IsLayerVisible( int LayerNumber ) const
{
if( LayerNumber < 0 || LayerNumber >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers
return false;
return (bool)( m_VisibleLayers & 1 << LayerNumber );
}
void SetLayerVisibility( int LayerNumber, bool State );
/**
* Function IsElementVisible
* @param ElementNumber The number of the element to be tested.
* @return bool - true if the elememt is visible.
*/
inline bool IsElementVisible( int ElementNumber ) const
{
if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE )
return false;
return (bool)( m_VisibleElements & 1 << ElementNumber );
}
void SetElementVisibility( int ElementNumber, bool State );
}; };
......
...@@ -290,9 +290,9 @@ GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide() ...@@ -290,9 +290,9 @@ GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
((PCB_SCREEN*)GetScreen())->m_Active_Layer ); ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
// account for the globals // account for the globals
guide.SetIgnoreMTextsMarkedNoShow( g_ModuleTextNOVColor & ITEM_NOT_SHOW ); guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ));
guide.SetIgnoreMTextsOnCopper( g_ModuleTextCUColor & ITEM_NOT_SHOW ); guide.SetIgnoreMTextsOnCopper( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_CU_VISIBLE ));
guide.SetIgnoreMTextsOnCmp( g_ModuleTextCMPColor & ITEM_NOT_SHOW ); guide.SetIgnoreMTextsOnCmp( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_CMP_VISIBLE ));
guide.SetIgnoreModulesOnCu( !DisplayOpt.Show_Modules_Cu ); guide.SetIgnoreModulesOnCu( !DisplayOpt.Show_Modules_Cu );
guide.SetIgnoreModulesOnCmp( !DisplayOpt.Show_Modules_Cmp ); guide.SetIgnoreModulesOnCmp( !DisplayOpt.Show_Modules_Cmp );
......
...@@ -406,10 +406,11 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -406,10 +406,11 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
m_Text->Draw( panel, DC, mode_color, offset ); m_Text->Draw( panel, DC, mode_color, offset );
gcolor = g_DesignSettings.m_LayerColor[m_Layer]; if( g_DesignSettings.IsLayerVisible( m_Layer ) == false )
if( (gcolor & ITEM_NOT_SHOW) != 0 )
return; return;
gcolor = g_DesignSettings.m_LayerColor[m_Layer];
GRSetDrawMode( DC, mode_color ); GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems; typeaff = DisplayOpt.DisplayDrawItems;
width = m_Width; width = m_Width;
......
...@@ -234,10 +234,11 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -234,10 +234,11 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int color, mode; int color, mode;
int rayon; int rayon;
color = g_DesignSettings.m_LayerColor[GetLayer()]; if( g_DesignSettings.IsLayerVisible( GetLayer() ) == false )
if( color & ITEM_NOT_SHOW )
return; return;
color = g_DesignSettings.m_LayerColor[GetLayer()];
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
l_piste = m_Width >> 1; /* l_piste = demi largeur piste */ l_piste = m_Width >> 1; /* l_piste = demi largeur piste */
......
...@@ -102,10 +102,11 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -102,10 +102,11 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( m_Parent && (m_Parent->Type() == TYPE_MODULE) ) if( m_Parent && (m_Parent->Type() == TYPE_MODULE) )
Module = (MODULE*) m_Parent; Module = (MODULE*) m_Parent;
color = g_DesignSettings.m_LayerColor[m_Layer]; if( g_DesignSettings.IsLayerVisible( m_Layer ) == false )
if( (color & ITEM_NOT_SHOW) != 0 )
return; return;
color = g_DesignSettings.m_LayerColor[m_Layer];
frame = (WinEDA_BasePcbFrame*) panel->m_Parent; frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
screen = frame->GetScreen(); screen = frame->GetScreen();
......
...@@ -114,10 +114,11 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -114,10 +114,11 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
ox = m_Pos.x + offset.x; ox = m_Pos.x + offset.x;
oy = m_Pos.y + offset.y; oy = m_Pos.y + offset.y;
gcolor = g_DesignSettings.m_LayerColor[m_Layer]; if( g_DesignSettings.IsLayerVisible( m_Layer ) == false )
if( (gcolor & ITEM_NOT_SHOW) != 0 )
return; return;
gcolor = g_DesignSettings.m_LayerColor[m_Layer];
GRSetDrawMode( DC, mode_color ); GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems; typeaff = DisplayOpt.DisplayDrawItems;
width = m_Width; width = m_Width;
......
...@@ -67,7 +67,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset ...@@ -67,7 +67,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
if( (g_AnchorColor & ITEM_NOT_SHOW) == 0 ) if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ))
{ {
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y, m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y,
......
...@@ -196,11 +196,11 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -196,11 +196,11 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
* and the actual size is very important, especially for copper texts * and the actual size is very important, especially for copper texts
*/ */
{ {
int color = g_DesignSettings.m_LayerColor[m_Layer]; if( g_DesignSettings.IsLayerVisible( m_Layer ) == false )
if( color & ITEM_NOT_SHOW )
return; return;
int color = g_DesignSettings.m_LayerColor[m_Layer];
GRTraceMode fillmode = FILLED; GRTraceMode fillmode = FILLED;
if ( DisplayOpt.DisplayDrawItems == SKETCH) if ( DisplayOpt.DisplayDrawItems == SKETCH)
fillmode = SKETCH; fillmode = SKETCH;
...@@ -210,7 +210,8 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -210,7 +210,8 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
offset, offset,
(EDA_Colors) color, (EDA_Colors) color,
DrawMode, fillmode, DrawMode, fillmode,
(g_AnchorColor & ITEM_NOT_SHOW) ? UNSPECIFIED_COLOR : (EDA_Colors) g_AnchorColor ); g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) ?
(EDA_Colors) g_AnchorColor : UNSPECIFIED_COLOR );
} }
......
...@@ -381,7 +381,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const ...@@ -381,7 +381,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
/* trace du centre du texte */ /* trace du centre du texte */
if( (g_AnchorColor & ITEM_NOT_SHOW) == 0 ) if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ))
{ {
int anchor_size = screen->Unscale( 2 ); int anchor_size = screen->Unscale( 2 );
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
...@@ -392,22 +392,30 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const ...@@ -392,22 +392,30 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
pos.x, pos.y + anchor_size, 0, g_AnchorColor ); pos.x, pos.y + anchor_size, 0, g_AnchorColor );
} }
//@@@@IMB: BIG BIG BUG Here???? May Module be NULL?
color = g_DesignSettings.m_LayerColor[Module->GetLayer()]; color = g_DesignSettings.m_LayerColor[Module->GetLayer()];
//@@IMB: Why the next ifs are testing for Module?
if( Module && Module->GetLayer() == COPPER_LAYER_N ) if( Module && Module->GetLayer() == COPPER_LAYER_N )
{
if( g_DesignSettings.IsElementVisible( MODULE_TEXT_CU_VISIBLE ) == false )
return;
color = g_ModuleTextCUColor; color = g_ModuleTextCUColor;
}
else if( Module && Module->GetLayer() == CMP_N ) else if( Module && Module->GetLayer() == CMP_N )
{
if( g_DesignSettings.IsElementVisible( MODULE_TEXT_CMP_VISIBLE ) == false )
return;
color = g_ModuleTextCMPColor; color = g_ModuleTextCMPColor;
}
if( (color & ITEM_NOT_SHOW) != 0 )
return;
if( m_NoShow ) if( m_NoShow )
{
if( g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) == false )
return;
color = g_ModuleTextNOVColor; color = g_ModuleTextNOVColor;
}
if( (color & ITEM_NOT_SHOW) != 0 )
return;
/* If the text is mirrored : negate size.x (mirror / Y axis) */ /* If the text is mirrored : negate size.x (mirror / Y axis) */
if( m_Mirror ) if( m_Mirror )
......
...@@ -579,7 +579,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -579,7 +579,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
{ {
color = g_DesignSettings.m_LayerColor[m_Layer]; color = g_DesignSettings.m_LayerColor[m_Layer];
if( ( color & (ITEM_NOT_SHOW | HIGHT_LIGHT_FLAG) ) == ITEM_NOT_SHOW ) if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
return; return;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
...@@ -743,7 +743,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi ...@@ -743,7 +743,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
color = g_DesignSettings.m_ViaColor[m_Shape]; color = g_DesignSettings.m_ViaColor[m_Shape];
if( ( color & (ITEM_NOT_SHOW | HIGHT_LIGHT_FLAG) ) == ITEM_NOT_SHOW ) if( g_DesignSettings.IsElementVisible( VIAS_VISIBLE + m_Shape ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
return; return;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
......
...@@ -450,7 +450,7 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con ...@@ -450,7 +450,7 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_DesignSettings.m_LayerColor[m_Layer]; int color = g_DesignSettings.m_LayerColor[m_Layer];
if( ( color & (ITEM_NOT_SHOW | HIGHT_LIGHT_FLAG) ) == ITEM_NOT_SHOW ) if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
return; return;
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
...@@ -538,7 +538,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -538,7 +538,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_DesignSettings.m_LayerColor[m_Layer]; int color = g_DesignSettings.m_LayerColor[m_Layer];
if( ( color & (ITEM_NOT_SHOW | HIGHT_LIGHT_FLAG) ) == ITEM_NOT_SHOW ) if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
return; return;
GRSetDrawMode( DC, aDrawMode ); GRSetDrawMode( DC, aDrawMode );
......
...@@ -137,32 +137,32 @@ bool PCB_SCREEN::IsMicroViaAcceptable( void ) ...@@ -137,32 +137,32 @@ bool PCB_SCREEN::IsMicroViaAcceptable( void )
DISPLAY_OPTIONS::DISPLAY_OPTIONS() DISPLAY_OPTIONS::DISPLAY_OPTIONS()
{ {
DisplayPadFill = FILLED; DisplayPadFill = FILLED;
DisplayViaFill = FILLED; DisplayViaFill = FILLED;
DisplayPadNum = true; DisplayPadNum = true;
DisplayPadNoConn = true; DisplayPadNoConn = true;
DisplayPadIsol = true; DisplayPadIsol = true;
DisplayModEdge = true; DisplayModEdge = true;
DisplayModText = true; DisplayModText = true;
DisplayPcbTrackFill = true; /* false = sketch , true = filled */ DisplayPcbTrackFill = true; /* false = sketch , true = filled */
ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS; ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
m_DisplayViaMode = VIA_HOLE_NOT_SHOW; m_DisplayViaMode = VIA_HOLE_NOT_SHOW;
DisplayPolarCood = false; /* false = display absolute coordinates, DisplayPolarCood = false; /* false = display absolute coordinates,
* true = display polar cordinates */ * true = display polar cordinates */
DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones, DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones,
* 1 = do not show filled areas outlines * 1 = do not show filled areas outlines
* 2 = show outlines of filled areas */ * 2 = show outlines of filled areas */
DisplayNetNamesMode = 3; /* 0 do not show netnames, DisplayNetNamesMode = 3; /* 0 do not show netnames,
* 1 show netnames on pads * 1 show netnames on pads
* 2 show netnames on tracks * 2 show netnames on tracks
* 3 show netnames on tracks and pads */ * 3 show netnames on tracks and pads */
Show_Modules_Cmp = true; Show_Modules_Cmp = true;
Show_Modules_Cu = true; Show_Modules_Cu = true;
DisplayDrawItems = true; DisplayDrawItems = true;
ContrastModeDisplay = false; ContrastModeDisplay = false;
} }
...@@ -213,23 +213,30 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -213,23 +213,30 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter m_MicroViasMinSize = 200; // micro vias (not vias) min diameter
m_MaskMargin = 150; // Solder mask margin m_MaskMargin = 150; // Solder mask margin
/* Color options for screen display of the Printed Board: */ /* Color options for screen display of the Printed Board: */
m_PcbGridColor = DARKGRAY; // Grid color
//@@IMB: Not used m_PcbGridColor = DARKGRAY; // Grid color
m_EnabledLayers = 0x1fffffff; // IMB: All layers enabled at first. TODO: Use a macro for the initial value.
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.
for( ii = 0; ii < 32; ii++ ) for( ii = 0; ii < 32; ii++ )
m_LayerColor[ii] = default_layer_color[ii]; m_LayerColor[ii] = default_layer_color[ii];
// Layer colors (tracks and graphic items) // Layer colors (tracks and graphic items)
m_ViaColor[VIA_NOT_DEFINED] = DARKGRAY; m_ViaColor[VIA_NOT_DEFINED] = DARKGRAY;
m_ViaColor[VIA_MICROVIA] = CYAN; m_ViaColor[VIA_MICROVIA] = CYAN;
m_ViaColor[VIA_BLIND_BURIED] = BROWN; m_ViaColor[VIA_BLIND_BURIED] = BROWN;
m_ViaColor[VIA_THROUGH] = WHITE; m_ViaColor[VIA_THROUGH] = WHITE;
m_ModuleTextCMPColor = LIGHTGRAY; // Text module color for modules on the COMPONENT layer //@@IMB: Not used m_ModuleTextCMPColor = LIGHTGRAY; // Text module color for modules on the COMPONENT layer
m_ModuleTextCUColor = MAGENTA; // Text module color for modules on the COPPER layer //@@IMB: Not used m_ModuleTextCUColor = MAGENTA; // Text module color for modules on the COPPER layer
m_ModuleTextNOVColor = DARKGRAY; // Text module color for "invisible" texts (must be BLACK if really not displayed) //@@IMB: Not used m_ModuleTextNOVColor = DARKGRAY; // Text module color for "invisible" texts (must be BLACK if really not displayed)
m_AnchorColor = BLUE; // Anchor color for modules and texts //@@IMB: Not used m_AnchorColor = BLUE; // Anchor color for modules and texts
m_PadCUColor = GREEN; // Pad color for the COMPONENT side of the pad //@@IMB: Not used m_PadCUColor = GREEN; // Pad color for the COMPONENT side of the pad
m_PadCMPColor = RED; // Pad color for the COPPER side of the pad //@@IMB: Not used m_PadCMPColor = RED; // Pad color for the COPPER side of the pad
m_RatsnestColor = WHITE; // Ratsnest color m_RatsnestColor = WHITE; // Ratsnest color
} }
...@@ -237,13 +244,48 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -237,13 +244,48 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
// see pcbstruct.h // see pcbstruct.h
int EDA_BoardDesignSettings::GetVisibleLayers() const int EDA_BoardDesignSettings::GetVisibleLayers() const
{ {
int layerMask = 0; return m_VisibleLayers;
}
for( int i = 0, mask = 1; i< 32; ++i, mask <<= 1 ) void EDA_BoardDesignSettings::SetVisibleLayers( int Mask )
{ {
if( !( m_LayerColor[i] & ITEM_NOT_SHOW ) ) m_VisibleLayers = Mask & 0x1fffffff;
layerMask |= mask; }
}
/* //@@IMB: Made inline
bool EDA_BoardDesignSettings::IsLayerVisible( int LayerNumber ) const
{
if( LayerNumber < 0 || LayerNumber >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers
return false;
return (bool)( m_VisibleLayers & 1 << LayerNumber );
}
*/
void EDA_BoardDesignSettings::SetLayerVisibility( int LayerNumber, bool State )
{
if( LayerNumber < 0 || LayerNumber >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers
return;
if( State )
m_VisibleLayers |= 1 << LayerNumber;
else
m_VisibleLayers &= ~( 1 << LayerNumber );
}
return layerMask; /* //@@IMB: Made inline
bool EDA_BoardDesignSettings::IsElementVisible( int ElementNumber ) const
{
if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE )
return false;
return (bool)( m_VisibleElements & 1 << ElementNumber );
}
*/
void EDA_BoardDesignSettings::SetElementVisibility( int ElementNumber, bool State )
{
if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE )
return;
if( State )
m_VisibleElements |= 1 << ElementNumber;
else
m_VisibleElements &= ~( 1 << ElementNumber );
} }
...@@ -420,7 +420,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, ...@@ -420,7 +420,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
if( doCheckNet && currTrack && currTrack->GetNet() != track->GetNet() ) if( doCheckNet && currTrack && currTrack->GetNet() != track->GetNet() )
continue; continue;
if( g_DesignSettings.m_LayerColor[track->GetLayer()] & ITEM_NOT_SHOW ) if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false )
continue; continue;
// omit the layer check if moving a via // omit the layer check if moving a via
......
...@@ -294,10 +294,8 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -294,10 +294,8 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
case ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE: case ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE:
if(!m_OptionsToolBar->GetToolState( id )) g_DesignSettings.SetElementVisibility( MODULE_TEXT_NOV_VISIBLE,
g_ModuleTextNOVColor &= (~ITEM_NOT_SHOW); m_OptionsToolBar->GetToolState( id ));
else
g_ModuleTextNOVColor |= ( ITEM_NOT_SHOW);
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
......
...@@ -189,6 +189,42 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum ) ...@@ -189,6 +189,42 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum )
if( strnicmp( data, "$EndGENERAL", 10 ) == 0 ) if( strnicmp( data, "$EndGENERAL", 10 ) == 0 )
break; break;
if( stricmp( data, "EnabledLayers" ) == 0 )
{
int EnabledLayers = 0;
data = strtok( NULL, " =\n\r" );
sscanf( data, "%X", &EnabledLayers );
// Setup layer visibility
GetBoard()->m_BoardSettings->m_EnabledLayers = EnabledLayers;
continue;
}
if( stricmp( data, "VisibleLayers" ) == 0 )
{
int VisibleLayers = 0;
data = strtok( NULL, " =\n\r" );
sscanf( data, "%X", &VisibleLayers );
// Setup layer visibility
GetBoard()->m_BoardSettings->m_VisibleLayers = VisibleLayers;
continue;
}
if( stricmp( data, "VisibleElements" ) == 0 )
{
int VisibleElements = 0;
data = strtok( NULL, " =\n\r" );
sscanf( data, "%X", &VisibleElements );
// Setup elements visibility
GetBoard()->m_BoardSettings->m_VisibleElements = VisibleElements;
continue;
}
if( strncmp( data, "Ly", 2 ) == 0 ) // Old format for Layer count if( strncmp( data, "Ly", 2 ) == 0 ) // Old format for Layer count
{ {
int Masque_Layer = 1, ii; int Masque_Layer = 1, ii;
...@@ -629,6 +665,9 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File ) ...@@ -629,6 +665,9 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
// Write old format for Layer count (for compatibility with old versions of pcbnew // Write old format for Layer count (for compatibility with old versions of pcbnew
fprintf( File, "Ly %8X\n", g_TabAllCopperLayerMask[NbLayers - 1] | ALL_NO_CU_LAYERS ); // For compatibility with old version of pcbnew fprintf( File, "Ly %8X\n", g_TabAllCopperLayerMask[NbLayers - 1] | ALL_NO_CU_LAYERS ); // For compatibility with old version of pcbnew
fprintf( File, "EnabledLayers %08X\n", GetBoard()->m_BoardSettings->m_EnabledLayers );
fprintf( File, "VisibleLayers %08X\n", GetBoard()->m_BoardSettings->m_VisibleLayers );
fprintf( File, "VisibleElements %08X\n", GetBoard()->m_BoardSettings->m_VisibleElements );
fprintf( File, "Links %d\n", GetBoard()->GetRatsnestsCount() ); fprintf( File, "Links %d\n", GetBoard()->GetRatsnestsCount() );
fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect ); fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect );
......
...@@ -506,7 +506,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa ...@@ -506,7 +506,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
continue; continue;
} }
if( g_DesignSettings.m_LayerColor[layer] & ITEM_NOT_SHOW ) if( g_DesignSettings.IsLayerVisible( layer ) == false )
continue; continue;
if( track->Type() == TYPE_VIA ) /* VIA rencontree */ if( track->Type() == TYPE_VIA ) /* VIA rencontree */
......
...@@ -186,25 +186,29 @@ bool Read_Config( const wxString& projectFileName ) ...@@ -186,25 +186,29 @@ bool Read_Config( const wxString& projectFileName )
/* User library path takes precedent over default library search paths. */ /* User library path takes precedent over default library search paths. */
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 ); wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
/* Reset the ITEM_NOT_SHOW flag when loading a new config /* Reset the ITEM*NOT*SHOW flag when loading a new config
* Because it could creates SERIOUS mistakes for the user, * Because it could creates SERIOUS mistakes for the user,
* if some items are not visible after loading a board... * if some items are not visible after loading a board...
*/ */
for( ii = 0; ii < LAYER_COUNT; ii++ ) for( ii = 0; ii < LAYER_COUNT; ii++ )
g_DesignSettings.m_LayerColor[ii] &= ~ ITEM_NOT_SHOW; g_DesignSettings.SetLayerVisibility( ii, true );
DisplayOpt.Show_Modules_Cmp = true; DisplayOpt.Show_Modules_Cmp = true;
DisplayOpt.Show_Modules_Cu = true; DisplayOpt.Show_Modules_Cu = true;
g_ModuleTextNOVColor &= ~ ITEM_NOT_SHOW;
g_ModuleTextCMPColor &= ~ ITEM_NOT_SHOW;
g_ModuleTextCUColor &= ~ ITEM_NOT_SHOW;
g_PadCMPColor &= ~ ITEM_NOT_SHOW;
g_PadCUColor &= ~ ITEM_NOT_SHOW;
g_DesignSettings.m_ViaColor[VIA_THROUGH] &= ~ ITEM_NOT_SHOW;
g_DesignSettings.m_ViaColor[VIA_BLIND_BURIED] &= ~ ITEM_NOT_SHOW;
g_DesignSettings.m_ViaColor[VIA_MICROVIA] &= ~ ITEM_NOT_SHOW;
// These parameters could be left in their previous state, or resetted // These parameters could be left in their previous state, or resetted
// Comment or uncomment to keep or reset this option after loading a board // Comment or uncomment to keep or reset this option after loading a board
g_AnchorColor &= ~ ITEM_NOT_SHOW;
g_DesignSettings.SetElementVisibility( MODULE_TEXT_NOV_VISIBLE, true );
g_DesignSettings.SetElementVisibility( MODULE_TEXT_CMP_VISIBLE, true );
g_DesignSettings.SetElementVisibility( MODULE_TEXT_CU_VISIBLE, true );
g_DesignSettings.SetElementVisibility( PAD_CMP_VISIBLE, true );
g_DesignSettings.SetElementVisibility( PAD_CU_VISIBLE, true );
g_DesignSettings.SetElementVisibility( VIA_THROUGH_VISIBLE, true );
g_DesignSettings.SetElementVisibility( VIA_BLIND_BURIED_VISIBLE, true );
g_DesignSettings.SetElementVisibility( VIA_MICROVIA_VISIBLE, true );
g_DesignSettings.SetElementVisibility( ANCHOR_VISIBLE, true );
DisplayOpt.DisplayPadNoConn = true; DisplayOpt.DisplayPadNoConn = true;
return TRUE; return TRUE;
} }
......
...@@ -210,32 +210,47 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -210,32 +210,47 @@ void WinEDA_SetColorsFrame::CreateControls()
RowBoxSizer->Add(BUTT_SIZE_X, BUTT_SIZE_Y, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5); RowBoxSizer->Add(BUTT_SIZE_X, BUTT_SIZE_Y, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5);
} }
//---------------------------------------------------------------
// Note: When setting texts, we must call wxGetTranslation( ) for all statically created texts // Note: When setting texts, we must call wxGetTranslation( ) for all statically created texts
// if we want them translated // if we want them translated
if( laytool_list[lyr]->m_LayerNumber >= 0 ) switch( laytool_list[lyr]->m_Type )
{ {
if( laytool_list[lyr]->m_Title == wxT( "*" ) ) case type_layer:
msg = wxGetTranslation( g_ViaType_Name[laytool_list[lyr]->m_LayerNumber]);
else
msg = m_Parent->GetBoard()->GetLayerName( laytool_list[lyr]->m_LayerNumber ); msg = m_Parent->GetBoard()->GetLayerName( laytool_list[lyr]->m_LayerNumber );
break;
case type_via:
msg = wxGetTranslation( g_ViaType_Name[laytool_list[lyr]->m_LayerNumber] );
break;
default:
msg = wxGetTranslation( laytool_list[lyr]->m_Title );
break;
} }
else
msg = wxGetTranslation( laytool_list[lyr]->m_Title );
//---------------------------------------------------------------
CheckBox = new wxCheckBox( this, ID_COLOR_CHECKBOX_ONOFF, msg, CheckBox = new wxCheckBox( this, ID_COLOR_CHECKBOX_ONOFF, msg,
wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
laytool_list[lyr]->m_CheckBox = CheckBox; laytool_list[lyr]->m_CheckBox = CheckBox;
if( laytool_list[lyr]->m_NoDisplayIsColor ) //---------------------------------------------------------------
switch( laytool_list[lyr]->m_Type )
{ {
if( *laytool_list[lyr]->m_Color & ITEM_NOT_SHOW ) case type_layer:
CheckBox->SetValue( FALSE ); CheckBox->SetValue( g_DesignSettings.IsLayerVisible( laytool_list[lyr]->m_LayerNumber ));
else break;
CheckBox->SetValue( TRUE );
case type_via:
case type_element:
CheckBox->SetValue( g_DesignSettings.IsElementVisible( laytool_list[lyr]->m_LayerNumber ));
break;
case type_visual:
CheckBox->SetValue( *laytool_list[lyr]->m_NoDisplay );
break;
} }
else if( laytool_list[lyr]->m_NoDisplay )
CheckBox->SetValue( *laytool_list[lyr]->m_NoDisplay );
RowBoxSizer->Add(CheckBox, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5); RowBoxSizer->Add(CheckBox, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5);
...@@ -457,26 +472,31 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() ...@@ -457,26 +472,31 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
{ {
for( int lyr = 0; lyr < NB_BUTT; lyr++ ) for( int lyr = 0; lyr < NB_BUTT; lyr++ )
{ {
if( laytool_list[lyr]->m_NoDisplayIsColor ) if( laytool_list[lyr]->m_Color )
{ *laytool_list[lyr]->m_Color = CurrentColor[lyr];
if( laytool_list[lyr]->m_CheckBox->GetValue() ) switch( laytool_list[lyr]->m_Type )
*laytool_list[lyr]->m_Color = CurrentColor[lyr] & ~ITEM_NOT_SHOW;
else
*laytool_list[lyr]->m_Color = CurrentColor[lyr] | ITEM_NOT_SHOW;
}
else
{ {
if( laytool_list[lyr]->m_Color ) case type_layer:
*laytool_list[lyr]->m_Color = CurrentColor[lyr]; g_DesignSettings.SetLayerVisibility( laytool_list[lyr]->m_LayerNumber,
laytool_list[lyr]->m_CheckBox->GetValue() );
*laytool_list[lyr]->m_NoDisplay = laytool_list[lyr]->m_CheckBox->GetValue(); break;
case type_via:
case type_element:
g_DesignSettings.SetElementVisibility( laytool_list[lyr]->m_LayerNumber,
laytool_list[lyr]->m_CheckBox->GetValue() );
break;
case type_visual:
*laytool_list[lyr]->m_NoDisplay = laytool_list[lyr]->m_CheckBox->GetValue();
break;
} }
} }
// Additional command required for updating visibility of grid. // Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = s_showGrid; m_Parent->m_Draw_Grid = s_showGrid;
} }
/**********************************************************************/ /**********************************************************************/
void WinEDA_SetColorsFrame::ResetDisplayLayersCu( wxCommandEvent& event ) void WinEDA_SetColorsFrame::ResetDisplayLayersCu( wxCommandEvent& event )
/**********************************************************************/ /**********************************************************************/
...@@ -487,11 +507,6 @@ void WinEDA_SetColorsFrame::ResetDisplayLayersCu( wxCommandEvent& event ) ...@@ -487,11 +507,6 @@ void WinEDA_SetColorsFrame::ResetDisplayLayersCu( wxCommandEvent& event )
for( int lyr = 0; lyr < 16; lyr++ ) for( int lyr = 0; lyr < 16; lyr++ )
{ {
// if( laytool_list[lyr]->m_CheckBox )
// laytool_list[lyr]->m_CheckBox->SetValue( NewState );
// (As checkboxes are actually provided for *all* of these layers,
// the following (simpler) command can be used instead.)
laytool_list[lyr]->m_CheckBox->SetValue( NewState ); laytool_list[lyr]->m_CheckBox->SetValue( NewState );
} }
} }
This diff is collapsed.
...@@ -388,7 +388,7 @@ void WinEDA_PcbFrame::ReCreateOptToolbar() ...@@ -388,7 +388,7 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
_( "Show Invisible Text" ), _( "Show Invisible Text" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & ITEM_NOT_SHOW ); g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ));
#ifdef MUWAVE_ENBL #ifdef MUWAVE_ENBL
......
...@@ -271,12 +271,14 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -271,12 +271,14 @@ void WinEDA_PcbFrame::SetToolbars()
DisplayOpt.ContrastModeDisplay ? DisplayOpt.ContrastModeDisplay ?
_( "Normal contrast mode display" ) : _( "Normal contrast mode display" ) :
_( "High contrast mode display" ) ); _( "High contrast mode display" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & ITEM_NOT_SHOW ); g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & (ITEM_NOT_SHOW) ? g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) ?
_( "Show invisible text" ) : _( "Hide invisible text" ) :
_( "Hide invisible text" ) ); _( "Show invisible text" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
m_AuxVToolBar ? true : false ); m_AuxVToolBar ? true : false );
} }
......
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