Commit 5732d815 authored by charras's avatar charras

Work on colors handling, and others changes. see changelog.

hide/show rastnest in pcbnew is currently not working, will be fixed soon
parent 4768fc78
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "drawtxt.h" #include "drawtxt.h"
#include "confirm.h" #include "confirm.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "3d_viewer.h" #include "3d_viewer.h"
#include "trackball.h" #include "trackball.h"
...@@ -362,7 +363,7 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track ) ...@@ -362,7 +363,7 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return; return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; int color = g_ColorsSettings.GetLayerColor(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;
...@@ -392,7 +393,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* zone_c ) ...@@ -392,7 +393,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* zone_c )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return; return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; int color = g_ColorsSettings.GetLayerColor(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;
...@@ -467,14 +468,14 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via ) ...@@ -467,14 +468,14 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false ) false )
continue; continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; color = g_ColorsSettings.GetLayerColor(layer);
} }
else else
{ {
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( LAYER_N_FRONT ) == if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( LAYER_N_FRONT ) ==
false ) false )
continue; continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[LAYER_N_FRONT]; color = g_ColorsSettings.GetLayerColor(LAYER_N_FRONT);
} }
SetGLColor( color ); SetGLColor( color );
...@@ -491,7 +492,7 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via ) ...@@ -491,7 +492,7 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
} }
// Drawing hole: // Drawing hole:
color = g_Parm_3D_Visu.m_BoardSettings->m_ViaColor[via->m_Shape]; color = g_ColorsSettings.GetItemColor(VIAS_VISIBLE + via->m_Shape);
SetGLColor( color ); SetGLColor( color );
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] - height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] -
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer]; g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
...@@ -510,7 +511,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment ) ...@@ -510,7 +511,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return; return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; int color = g_ColorsSettings.GetLayerColor(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;
...@@ -596,7 +597,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text ) ...@@ -596,7 +597,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
if( !Get3DLayerEnable( layer ) ) if( !Get3DLayerEnable( layer ) )
return; return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; int color = g_ColorsSettings.GetLayerColor(layer);
SetGLColor( color ); SetGLColor( color );
...@@ -730,7 +731,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -730,7 +731,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( m_Layer ) == false ) 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]; int color = g_ColorsSettings.GetLayerColor(m_Layer);
SetGLColor( color ); SetGLColor( color );
...@@ -838,7 +839,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -838,7 +839,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
&& !Both ) && !Both )
continue; continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; color = g_ColorsSettings.GetLayerColor(layer);
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false ) false )
continue; continue;
...@@ -890,7 +891,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -890,7 +891,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
if( (layer > FIRST_COPPER_LAYER) if( (layer > FIRST_COPPER_LAYER)
&& (layer < LAST_COPPER_LAYER) && !Both ) && (layer < LAST_COPPER_LAYER) && !Both )
continue; continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; color = g_ColorsSettings.GetLayerColor(layer);
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 ); glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false ) false )
...@@ -968,7 +969,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -968,7 +969,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
&& !Both ) && !Both )
continue; continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; color = g_ColorsSettings.GetLayerColor(layer);
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 ); glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false ) false )
......
...@@ -4,6 +4,37 @@ KiCad ChangeLog 2010 ...@@ -4,6 +4,37 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2010-Jan-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++ All:
added a test to solve a problem when cross compiling Kicad under Linux for Windows
Specific to countries that use a comma as separators in floating point numbers notation:
Depending on wxWideget version:
printed as 0,5 and read as 0.5
or
printed as 0.5 and read as 0,5
So float values are always broken in dialogs (many are seen as 0)
Now a test is made, and if there are problems relative to floats
(write/read conversion error),
use the C convention (always a point as separator)
++ eeschema:
Removed metrics grid values, that cannot be handled in schematic.
(because 2 items are seen as connected if they have the same coordinates
mixing mm and mils with internal units = 1 mil break netlist
and ERC calculations
So grid value *must* be an integer (in 1/1000 inch).
And metric grid is not very useful in schematic.
(Also 1 mil and 0.025 mm can be seen as the same value for a schematic that do not
needs precision in dimensions, so no need to have mils and mm in grid values)
++ pcbnew:
Starting work on color selection and items visibility
* code cleaning and removing global values.
* Separe visibility options for board editor and module editor
(work in progress, just starting)
2010-Jan-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2010-Jan-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
*fixed eeschema crash when using the hotkey m (move) command. *fixed eeschema crash when using the hotkey m (move) command.
......
...@@ -13,6 +13,7 @@ set(COMMON_SRCS ...@@ -13,6 +13,7 @@ set(COMMON_SRCS
bezier_curves.cpp bezier_curves.cpp
block_commande.cpp block_commande.cpp
build_version.cpp build_version.cpp
class_colors_design_settings.cpp
class_marker_base.cpp class_marker_base.cpp
class_plotter.cpp class_plotter.cpp
class_undoredo_container.cpp class_undoredo_container.cpp
......
...@@ -117,6 +117,16 @@ StructColors ColorRefs[NBCOLOR] = ...@@ -117,6 +117,16 @@ StructColors ColorRefs[NBCOLOR] =
{ 128, 255, 255, LIGHTYELLOW, wxT( "LIGHTYELLOW" ), LIGHTYELLOW } { 128, 255, 255, LIGHTYELLOW, wxT( "LIGHTYELLOW" ), LIGHTYELLOW }
}; };
/** Function to use local notation or C standard notation for floating point numbers
* some countries use 1,5 and others (and C) 1.5
* so we switch from local to C and C to local when reading or writing files
* And other problem is a bug when cross compiling under linux:
* a printf print 1,5 and the read functions expects 1.5
* (depending on version print = 1.5 and read = 1,5
* Very annoying and we detect this and use a stupid but necessary workarount
*/
bool g_DisableFloatingPointLocalNotation = false;
/** function SetLocaleTo_C_standard /** function SetLocaleTo_C_standard
* because kicad is internationalized, switch internalization to "C" standard * because kicad is internationalized, switch internalization to "C" standard
...@@ -146,6 +156,7 @@ void SetLocaleTo_C_standard( void ) ...@@ -146,6 +156,7 @@ void SetLocaleTo_C_standard( void )
*/ */
void SetLocaleTo_Default( void ) void SetLocaleTo_Default( void )
{ {
if( ! g_DisableFloatingPointLocalNotation )
setlocale( LC_NUMERIC, "" ); // revert to the current locale setlocale( LC_NUMERIC, "" ); // revert to the current locale
} }
......
...@@ -684,6 +684,22 @@ bool WinEDA_App::SetLanguage( bool first_time ) ...@@ -684,6 +684,22 @@ bool WinEDA_App::SetLanguage( bool first_time )
m_EDA_CommonConfig->Write( wxT( "Language" ), m_LanguageId ); m_EDA_CommonConfig->Write( wxT( "Language" ), m_LanguageId );
} }
// Test if floating point notation is working (bug in cross compilation)
// Make a conversion double <=> string
double dtst = 0.5;
wxString msg;
extern bool g_DisableFloatingPointLocalNotation; // See common.cpp
g_DisableFloatingPointLocalNotation = false;
msg << dtst;
double result;
msg.ToDouble(&result);
if( result != dtst ) // string to double encode/decode does not work! Bug detected
{
// Disable floating point localisation:
g_DisableFloatingPointLocalNotation = true;
SetLocaleTo_C_standard( );
}
if( !m_Locale->IsLoaded( DictionaryName ) ) if( !m_Locale->IsLoaded( DictionaryName ) )
m_Locale->AddCatalog( DictionaryName ); m_Locale->AddCatalog( DictionaryName );
......
...@@ -88,7 +88,6 @@ const wxString PcbFileWildcard( ...@@ -88,7 +88,6 @@ const wxString PcbFileWildcard(
int g_CurrentVersionPCB = 1; int g_CurrentVersionPCB = 1;
int g_TimeOut; // Timer for automatic saving int g_TimeOut; // Timer for automatic saving
int g_SaveTime; // Time for next saving int g_SaveTime; // Time for next saving
......
...@@ -14,11 +14,14 @@ ...@@ -14,11 +14,14 @@
#include "bitmaps.h" #include "bitmaps.h"
#include "protos.h" #include "protos.h"
#include "cvstruct.h" #include "cvstruct.h"
#include "colors_selection.h"
#include "build_version.h" #include "build_version.h"
#include <wx/snglinst.h> #include <wx/snglinst.h>
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
/* Constant string definitions for CvPcb */ /* Constant string definitions for CvPcb */
const wxString ComponentFileExtension( wxT( "cmp" ) ); const wxString ComponentFileExtension( wxT( "cmp" ) );
......
...@@ -48,10 +48,19 @@ static int SchematicZoomList[] = ...@@ -48,10 +48,19 @@ static int SchematicZoomList[] =
#define SCHEMATIC_ZOOM_LIST_CNT ( sizeof( SchematicZoomList ) / \ #define SCHEMATIC_ZOOM_LIST_CNT ( sizeof( SchematicZoomList ) / \
sizeof( int ) ) sizeof( int ) )
#define MM_TO_SCH_UNITS 1000.0 / 25.4000508001016 #define MM_TO_SCH_UNITS 1000.0 / 25.4 //schematic internal unites are mils
/* Default grid sizes for the schematic editor. */ /* Default grid sizes for the schematic editor.
* Do NOT add others values (mainly grid values in mm),
* because they can break the schematic:
* because wires and pins are considered as connected when the are to the same coordinate
* we cannot mix coordinates in mils (internal units) and mm
* (that cannot exactly converted in mils in many cases
* in fact schematic must only use 50 and 25 mils to place labnels, wires and components
* others values are useful only for graphic items (mainly in library editor)
* so use integer values in mils only.
*/
static GRID_TYPE SchematicGridList[] = { static GRID_TYPE SchematicGridList[] = {
{ ID_POPUP_GRID_LEVEL_50, wxRealPoint( 50, 50 ) }, { ID_POPUP_GRID_LEVEL_50, wxRealPoint( 50, 50 ) },
{ ID_POPUP_GRID_LEVEL_25, wxRealPoint( 25, 25 ) }, { ID_POPUP_GRID_LEVEL_25, wxRealPoint( 25, 25 ) },
...@@ -59,18 +68,6 @@ static GRID_TYPE SchematicGridList[] = { ...@@ -59,18 +68,6 @@ static GRID_TYPE SchematicGridList[] = {
{ ID_POPUP_GRID_LEVEL_5, wxRealPoint( 5, 5 ) }, { ID_POPUP_GRID_LEVEL_5, wxRealPoint( 5, 5 ) },
{ ID_POPUP_GRID_LEVEL_2, wxRealPoint( 2, 2 ) }, { ID_POPUP_GRID_LEVEL_2, wxRealPoint( 2, 2 ) },
{ ID_POPUP_GRID_LEVEL_1, wxRealPoint( 1, 1 ) }, { ID_POPUP_GRID_LEVEL_1, wxRealPoint( 1, 1 ) },
// predefined grid list in mm
{ ID_POPUP_GRID_LEVEL_2_5MM, wxRealPoint( MM_TO_SCH_UNITS * 2.5,
MM_TO_SCH_UNITS * 2.5 ) },
{ ID_POPUP_GRID_LEVEL_1MM, wxRealPoint( MM_TO_SCH_UNITS,
MM_TO_SCH_UNITS ) },
{ ID_POPUP_GRID_LEVEL_0_5MM, wxRealPoint( MM_TO_SCH_UNITS * 0.5,
MM_TO_SCH_UNITS * 0.5 ) },
{ ID_POPUP_GRID_LEVEL_0_25MM, wxRealPoint( MM_TO_SCH_UNITS * 0.25,
MM_TO_SCH_UNITS * 0.25 ) },
{ ID_POPUP_GRID_LEVEL_0_1MM, wxRealPoint( MM_TO_SCH_UNITS * 0.1,
MM_TO_SCH_UNITS * 0.1 ) }
}; };
#define SCHEMATIC_GRID_LIST_CNT ( sizeof( SchematicGridList ) / \ #define SCHEMATIC_GRID_LIST_CNT ( sizeof( SchematicGridList ) / \
......
...@@ -82,7 +82,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -82,7 +82,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticText9->Wrap( -1 ); m_staticText9->Wrap( -1 );
fgSizer1->Add( m_staticText9, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticText9, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_spinRepeatHorizontal = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 2000, 0 ); m_spinRepeatHorizontal = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 500, 0 );
fgSizer1->Add( m_spinRepeatHorizontal, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); fgSizer1->Add( m_spinRepeatHorizontal, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticRepeatXUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticRepeatXUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
...@@ -93,7 +93,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -93,7 +93,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticText12->Wrap( -1 ); m_staticText12->Wrap( -1 );
fgSizer1->Add( m_staticText12, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticText12, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_spinRepeatVertical = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 2000, 100 ); m_spinRepeatVertical = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 500, 100 );
fgSizer1->Add( m_spinRepeatVertical, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); fgSizer1->Add( m_spinRepeatVertical, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticRepeatYUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticRepeatYUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
...@@ -104,7 +104,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -104,7 +104,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticText16->Wrap( -1 ); m_staticText16->Wrap( -1 );
fgSizer1->Add( m_staticText16, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticText16, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_spinRepeatLabel = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, -100, 100, 1 ); m_spinRepeatLabel = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 10, 1 );
fgSizer1->Add( m_spinRepeatLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); fgSizer1->Add( m_spinRepeatLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
......
...@@ -742,10 +742,10 @@ ...@@ -742,10 +742,10 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="initial">1</property> <property name="initial">0</property>
<property name="max">2000</property> <property name="max">500</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min">1</property> <property name="min">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_spinRepeatHorizontal</property> <property name="name">m_spinRepeatHorizontal</property>
<property name="permission">protected</property> <property name="permission">protected</property>
...@@ -899,10 +899,10 @@ ...@@ -899,10 +899,10 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="initial">1</property> <property name="initial">100</property>
<property name="max">2000</property> <property name="max">500</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min">1</property> <property name="min">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_spinRepeatVertical</property> <property name="name">m_spinRepeatVertical</property>
<property name="permission">protected</property> <property name="permission">protected</property>
...@@ -1057,9 +1057,9 @@ ...@@ -1057,9 +1057,9 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="initial">1</property> <property name="initial">1</property>
<property name="max">100</property> <property name="max">10</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min">-100</property> <property name="min">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_spinRepeatLabel</property> <property name="name">m_spinRepeatLabel</property>
<property name="permission">protected</property> <property name="permission">protected</property>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "protos.h" #include "protos.h"
#include "zones.h" #include "zones.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "build_version.h" #include "build_version.h"
...@@ -27,7 +28,9 @@ wxString g_PhotoFilenameExt; ...@@ -27,7 +28,9 @@ wxString g_PhotoFilenameExt;
wxString g_DrillFilenameExt; wxString g_DrillFilenameExt;
wxString g_PenFilenameExt; wxString g_PenFilenameExt;
int g_DCodesColor; // Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
int g_Default_GERBER_Format; int g_Default_GERBER_Format;
int g_Plot_Spot_Mini; /* Diameter of the opening mini-track for GERBER. */ int g_Plot_Spot_Mini; /* Diameter of the opening mini-track for GERBER. */
int g_DisplayPolygonsModeSketch; int g_DisplayPolygonsModeSketch;
......
...@@ -25,12 +25,21 @@ typedef enum ...@@ -25,12 +25,21 @@ typedef enum
FORMAT_POST FORMAT_POST
} PlotFormat; } PlotFormat;
/**
* Enum ITEM_VISIBLE
* is a set of visible PCB elements.
*/
enum ITEM_VISIBLE
{
DCODES_VISIBLE,
END_ITEM_VISIBLE_LIST // sentinel
};
extern wxString g_PhotoFilenameExt; extern wxString g_PhotoFilenameExt;
extern wxString g_DrillFilenameExt; extern wxString g_DrillFilenameExt;
extern wxString g_PenFilenameExt; extern wxString g_PenFilenameExt;
extern int g_DCodesColor;
extern int g_Default_GERBER_Format; extern int g_Default_GERBER_Format;
extern int g_Plot_Spot_Mini; /* Diameter of the opening mini-track for extern int g_Plot_Spot_Mini; /* Diameter of the opening mini-track for
......
...@@ -3,12 +3,16 @@ ...@@ -3,12 +3,16 @@
/*************************/ /*************************/
#include "param_config.h" #include "param_config.h"
#include "colors_selection.h"
#define GROUP wxT("/gerbview") #define GROUP wxT("/gerbview")
#define GROUPLIB wxT("libraries") #define GROUPLIB wxT("libraries")
#define INSETUP TRUE #define INSETUP TRUE
/* Useful macro : */
#define LOC_COLOR(numlayer) &g_ColorsSettings.m_LayersColors[numlayer]
/* Liste des parametres */ /* Liste des parametres */
static PARAM_CFG_WXSTRING PhotoExtBufCfg static PARAM_CFG_WXSTRING PhotoExtBufCfg
...@@ -81,7 +85,7 @@ static PARAM_CFG_SETCOLOR ColorLayer0Cfg ...@@ -81,7 +85,7 @@ static PARAM_CFG_SETCOLOR ColorLayer0Cfg
( (
INSETUP, INSETUP,
wxT("ColLay0"), wxT("ColLay0"),
&g_DesignSettings.m_LayerColor[0], LOC_COLOR(0),
GREEN GREEN
); );
...@@ -89,7 +93,7 @@ static PARAM_CFG_SETCOLOR ColorLayer1Cfg ...@@ -89,7 +93,7 @@ static PARAM_CFG_SETCOLOR ColorLayer1Cfg
( (
INSETUP, INSETUP,
wxT("ColLay1"), wxT("ColLay1"),
&g_DesignSettings.m_LayerColor[1], LOC_COLOR(1),
BLUE BLUE
); );
...@@ -97,7 +101,7 @@ static PARAM_CFG_SETCOLOR ColorLayer2Cfg ...@@ -97,7 +101,7 @@ static PARAM_CFG_SETCOLOR ColorLayer2Cfg
( (
INSETUP, INSETUP,
wxT("ColLay2"), wxT("ColLay2"),
&g_DesignSettings.m_LayerColor[2], LOC_COLOR(2),
LIGHTGRAY LIGHTGRAY
); );
...@@ -105,7 +109,7 @@ static PARAM_CFG_SETCOLOR ColorLayer3Cfg ...@@ -105,7 +109,7 @@ static PARAM_CFG_SETCOLOR ColorLayer3Cfg
( (
INSETUP, INSETUP,
wxT("ColLay3"), wxT("ColLay3"),
&g_DesignSettings.m_LayerColor[3], LOC_COLOR(3),
5 5
); );
...@@ -113,7 +117,7 @@ static PARAM_CFG_SETCOLOR ColorLayer4Cfg ...@@ -113,7 +117,7 @@ static PARAM_CFG_SETCOLOR ColorLayer4Cfg
( (
INSETUP, INSETUP,
wxT("ColLay4"), wxT("ColLay4"),
&g_DesignSettings.m_LayerColor[4], LOC_COLOR(4),
4 4
); );
...@@ -121,7 +125,7 @@ static PARAM_CFG_SETCOLOR ColorLayer5Cfg ...@@ -121,7 +125,7 @@ static PARAM_CFG_SETCOLOR ColorLayer5Cfg
( (
INSETUP, INSETUP,
wxT("ColLay5"), wxT("ColLay5"),
&g_DesignSettings.m_LayerColor[5], LOC_COLOR(5),
5 5
); );
...@@ -129,7 +133,7 @@ static PARAM_CFG_SETCOLOR ColorLayer6Cfg ...@@ -129,7 +133,7 @@ static PARAM_CFG_SETCOLOR ColorLayer6Cfg
( (
INSETUP, INSETUP,
wxT("ColLay6"), wxT("ColLay6"),
&g_DesignSettings.m_LayerColor[6], LOC_COLOR(6),
6 6
); );
...@@ -137,7 +141,7 @@ static PARAM_CFG_SETCOLOR ColorLayer7Cfg ...@@ -137,7 +141,7 @@ static PARAM_CFG_SETCOLOR ColorLayer7Cfg
( (
INSETUP, INSETUP,
wxT("ColLay7"), wxT("ColLay7"),
&g_DesignSettings.m_LayerColor[7], LOC_COLOR(7),
5 5
); );
...@@ -145,7 +149,7 @@ static PARAM_CFG_SETCOLOR ColorLayer8Cfg ...@@ -145,7 +149,7 @@ static PARAM_CFG_SETCOLOR ColorLayer8Cfg
( (
INSETUP, INSETUP,
wxT("ColLay8"), wxT("ColLay8"),
&g_DesignSettings.m_LayerColor[8], LOC_COLOR(8),
7 7
); );
...@@ -153,7 +157,7 @@ static PARAM_CFG_SETCOLOR ColorLayer9Cfg ...@@ -153,7 +157,7 @@ static PARAM_CFG_SETCOLOR ColorLayer9Cfg
( (
INSETUP, INSETUP,
wxT("ColLay9"), wxT("ColLay9"),
&g_DesignSettings.m_LayerColor[9], LOC_COLOR(9),
1 1
); );
...@@ -161,7 +165,7 @@ static PARAM_CFG_SETCOLOR ColorLayer10Cfg ...@@ -161,7 +165,7 @@ static PARAM_CFG_SETCOLOR ColorLayer10Cfg
( (
INSETUP, INSETUP,
wxT("ColLayA"), wxT("ColLayA"),
&g_DesignSettings.m_LayerColor[10], LOC_COLOR(10),
2 2
); );
...@@ -169,7 +173,7 @@ static PARAM_CFG_SETCOLOR ColorLayer11Cfg ...@@ -169,7 +173,7 @@ static PARAM_CFG_SETCOLOR ColorLayer11Cfg
( (
INSETUP, INSETUP,
wxT("ColLayB"), wxT("ColLayB"),
&g_DesignSettings.m_LayerColor[11], LOC_COLOR(11),
3 3
); );
...@@ -177,7 +181,7 @@ static PARAM_CFG_SETCOLOR ColorLayer12Cfg ...@@ -177,7 +181,7 @@ static PARAM_CFG_SETCOLOR ColorLayer12Cfg
( (
INSETUP, INSETUP,
wxT("ColLayC"), wxT("ColLayC"),
&g_DesignSettings.m_LayerColor[12], LOC_COLOR(12),
12 12
); );
...@@ -185,7 +189,7 @@ static PARAM_CFG_SETCOLOR ColorLayer13Cfg ...@@ -185,7 +189,7 @@ static PARAM_CFG_SETCOLOR ColorLayer13Cfg
( (
INSETUP, INSETUP,
wxT("ColLayD"), wxT("ColLayD"),
&g_DesignSettings.m_LayerColor[13], LOC_COLOR(13),
13 13
); );
...@@ -193,7 +197,7 @@ static PARAM_CFG_SETCOLOR ColorLayer14Cfg ...@@ -193,7 +197,7 @@ static PARAM_CFG_SETCOLOR ColorLayer14Cfg
( (
INSETUP, INSETUP,
wxT("ColLayE"), wxT("ColLayE"),
&g_DesignSettings.m_LayerColor[14], LOC_COLOR(14),
14 14
); );
...@@ -201,7 +205,7 @@ static PARAM_CFG_SETCOLOR ColorLayer15Cfg ...@@ -201,7 +205,7 @@ static PARAM_CFG_SETCOLOR ColorLayer15Cfg
( (
INSETUP, INSETUP,
wxT("ColLayF"), wxT("ColLayF"),
&g_DesignSettings.m_LayerColor[15], LOC_COLOR(15),
RED RED
); );
...@@ -209,7 +213,7 @@ static PARAM_CFG_SETCOLOR ColorLayer16Cfg ...@@ -209,7 +213,7 @@ static PARAM_CFG_SETCOLOR ColorLayer16Cfg
( (
INSETUP, INSETUP,
wxT("ColLayG"), wxT("ColLayG"),
&g_DesignSettings.m_LayerColor[16], LOC_COLOR(16),
1 1
); );
...@@ -217,7 +221,7 @@ static PARAM_CFG_SETCOLOR ColorLayer17Cfg ...@@ -217,7 +221,7 @@ static PARAM_CFG_SETCOLOR ColorLayer17Cfg
( (
INSETUP, INSETUP,
wxT("ColLayH"), wxT("ColLayH"),
&g_DesignSettings.m_LayerColor[17], LOC_COLOR(17),
5 5
); );
...@@ -225,7 +229,7 @@ static PARAM_CFG_SETCOLOR ColorLayer18Cfg ...@@ -225,7 +229,7 @@ static PARAM_CFG_SETCOLOR ColorLayer18Cfg
( (
INSETUP, INSETUP,
wxT("ColLayI"), wxT("ColLayI"),
&g_DesignSettings.m_LayerColor[18], LOC_COLOR(18),
11 11
); );
...@@ -233,7 +237,7 @@ static PARAM_CFG_SETCOLOR ColorLayer19Cfg ...@@ -233,7 +237,7 @@ static PARAM_CFG_SETCOLOR ColorLayer19Cfg
( (
INSETUP, INSETUP,
wxT("ColLayJ"), wxT("ColLayJ"),
&g_DesignSettings.m_LayerColor[19], LOC_COLOR(19),
4 4
); );
...@@ -241,7 +245,7 @@ static PARAM_CFG_SETCOLOR ColorLayer20Cfg ...@@ -241,7 +245,7 @@ static PARAM_CFG_SETCOLOR ColorLayer20Cfg
( (
INSETUP, INSETUP,
wxT("ColLayK"), wxT("ColLayK"),
&g_DesignSettings.m_LayerColor[20], LOC_COLOR(20),
5 5
); );
...@@ -249,7 +253,7 @@ static PARAM_CFG_SETCOLOR ColorLayer21Cfg ...@@ -249,7 +253,7 @@ static PARAM_CFG_SETCOLOR ColorLayer21Cfg
( (
INSETUP, INSETUP,
wxT("ColLayL"), wxT("ColLayL"),
&g_DesignSettings.m_LayerColor[21], LOC_COLOR(21),
3 3
); );
...@@ -257,7 +261,7 @@ static PARAM_CFG_SETCOLOR ColorLayer22Cfg ...@@ -257,7 +261,7 @@ static PARAM_CFG_SETCOLOR ColorLayer22Cfg
( (
INSETUP, INSETUP,
wxT("ColLayM"), wxT("ColLayM"),
&g_DesignSettings.m_LayerColor[22], LOC_COLOR(22),
6 6
); );
...@@ -265,7 +269,7 @@ static PARAM_CFG_SETCOLOR ColorLayer23Cfg ...@@ -265,7 +269,7 @@ static PARAM_CFG_SETCOLOR ColorLayer23Cfg
( (
INSETUP, INSETUP,
wxT("ColLayN"), wxT("ColLayN"),
&g_DesignSettings.m_LayerColor[23], LOC_COLOR(23),
5 5
); );
...@@ -273,7 +277,7 @@ static PARAM_CFG_SETCOLOR ColorLayer24Cfg ...@@ -273,7 +277,7 @@ static PARAM_CFG_SETCOLOR ColorLayer24Cfg
( (
INSETUP, INSETUP,
wxT("ColLayO"), wxT("ColLayO"),
&g_DesignSettings.m_LayerColor[24], LOC_COLOR(24),
LIGHTGRAY LIGHTGRAY
); );
...@@ -281,7 +285,7 @@ static PARAM_CFG_SETCOLOR ColorLayer25Cfg ...@@ -281,7 +285,7 @@ static PARAM_CFG_SETCOLOR ColorLayer25Cfg
( (
INSETUP, INSETUP,
wxT("ColLayP"), wxT("ColLayP"),
&g_DesignSettings.m_LayerColor[25], LOC_COLOR(25),
1 1
); );
...@@ -289,7 +293,7 @@ static PARAM_CFG_SETCOLOR ColorLayer26Cfg ...@@ -289,7 +293,7 @@ static PARAM_CFG_SETCOLOR ColorLayer26Cfg
( (
INSETUP, INSETUP,
wxT("ColLayQ"), wxT("ColLayQ"),
&g_DesignSettings.m_LayerColor[26], LOC_COLOR(26),
2 2
); );
...@@ -297,7 +301,7 @@ static PARAM_CFG_SETCOLOR ColorLayer27Cfg ...@@ -297,7 +301,7 @@ static PARAM_CFG_SETCOLOR ColorLayer27Cfg
( (
INSETUP, INSETUP,
wxT("ColLayR"), wxT("ColLayR"),
&g_DesignSettings.m_LayerColor[27], LOC_COLOR(27),
14 14
); );
...@@ -305,7 +309,7 @@ static PARAM_CFG_SETCOLOR ColorLayer28Cfg ...@@ -305,7 +309,7 @@ static PARAM_CFG_SETCOLOR ColorLayer28Cfg
( (
INSETUP, INSETUP,
wxT("ColLayS"), wxT("ColLayS"),
&g_DesignSettings.m_LayerColor[28], LOC_COLOR(28),
YELLOW YELLOW
); );
...@@ -313,7 +317,7 @@ static PARAM_CFG_SETCOLOR ColorLayer29Cfg ...@@ -313,7 +317,7 @@ static PARAM_CFG_SETCOLOR ColorLayer29Cfg
( (
INSETUP, INSETUP,
wxT("ColLayT"), wxT("ColLayT"),
&g_DesignSettings.m_LayerColor[29], LOC_COLOR(29),
13 13
); );
...@@ -321,7 +325,7 @@ static PARAM_CFG_SETCOLOR ColorLayer30Cfg ...@@ -321,7 +325,7 @@ static PARAM_CFG_SETCOLOR ColorLayer30Cfg
( (
INSETUP, INSETUP,
wxT("ColLayU"), wxT("ColLayU"),
&g_DesignSettings.m_LayerColor[30], LOC_COLOR(30),
14 14
); );
...@@ -329,7 +333,7 @@ static PARAM_CFG_SETCOLOR ColorLayer31Cfg ...@@ -329,7 +333,7 @@ static PARAM_CFG_SETCOLOR ColorLayer31Cfg
( (
INSETUP, INSETUP,
wxT("ColLayV"), wxT("ColLayV"),
&g_DesignSettings.m_LayerColor[31], LOC_COLOR(31),
7 7
); );
...@@ -347,7 +351,7 @@ static PARAM_CFG_SETCOLOR ColorDCodesCfg ...@@ -347,7 +351,7 @@ static PARAM_CFG_SETCOLOR ColorDCodesCfg
( (
INSETUP, INSETUP,
wxT("CoDCode"), wxT("CoDCode"),
&g_DCodesColor, &g_ColorsSettings.m_ItemsColors[DCODES_VISIBLE],
WHITE WHITE
); );
......
...@@ -5,10 +5,6 @@ ...@@ -5,10 +5,6 @@
/*Set up the items and layer colors and show/no show options /*Set up the items and layer colors and show/no show options
*/ */
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation "set_color.h"
#endif
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
...@@ -442,7 +438,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() ...@@ -442,7 +438,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
g_GridColor = CurrentColor[32]; g_GridColor = CurrentColor[32];
s_showGrid = laytool_list[32]->m_CheckBox->GetValue(); s_showGrid = laytool_list[32]->m_CheckBox->GetValue();
g_DCodesColor = CurrentColor[33]; g_ColorsSettings.SetItemColor(DCODES_VISIBLE, CurrentColor[33] );
DisplayOpt.DisplayPadNum = laytool_list[33]->m_CheckBox->GetValue(); DisplayOpt.DisplayPadNum = laytool_list[33]->m_CheckBox->GetValue();
// Additional command required for updating visibility of grid. // Additional command required for updating visibility of grid.
......
...@@ -5,11 +5,8 @@ ...@@ -5,11 +5,8 @@
#ifndef SET_COLOR_H #ifndef SET_COLOR_H
#define SET_COLOR_H #define SET_COLOR_H
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "set_color.cpp"
#endif
#include "wx/statline.h" #include "wx/statline.h"
#include "colors_selection.h"
class wxBoxSizer; class wxBoxSizer;
class wxFlexGridSizer; class wxFlexGridSizer;
...@@ -48,8 +45,8 @@ enum col_sel_id { ...@@ -48,8 +45,8 @@ enum col_sel_id {
const int BUTT_SIZE_X = 20; const int BUTT_SIZE_X = 20;
const int BUTT_SIZE_Y = 16; const int BUTT_SIZE_Y = 16;
/* Macro utile : */ /* Useful macro : */
#define ADR(numlayer) &g_DesignSettings.m_LayerColor[(numlayer)] #define LOC_COLOR(numlayer) &g_ColorsSettings.m_LayersColors[numlayer]
/**********************************/ /**********************************/
...@@ -84,112 +81,112 @@ static ButtonIndex Msg_Layers_Cu = ...@@ -84,112 +81,112 @@ static ButtonIndex Msg_Layers_Cu =
static ColorButton Layer_1_Butt= static ColorButton Layer_1_Butt=
{ {
_("Layer 1"), // Title _("Layer 1"), // Title
ADR(0), // Address of optional parameter LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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
}; };
...@@ -203,112 +200,112 @@ static ButtonIndex Msg_Layers_Tech = ...@@ -203,112 +200,112 @@ static ButtonIndex Msg_Layers_Tech =
static ColorButton Layer_17_Butt= static ColorButton Layer_17_Butt=
{ {
_("Layer 17"), // Title _("Layer 17"), // Title
ADR(16), // Address of optional parameter LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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 LOC_COLOR(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
}; };
...@@ -330,7 +327,7 @@ static ColorButton Grid_Butt= ...@@ -330,7 +327,7 @@ static ColorButton Grid_Butt=
static ColorButton Show_DCodes_Butt= static ColorButton Show_DCodes_Butt=
{ {
_("D codes id."), // Title _("D codes id."), // Title
&g_DCodesColor, // Address of optional parameter &g_ColorsSettings.m_ItemsColors[DCODES_VISIBLE], // Address of optional parameter
FALSE, FALSE,
&DisplayOpt.DisplayPadNum // Address of boolean display control parameter to toggle &DisplayOpt.DisplayPadNum // Address of boolean display control parameter to toggle
}; };
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "pcbplot.h" #include "pcbplot.h"
#include "protos.h" #include "protos.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
static void Draw_Track_Buffer( WinEDA_DrawPanel* panel, static void Draw_Track_Buffer( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
...@@ -142,7 +143,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay ...@@ -142,7 +143,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
} }
else else
{ {
Color = g_DesignSettings.m_LayerColor[track->GetLayer()]; Color = g_ColorsSettings.GetLayerColor( track->GetLayer() );
filled = (g_DisplayPolygonsModeSketch == 0); filled = (g_DisplayPolygonsModeSketch == 0);
} }
...@@ -170,7 +171,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay ...@@ -170,7 +171,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
} }
else else
{ {
Color = g_DesignSettings.m_LayerColor[track->GetLayer()]; Color = g_ColorsSettings.GetLayerColor( track->GetLayer() );
filled = (g_DisplayPolygonsModeSketch == 0); filled = (g_DisplayPolygonsModeSketch == 0);
} }
...@@ -253,7 +254,7 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo ...@@ -253,7 +254,7 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false ) if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false )
return; return;
color = g_DesignSettings.m_LayerColor[track->GetLayer()]; color = g_ColorsSettings.GetLayerColor( track->GetLayer() );
if( draw_mode & GR_SURBRILL ) if( draw_mode & GR_SURBRILL )
{ {
...@@ -453,8 +454,10 @@ void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int d ...@@ -453,8 +454,10 @@ void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int d
width /= 2; width /= 2;
} }
int color = g_ColorsSettings.GetItemColor(DCODES_VISIBLE);
DrawGraphicText( panel, DC, DrawGraphicText( panel, DC,
pos, (EDA_Colors) g_DCodesColor, Line, pos, (EDA_Colors) color, Line,
orient, wxSize( width, width ), orient, wxSize( width, width ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
0, false, false, false); 0, false, false, false);
......
...@@ -37,18 +37,6 @@ protected: ...@@ -37,18 +37,6 @@ protected:
int m_VisibleLayers; // Bit-mask for layer visibility int m_VisibleLayers; // Bit-mask for layer visibility
int m_VisibleElements; // Bit-mask for element category visibility int m_VisibleElements; // Bit-mask for element category visibility
public:
// Color options for screen display of the Printed Board:
int m_LayerColor[LAYER_COUNT]; ///< Layer colors (tracks and graphic items)
int m_ViaColor[4]; // Via color (depending on is type)
// Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors)
int m_RatsnestColor; // Ratsnest color
public: public:
EDA_BoardDesignSettings(); EDA_BoardDesignSettings();
...@@ -184,34 +172,6 @@ public: ...@@ -184,34 +172,6 @@ public:
* @param aNewLayerCount = The new number of enabled copper layers * @param aNewLayerCount = The new number of enabled copper layers
*/ */
void SetCopperLayerCount( int aNewLayerCount ); void SetCopperLayerCount( int aNewLayerCount );
/**
* Function GetLayerColor
* returns the color for aLayer which is one of the layer indices given
* in pcbstruct.h
*/
int GetLayerColor( int aLayer )
{
if( (unsigned) aLayer < (unsigned) NB_LAYERS )
{
return m_LayerColor[aLayer];
}
return -1;
}
/**
* Function SetLayerColor
* sets the color for aLayer which is one of the layer indices given
* in pcbstruct.h
*/
void SetLayerColor( int aLayer, int aColor )
{
if( (unsigned) aLayer < (unsigned) NB_LAYERS )
{
m_LayerColor[aLayer] = aColor;
}
}
}; };
......
/****************************************************/
/* class_colors_design_settings.h */
/* handle colors used to draw all items or layers */
/****************************************************/
#ifndef _COLORS_DESIGN_SETTING_H
#define _COLORS_DESIGN_SETTING_H
#define LAYERSCOLORSBUFFERSIZE 32
#define ITEMSCOLORSBUFFERSIZE 32
/* Class for handle list of color settings for designs
* in Eeschema, Pcbnew and gerbview
*/
class COLORS_DESIGN_SETTINGS
{
public:
// Color options for screen display of the Printed Board and schematic:
// Common to Eeschema, Pcbnew, Gerbview
int m_LayersColors[LAYERSCOLORSBUFFERSIZE]; ///< Layer colors (tracks and graphic items)
// Common to Eeschema, Pcbnew
int m_ItemsColors[ITEMSCOLORSBUFFERSIZE]; ///< All others items but layers
public:
COLORS_DESIGN_SETTINGS( );
/**
* Function GetLayerColor
* @return the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
int GetLayerColor( int aLayer );
/**
* Function SetLayerColor
* sets the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
void SetLayerColor( int aLayer, int aColor );
/**
* Function GetItemColor
* @return the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
int GetItemColor( int aItemIdx );
/**
* Function SetItemColor
* sets the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
void SetItemColor( int aItemIdx, int aColor );
};
#endif // _COLORS_DESIGN_SETTING_H
/**************************************************************/
/* pcbstruct.h : some classes and definitions used in pcbnew */
/**************************************************************/
#ifndef _LAYERS_ID_AND_VISIBILITY_H_
#define _LAYERS_ID_AND_VISIBILITY_H_
/* Layer identification (layer number) */
#define FIRST_COPPER_LAYER 0
#define LAYER_N_BACK 0
#define LAYER_N_2 1
#define LAYER_N_3 2
#define LAYER_N_4 3
#define LAYER_N_5 4
#define LAYER_N_6 5
#define LAYER_N_7 6
#define LAYER_N_8 7
#define LAYER_N_9 8
#define LAYER_N_10 9
#define LAYER_N_11 10
#define LAYER_N_12 11
#define LAYER_N_13 12
#define LAYER_N_14 13
#define LAYER_N_15 14
#define LAYER_N_FRONT 15
#define LAST_COPPER_LAYER LAYER_N_FRONT
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER + 1)
#define FIRST_NO_COPPER_LAYER 16
#define ADHESIVE_N_BACK 16
#define ADHESIVE_N_FRONT 17
#define SOLDERPASTE_N_BACK 18
#define SOLDERPASTE_N_FRONT 19
#define SILKSCREEN_N_BACK 20
#define SILKSCREEN_N_FRONT 21
#define SOLDERMASK_N_BACK 22
#define SOLDERMASK_N_FRONT 23
#define DRAW_N 24
#define COMMENT_N 25
#define ECO1_N 26
#define ECO2_N 27
#define EDGE_N 28
#define LAST_NO_COPPER_LAYER 28
#define UNUSED_LAYER_29 29
#define UNUSED_LAYER_30 30
#define UNUSED_LAYER_31 31
#define NB_LAYERS (LAST_NO_COPPER_LAYER + 1)
#define LAYER_COUNT 32
// Masks to identify a layer by a bit map
#define LAYER_BACK (1 << LAYER_N_BACK) ///< bit mask for copper layer
#define LAYER_2 (1 << LAYER_N_2) ///< bit mask for layer 2
#define LAYER_3 (1 << LAYER_N_3) ///< bit mask for layer 3
#define LAYER_4 (1 << LAYER_N_4) ///< bit mask for layer 4
#define LAYER_5 (1 << LAYER_N_5) ///< bit mask for layer 5
#define LAYER_6 (1 << LAYER_N_6) ///< bit mask for layer 6
#define LAYER_7 (1 << LAYER_N_7) ///< bit mask for layer 7
#define LAYER_8 (1 << LAYER_N_8) ///< bit mask for layer 8
#define LAYER_9 (1 << LAYER_N_9) ///< bit mask for layer 9
#define LAYER_10 (1 << LAYER_N_10) ///< bit mask for layer 10
#define LAYER_11 (1 << LAYER_N_11) ///< bit mask for layer 11
#define LAYER_12 (1 << LAYER_N_12) ///< bit mask for layer 12
#define LAYER_13 (1 << LAYER_N_13) ///< bit mask for layer 13
#define LAYER_14 (1 << LAYER_N_14) ///< bit mask for layer 14
#define LAYER_15 (1 << LAYER_N_15) ///< bit mask for layer 15
#define LAYER_FRONT (1 << LAYER_N_FRONT) ///< bit mask for component layer
#define ADHESIVE_LAYER_BACK (1 << ADHESIVE_N_BACK)
#define ADHESIVE_LAYER_FRONT (1 << ADHESIVE_N_FRONT)
#define SOLDERPASTE_LAYER_BACK (1 << SOLDERPASTE_N_BACK)
#define SOLDERPASTE_LAYER_FRONT (1 << SOLDERPASTE_N_FRONT)
#define SILKSCREEN_LAYER_BACK (1 << SILKSCREEN_N_BACK)
#define SILKSCREEN_LAYER_FRONT (1 << SILKSCREEN_N_FRONT)
#define SOLDERMASK_LAYER_BACK (1 << SOLDERMASK_N_BACK)
#define SOLDERMASK_LAYER_FRONT (1 << SOLDERMASK_N_FRONT)
#define DRAW_LAYER (1 << DRAW_N)
#define COMMENT_LAYER (1 << COMMENT_N)
#define ECO1_LAYER (1 << ECO1_N)
#define ECO2_LAYER (1 << ECO2_N)
#define EDGE_LAYER (1 << EDGE_N)
#define FIRST_NON_COPPER_LAYER ADHESIVE_N_BACK
#define LAST_NON_COPPER_LAYER EDGE_N
// extra bits 0xE0000000
/* Helpful global layers mask : */
#define ALL_LAYERS 0x1FFFFFFF // Pcbnew used 29 layers
#define FULL_LAYERS 0xFFFFFFFF // Gerbview used 32 layers
#define ALL_NO_CU_LAYERS 0x1FFF0000
#define ALL_CU_LAYERS 0x0000FFFF
#define INTERNAL_LAYERS 0x00007FFE
#define EXTERNAL_LAYERS 0x00008001
// layers order in dialogs (plot, print and toolbars)
// in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
#define DECLARE_LAYERS_ORDER_LIST(list) int list[LAYER_COUNT] =\
{ LAYER_N_FRONT,\
LAYER_N_15, LAYER_N_14, LAYER_N_13, LAYER_N_12,\
LAYER_N_11, LAYER_N_10, LAYER_N_9, LAYER_N_8,\
LAYER_N_7, LAYER_N_6, LAYER_N_5, LAYER_N_4,\
LAYER_N_3, LAYER_N_2,\
LAYER_N_BACK,\
ADHESIVE_N_FRONT , ADHESIVE_N_BACK,\
SOLDERPASTE_N_FRONT, SOLDERPASTE_N_BACK,\
SILKSCREEN_N_FRONT, SILKSCREEN_N_BACK,\
SOLDERMASK_N_FRONT, SOLDERMASK_N_BACK,\
DRAW_N,\
COMMENT_N,\
ECO1_N, ECO2_N,\
EDGE_N,\
UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31\
};
/**
* Enum PCB_VISIBLE
* is a set of visible PCB elements.
* @see BOARD::SetVisibleElementColor()
* @see BOARD::SetVisibleElement()
*/
enum PCB_VISIBLE
{
VIAS_VISIBLE,
VIA_MICROVIA_VISIBLE,
VIA_BBLIND_VISIBLE,
VIA_THROUGH_VISIBLE,
MOD_TEXT_FR_VISIBLE,
MOD_TEXT_BK_VISIBLE,
MOD_TEXT_INVISIBLE, ///< text marked as invisible
ANCHOR_VISIBLE,
PAD_FR_VISIBLE,
PAD_BK_VISIBLE,
RATSNEST_VISIBLE,
GRID_VISIBLE,
// the rest of these do not currently support color changes:
NO_CONNECTS_VISIBLE, ///< show a marker on pads with no nets
MOD_FR_VISIBLE, ///< show modules on front
MOD_BK_VISIBLE, ///< show modules on back
MOD_VALUES_VISIBLE, ///< show modules values (when texts are visibles)
MOD_REFERENCES_VISIBLE, ///< show modules references (when texts are visibles)
END_PCB_VISIBLE_LIST // sentinel
};
/**
* Function IsValidLayerIndex
* tests whether a given integer is a valid layer index
* @param aLayerIndex = Layer index to test
* @return true if aLayerIndex is a valid layer index
*/
inline bool IsValidLayerIndex( int aLayerIndex )
{
return aLayerIndex >= 0 && aLayerIndex < NB_LAYERS;
}
/**
* Function IsValidCopperLayerIndex
* tests whether an integer is a valid copper layer index
* @param aLayerIndex = Layer index to test
* @return true if aLayerIndex is a valid copper layer index
*/
inline bool IsValidCopperLayerIndex( int aLayerIndex )
{
return aLayerIndex >= FIRST_COPPER_LAYER && aLayerIndex <= LAST_COPPER_LAYER;
}
/**
* Function IsValidNonCopperLayerIndex
* tests whether an integer is a valid non copper layer index
* @param aLayerIndex = Layer index to test
* @return true if aLayerIndex is a valid non copper layer index
*/
inline bool IsValidNonCopperLayerIndex( int aLayerIndex )
{
return aLayerIndex >= FIRST_NO_COPPER_LAYER
&& aLayerIndex <= LAST_NO_COPPER_LAYER;
}
#endif // _LAYERS_ID_AND_VISIBILITY_H_
...@@ -36,12 +36,6 @@ extern const wxString PcbFileWildcard; ...@@ -36,12 +36,6 @@ extern const wxString PcbFileWildcard;
extern wxString g_ViaType_Name[4]; extern wxString g_ViaType_Name[4];
extern int g_CurrentVersionPCB; extern int g_CurrentVersionPCB;
extern int g_AnchorColor;
extern int g_ModuleTextCMPColor;
extern int g_ModuleTextCUColor;
extern int g_ModuleTextNOVColor;
extern int g_PadCUColor;
extern int g_PadCMPColor;
extern int g_TimeOut; // Timer for automatic saving extern int g_TimeOut; // Timer for automatic saving
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base_struct.h" #include "base_struct.h"
#include "class_base_screen.h" #include "class_base_screen.h"
#include "class_board_item.h" #include "class_board_item.h"
#include "layers_id_colors_and_visibility.h"
// Definitions relatives aux libraries // Definitions relatives aux libraries
#define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1" #define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1"
...@@ -33,114 +34,6 @@ ...@@ -33,114 +34,6 @@
#define CHAIN (1 << 0) // mark segment #define CHAIN (1 << 0) // mark segment
/* Layer identification (layer number) */
#define FIRST_COPPER_LAYER 0
#define LAYER_N_BACK 0
#define LAYER_N_2 1
#define LAYER_N_3 2
#define LAYER_N_4 3
#define LAYER_N_5 4
#define LAYER_N_6 5
#define LAYER_N_7 6
#define LAYER_N_8 7
#define LAYER_N_9 8
#define LAYER_N_10 9
#define LAYER_N_11 10
#define LAYER_N_12 11
#define LAYER_N_13 12
#define LAYER_N_14 13
#define LAYER_N_15 14
#define LAYER_N_FRONT 15
#define LAST_COPPER_LAYER LAYER_N_FRONT
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER + 1)
#define FIRST_NO_COPPER_LAYER 16
#define ADHESIVE_N_BACK 16
#define ADHESIVE_N_FRONT 17
#define SOLDERPASTE_N_BACK 18
#define SOLDERPASTE_N_FRONT 19
#define SILKSCREEN_N_BACK 20
#define SILKSCREEN_N_FRONT 21
#define SOLDERMASK_N_BACK 22
#define SOLDERMASK_N_FRONT 23
#define DRAW_N 24
#define COMMENT_N 25
#define ECO1_N 26
#define ECO2_N 27
#define EDGE_N 28
#define LAST_NO_COPPER_LAYER 28
#define UNUSED_LAYER_29 29
#define UNUSED_LAYER_30 30
#define UNUSED_LAYER_31 31
#define NB_LAYERS (LAST_NO_COPPER_LAYER + 1)
#define LAYER_COUNT 32
#define LAYER_BACK (1 << LAYER_N_BACK) ///< bit mask for copper layer
#define LAYER_2 (1 << LAYER_N_2) ///< bit mask for layer 2
#define LAYER_3 (1 << LAYER_N_3) ///< bit mask for layer 3
#define LAYER_4 (1 << LAYER_N_4) ///< bit mask for layer 4
#define LAYER_5 (1 << LAYER_N_5) ///< bit mask for layer 5
#define LAYER_6 (1 << LAYER_N_6) ///< bit mask for layer 6
#define LAYER_7 (1 << LAYER_N_7) ///< bit mask for layer 7
#define LAYER_8 (1 << LAYER_N_8) ///< bit mask for layer 8
#define LAYER_9 (1 << LAYER_N_9) ///< bit mask for layer 9
#define LAYER_10 (1 << LAYER_N_10) ///< bit mask for layer 10
#define LAYER_11 (1 << LAYER_N_11) ///< bit mask for layer 11
#define LAYER_12 (1 << LAYER_N_12) ///< bit mask for layer 12
#define LAYER_13 (1 << LAYER_N_13) ///< bit mask for layer 13
#define LAYER_14 (1 << LAYER_N_14) ///< bit mask for layer 14
#define LAYER_15 (1 << LAYER_N_15) ///< bit mask for layer 15
#define LAYER_FRONT (1 << LAYER_N_FRONT) ///< bit mask for component layer
#define ADHESIVE_LAYER_BACK (1 << ADHESIVE_N_BACK)
#define ADHESIVE_LAYER_FRONT (1 << ADHESIVE_N_FRONT)
#define SOLDERPASTE_LAYER_BACK (1 << SOLDERPASTE_N_BACK)
#define SOLDERPASTE_LAYER_FRONT (1 << SOLDERPASTE_N_FRONT)
#define SILKSCREEN_LAYER_BACK (1 << SILKSCREEN_N_BACK)
#define SILKSCREEN_LAYER_FRONT (1 << SILKSCREEN_N_FRONT)
#define SOLDERMASK_LAYER_BACK (1 << SOLDERMASK_N_BACK)
#define SOLDERMASK_LAYER_FRONT (1 << SOLDERMASK_N_FRONT)
#define DRAW_LAYER (1 << DRAW_N)
#define COMMENT_LAYER (1 << COMMENT_N)
#define ECO1_LAYER (1 << ECO1_N)
#define ECO2_LAYER (1 << ECO2_N)
#define EDGE_LAYER (1 << EDGE_N)
#define FIRST_NON_COPPER_LAYER ADHESIVE_N_BACK
#define LAST_NON_COPPER_LAYER EDGE_N
// extra bits 0xE0000000
/* Helpful global layers mask : */
#define ALL_LAYERS 0x1FFFFFFF // Pcbnew used 29 layers
#define FULL_LAYERS 0xFFFFFFFF // Gerbview used 32 layers
#define ALL_NO_CU_LAYERS 0x1FFF0000
#define ALL_CU_LAYERS 0x0000FFFF
#define INTERNAL_LAYERS 0x00007FFE
#define EXTERNAL_LAYERS 0x00008001
// layers order in dialogs (plot, print and toolbars)
// in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
#define DECLARE_LAYERS_ORDER_LIST(list) int list[LAYER_COUNT] =\
{ LAYER_N_FRONT,\
LAYER_N_15, LAYER_N_14, LAYER_N_13, LAYER_N_12,\
LAYER_N_11, LAYER_N_10, LAYER_N_9, LAYER_N_8,\
LAYER_N_7, LAYER_N_6, LAYER_N_5, LAYER_N_4,\
LAYER_N_3, LAYER_N_2,\
LAYER_N_BACK,\
ADHESIVE_N_FRONT , ADHESIVE_N_BACK,\
SOLDERPASTE_N_FRONT, SOLDERPASTE_N_BACK,\
SILKSCREEN_N_FRONT, SILKSCREEN_N_BACK,\
SOLDERMASK_N_FRONT, SOLDERMASK_N_BACK,\
DRAW_N,\
COMMENT_N,\
ECO1_N, ECO2_N,\
EDGE_N,\
UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31\
};
class NETINFO_ITEM; class NETINFO_ITEM;
class MARKER_PCB; class MARKER_PCB;
class RATSNEST_ITEM; class RATSNEST_ITEM;
...@@ -153,73 +46,6 @@ class RATSNEST_ITEM; ...@@ -153,73 +46,6 @@ class RATSNEST_ITEM;
#include "class_board.h" #include "class_board.h"
/**
* Enum PCB_VISIBLE
* is a set of visible PCB elements.
* @see BOARD::SetVisibleElementColor()
* @see BOARD::SetVisibleElement()
*/
enum PCB_VISIBLE
{
VIAS_VISIBLE,
VIA_MICROVIA_VISIBLE,
VIA_BBLIND_VISIBLE,
VIA_THROUGH_VISIBLE,
MOD_TEXT_FR_VISIBLE,
MOD_TEXT_BK_VISIBLE,
MOD_TEXT_INVISIBLE, ///< text marked as invisible
ANCHOR_VISIBLE,
PAD_FR_VISIBLE,
PAD_BK_VISIBLE,
RATSNEST_VISIBLE,
GRID_VISIBLE,
// the rest of these do not currently support color changes:
NO_CONNECTS_VISIBLE, ///< show a marker on pads with no nets
MOD_FR_VISIBLE, ///< show modules on front
MOD_BK_VISIBLE, ///< show modules on back
MOD_VALUES_VISIBLE, ///< show modules values (when texts are visibles)
MOD_REFERENCES_VISIBLE, ///< show modules references (when texts are visibles)
END_VISIBLE // sentinel
};
/**
* Function IsValidLayerIndex
* tests whether a given integer is a valid layer index
* @param aLayerIndex = Layer index to test
* @return true if aLayerIndex is a valid layer index
*/
inline bool IsValidLayerIndex( int aLayerIndex )
{
return aLayerIndex >= 0 && aLayerIndex < NB_LAYERS;
}
/**
* Function IsValidCopperLayerIndex
* tests whether an integer is a valid copper layer index
* @param aLayerIndex = Layer index to test
* @return true if aLayerIndex is a valid copper layer index
*/
inline bool IsValidCopperLayerIndex( int aLayerIndex )
{
return aLayerIndex >= FIRST_COPPER_LAYER && aLayerIndex <= LAST_COPPER_LAYER;
}
/**
* Function IsValidNonCopperLayerIndex
* tests whether an integer is a valid non copper layer index
* @param aLayerIndex = Layer index to test
* @return true if aLayerIndex is a valid non copper layer index
*/
inline bool IsValidNonCopperLayerIndex( int aLayerIndex )
{
return aLayerIndex >= FIRST_NO_COPPER_LAYER
&& aLayerIndex <= LAST_NO_COPPER_LAYER;
}
// Values for m_DisplayViaMode member: // Values for m_DisplayViaMode member:
enum DisplayViaMode { enum DisplayViaMode {
VIA_HOLE_NOT_SHOW = 0, VIA_HOLE_NOT_SHOW = 0,
......
...@@ -808,7 +808,6 @@ public: ...@@ -808,7 +808,6 @@ public:
void GlobalRoute( wxDC* DC ); void GlobalRoute( wxDC* DC );
void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ); void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC );
void Ratsnest_On_Off( wxDC* DC );
void Clean_Pcb( wxDC* DC ); void Clean_Pcb( wxDC* DC );
void InstallFindFrame( const wxPoint& pos, wxDC* DC ); void InstallFindFrame( const wxPoint& pos, wxDC* DC );
......
...@@ -65,7 +65,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) ...@@ -65,7 +65,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
} }
/* Erase ratsnest if needed */ /* Erase ratsnest if needed */
if( g_Show_Ratsnest ) if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
DrawGeneralRatsnest( &dc ); DrawGeneralRatsnest( &dc );
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "zones.h" #include "zones.h"
#include "cell.h" #include "cell.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "protos.h" #include "protos.h"
...@@ -856,6 +857,10 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC ) ...@@ -856,6 +857,10 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
return -1; return -1;
cout = 0; cout = 0;
int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
if( AutoPlaceShowAll )
GRSetDrawMode( DC, GR_XOR );
for( unsigned ii = 0; ii < GetBoard()->m_LocalRatsnest.size(); ii++ ) for( unsigned ii = 0; ii < GetBoard()->m_LocalRatsnest.size(); ii++ )
{ {
RATSNEST_ITEM* pt_local_chevelu = &GetBoard()->m_LocalRatsnest[ii]; RATSNEST_ITEM* pt_local_chevelu = &GetBoard()->m_LocalRatsnest[ii];
...@@ -871,7 +876,7 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC ) ...@@ -871,7 +876,7 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
if( AutoPlaceShowAll ) if( AutoPlaceShowAll )
{ {
GRLine( &DrawPanel->m_ClipBox, DC, ox, oy, fx, fy, GRLine( &DrawPanel->m_ClipBox, DC, ox, oy, fx, fy,
0, g_DesignSettings.m_RatsnestColor | GR_XOR ); 0, color );
} }
/* Cost of the ratsnest. */ /* Cost of the ratsnest. */
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
/* This is an odd place for this, but cvpcb won't link if it is /* This is an odd place for this, but cvpcb won't link if it is
...@@ -435,20 +436,24 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE ) ...@@ -435,20 +436,24 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
{ {
int color = -1; int color = -1;
// @todo move these globals into the board.
switch( aPCB_VISIBLE ) switch( aPCB_VISIBLE )
{ {
case VIA_THROUGH_VISIBLE: color = m_BoardSettings->m_ViaColor[VIA_THROUGH]; break; case VIA_THROUGH_VISIBLE:
case VIA_MICROVIA_VISIBLE: color = m_BoardSettings->m_ViaColor[VIA_MICROVIA]; break; case VIA_MICROVIA_VISIBLE:
case VIA_BBLIND_VISIBLE: color = m_BoardSettings->m_ViaColor[VIA_BLIND_BURIED]; break; case VIA_BBLIND_VISIBLE:
case MOD_TEXT_FR_VISIBLE: color = g_ModuleTextCMPColor; break; case MOD_TEXT_FR_VISIBLE:
case MOD_TEXT_BK_VISIBLE: color = g_ModuleTextCUColor; break; case MOD_TEXT_BK_VISIBLE:
case MOD_TEXT_INVISIBLE: color = g_ModuleTextNOVColor; break; case MOD_TEXT_INVISIBLE:
case ANCHOR_VISIBLE: color = g_AnchorColor; break; case ANCHOR_VISIBLE:
case PAD_FR_VISIBLE: color = g_PadCMPColor; break; case PAD_FR_VISIBLE:
case PAD_BK_VISIBLE: color = g_PadCUColor; break; case PAD_BK_VISIBLE:
case RATSNEST_VISIBLE: color = m_BoardSettings->m_RatsnestColor; break; case RATSNEST_VISIBLE:
case GRID_VISIBLE: color = g_GridColor; break; color = g_ColorsSettings.GetItemColor( aPCB_VISIBLE );
break;
case GRID_VISIBLE:
color = g_GridColor;
break;
default: default:
wxLogDebug( wxT( "BOARD::GetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE ); wxLogDebug( wxT( "BOARD::GetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE );
} }
...@@ -459,20 +464,41 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE ) ...@@ -459,20 +464,41 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor ) void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor )
{ {
// @todo move these globals into the board.
switch( aPCB_VISIBLE ) switch( aPCB_VISIBLE )
{ {
case VIA_THROUGH_VISIBLE: m_BoardSettings->m_ViaColor[VIA_THROUGH] = aColor; break; case VIA_THROUGH_VISIBLE:
case VIA_MICROVIA_VISIBLE: m_BoardSettings->m_ViaColor[VIA_MICROVIA] = aColor; break; case VIA_MICROVIA_VISIBLE:
case VIA_BBLIND_VISIBLE: m_BoardSettings->m_ViaColor[VIA_BLIND_BURIED] = aColor; break; case VIA_BBLIND_VISIBLE:
case MOD_TEXT_FR_VISIBLE: g_ModuleTextCMPColor = aColor; break; case MOD_TEXT_FR_VISIBLE:
case MOD_TEXT_BK_VISIBLE: g_ModuleTextCUColor = aColor; break; case MOD_TEXT_BK_VISIBLE:
case MOD_TEXT_INVISIBLE: g_ModuleTextNOVColor = aColor; break; case MOD_TEXT_INVISIBLE:
case ANCHOR_VISIBLE: g_AnchorColor = aColor; break; case ANCHOR_VISIBLE:
case PAD_FR_VISIBLE: g_PadCMPColor = aColor; break; case PAD_FR_VISIBLE:
case PAD_BK_VISIBLE: g_PadCUColor = aColor; break; case PAD_BK_VISIBLE:
case RATSNEST_VISIBLE: m_BoardSettings->m_RatsnestColor = aColor; break; g_ColorsSettings.SetItemColor( aPCB_VISIBLE, aColor );
case GRID_VISIBLE: g_GridColor = aColor; break; break;
case RATSNEST_VISIBLE:
// we must clear or set the CH_VISIBLE flags to hide/show ratsnet
// because we have atool to show hide ratsnest relative to a pad or a module
// so the hide/show option is a per item selection
if( IsElementVisible(RATSNEST_VISIBLE) )
{
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
}
else
{
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
}
g_ColorsSettings.SetItemColor( aPCB_VISIBLE, aColor );
break;
case GRID_VISIBLE:
g_GridColor = aColor;
break;
default: default:
wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE ); wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE );
} }
...@@ -481,13 +507,13 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor ) ...@@ -481,13 +507,13 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor )
void BOARD::SetLayerColor( int aLayer, int aColor ) void BOARD::SetLayerColor( int aLayer, int aColor )
{ {
m_BoardSettings->SetLayerColor( aLayer, aColor ); g_ColorsSettings.SetLayerColor( aLayer, aColor );
} }
int BOARD::GetLayerColor( int aLayer ) int BOARD::GetLayerColor( int aLayer )
{ {
return m_BoardSettings->GetLayerColor( aLayer ); return g_ColorsSettings.GetLayerColor( aLayer );
} }
......
...@@ -14,27 +14,6 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -14,27 +14,6 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
// Default values for designing boards // Default values for designing boards
{ {
int ii;
static const int default_layer_color[32] =
{
GREEN, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, RED,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY,
MAGENTA, CYAN,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY
};
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first. m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust this. // SetCopperLayerCount() will adjust this.
SetVisibleAlls( ); // All layers and all elements visible at first. SetVisibleAlls( ); // All layers and all elements visible at first.
...@@ -61,17 +40,6 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -61,17 +40,6 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
// The final margin is the sum of these 2 values // The final margin is the sum of these 2 values
// Usually < 0 because the mask is smaller than pad // Usually < 0 because the mask is smaller than pad
/* Color options for screen display of the Printed Board: */
for( ii = 0; ii < 32; ii++ )
m_LayerColor[ii] = default_layer_color[ii];
// Layer colors (tracks and graphic items)
m_ViaColor[VIA_NOT_DEFINED] = DARKGRAY;
m_ViaColor[VIA_MICROVIA] = CYAN;
m_ViaColor[VIA_BLIND_BURIED] = BROWN;
m_ViaColor[VIA_THROUGH] = WHITE;
m_RatsnestColor = WHITE; // Ratsnest color
} }
...@@ -114,7 +82,7 @@ void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewStat ...@@ -114,7 +82,7 @@ void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewStat
void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState ) void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState )
{ {
if( aElementCategory < 0 || aElementCategory >= END_VISIBLE ) if( aElementCategory < 0 || aElementCategory >= END_PCB_VISIBLE_LIST )
return; return;
if( aNewState ) if( aNewState )
m_VisibleElements |= 1 << aElementCategory; m_VisibleElements |= 1 << aElementCategory;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "wxstruct.h" #include "wxstruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "colors_selection.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "protos.h" #include "protos.h"
...@@ -423,7 +424,7 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -423,7 +424,7 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) if( g_DesignSettings.IsLayerVisible( m_Layer ) == false )
return; return;
gcolor = g_DesignSettings.m_LayerColor[m_Layer]; gcolor = g_ColorsSettings.GetLayerColor(m_Layer);
GRSetDrawMode( DC, mode_color ); GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems; typeaff = DisplayOpt.DisplayDrawItems;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "colors_selection.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
...@@ -238,7 +239,7 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -238,7 +239,7 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( g_DesignSettings.IsLayerVisible( GetLayer() ) == false ) if( g_DesignSettings.IsLayerVisible( GetLayer() ) == false )
return; return;
color = g_DesignSettings.m_LayerColor[GetLayer()]; color = g_ColorsSettings.GetLayerColor(GetLayer());
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
l_piste = m_Width >> 1; /* half trace width */ l_piste = m_Width >> 1; /* half trace width */
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "colors_selection.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
...@@ -167,7 +168,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -167,7 +168,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) if( g_DesignSettings.IsLayerVisible( m_Layer ) == false )
return; return;
color = g_DesignSettings.m_LayerColor[m_Layer]; color = g_ColorsSettings.GetLayerColor(m_Layer);
frame = (WinEDA_BasePcbFrame*) panel->GetParent(); frame = (WinEDA_BasePcbFrame*) panel->GetParent();
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "trigo.h" #include "trigo.h"
#include "protos.h" #include "protos.h"
...@@ -109,7 +110,7 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -109,7 +110,7 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) if( g_DesignSettings.IsLayerVisible( m_Layer ) == false )
return; return;
gcolor = g_DesignSettings.m_LayerColor[m_Layer]; gcolor = g_ColorsSettings.GetLayerColor(m_Layer);
GRSetDrawMode( DC, mode_color ); GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems; typeaff = DisplayOpt.DisplayDrawItems;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "autorout.h" #include "autorout.h"
#include "drag.h" #include "drag.h"
...@@ -72,14 +73,15 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset ...@@ -72,14 +73,15 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
if( ((BOARD*)m_Parent)->IsElementVisible( ANCHOR_VISIBLE ) ) if( ((BOARD*)m_Parent)->IsElementVisible( ANCHOR_VISIBLE ) )
{ {
int color = g_ColorsSettings.GetItemColor(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,
m_Pos.x - offset.x + anchor_size, m_Pos.y - offset.y, m_Pos.x - offset.x + anchor_size, m_Pos.y - offset.y,
0, g_AnchorColor ); 0, color );
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
m_Pos.x - offset.x, m_Pos.y - offset.y - anchor_size, m_Pos.x - offset.x, m_Pos.y - offset.y - anchor_size,
m_Pos.x - offset.x, m_Pos.y - offset.y + anchor_size, m_Pos.x - offset.x, m_Pos.y - offset.y + anchor_size,
0, g_AnchorColor ); 0, color );
} }
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "kicad_string.h" #include "kicad_string.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
/*********************************************************/ /*********************************************************/
...@@ -193,6 +194,7 @@ void RATSNEST_ITEM::Draw( WinEDA_DrawPanel* panel, ...@@ -193,6 +194,7 @@ void RATSNEST_ITEM::Draw( WinEDA_DrawPanel* panel,
const wxPoint& aOffset ) const wxPoint& aOffset )
{ {
GRSetDrawMode( DC, aDrawMode ); GRSetDrawMode( DC, aDrawMode );
int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
GRLine( &panel->m_ClipBox, DC, m_PadStart->m_Pos - aOffset, GRLine( &panel->m_ClipBox, DC, m_PadStart->m_Pos - aOffset,
m_PadEnd->m_Pos - aOffset, 0, g_DesignSettings.m_RatsnestColor ); m_PadEnd->m_Pos - aOffset, 0, color );
} }
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
/** Draw a pad: /** Draw a pad:
...@@ -89,12 +90,12 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -89,12 +90,12 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
if( m_Masque_Layer & LAYER_FRONT ) if( m_Masque_Layer & LAYER_FRONT )
{ {
color = g_PadCMPColor; color = g_ColorsSettings.GetItemColor(PAD_FR_VISIBLE);
} }
if( m_Masque_Layer & LAYER_BACK ) if( m_Masque_Layer & LAYER_BACK )
{ {
color |= g_PadCUColor; color |= g_ColorsSettings.GetItemColor(PAD_BK_VISIBLE);
} }
if( color == 0 ) /* Not on copper layer */ if( color == 0 ) /* Not on copper layer */
...@@ -104,55 +105,55 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -104,55 +105,55 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
switch( m_Masque_Layer & ~ALL_CU_LAYERS ) switch( m_Masque_Layer & ~ALL_CU_LAYERS )
{ {
case ADHESIVE_LAYER_BACK: case ADHESIVE_LAYER_BACK:
color = g_DesignSettings.m_LayerColor[ADHESIVE_N_BACK]; color = g_ColorsSettings.GetLayerColor(ADHESIVE_N_BACK);
break; break;
case ADHESIVE_LAYER_FRONT: case ADHESIVE_LAYER_FRONT:
color = g_DesignSettings.m_LayerColor[ADHESIVE_N_FRONT]; color = g_ColorsSettings.GetLayerColor(ADHESIVE_N_FRONT);
break; break;
case SOLDERPASTE_LAYER_BACK: case SOLDERPASTE_LAYER_BACK:
color = g_DesignSettings.m_LayerColor[SOLDERPASTE_N_BACK]; color = g_ColorsSettings.GetLayerColor(SOLDERPASTE_N_BACK);
break; break;
case SOLDERPASTE_LAYER_FRONT: case SOLDERPASTE_LAYER_FRONT:
color = g_DesignSettings.m_LayerColor[SOLDERPASTE_N_FRONT]; color = g_ColorsSettings.GetLayerColor(SOLDERPASTE_N_FRONT);
break; break;
case SILKSCREEN_LAYER_BACK: case SILKSCREEN_LAYER_BACK:
color = g_DesignSettings.m_LayerColor[SILKSCREEN_N_BACK]; color = g_ColorsSettings.GetLayerColor(SILKSCREEN_N_BACK);
break; break;
case SILKSCREEN_LAYER_FRONT: case SILKSCREEN_LAYER_FRONT:
color = g_DesignSettings.m_LayerColor[SILKSCREEN_N_FRONT]; color = g_ColorsSettings.GetLayerColor(SILKSCREEN_N_FRONT);
break; break;
case SOLDERMASK_LAYER_BACK: case SOLDERMASK_LAYER_BACK:
color = g_DesignSettings.m_LayerColor[SOLDERMASK_N_BACK]; color = g_ColorsSettings.GetLayerColor(SOLDERMASK_N_BACK);
break; break;
case SOLDERMASK_LAYER_FRONT: case SOLDERMASK_LAYER_FRONT:
color = g_DesignSettings.m_LayerColor[SOLDERMASK_N_FRONT]; color = g_ColorsSettings.GetLayerColor(SOLDERMASK_N_FRONT);
break; break;
case DRAW_LAYER: case DRAW_LAYER:
color = g_DesignSettings.m_LayerColor[DRAW_N]; color = g_ColorsSettings.GetLayerColor(DRAW_N);
break; break;
case COMMENT_LAYER: case COMMENT_LAYER:
color = g_DesignSettings.m_LayerColor[COMMENT_N]; color = g_ColorsSettings.GetLayerColor(COMMENT_N);
break; break;
case ECO1_LAYER: case ECO1_LAYER:
color = g_DesignSettings.m_LayerColor[ECO1_N]; color = g_ColorsSettings.GetLayerColor(ECO1_N);
break; break;
case ECO2_LAYER: case ECO2_LAYER:
color = g_DesignSettings.m_LayerColor[ECO2_N]; color = g_ColorsSettings.GetLayerColor(ECO2_N);
break; break;
case EDGE_LAYER: case EDGE_LAYER:
color = g_DesignSettings.m_LayerColor[EDGE_N]; color = g_ColorsSettings.GetLayerColor(EDGE_N);
break; break;
default: default:
...@@ -217,7 +218,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -217,7 +218,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
{ {
if( IsOnLayer( screen->m_Active_Layer ) ) if( IsOnLayer( screen->m_Active_Layer ) )
{ {
color = g_DesignSettings.m_LayerColor[screen->m_Active_Layer]; color = g_ColorsSettings.GetLayerColor(screen->m_Active_Layer);
// In hight contrast mode, and if the active layer is the mask // In hight contrast mode, and if the active layer is the mask
// layer shows the pad size with the mask clearance // layer shows the pad size with the mask clearance
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "trigo.h" #include "trigo.h"
#include "protos.h" #include "protos.h"
...@@ -190,16 +191,18 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -190,16 +191,18 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) if( g_DesignSettings.IsLayerVisible( m_Layer ) == false )
return; return;
int color = g_DesignSettings.m_LayerColor[m_Layer]; int color = g_ColorsSettings.GetLayerColor(m_Layer);
GRTraceMode fillmode = FILLED; GRTraceMode fillmode = FILLED;
if ( DisplayOpt.DisplayDrawItems == SKETCH) if ( DisplayOpt.DisplayDrawItems == SKETCH)
fillmode = SKETCH; fillmode = SKETCH;
int anchor_color = UNSPECIFIED_COLOR;
if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) )
anchor_color = g_ColorsSettings.GetItemColor(ANCHOR_VISIBLE);
EDA_TextStruct::Draw( panel, DC, offset, (EDA_Colors) color, EDA_TextStruct::Draw( panel, DC, offset, (EDA_Colors) color,
DrawMode, fillmode, DrawMode, fillmode, (EDA_Colors) anchor_color );
g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) ?
(EDA_Colors) g_AnchorColor : UNSPECIFIED_COLOR );
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "kicad_string.h" #include "kicad_string.h"
#include "pcbcommon.h" #include "pcbcommon.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
/*******************************************************************/ /*******************************************************************/
/* Class TEXTE_MODULE base class type of text elements in a module */ /* Class TEXTE_MODULE base class type of text elements in a module */
...@@ -364,36 +365,37 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -364,36 +365,37 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) ) if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) )
{ {
color = g_ColorsSettings.GetItemColor(ANCHOR_VISIBLE);
int anchor_size = screen->Unscale( 2 ); int anchor_size = screen->Unscale( 2 );
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
pos.x - anchor_size, pos.y, pos.x - anchor_size, pos.y,
pos.x + anchor_size, pos.y, 0, g_AnchorColor ); pos.x + anchor_size, pos.y, 0, color );
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
pos.x, pos.y - anchor_size, pos.x, pos.y - anchor_size,
pos.x, pos.y + anchor_size, 0, g_AnchorColor ); pos.x, pos.y + anchor_size, 0, color );
} }
color = g_DesignSettings.m_LayerColor[Module->GetLayer()]; color = g_ColorsSettings.GetLayerColor(Module->GetLayer());
if( Module->GetLayer() == LAYER_N_BACK ) if( Module->GetLayer() == LAYER_N_BACK )
{ {
if( g_DesignSettings.IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false ) if( g_DesignSettings.IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false )
return; return;
color = g_ModuleTextCUColor; color = g_ColorsSettings.GetItemColor(MOD_TEXT_BK_VISIBLE);
} }
else if( Module->GetLayer() == LAYER_N_FRONT ) else if( Module->GetLayer() == LAYER_N_FRONT )
{ {
if( g_DesignSettings.IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false ) if( g_DesignSettings.IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false )
return; return;
color = g_ModuleTextCMPColor; color = g_ColorsSettings.GetItemColor(MOD_TEXT_FR_VISIBLE);
} }
if( m_NoShow ) if( m_NoShow )
{ {
if( g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ) == false ) if( g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ) == false )
return; return;
color = g_ModuleTextNOVColor; color = g_ColorsSettings.GetItemColor(MOD_TEXT_INVISIBLE);
} }
/* If the text is mirrored : negate size.x (mirror / Y axis) */ /* If the text is mirrored : negate size.x (mirror / Y axis) */
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "protos.h" #include "protos.h"
...@@ -557,7 +558,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -557,7 +558,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
} }
else else
{ {
color = g_DesignSettings.m_LayerColor[m_Layer]; color = g_ColorsSettings.GetLayerColor(m_Layer);
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) !=
HIGHT_LIGHT_FLAG ) HIGHT_LIGHT_FLAG )
...@@ -723,7 +724,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi ...@@ -723,7 +724,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
color = g_DesignSettings.m_ViaColor[m_Shape]; color = g_ColorsSettings.GetItemColor(VIAS_VISIBLE + m_Shape);
if( g_DesignSettings.IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + m_Shape) ) == false if( g_DesignSettings.IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + m_Shape) ) == false
&& ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "zones.h" #include "zones.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "protos.h" #include "protos.h"
...@@ -443,9 +444,10 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con ...@@ -443,9 +444,10 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
wxPoint seg_start, seg_end; wxPoint seg_start, seg_end;
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_ColorsSettings.GetLayerColor(m_Layer);
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) if( g_DesignSettings.IsLayerVisible( m_Layer ) == false &&
( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
return; return;
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
...@@ -531,7 +533,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -531,7 +533,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
return; return;
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_ColorsSettings.GetLayerColor(m_Layer);
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
return; return;
...@@ -685,7 +687,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -685,7 +687,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC,
if( DC == NULL ) if( DC == NULL )
return; return;
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 & 31] & MASKCOLOR; int color = g_ColorsSettings.GetLayerColor(m_Layer) & MASKCOLOR;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
{ {
......
...@@ -34,6 +34,8 @@ void Dialog_GeneralOptions::init() ...@@ -34,6 +34,8 @@ void Dialog_GeneralOptions::init()
{ {
SetFocus(); SetFocus();
m_Board = m_Parent->GetBoard();
/* Set display options */ /* Set display options */
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 ); m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
m_UnitsSelection->SetSelection( g_UnitMetric ? 1 : 0 ); m_UnitsSelection->SetSelection( g_UnitMetric ? 1 : 0 );
...@@ -58,7 +60,7 @@ void Dialog_GeneralOptions::init() ...@@ -58,7 +60,7 @@ void Dialog_GeneralOptions::init()
m_DrcOn->SetValue( Drc_On ); m_DrcOn->SetValue( Drc_On );
m_ShowModuleRatsnest->SetValue( g_Show_Module_Ratsnest ); m_ShowModuleRatsnest->SetValue( g_Show_Module_Ratsnest );
m_ShowGlobalRatsnest->SetValue( g_Show_Ratsnest ); m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible(RATSNEST_VISIBLE) );
m_TrackAutodel->SetValue( g_AutoDeleteOldTrack ); m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
m_Track_45_Only_Ctrl->SetValue( Track_45_Only ); m_Track_45_Only_Ctrl->SetValue( Track_45_Only );
m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
...@@ -94,10 +96,9 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) ...@@ -94,10 +96,9 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
/* Updating the combobox to display the active layer. */ /* Updating the combobox to display the active layer. */
g_MaxLinksShowed = m_MaxShowLinks->GetValue(); g_MaxLinksShowed = m_MaxShowLinks->GetValue();
Drc_On = m_DrcOn->GetValue(); Drc_On = m_DrcOn->GetValue();
if( g_Show_Ratsnest != m_ShowGlobalRatsnest->GetValue() ) if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() )
{ {
g_Show_Ratsnest = m_ShowGlobalRatsnest->GetValue(); m_Board->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() );
m_Parent->Ratsnest_On_Off( NULL );
m_Parent->DrawPanel->Refresh( ); m_Parent->DrawPanel->Refresh( );
} }
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue(); g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
...@@ -144,7 +145,7 @@ void WinEDA_ModuleEditFrame::InstallOptionsFrame( const wxPoint& pos ) ...@@ -144,7 +145,7 @@ void WinEDA_ModuleEditFrame::InstallOptionsFrame( const wxPoint& pos )
/* Must be called on a click on the left toolbar (options toolbar /* Must be called on a click on the left toolbar (options toolbar
* Update variables according to the tools states * Update variables according to tools states
*/ */
void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
...@@ -163,8 +164,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -163,8 +164,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_RATSNEST: case ID_TB_OPTIONS_SHOW_RATSNEST:
g_Show_Ratsnest = m_OptionsToolBar->GetToolState( id ); GetBoard()->SetElementVisibility(RATSNEST_VISIBLE, m_OptionsToolBar->GetToolState( id ));
Ratsnest_On_Off( NULL );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
......
...@@ -9,6 +9,7 @@ class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base ...@@ -9,6 +9,7 @@ class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base
{ {
private: private:
WinEDA_PcbFrame* m_Parent; WinEDA_PcbFrame* m_Parent;
BOARD * m_Board;
void init(); void init();
......
...@@ -14,40 +14,6 @@ ...@@ -14,40 +14,6 @@
#include "protos.h" #include "protos.h"
/* Displays or hides the ratsnest. */
void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
{
unsigned ii;
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
{
if( g_Show_Ratsnest )
Compile_Ratsnest( DC, TRUE );
return;
}
DrawGeneralRatsnest( DC, 0 );
if( GetBoard()->GetRatsnestsCount() == 0 )
return;
if( g_Show_Ratsnest )
{
for( ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
{
GetBoard()->m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
}
}
else
{
for( ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
{
GetBoard()->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
}
}
}
/* /*
* Exchange layer the track pointed to by the mouse: * Exchange layer the track pointed to by the mouse:
* The track must be on one layer of work, * The track must be on one layer of work,
...@@ -324,7 +290,7 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ) ...@@ -324,7 +290,7 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
D_PAD* pt_pad = NULL; D_PAD* pt_pad = NULL;
MODULE* Module = NULL; MODULE* Module = NULL;
if( g_Show_Ratsnest ) if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
return; return;
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 ) if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "drc_stuff.h" #include "drc_stuff.h"
#include "trigo.h" #include "trigo.h"
...@@ -705,7 +706,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, ...@@ -705,7 +706,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
{ {
int color = int color =
g_DesignSettings.m_LayerColor[g_CurrentTrackSegment->GetLayer()]; g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x, GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y, g_CurrentTrackSegment->m_End.y,
...@@ -775,7 +776,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, ...@@ -775,7 +776,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
{ {
int color = int color =
g_DesignSettings.m_LayerColor[g_CurrentTrackSegment->GetLayer()]; g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x, GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y, g_CurrentTrackSegment->m_End.y,
......
...@@ -104,7 +104,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC ) ...@@ -104,7 +104,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
/* Show ratsnest. */ /* Show ratsnest. */
if( g_Show_Ratsnest ) if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
if( g_DragSegmentList ) /* Should not occur ! */ if( g_DragSegmentList ) /* Should not occur ! */
...@@ -224,7 +224,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -224,7 +224,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
// Display ratsnest is allowed // Display ratsnest is allowed
pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST; pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST;
if( g_Show_Ratsnest ) if( pcbframe->GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
pcbframe->DrawGeneralRatsnest( DC ); pcbframe->DrawGeneralRatsnest( DC );
} }
...@@ -365,7 +365,7 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC ) ...@@ -365,7 +365,7 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
} }
/* Show ratsnest if necessary. */ /* Show ratsnest if necessary. */
if( DC && g_Show_Ratsnest ) if( DC && GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
g_Offset_Module.x = 0; g_Offset_Module.x = 0;
...@@ -518,7 +518,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module, ...@@ -518,7 +518,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
DrawPanel->PostDirtyRect( module->GetBoundingBox() ); DrawPanel->PostDirtyRect( module->GetBoundingBox() );
module->m_Flags = tmp; module->m_Flags = tmp;
if( g_Show_Ratsnest ) if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
} }
} }
......
...@@ -394,6 +394,7 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) ...@@ -394,6 +394,7 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
// Keys used in read/write config // Keys used in read/write config
#define PCB_SHOW_FULL_RATSNET_OPT wxT( "PcbFulRatsnest" )
#define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" ) #define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" )
#define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" ) #define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" )
#define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" ) #define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" )
...@@ -837,6 +838,9 @@ void WinEDA_PcbFrame::LoadSettings() ...@@ -837,6 +838,9 @@ void WinEDA_PcbFrame::LoadSettings()
WinEDA_BasePcbFrame::LoadSettings(); WinEDA_BasePcbFrame::LoadSettings();
long tmp;
config->Read( PCB_SHOW_FULL_RATSNET_OPT, &tmp );
GetBoard()->SetElementVisibility(RATSNEST_VISIBLE, tmp);
config->Read( PCB_MAGNETIC_PADS_OPT, &g_MagneticPadOption ); config->Read( PCB_MAGNETIC_PADS_OPT, &g_MagneticPadOption );
config->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption ); config->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption );
config->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools ); config->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools );
...@@ -855,6 +859,8 @@ void WinEDA_PcbFrame::SaveSettings() ...@@ -855,6 +859,8 @@ void WinEDA_PcbFrame::SaveSettings()
wxRealPoint GridSize = GetScreen()->GetGridSize(); wxRealPoint GridSize = GetScreen()->GetGridSize();
long tmp = GetBoard()->IsElementVisible(RATSNEST_VISIBLE);
config->Write( PCB_SHOW_FULL_RATSNET_OPT, tmp );
config->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption ); config->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption );
config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption ); config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption );
config->Write( SHOW_MICROWAVE_TOOLS, config->Write( SHOW_MICROWAVE_TOOLS,
......
...@@ -21,17 +21,21 @@ ...@@ -21,17 +21,21 @@
#include "zones.h" #include "zones.h"
#include "drag.h" #include "drag.h"
#include "eda_dde.h" #include "eda_dde.h"
#include "colors_selection.h"
#include "id.h" #include "id.h"
#include "build_version.h" #include "build_version.h"
#include "protos.h" #include "protos.h"
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
bool Drc_On = true; bool Drc_On = true;
bool g_AutoDeleteOldTrack = true; bool g_AutoDeleteOldTrack = true;
bool g_No_Via_Route; bool g_No_Via_Route;
bool g_Drag_Pistes_On; bool g_Drag_Pistes_On;
bool g_Show_Ratsnest;
bool g_Show_Module_Ratsnest; bool g_Show_Module_Ratsnest;
bool g_Show_Pads_Module_in_Move = true; bool g_Show_Pads_Module_in_Move = true;
bool g_Raccord_45_Auto = true; bool g_Raccord_45_Auto = true;
......
...@@ -49,13 +49,11 @@ ...@@ -49,13 +49,11 @@
#define APPEND_PCB 1 /* used to append the new board to the existing board */ #define APPEND_PCB 1 /* used to append the new board to the existing board */
#define NEWPCB 0 /* used for normal load file */ #define NEWPCB 0 /* used for normal load file */
/* variables */ /* variables */
extern bool Drc_On; extern bool Drc_On;
extern bool g_AutoDeleteOldTrack; extern bool g_AutoDeleteOldTrack;
extern bool g_No_Via_Route; extern bool g_No_Via_Route;
extern bool g_Drag_Pistes_On; extern bool g_Drag_Pistes_On;
extern bool g_Show_Ratsnest;
extern bool g_Show_Module_Ratsnest; extern bool g_Show_Module_Ratsnest;
extern bool g_Show_Pads_Module_in_Move; extern bool g_Show_Pads_Module_in_Move;
extern bool g_Raccord_45_Auto; extern bool g_Raccord_45_Auto;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "pcbnew_config.h"
#include "worksheet.h" #include "worksheet.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
#include "hotkeys.h" #include "hotkeys.h"
...@@ -21,6 +20,7 @@ ...@@ -21,6 +20,7 @@
#include "dialog_mask_clearance.h" #include "dialog_mask_clearance.h"
#include "dialog_general_options.h" #include "dialog_general_options.h"
#include "pcbnew_config.h"
#define HOTKEY_FILENAME wxT( "pcbnew" ) #define HOTKEY_FILENAME wxT( "pcbnew" )
...@@ -193,7 +193,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName ) ...@@ -193,7 +193,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
* 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...
*/ */
g_DesignSettings.SetVisibleAlls( ); GetBoard()->m_BoardSettings->SetVisibleAlls( );
DisplayOpt.DisplayPadNoConn = true; DisplayOpt.DisplayPadNoConn = true;
return TRUE; return TRUE;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/*****************************************************/ /*****************************************************/
#include "param_config.h" #include "param_config.h"
#include "colors_selection.h"
#define GROUP wxT( "/pcbnew" ) #define GROUP wxT( "/pcbnew" )
#define GROUPLIB wxT( "/pcbnew/libraries" ) #define GROUPLIB wxT( "/pcbnew/libraries" )
...@@ -15,6 +16,9 @@ ...@@ -15,6 +16,9 @@
// project, in .pro file) // project, in .pro file)
#define INSETUP TRUE #define INSETUP TRUE
/* Useful macro : */
#define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer]
#define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible]
/* Configuration parameters. */ /* Configuration parameters. */
...@@ -226,7 +230,7 @@ static PARAM_CFG_SETCOLOR ColorLayer0Cfg // CU Layer Color ...@@ -226,7 +230,7 @@ static PARAM_CFG_SETCOLOR ColorLayer0Cfg // CU Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLay0" ), wxT( "ColLay0" ),
&g_DesignSettings.m_LayerColor[0], LOC_COLOR(0),
GREEN GREEN
); );
...@@ -234,7 +238,7 @@ static PARAM_CFG_SETCOLOR ColorLayer1Cfg ...@@ -234,7 +238,7 @@ static PARAM_CFG_SETCOLOR ColorLayer1Cfg
( (
INSETUP, INSETUP,
wxT( "ColLay1" ), wxT( "ColLay1" ),
&g_DesignSettings.m_LayerColor[1], LOC_COLOR(1),
BLUE BLUE
); );
...@@ -242,7 +246,7 @@ static PARAM_CFG_SETCOLOR ColorLayer2Cfg ...@@ -242,7 +246,7 @@ static PARAM_CFG_SETCOLOR ColorLayer2Cfg
( (
INSETUP, INSETUP,
wxT( "ColLay2" ), wxT( "ColLay2" ),
&g_DesignSettings.m_LayerColor[2], LOC_COLOR(2),
LIGHTGRAY LIGHTGRAY
); );
...@@ -250,7 +254,7 @@ static PARAM_CFG_SETCOLOR ColorLayer3Cfg ...@@ -250,7 +254,7 @@ static PARAM_CFG_SETCOLOR ColorLayer3Cfg
( (
INSETUP, INSETUP,
wxT( "ColLay3" ), wxT( "ColLay3" ),
&g_DesignSettings.m_LayerColor[3], LOC_COLOR(3),
5 5
); );
...@@ -258,7 +262,7 @@ static PARAM_CFG_SETCOLOR ColorLayer4Cfg ...@@ -258,7 +262,7 @@ static PARAM_CFG_SETCOLOR ColorLayer4Cfg
( (
INSETUP, INSETUP,
wxT( "ColLay4" ), wxT( "ColLay4" ),
&g_DesignSettings.m_LayerColor[4], LOC_COLOR(4),
4 4
); );
...@@ -266,7 +270,7 @@ static PARAM_CFG_SETCOLOR ColorLayer5Cfg ...@@ -266,7 +270,7 @@ static PARAM_CFG_SETCOLOR ColorLayer5Cfg
( (
INSETUP, INSETUP,
wxT( "ColLay5" ), wxT( "ColLay5" ),
&g_DesignSettings.m_LayerColor[5], LOC_COLOR(5),
5 5
); );
...@@ -274,7 +278,7 @@ static PARAM_CFG_SETCOLOR ColorLayer6Cfg ...@@ -274,7 +278,7 @@ static PARAM_CFG_SETCOLOR ColorLayer6Cfg
( (
INSETUP, INSETUP,
wxT( "ColLay6" ), wxT( "ColLay6" ),
&g_DesignSettings.m_LayerColor[6], LOC_COLOR(6),
6 6
); );
...@@ -282,7 +286,7 @@ static PARAM_CFG_SETCOLOR ColorLayer7Cfg ...@@ -282,7 +286,7 @@ static PARAM_CFG_SETCOLOR ColorLayer7Cfg
( (
INSETUP, INSETUP,
wxT( "ColLay7" ), wxT( "ColLay7" ),
&g_DesignSettings.m_LayerColor[7], LOC_COLOR(7),
5 5
); );
...@@ -290,7 +294,7 @@ static PARAM_CFG_SETCOLOR ColorLayer8Cfg ...@@ -290,7 +294,7 @@ static PARAM_CFG_SETCOLOR ColorLayer8Cfg
( (
INSETUP, INSETUP,
wxT( "ColLay8" ), wxT( "ColLay8" ),
&g_DesignSettings.m_LayerColor[8], LOC_COLOR(8),
7 7
); );
...@@ -298,7 +302,7 @@ static PARAM_CFG_SETCOLOR ColorLayer9Cfg ...@@ -298,7 +302,7 @@ static PARAM_CFG_SETCOLOR ColorLayer9Cfg
( (
INSETUP, INSETUP,
wxT( "ColLay9" ), wxT( "ColLay9" ),
&g_DesignSettings.m_LayerColor[9], LOC_COLOR(9),
1 1
); );
...@@ -306,7 +310,7 @@ static PARAM_CFG_SETCOLOR ColorLayer10Cfg ...@@ -306,7 +310,7 @@ static PARAM_CFG_SETCOLOR ColorLayer10Cfg
( (
INSETUP, INSETUP,
wxT( "ColLayA" ), wxT( "ColLayA" ),
&g_DesignSettings.m_LayerColor[10], LOC_COLOR(10),
2 2
); );
...@@ -314,7 +318,7 @@ static PARAM_CFG_SETCOLOR ColorLayer11Cfg ...@@ -314,7 +318,7 @@ static PARAM_CFG_SETCOLOR ColorLayer11Cfg
( (
INSETUP, INSETUP,
wxT( "ColLayB" ), wxT( "ColLayB" ),
&g_DesignSettings.m_LayerColor[11], LOC_COLOR(11),
3 3
); );
...@@ -322,7 +326,7 @@ static PARAM_CFG_SETCOLOR ColorLayer12Cfg ...@@ -322,7 +326,7 @@ static PARAM_CFG_SETCOLOR ColorLayer12Cfg
( (
INSETUP, INSETUP,
wxT( "ColLayC" ), wxT( "ColLayC" ),
&g_DesignSettings.m_LayerColor[12], LOC_COLOR(12),
12 12
); );
...@@ -330,7 +334,7 @@ static PARAM_CFG_SETCOLOR ColorLayer13Cfg ...@@ -330,7 +334,7 @@ static PARAM_CFG_SETCOLOR ColorLayer13Cfg
( (
INSETUP, INSETUP,
wxT( "ColLayD" ), wxT( "ColLayD" ),
&g_DesignSettings.m_LayerColor[13], LOC_COLOR(13),
13 13
); );
...@@ -338,7 +342,7 @@ static PARAM_CFG_SETCOLOR ColorLayer14Cfg ...@@ -338,7 +342,7 @@ static PARAM_CFG_SETCOLOR ColorLayer14Cfg
( (
INSETUP, INSETUP,
wxT( "ColLayE" ), wxT( "ColLayE" ),
&g_DesignSettings.m_LayerColor[14], LOC_COLOR(14),
14 14
); );
...@@ -346,7 +350,7 @@ static PARAM_CFG_SETCOLOR ColorLayer15Cfg // CMP Layer Color ...@@ -346,7 +350,7 @@ static PARAM_CFG_SETCOLOR ColorLayer15Cfg // CMP Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayF" ), wxT( "ColLayF" ),
&g_DesignSettings.m_LayerColor[15], LOC_COLOR(15),
RED RED
); );
...@@ -354,7 +358,7 @@ static PARAM_CFG_SETCOLOR ColorLayer16Cfg // Adhesive CU Layer Color ...@@ -354,7 +358,7 @@ static PARAM_CFG_SETCOLOR ColorLayer16Cfg // Adhesive CU Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayG" ), wxT( "ColLayG" ),
&g_DesignSettings.m_LayerColor[16], LOC_COLOR(16),
1 1
); );
...@@ -362,7 +366,7 @@ static PARAM_CFG_SETCOLOR ColorLayer17Cfg // Adhesive CMP Layer Color ...@@ -362,7 +366,7 @@ static PARAM_CFG_SETCOLOR ColorLayer17Cfg // Adhesive CMP Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayH" ), wxT( "ColLayH" ),
&g_DesignSettings.m_LayerColor[17], LOC_COLOR(17),
5 5
); );
...@@ -370,7 +374,7 @@ static PARAM_CFG_SETCOLOR ColorLayer18Cfg // Solder Mask CU Layer Color ...@@ -370,7 +374,7 @@ static PARAM_CFG_SETCOLOR ColorLayer18Cfg // Solder Mask CU Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayI" ), wxT( "ColLayI" ),
&g_DesignSettings.m_LayerColor[18], LOC_COLOR(18),
11 11
); );
...@@ -378,7 +382,7 @@ static PARAM_CFG_SETCOLOR ColorLayer19Cfg // Solder Mask CMP Layer Color ...@@ -378,7 +382,7 @@ static PARAM_CFG_SETCOLOR ColorLayer19Cfg // Solder Mask CMP Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayJ" ), wxT( "ColLayJ" ),
&g_DesignSettings.m_LayerColor[19], LOC_COLOR(19),
4 4
); );
...@@ -386,7 +390,7 @@ static PARAM_CFG_SETCOLOR ColorLayer20Cfg // Silk Screen CU Layer Color ...@@ -386,7 +390,7 @@ static PARAM_CFG_SETCOLOR ColorLayer20Cfg // Silk Screen CU Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayK" ), wxT( "ColLayK" ),
&g_DesignSettings.m_LayerColor[20], LOC_COLOR(20),
5 5
); );
...@@ -394,7 +398,7 @@ static PARAM_CFG_SETCOLOR ColorLayer21Cfg // Silk Screen CMP Layer Color ...@@ -394,7 +398,7 @@ static PARAM_CFG_SETCOLOR ColorLayer21Cfg // Silk Screen CMP Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayL" ), wxT( "ColLayL" ),
&g_DesignSettings.m_LayerColor[21], LOC_COLOR(21),
3 3
); );
...@@ -402,7 +406,7 @@ static PARAM_CFG_SETCOLOR ColorLayer22Cfg // Mask CU Layer Color ...@@ -402,7 +406,7 @@ static PARAM_CFG_SETCOLOR ColorLayer22Cfg // Mask CU Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayM" ), wxT( "ColLayM" ),
&g_DesignSettings.m_LayerColor[22], LOC_COLOR(22),
6 6
); );
...@@ -410,7 +414,7 @@ static PARAM_CFG_SETCOLOR ColorLayer23Cfg // Mask CMP Layer Color ...@@ -410,7 +414,7 @@ static PARAM_CFG_SETCOLOR ColorLayer23Cfg // Mask CMP Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayN" ), wxT( "ColLayN" ),
&g_DesignSettings.m_LayerColor[23], LOC_COLOR(23),
5 5
); );
...@@ -418,7 +422,7 @@ static PARAM_CFG_SETCOLOR ColorLayer24Cfg // DRAW Layer Color ...@@ -418,7 +422,7 @@ static PARAM_CFG_SETCOLOR ColorLayer24Cfg // DRAW Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayO" ), wxT( "ColLayO" ),
&g_DesignSettings.m_LayerColor[24], LOC_COLOR(24),
LIGHTGRAY LIGHTGRAY
); );
...@@ -426,7 +430,7 @@ static PARAM_CFG_SETCOLOR ColorLayer25Cfg // Comment Layer Color ...@@ -426,7 +430,7 @@ static PARAM_CFG_SETCOLOR ColorLayer25Cfg // Comment Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayP" ), wxT( "ColLayP" ),
&g_DesignSettings.m_LayerColor[25], LOC_COLOR(25),
1 1
); );
...@@ -434,7 +438,7 @@ static PARAM_CFG_SETCOLOR ColorLayer26Cfg // ECO1 Layer Color ...@@ -434,7 +438,7 @@ static PARAM_CFG_SETCOLOR ColorLayer26Cfg // ECO1 Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayQ" ), wxT( "ColLayQ" ),
&g_DesignSettings.m_LayerColor[26], LOC_COLOR(26),
2 2
); );
...@@ -442,7 +446,7 @@ static PARAM_CFG_SETCOLOR ColorLayer27Cfg //ECO2 Layer Color ...@@ -442,7 +446,7 @@ static PARAM_CFG_SETCOLOR ColorLayer27Cfg //ECO2 Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayR" ), wxT( "ColLayR" ),
&g_DesignSettings.m_LayerColor[27], LOC_COLOR(27),
14 14
); );
...@@ -450,7 +454,7 @@ static PARAM_CFG_SETCOLOR ColorLayer28Cfg // EDGES Layer Color ...@@ -450,7 +454,7 @@ static PARAM_CFG_SETCOLOR ColorLayer28Cfg // EDGES Layer Color
( (
INSETUP, INSETUP,
wxT( "ColLayS" ), wxT( "ColLayS" ),
&g_DesignSettings.m_LayerColor[28], LOC_COLOR(28),
YELLOW YELLOW
); );
...@@ -458,7 +462,7 @@ static PARAM_CFG_SETCOLOR ColorLayer29Cfg ...@@ -458,7 +462,7 @@ static PARAM_CFG_SETCOLOR ColorLayer29Cfg
( (
INSETUP, INSETUP,
wxT( "ColLayT" ), wxT( "ColLayT" ),
&g_DesignSettings.m_LayerColor[29], LOC_COLOR(29),
13 13
); );
...@@ -466,7 +470,7 @@ static PARAM_CFG_SETCOLOR ColorLayer30Cfg ...@@ -466,7 +470,7 @@ static PARAM_CFG_SETCOLOR ColorLayer30Cfg
( (
INSETUP, INSETUP,
wxT( "ColLayU" ), wxT( "ColLayU" ),
&g_DesignSettings.m_LayerColor[30], LOC_COLOR(30),
14 14
); );
...@@ -474,7 +478,7 @@ static PARAM_CFG_SETCOLOR ColorLayer31Cfg ...@@ -474,7 +478,7 @@ static PARAM_CFG_SETCOLOR ColorLayer31Cfg
( (
INSETUP, INSETUP,
wxT( "ColLayV" ), wxT( "ColLayV" ),
&g_DesignSettings.m_LayerColor[31], LOC_COLOR(31),
7 7
); );
...@@ -482,7 +486,7 @@ static PARAM_CFG_SETCOLOR ColorTxtModCmpCfg ...@@ -482,7 +486,7 @@ static PARAM_CFG_SETCOLOR ColorTxtModCmpCfg
( (
INSETUP, INSETUP,
wxT( "CTxtMoC" ), wxT( "CTxtMoC" ),
&g_ModuleTextCMPColor, ITEM_COLOR(MOD_TEXT_FR_VISIBLE),
LIGHTGRAY LIGHTGRAY
); );
...@@ -490,15 +494,15 @@ static PARAM_CFG_SETCOLOR ColorTxtModCuCfg ...@@ -490,15 +494,15 @@ static PARAM_CFG_SETCOLOR ColorTxtModCuCfg
( (
INSETUP, INSETUP,
wxT( "CTxtMoS" ), wxT( "CTxtMoS" ),
&g_ModuleTextCUColor, ITEM_COLOR(MOD_TEXT_BK_VISIBLE),
1 BLUE
); );
static PARAM_CFG_SETCOLOR VisibleTxtModCfg static PARAM_CFG_SETCOLOR VisibleTxtModCfg
( (
INSETUP, INSETUP,
wxT( "CTxtVis" ), wxT( "CTxtVis" ),
&g_ModuleTextNOVColor, ITEM_COLOR(MOD_TEXT_INVISIBLE),
DARKGRAY DARKGRAY
); );
...@@ -530,7 +534,7 @@ static PARAM_CFG_SETCOLOR ColorAncreModCfg ...@@ -530,7 +534,7 @@ static PARAM_CFG_SETCOLOR ColorAncreModCfg
( (
INSETUP, INSETUP,
wxT( "CAncreM" ), wxT( "CAncreM" ),
&g_AnchorColor, ITEM_COLOR(ANCHOR_VISIBLE),
BLUE BLUE
); );
...@@ -538,7 +542,7 @@ static PARAM_CFG_SETCOLOR ColorPadCuCfg ...@@ -538,7 +542,7 @@ static PARAM_CFG_SETCOLOR ColorPadCuCfg
( (
INSETUP, INSETUP,
wxT( "CoPadCu" ), wxT( "CoPadCu" ),
&g_PadCUColor, ITEM_COLOR(PAD_BK_VISIBLE),
GREEN GREEN
); );
...@@ -546,7 +550,7 @@ static PARAM_CFG_SETCOLOR ColorPadCmpCfg ...@@ -546,7 +550,7 @@ static PARAM_CFG_SETCOLOR ColorPadCmpCfg
( (
INSETUP, INSETUP,
wxT( "CoPadCm" ), wxT( "CoPadCm" ),
&g_PadCMPColor, ITEM_COLOR(PAD_FR_VISIBLE),
RED RED
); );
...@@ -554,7 +558,7 @@ static PARAM_CFG_SETCOLOR ColorViaThroughCfg ...@@ -554,7 +558,7 @@ static PARAM_CFG_SETCOLOR ColorViaThroughCfg
( (
INSETUP, INSETUP,
wxT( "CoViaTh" ), wxT( "CoViaTh" ),
&g_DesignSettings.m_ViaColor[VIA_THROUGH], ITEM_COLOR(VIA_THROUGH_VISIBLE),
LIGHTGRAY LIGHTGRAY
); );
...@@ -562,7 +566,7 @@ static PARAM_CFG_SETCOLOR ColorViaBlindBuriedCfg ...@@ -562,7 +566,7 @@ static PARAM_CFG_SETCOLOR ColorViaBlindBuriedCfg
( (
INSETUP, INSETUP,
wxT( "CoViaBu" ), wxT( "CoViaBu" ),
&g_DesignSettings.m_ViaColor[VIA_BLIND_BURIED], ITEM_COLOR(VIA_BBLIND_VISIBLE),
BROWN BROWN
); );
...@@ -570,7 +574,7 @@ static PARAM_CFG_SETCOLOR ColorViaMicroViaCfg // Buried Via Color ...@@ -570,7 +574,7 @@ static PARAM_CFG_SETCOLOR ColorViaMicroViaCfg // Buried Via Color
( (
INSETUP, INSETUP,
wxT( "CoViaMi" ), wxT( "CoViaMi" ),
&g_DesignSettings.m_ViaColor[VIA_MICROVIA], ITEM_COLOR(VIA_MICROVIA_VISIBLE),
CYAN CYAN
); );
...@@ -586,7 +590,7 @@ static PARAM_CFG_SETCOLOR ColorCheveluCfg ...@@ -586,7 +590,7 @@ static PARAM_CFG_SETCOLOR ColorCheveluCfg
( (
INSETUP, INSETUP,
wxT( "CoRatsN" ), wxT( "CoRatsN" ),
&g_DesignSettings.m_RatsnestColor, ITEM_COLOR(RATSNEST_VISIBLE),
WHITE WHITE
); );
...@@ -700,14 +704,6 @@ static PARAM_CFG_INT PrmMaxLinksShowed ...@@ -700,14 +704,6 @@ static PARAM_CFG_INT PrmMaxLinksShowed
0, 15 0, 15
); );
static PARAM_CFG_BOOL ShowRatsnestCfg
(
INSETUP,
wxT( "ShowRat" ),
&g_Show_Ratsnest,
FALSE
);
static PARAM_CFG_BOOL ShowModuleRatsnestCfg static PARAM_CFG_BOOL ShowModuleRatsnestCfg
( (
INSETUP, INSETUP,
...@@ -813,7 +809,6 @@ PARAM_CFG_BASE* ParamCfgList[] = ...@@ -813,7 +809,6 @@ PARAM_CFG_BASE* ParamCfgList[] =
&TimeOutCfg, &TimeOutCfg,
&DisplPolairCfg, &DisplPolairCfg,
&PrmMaxLinksShowed, &PrmMaxLinksShowed,
&ShowRatsnestCfg,
&ShowModuleRatsnestCfg, &ShowModuleRatsnestCfg,
&TwoSegmentTrackBuildCfg, &TwoSegmentTrackBuildCfg,
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "printout_controler.h" #include "printout_controler.h"
#include "colors_selection.h"
#include "protos.h" #include "protos.h"
...@@ -111,7 +112,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, ...@@ -111,7 +112,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */ if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
{ {
int rayon = pt_piste->m_Width >> 1; int rayon = pt_piste->m_Width >> 1;
int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape]; int color = g_ColorsSettings.GetItemColor(VIAS_VISIBLE+pt_piste->m_Shape);
GRSetDrawMode( aDC, drawmode ); GRSetDrawMode( aDC, drawmode );
GRFilledCircle( &m_ClipBox, aDC, GRFilledCircle( &m_ClipBox, aDC,
pt_piste->m_Start.x, pt_piste->m_Start.x,
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "autorout.h" #include "autorout.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "protos.h" #include "protos.h"
...@@ -157,7 +158,7 @@ void WinEDA_BasePcbFrame::Compile_Ratsnest( wxDC* DC, bool display_status_pcb ) ...@@ -157,7 +158,7 @@ void WinEDA_BasePcbFrame::Compile_Ratsnest( wxDC* DC, bool display_status_pcb )
Tst_Ratsnest( DC, 0 ); Tst_Ratsnest( DC, 0 );
// Redraw the active ratsnest ( if enabled ) // Redraw the active ratsnest ( if enabled )
if( g_Show_Ratsnest && DC ) if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) && DC )
DrawGeneralRatsnest( DC, 0 ); DrawGeneralRatsnest( DC, 0 );
if( display_status_pcb ) if( display_status_pcb )
...@@ -505,7 +506,7 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC ) ...@@ -505,7 +506,7 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
// erase the ratsnest displayed on screen if needed // erase the ratsnest displayed on screen if needed
for( unsigned ii = 0; ii < m_Pcb->GetRatsnestsCount(); ii++ ) for( unsigned ii = 0; ii < m_Pcb->GetRatsnestsCount(); ii++ )
{ {
if( !g_Show_Ratsnest ) // Clear VISIBLE flag if( !GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) // Clear VISIBLE flag
m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE; m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
if( DC ) if( DC )
...@@ -1002,18 +1003,18 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC ) ...@@ -1002,18 +1003,18 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
if( ( m_Pcb->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK ) == 0 ) if( ( m_Pcb->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK ) == 0 )
return; return;
int tmpcolor = g_DesignSettings.m_RatsnestColor; int tmpcolor = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
for( unsigned ii = 0; ii < m_Pcb->m_LocalRatsnest.size(); ii++ ) for( unsigned ii = 0; ii < m_Pcb->m_LocalRatsnest.size(); ii++ )
{ {
RATSNEST_ITEM* rats = &m_Pcb->m_LocalRatsnest[ii]; RATSNEST_ITEM* rats = &m_Pcb->m_LocalRatsnest[ii];
if( rats->m_Status & LOCAL_RATSNEST_ITEM ) if( rats->m_Status & LOCAL_RATSNEST_ITEM )
{ {
g_DesignSettings.m_RatsnestColor = YELLOW; g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, YELLOW);
rats->Draw( DrawPanel, DC, GR_XOR, g_Offset_Module ); rats->Draw( DrawPanel, DC, GR_XOR, g_Offset_Module );
} }
else else
{ {
g_DesignSettings.m_RatsnestColor = tmpcolor; g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, tmpcolor);
wxPoint tmp = rats->m_PadStart->m_Pos; wxPoint tmp = rats->m_PadStart->m_Pos;
rats->m_PadStart->m_Pos -= g_Offset_Module; rats->m_PadStart->m_Pos -= g_Offset_Module;
rats->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) ); rats->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
...@@ -1021,7 +1022,7 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC ) ...@@ -1021,7 +1022,7 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
} }
} }
g_DesignSettings.m_RatsnestColor = tmpcolor; g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, tmpcolor);
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h"
#include "bitmaps.h" #include "bitmaps.h"
...@@ -68,25 +69,25 @@ void WinEDA_PcbFrame::PrepareLayerIndicator() ...@@ -68,25 +69,25 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
previous_Route_Layer_BOTTOM_color, previous_via_color; previous_Route_Layer_BOTTOM_color, previous_via_color;
/* get colors, and redraw bitmap button only on changes */ /* get colors, and redraw bitmap button only on changes */
active_layer_color = g_DesignSettings.m_LayerColor[ getActiveLayer() ]; active_layer_color = g_ColorsSettings.GetLayerColor(getActiveLayer());
if( previous_active_layer_color != active_layer_color ) if( previous_active_layer_color != active_layer_color )
{ {
previous_active_layer_color = active_layer_color; previous_active_layer_color = active_layer_color;
change = true; change = true;
} }
Route_Layer_TOP_color = g_DesignSettings.m_LayerColor[((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP]; Route_Layer_TOP_color = g_ColorsSettings.GetLayerColor(((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP);
if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color ) if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color )
{ {
previous_Route_Layer_TOP_color = Route_Layer_TOP_color; previous_Route_Layer_TOP_color = Route_Layer_TOP_color;
change = true; change = true;
} }
Route_Layer_BOTTOM_color = g_DesignSettings.m_LayerColor[((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM]; Route_Layer_BOTTOM_color = g_ColorsSettings.GetLayerColor(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM);
if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color ) if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color )
{ {
previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color; previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color;
change = true; change = true;
} }
via_color = g_DesignSettings.m_ViaColor[g_DesignSettings.m_CurrentViaType ]; via_color = g_ColorsSettings.GetItemColor(VIAS_VISIBLE+g_DesignSettings.m_CurrentViaType);
if( previous_via_color != via_color ) if( previous_via_color != via_color )
{ {
previous_via_color = via_color; previous_via_color = via_color;
......
...@@ -214,9 +214,9 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -214,9 +214,9 @@ void WinEDA_PcbFrame::SetToolbars()
m_CursorShape ); m_CursorShape );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest ); GetBoard()->IsElementVisible(RATSNEST_VISIBLE) );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest ? GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ?
_( "Hide board ratsnest" ) : _( "Hide board ratsnest" ) :
_( "Show board ratsnest" ) ); _( "Show board ratsnest" ) );
......
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