From 5732d815c614c793708559e1af02b735ff8433fc Mon Sep 17 00:00:00 2001 From: charras Date: Fri, 29 Jan 2010 20:36:12 +0000 Subject: [PATCH] Work on colors handling, and others changes. see changelog. hide/show rastnest in pcbnew is currently not working, will be fixed soon --- 3d-viewer/3d_draw.cpp | 23 +-- CHANGELOG.txt | 31 +++ common/CMakeLists.txt | 1 + common/common.cpp | 13 +- common/edaappl.cpp | 16 ++ common/pcbcommon.cpp | 1 - cvpcb/cvpcb.cpp | 3 + eeschema/class_sch_screen.cpp | 25 ++- eeschema/dialog_eeschema_options_base.cpp | 6 +- ...s.fbp => dialog_eeschema_options_base.fbp} | 16 +- eeschema/dialog_eeschema_options_base.h | 164 ++++++++-------- gerbview/gerbview.cpp | 5 +- gerbview/gerbview.h | 11 +- gerbview/gerbview_config.h | 70 +++---- gerbview/set_color.cpp | 6 +- gerbview/set_color.h | 75 ++++---- gerbview/tracepcb.cpp | 11 +- include/class_board_design_settings.h | 40 ---- include/class_colors_design_settings.h | 58 ++++++ include/layers_id_colors_and_visibility.h | 182 ++++++++++++++++++ include/pcbcommon.h | 6 - include/pcbstruct.h | 176 +---------------- include/wxPcbStruct.h | 1 - pcbnew/automove.cpp | 2 +- pcbnew/autoplac.cpp | 7 +- pcbnew/class_board.cpp | 78 +++++--- pcbnew/class_board_design_settings.cpp | 34 +--- pcbnew/class_dimension.cpp | 3 +- pcbnew/class_drawsegment.cpp | 3 +- pcbnew/class_edge_mod.cpp | 3 +- pcbnew/class_mire.cpp | 3 +- pcbnew/class_module.cpp | 6 +- pcbnew/class_netinfo_item.cpp | 4 +- pcbnew/class_pad_draw_functions.cpp | 33 ++-- pcbnew/class_pcb_text.cpp | 11 +- pcbnew/class_text_mod.cpp | 14 +- pcbnew/class_track.cpp | 5 +- pcbnew/class_zone.cpp | 10 +- pcbnew/dialog_general_options.cpp | 14 +- pcbnew/dialog_general_options.h | 1 + pcbnew/editrack-part2.cpp | 36 +--- pcbnew/editrack.cpp | 5 +- pcbnew/modules.cpp | 8 +- pcbnew/pcbframe.cpp | 6 + pcbnew/pcbnew.cpp | 6 +- pcbnew/pcbnew.h | 2 - pcbnew/pcbnew_config.cpp | 4 +- pcbnew/pcbnew_config.h | 99 +++++----- pcbnew/print_board_functions.cpp | 3 +- pcbnew/ratsnest.cpp | 13 +- pcbnew/tool_pcb.cpp | 9 +- pcbnew/toolbars_update_user_interface.cpp | 4 +- 52 files changed, 723 insertions(+), 643 deletions(-) rename eeschema/{dialog_eeschema_options.fbp => dialog_eeschema_options_base.fbp} (98%) create mode 100644 include/class_colors_design_settings.h create mode 100644 include/layers_id_colors_and_visibility.h diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 6f18ddbef8..237c26a664 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -11,6 +11,7 @@ #include "drawtxt.h" #include "confirm.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "3d_viewer.h" #include "trackball.h" @@ -362,7 +363,7 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false ) return; - int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; + int color = g_ColorsSettings.GetLayerColor(layer); if( layer == LAST_COPPER_LAYER ) layer = g_Parm_3D_Visu.m_Layers - 1; @@ -392,7 +393,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* zone_c ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false ) return; - int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; + int color = g_ColorsSettings.GetLayerColor(layer); if( layer == LAST_COPPER_LAYER ) layer = g_Parm_3D_Visu.m_Layers - 1; @@ -467,14 +468,14 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false ) continue; - color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; + color = g_ColorsSettings.GetLayerColor(layer); } else { if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( LAYER_N_FRONT ) == false ) continue; - color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[LAYER_N_FRONT]; + color = g_ColorsSettings.GetLayerColor(LAYER_N_FRONT); } SetGLColor( color ); @@ -491,7 +492,7 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via ) } // 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 ); height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] - g_Parm_3D_Visu.m_LayerZcoord[bottom_layer]; @@ -510,7 +511,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false ) return; - int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; + int color = g_ColorsSettings.GetLayerColor(layer); SetGLColor( color ); w = segment->m_Width * g_Parm_3D_Visu.m_BoardScale; @@ -596,7 +597,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text ) if( !Get3DLayerEnable( layer ) ) return; - int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer]; + int color = g_ColorsSettings.GetLayerColor(layer); SetGLColor( color ); @@ -730,7 +731,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( m_Layer ) == false ) return; - int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer]; + int color = g_ColorsSettings.GetLayerColor(m_Layer); SetGLColor( color ); @@ -838,7 +839,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both ) 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 ) == false ) continue; @@ -890,7 +891,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both ) 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 ); if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false ) @@ -968,7 +969,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both ) 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 ); if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false ) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 16451ab031..cc38e14638 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,37 @@ KiCad ChangeLog 2010 Please add newer entries at the top, list the date and your name with email address. +2010-Jan-29 UPDATE Jean-Pierre Charras +================================================================================ + ++ 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 ================================================================================ *fixed eeschema crash when using the hotkey m (move) command. diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index bbd0b9a406..dfc5d788cc 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -13,6 +13,7 @@ set(COMMON_SRCS bezier_curves.cpp block_commande.cpp build_version.cpp + class_colors_design_settings.cpp class_marker_base.cpp class_plotter.cpp class_undoredo_container.cpp diff --git a/common/common.cpp b/common/common.cpp index aec535052d..5c72336080 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -117,6 +117,16 @@ StructColors ColorRefs[NBCOLOR] = { 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 * because kicad is internationalized, switch internalization to "C" standard @@ -146,7 +156,8 @@ void SetLocaleTo_C_standard( void ) */ void SetLocaleTo_Default( void ) { - setlocale( LC_NUMERIC, "" ); // revert to the current locale + if( ! g_DisableFloatingPointLocalNotation ) + setlocale( LC_NUMERIC, "" ); // revert to the current locale } diff --git a/common/edaappl.cpp b/common/edaappl.cpp index 27a619b273..332cf78953 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -684,6 +684,22 @@ bool WinEDA_App::SetLanguage( bool first_time ) 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 ) ) m_Locale->AddCatalog( DictionaryName ); diff --git a/common/pcbcommon.cpp b/common/pcbcommon.cpp index f90e69b9e5..bcbb3a53aa 100644 --- a/common/pcbcommon.cpp +++ b/common/pcbcommon.cpp @@ -88,7 +88,6 @@ const wxString PcbFileWildcard( int g_CurrentVersionPCB = 1; - int g_TimeOut; // Timer for automatic saving int g_SaveTime; // Time for next saving diff --git a/cvpcb/cvpcb.cpp b/cvpcb/cvpcb.cpp index 7d0210bb50..1cb6189c3b 100644 --- a/cvpcb/cvpcb.cpp +++ b/cvpcb/cvpcb.cpp @@ -14,11 +14,14 @@ #include "bitmaps.h" #include "protos.h" #include "cvstruct.h" +#include "colors_selection.h" #include "build_version.h" #include +// Colors for layers and items +COLORS_DESIGN_SETTINGS g_ColorsSettings; /* Constant string definitions for CvPcb */ const wxString ComponentFileExtension( wxT( "cmp" ) ); diff --git a/eeschema/class_sch_screen.cpp b/eeschema/class_sch_screen.cpp index c80e4eb32e..697e2ecf83 100644 --- a/eeschema/class_sch_screen.cpp +++ b/eeschema/class_sch_screen.cpp @@ -48,10 +48,19 @@ static int SchematicZoomList[] = #define SCHEMATIC_ZOOM_LIST_CNT ( sizeof( SchematicZoomList ) / \ 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[] = { { ID_POPUP_GRID_LEVEL_50, wxRealPoint( 50, 50 ) }, { ID_POPUP_GRID_LEVEL_25, wxRealPoint( 25, 25 ) }, @@ -59,18 +68,6 @@ static GRID_TYPE SchematicGridList[] = { { ID_POPUP_GRID_LEVEL_5, wxRealPoint( 5, 5 ) }, { ID_POPUP_GRID_LEVEL_2, wxRealPoint( 2, 2 ) }, { 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 ) / \ diff --git a/eeschema/dialog_eeschema_options_base.cpp b/eeschema/dialog_eeschema_options_base.cpp index 1c27a4cc4a..0b9ff027c5 100644 --- a/eeschema/dialog_eeschema_options_base.cpp +++ b/eeschema/dialog_eeschema_options_base.cpp @@ -82,7 +82,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx m_staticText9->Wrap( -1 ); 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 ); 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 m_staticText12->Wrap( -1 ); 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 ); 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 m_staticText16->Wrap( -1 ); 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 ); diff --git a/eeschema/dialog_eeschema_options.fbp b/eeschema/dialog_eeschema_options_base.fbp similarity index 98% rename from eeschema/dialog_eeschema_options.fbp rename to eeschema/dialog_eeschema_options_base.fbp index e0a0eb26e2..d57dacdaf3 100644 --- a/eeschema/dialog_eeschema_options.fbp +++ b/eeschema/dialog_eeschema_options_base.fbp @@ -742,10 +742,10 @@ 0 wxID_ANY - 1 - 2000 + 0 + 500 - 1 + 0 m_spinRepeatHorizontal protected @@ -899,10 +899,10 @@ 0 wxID_ANY - 1 - 2000 + 100 + 500 - 1 + 0 m_spinRepeatVertical protected @@ -1057,9 +1057,9 @@ 0 wxID_ANY 1 - 100 + 10 - -100 + 0 m_spinRepeatLabel protected diff --git a/eeschema/dialog_eeschema_options_base.h b/eeschema/dialog_eeschema_options_base.h index 0ae962375e..dd5b7a532b 100644 --- a/eeschema/dialog_eeschema_options_base.h +++ b/eeschema/dialog_eeschema_options_base.h @@ -1,82 +1,82 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __dialog_eeschema_options_base__ -#define __dialog_eeschema_options_base__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_EESCHEMA_OPTIONS_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog -{ - DECLARE_EVENT_TABLE() - private: - - // Private event handlers - void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); } - - - protected: - wxStaticText* m_staticText2; - wxChoice* m_choiceUnits; - - wxStaticText* m_staticText3; - wxChoice* m_choiceGridSize; - wxStaticText* m_staticGridUnits; - wxStaticText* m_staticText5; - wxSpinCtrl* m_spinLineWidth; - wxStaticText* m_staticLineWidthUnits; - wxStaticText* m_staticText7; - wxSpinCtrl* m_spinTextSize; - wxStaticText* m_staticTextSizeUnits; - wxStaticText* m_staticText9; - wxSpinCtrl* m_spinRepeatHorizontal; - wxStaticText* m_staticRepeatXUnits; - wxStaticText* m_staticText12; - wxSpinCtrl* m_spinRepeatVertical; - wxStaticText* m_staticRepeatYUnits; - wxStaticText* m_staticText16; - wxSpinCtrl* m_spinRepeatLabel; - - wxCheckBox* m_checkShowGrid; - wxCheckBox* m_checkShowHiddenPins; - wxCheckBox* m_checkAutoPan; - wxCheckBox* m_checkAnyOrientation; - wxCheckBox* m_checkPageLimits; - - wxStdDialogButtonSizer* m_sdbSizer1; - wxButton* m_sdbSizer1OK; - wxButton* m_sdbSizer1Cancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnChooseUnits( wxCommandEvent& event ){ event.Skip(); } - - - public: - DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_EESCHEMA_OPTIONS_BASE(); - -}; - -#endif //__dialog_eeschema_options_base__ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __dialog_eeschema_options_base__ +#define __dialog_eeschema_options_base__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_EESCHEMA_OPTIONS_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog +{ + DECLARE_EVENT_TABLE() + private: + + // Private event handlers + void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); } + + + protected: + wxStaticText* m_staticText2; + wxChoice* m_choiceUnits; + + wxStaticText* m_staticText3; + wxChoice* m_choiceGridSize; + wxStaticText* m_staticGridUnits; + wxStaticText* m_staticText5; + wxSpinCtrl* m_spinLineWidth; + wxStaticText* m_staticLineWidthUnits; + wxStaticText* m_staticText7; + wxSpinCtrl* m_spinTextSize; + wxStaticText* m_staticTextSizeUnits; + wxStaticText* m_staticText9; + wxSpinCtrl* m_spinRepeatHorizontal; + wxStaticText* m_staticRepeatXUnits; + wxStaticText* m_staticText12; + wxSpinCtrl* m_spinRepeatVertical; + wxStaticText* m_staticRepeatYUnits; + wxStaticText* m_staticText16; + wxSpinCtrl* m_spinRepeatLabel; + + wxCheckBox* m_checkShowGrid; + wxCheckBox* m_checkShowHiddenPins; + wxCheckBox* m_checkAutoPan; + wxCheckBox* m_checkAnyOrientation; + wxCheckBox* m_checkPageLimits; + + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnChooseUnits( wxCommandEvent& event ){ event.Skip(); } + + + public: + DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_EESCHEMA_OPTIONS_BASE(); + +}; + +#endif //__dialog_eeschema_options_base__ diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index 66ac5a49ce..908e62107a 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -16,6 +16,7 @@ #include "protos.h" #include "zones.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "build_version.h" @@ -27,7 +28,9 @@ wxString g_PhotoFilenameExt; wxString g_DrillFilenameExt; wxString g_PenFilenameExt; -int g_DCodesColor; +// Colors for layers and items +COLORS_DESIGN_SETTINGS g_ColorsSettings; + int g_Default_GERBER_Format; int g_Plot_Spot_Mini; /* Diameter of the opening mini-track for GERBER. */ int g_DisplayPolygonsModeSketch; diff --git a/gerbview/gerbview.h b/gerbview/gerbview.h index a36e67d5d6..9f3b4250dd 100644 --- a/gerbview/gerbview.h +++ b/gerbview/gerbview.h @@ -25,12 +25,21 @@ typedef enum FORMAT_POST } 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_DrillFilenameExt; extern wxString g_PenFilenameExt; -extern int g_DCodesColor; extern int g_Default_GERBER_Format; extern int g_Plot_Spot_Mini; /* Diameter of the opening mini-track for diff --git a/gerbview/gerbview_config.h b/gerbview/gerbview_config.h index 4ea27776f4..6a02232241 100644 --- a/gerbview/gerbview_config.h +++ b/gerbview/gerbview_config.h @@ -3,12 +3,16 @@ /*************************/ #include "param_config.h" +#include "colors_selection.h" #define GROUP wxT("/gerbview") #define GROUPLIB wxT("libraries") #define INSETUP TRUE +/* Useful macro : */ +#define LOC_COLOR(numlayer) &g_ColorsSettings.m_LayersColors[numlayer] + /* Liste des parametres */ static PARAM_CFG_WXSTRING PhotoExtBufCfg @@ -81,7 +85,7 @@ static PARAM_CFG_SETCOLOR ColorLayer0Cfg ( INSETUP, wxT("ColLay0"), - &g_DesignSettings.m_LayerColor[0], + LOC_COLOR(0), GREEN ); @@ -89,7 +93,7 @@ static PARAM_CFG_SETCOLOR ColorLayer1Cfg ( INSETUP, wxT("ColLay1"), - &g_DesignSettings.m_LayerColor[1], + LOC_COLOR(1), BLUE ); @@ -97,7 +101,7 @@ static PARAM_CFG_SETCOLOR ColorLayer2Cfg ( INSETUP, wxT("ColLay2"), - &g_DesignSettings.m_LayerColor[2], + LOC_COLOR(2), LIGHTGRAY ); @@ -105,7 +109,7 @@ static PARAM_CFG_SETCOLOR ColorLayer3Cfg ( INSETUP, wxT("ColLay3"), - &g_DesignSettings.m_LayerColor[3], + LOC_COLOR(3), 5 ); @@ -113,7 +117,7 @@ static PARAM_CFG_SETCOLOR ColorLayer4Cfg ( INSETUP, wxT("ColLay4"), - &g_DesignSettings.m_LayerColor[4], + LOC_COLOR(4), 4 ); @@ -121,7 +125,7 @@ static PARAM_CFG_SETCOLOR ColorLayer5Cfg ( INSETUP, wxT("ColLay5"), - &g_DesignSettings.m_LayerColor[5], + LOC_COLOR(5), 5 ); @@ -129,7 +133,7 @@ static PARAM_CFG_SETCOLOR ColorLayer6Cfg ( INSETUP, wxT("ColLay6"), - &g_DesignSettings.m_LayerColor[6], + LOC_COLOR(6), 6 ); @@ -137,7 +141,7 @@ static PARAM_CFG_SETCOLOR ColorLayer7Cfg ( INSETUP, wxT("ColLay7"), - &g_DesignSettings.m_LayerColor[7], + LOC_COLOR(7), 5 ); @@ -145,7 +149,7 @@ static PARAM_CFG_SETCOLOR ColorLayer8Cfg ( INSETUP, wxT("ColLay8"), - &g_DesignSettings.m_LayerColor[8], + LOC_COLOR(8), 7 ); @@ -153,7 +157,7 @@ static PARAM_CFG_SETCOLOR ColorLayer9Cfg ( INSETUP, wxT("ColLay9"), - &g_DesignSettings.m_LayerColor[9], + LOC_COLOR(9), 1 ); @@ -161,7 +165,7 @@ static PARAM_CFG_SETCOLOR ColorLayer10Cfg ( INSETUP, wxT("ColLayA"), - &g_DesignSettings.m_LayerColor[10], + LOC_COLOR(10), 2 ); @@ -169,7 +173,7 @@ static PARAM_CFG_SETCOLOR ColorLayer11Cfg ( INSETUP, wxT("ColLayB"), - &g_DesignSettings.m_LayerColor[11], + LOC_COLOR(11), 3 ); @@ -177,7 +181,7 @@ static PARAM_CFG_SETCOLOR ColorLayer12Cfg ( INSETUP, wxT("ColLayC"), - &g_DesignSettings.m_LayerColor[12], + LOC_COLOR(12), 12 ); @@ -185,7 +189,7 @@ static PARAM_CFG_SETCOLOR ColorLayer13Cfg ( INSETUP, wxT("ColLayD"), - &g_DesignSettings.m_LayerColor[13], + LOC_COLOR(13), 13 ); @@ -193,7 +197,7 @@ static PARAM_CFG_SETCOLOR ColorLayer14Cfg ( INSETUP, wxT("ColLayE"), - &g_DesignSettings.m_LayerColor[14], + LOC_COLOR(14), 14 ); @@ -201,7 +205,7 @@ static PARAM_CFG_SETCOLOR ColorLayer15Cfg ( INSETUP, wxT("ColLayF"), - &g_DesignSettings.m_LayerColor[15], + LOC_COLOR(15), RED ); @@ -209,7 +213,7 @@ static PARAM_CFG_SETCOLOR ColorLayer16Cfg ( INSETUP, wxT("ColLayG"), - &g_DesignSettings.m_LayerColor[16], + LOC_COLOR(16), 1 ); @@ -217,7 +221,7 @@ static PARAM_CFG_SETCOLOR ColorLayer17Cfg ( INSETUP, wxT("ColLayH"), - &g_DesignSettings.m_LayerColor[17], + LOC_COLOR(17), 5 ); @@ -225,7 +229,7 @@ static PARAM_CFG_SETCOLOR ColorLayer18Cfg ( INSETUP, wxT("ColLayI"), - &g_DesignSettings.m_LayerColor[18], + LOC_COLOR(18), 11 ); @@ -233,7 +237,7 @@ static PARAM_CFG_SETCOLOR ColorLayer19Cfg ( INSETUP, wxT("ColLayJ"), - &g_DesignSettings.m_LayerColor[19], + LOC_COLOR(19), 4 ); @@ -241,7 +245,7 @@ static PARAM_CFG_SETCOLOR ColorLayer20Cfg ( INSETUP, wxT("ColLayK"), - &g_DesignSettings.m_LayerColor[20], + LOC_COLOR(20), 5 ); @@ -249,7 +253,7 @@ static PARAM_CFG_SETCOLOR ColorLayer21Cfg ( INSETUP, wxT("ColLayL"), - &g_DesignSettings.m_LayerColor[21], + LOC_COLOR(21), 3 ); @@ -257,7 +261,7 @@ static PARAM_CFG_SETCOLOR ColorLayer22Cfg ( INSETUP, wxT("ColLayM"), - &g_DesignSettings.m_LayerColor[22], + LOC_COLOR(22), 6 ); @@ -265,7 +269,7 @@ static PARAM_CFG_SETCOLOR ColorLayer23Cfg ( INSETUP, wxT("ColLayN"), - &g_DesignSettings.m_LayerColor[23], + LOC_COLOR(23), 5 ); @@ -273,7 +277,7 @@ static PARAM_CFG_SETCOLOR ColorLayer24Cfg ( INSETUP, wxT("ColLayO"), - &g_DesignSettings.m_LayerColor[24], + LOC_COLOR(24), LIGHTGRAY ); @@ -281,7 +285,7 @@ static PARAM_CFG_SETCOLOR ColorLayer25Cfg ( INSETUP, wxT("ColLayP"), - &g_DesignSettings.m_LayerColor[25], + LOC_COLOR(25), 1 ); @@ -289,7 +293,7 @@ static PARAM_CFG_SETCOLOR ColorLayer26Cfg ( INSETUP, wxT("ColLayQ"), - &g_DesignSettings.m_LayerColor[26], + LOC_COLOR(26), 2 ); @@ -297,7 +301,7 @@ static PARAM_CFG_SETCOLOR ColorLayer27Cfg ( INSETUP, wxT("ColLayR"), - &g_DesignSettings.m_LayerColor[27], + LOC_COLOR(27), 14 ); @@ -305,7 +309,7 @@ static PARAM_CFG_SETCOLOR ColorLayer28Cfg ( INSETUP, wxT("ColLayS"), - &g_DesignSettings.m_LayerColor[28], + LOC_COLOR(28), YELLOW ); @@ -313,7 +317,7 @@ static PARAM_CFG_SETCOLOR ColorLayer29Cfg ( INSETUP, wxT("ColLayT"), - &g_DesignSettings.m_LayerColor[29], + LOC_COLOR(29), 13 ); @@ -321,7 +325,7 @@ static PARAM_CFG_SETCOLOR ColorLayer30Cfg ( INSETUP, wxT("ColLayU"), - &g_DesignSettings.m_LayerColor[30], + LOC_COLOR(30), 14 ); @@ -329,7 +333,7 @@ static PARAM_CFG_SETCOLOR ColorLayer31Cfg ( INSETUP, wxT("ColLayV"), - &g_DesignSettings.m_LayerColor[31], + LOC_COLOR(31), 7 ); @@ -347,7 +351,7 @@ static PARAM_CFG_SETCOLOR ColorDCodesCfg ( INSETUP, wxT("CoDCode"), - &g_DCodesColor, + &g_ColorsSettings.m_ItemsColors[DCODES_VISIBLE], WHITE ); diff --git a/gerbview/set_color.cpp b/gerbview/set_color.cpp index ba777afd88..ecf0b05714 100644 --- a/gerbview/set_color.cpp +++ b/gerbview/set_color.cpp @@ -5,10 +5,6 @@ /*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 "gr_basic.h" #include "common.h" @@ -442,7 +438,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() g_GridColor = CurrentColor[32]; 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(); // Additional command required for updating visibility of grid. diff --git a/gerbview/set_color.h b/gerbview/set_color.h index 10220bb93e..2796321d12 100644 --- a/gerbview/set_color.h +++ b/gerbview/set_color.h @@ -5,11 +5,8 @@ #ifndef SET_COLOR_H #define SET_COLOR_H -#if defined(__GNUG__) && !defined(__APPLE__) -#pragma interface "set_color.cpp" -#endif - #include "wx/statline.h" +#include "colors_selection.h" class wxBoxSizer; class wxFlexGridSizer; @@ -48,8 +45,8 @@ enum col_sel_id { const int BUTT_SIZE_X = 20; const int BUTT_SIZE_Y = 16; -/* Macro utile : */ -#define ADR(numlayer) &g_DesignSettings.m_LayerColor[(numlayer)] +/* Useful macro : */ +#define LOC_COLOR(numlayer) &g_ColorsSettings.m_LayersColors[numlayer] /**********************************/ @@ -84,112 +81,112 @@ static ButtonIndex Msg_Layers_Cu = static ColorButton Layer_1_Butt= { _("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 }; static ColorButton Layer_2_Butt= { _("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 }; static ColorButton Layer_3_Butt= { _("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 }; static ColorButton Layer_4_Butt= { _("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 }; static ColorButton Layer_5_Butt= { _("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 }; static ColorButton Layer_6_Butt= { _("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 }; static ColorButton Layer_7_Butt= { _("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 }; static ColorButton Layer_8_Butt= { _("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 }; static ColorButton Layer_9_Butt= { _("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 }; static ColorButton Layer_10_Butt= { _("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 }; static ColorButton Layer_11_Butt= { _("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 }; static ColorButton Layer_12_Butt= { _("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 }; static ColorButton Layer_13_Butt= { _("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 }; static ColorButton Layer_14_Butt= { _("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 }; static ColorButton Layer_15_Butt= { _("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 }; static ColorButton Layer_16_Butt= { _("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 }; @@ -203,112 +200,112 @@ static ButtonIndex Msg_Layers_Tech = static ColorButton Layer_17_Butt= { _("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 }; static ColorButton Layer_18_Butt= { _("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 }; static ColorButton Layer_19_Butt= { _("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 }; static ColorButton Layer_20_Butt= { _("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 }; static ColorButton Layer_21_Butt= { _("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 }; static ColorButton Layer_22_Butt= { _("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 }; static ColorButton Layer_23_Butt= { _("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 }; static ColorButton Layer_24_Butt= { _("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 }; static ColorButton Layer_25_Butt= { _("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 }; static ColorButton Layer_26_Butt= { _("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 }; static ColorButton Layer_27_Butt= { _("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 }; static ColorButton Layer_28_Butt= { _("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 }; static ColorButton Layer_29_Butt= { _("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 }; static ColorButton Layer_30_Butt= { _("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 }; static ColorButton Layer_31_Butt= { _("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 }; static ColorButton Layer_32_Butt= { _("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 }; @@ -330,7 +327,7 @@ static ColorButton Grid_Butt= static ColorButton Show_DCodes_Butt= { _("D codes id."), // Title - &g_DCodesColor, // Address of optional parameter + &g_ColorsSettings.m_ItemsColors[DCODES_VISIBLE], // Address of optional parameter FALSE, &DisplayOpt.DisplayPadNum // Address of boolean display control parameter to toggle }; diff --git a/gerbview/tracepcb.cpp b/gerbview/tracepcb.cpp index f42787a381..ed6d79bd4e 100644 --- a/gerbview/tracepcb.cpp +++ b/gerbview/tracepcb.cpp @@ -16,6 +16,7 @@ #include "pcbplot.h" #include "protos.h" #include "class_board_design_settings.h" +#include "colors_selection.h" static void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, @@ -142,7 +143,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay } else { - Color = g_DesignSettings.m_LayerColor[track->GetLayer()]; + Color = g_ColorsSettings.GetLayerColor( track->GetLayer() ); filled = (g_DisplayPolygonsModeSketch == 0); } @@ -170,7 +171,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay } else { - Color = g_DesignSettings.m_LayerColor[track->GetLayer()]; + Color = g_ColorsSettings.GetLayerColor( track->GetLayer() ); filled = (g_DisplayPolygonsModeSketch == 0); } @@ -253,7 +254,7 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false ) return; - color = g_DesignSettings.m_LayerColor[track->GetLayer()]; + color = g_ColorsSettings.GetLayerColor( track->GetLayer() ); if( draw_mode & GR_SURBRILL ) { @@ -452,9 +453,11 @@ void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int d orient = TEXT_ORIENT_VERT; width /= 2; } + + int color = g_ColorsSettings.GetItemColor(DCODES_VISIBLE); DrawGraphicText( panel, DC, - pos, (EDA_Colors) g_DCodesColor, Line, + pos, (EDA_Colors) color, Line, orient, wxSize( width, width ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, 0, false, false, false); diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 18a2c29e52..da2691ff04 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -37,18 +37,6 @@ protected: int m_VisibleLayers; // Bit-mask for layer 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: EDA_BoardDesignSettings(); @@ -184,34 +172,6 @@ public: * @param aNewLayerCount = The new number of enabled copper layers */ 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; - } - } - }; diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h new file mode 100644 index 0000000000..afa6d81c79 --- /dev/null +++ b/include/class_colors_design_settings.h @@ -0,0 +1,58 @@ +/****************************************************/ +/* 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 diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h new file mode 100644 index 0000000000..6abd2614f2 --- /dev/null +++ b/include/layers_id_colors_and_visibility.h @@ -0,0 +1,182 @@ +/**************************************************************/ +/* 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_ diff --git a/include/pcbcommon.h b/include/pcbcommon.h index 9781fca730..a918ef1a30 100644 --- a/include/pcbcommon.h +++ b/include/pcbcommon.h @@ -36,12 +36,6 @@ extern const wxString PcbFileWildcard; extern wxString g_ViaType_Name[4]; 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 diff --git a/include/pcbstruct.h b/include/pcbstruct.h index d46da3d98a..d5ff45ad19 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -8,6 +8,7 @@ #include "base_struct.h" #include "class_base_screen.h" #include "class_board_item.h" +#include "layers_id_colors_and_visibility.h" // Definitions relatives aux libraries #define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1" @@ -33,114 +34,6 @@ #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 MARKER_PCB; class RATSNEST_ITEM; @@ -153,73 +46,6 @@ class RATSNEST_ITEM; #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: enum DisplayViaMode { VIA_HOLE_NOT_SHOW = 0, diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 747ef5c379..534c259ef8 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -808,7 +808,6 @@ public: void GlobalRoute( wxDC* DC ); void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ); - void Ratsnest_On_Off( wxDC* DC ); void Clean_Pcb( wxDC* DC ); void InstallFindFrame( const wxPoint& pos, wxDC* DC ); diff --git a/pcbnew/automove.cpp b/pcbnew/automove.cpp index 9e9b87a307..238e0e126f 100644 --- a/pcbnew/automove.cpp +++ b/pcbnew/automove.cpp @@ -65,7 +65,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) } /* Erase ratsnest if needed */ - if( g_Show_Ratsnest ) + if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) DrawGeneralRatsnest( &dc ); GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; diff --git a/pcbnew/autoplac.cpp b/pcbnew/autoplac.cpp index a651b18300..92621cdf0e 100644 --- a/pcbnew/autoplac.cpp +++ b/pcbnew/autoplac.cpp @@ -13,6 +13,7 @@ #include "zones.h" #include "cell.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "protos.h" @@ -856,6 +857,10 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC ) return -1; 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++ ) { RATSNEST_ITEM* pt_local_chevelu = &GetBoard()->m_LocalRatsnest[ii]; @@ -871,7 +876,7 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC ) if( AutoPlaceShowAll ) { GRLine( &DrawPanel->m_ClipBox, DC, ox, oy, fx, fy, - 0, g_DesignSettings.m_RatsnestColor | GR_XOR ); + 0, color ); } /* Cost of the ratsnest. */ diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 65c4fbc480..e747ac9968 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -6,6 +6,7 @@ #include "pcbnew.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 @@ -435,20 +436,24 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE ) { int color = -1; - // @todo move these globals into the board. switch( aPCB_VISIBLE ) { - case VIA_THROUGH_VISIBLE: color = m_BoardSettings->m_ViaColor[VIA_THROUGH]; break; - case VIA_MICROVIA_VISIBLE: color = m_BoardSettings->m_ViaColor[VIA_MICROVIA]; break; - case VIA_BBLIND_VISIBLE: color = m_BoardSettings->m_ViaColor[VIA_BLIND_BURIED]; break; - case MOD_TEXT_FR_VISIBLE: color = g_ModuleTextCMPColor; break; - case MOD_TEXT_BK_VISIBLE: color = g_ModuleTextCUColor; break; - case MOD_TEXT_INVISIBLE: color = g_ModuleTextNOVColor; break; - case ANCHOR_VISIBLE: color = g_AnchorColor; break; - case PAD_FR_VISIBLE: color = g_PadCMPColor; break; - case PAD_BK_VISIBLE: color = g_PadCUColor; break; - case RATSNEST_VISIBLE: color = m_BoardSettings->m_RatsnestColor; break; - case GRID_VISIBLE: color = g_GridColor; break; + case VIA_THROUGH_VISIBLE: + case VIA_MICROVIA_VISIBLE: + case VIA_BBLIND_VISIBLE: + case MOD_TEXT_FR_VISIBLE: + case MOD_TEXT_BK_VISIBLE: + case MOD_TEXT_INVISIBLE: + case ANCHOR_VISIBLE: + case PAD_FR_VISIBLE: + case PAD_BK_VISIBLE: + case RATSNEST_VISIBLE: + color = g_ColorsSettings.GetItemColor( aPCB_VISIBLE ); + break; + case GRID_VISIBLE: + color = g_GridColor; + break; + default: wxLogDebug( wxT( "BOARD::GetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE ); } @@ -459,20 +464,41 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE ) void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor ) { - // @todo move these globals into the board. switch( aPCB_VISIBLE ) { - case VIA_THROUGH_VISIBLE: m_BoardSettings->m_ViaColor[VIA_THROUGH] = aColor; break; - case VIA_MICROVIA_VISIBLE: m_BoardSettings->m_ViaColor[VIA_MICROVIA] = aColor; break; - case VIA_BBLIND_VISIBLE: m_BoardSettings->m_ViaColor[VIA_BLIND_BURIED] = aColor; break; - case MOD_TEXT_FR_VISIBLE: g_ModuleTextCMPColor = aColor; break; - case MOD_TEXT_BK_VISIBLE: g_ModuleTextCUColor = aColor; break; - case MOD_TEXT_INVISIBLE: g_ModuleTextNOVColor = aColor; break; - case ANCHOR_VISIBLE: g_AnchorColor = aColor; break; - case PAD_FR_VISIBLE: g_PadCMPColor = aColor; break; - case PAD_BK_VISIBLE: g_PadCUColor = aColor; break; - case RATSNEST_VISIBLE: m_BoardSettings->m_RatsnestColor = aColor; break; - case GRID_VISIBLE: g_GridColor = aColor; break; + case VIA_THROUGH_VISIBLE: + case VIA_MICROVIA_VISIBLE: + case VIA_BBLIND_VISIBLE: + case MOD_TEXT_FR_VISIBLE: + case MOD_TEXT_BK_VISIBLE: + case MOD_TEXT_INVISIBLE: + case ANCHOR_VISIBLE: + case PAD_FR_VISIBLE: + case PAD_BK_VISIBLE: + g_ColorsSettings.SetItemColor( aPCB_VISIBLE, aColor ); + 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: wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE ); } @@ -481,13 +507,13 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor ) void BOARD::SetLayerColor( int aLayer, int aColor ) { - m_BoardSettings->SetLayerColor( aLayer, aColor ); + g_ColorsSettings.SetLayerColor( aLayer, aColor ); } int BOARD::GetLayerColor( int aLayer ) { - return m_BoardSettings->GetLayerColor( aLayer ); + return g_ColorsSettings.GetLayerColor( aLayer ); } diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index ac3998d495..b391804290 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -14,27 +14,6 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() // 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. // SetCopperLayerCount() will adjust this. SetVisibleAlls( ); // All layers and all elements visible at first. @@ -61,17 +40,6 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() // The final margin is the sum of these 2 values // 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 void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState ) { - if( aElementCategory < 0 || aElementCategory >= END_VISIBLE ) + if( aElementCategory < 0 || aElementCategory >= END_PCB_VISIBLE_LIST ) return; if( aNewState ) m_VisibleElements |= 1 << aElementCategory; diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index ecf0db2939..78c7fd436b 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -10,6 +10,7 @@ #include "wxstruct.h" #include "class_board_design_settings.h" #include "class_drawpanel.h" +#include "colors_selection.h" #include "kicad_string.h" #include "protos.h" @@ -423,7 +424,7 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC, if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) return; - gcolor = g_DesignSettings.m_LayerColor[m_Layer]; + gcolor = g_ColorsSettings.GetLayerColor(m_Layer); GRSetDrawMode( DC, mode_color ); typeaff = DisplayOpt.DisplayDrawItems; diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 1cfc9d2217..746a8bb494 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -9,6 +9,7 @@ #include "common.h" #include "class_drawpanel.h" #include "kicad_string.h" +#include "colors_selection.h" #include "pcbnew.h" #include "class_board_design_settings.h" @@ -238,7 +239,7 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, if( g_DesignSettings.IsLayerVisible( GetLayer() ) == false ) return; - color = g_DesignSettings.m_LayerColor[GetLayer()]; + color = g_ColorsSettings.GetLayerColor(GetLayer()); GRSetDrawMode( DC, draw_mode ); l_piste = m_Width >> 1; /* half trace width */ diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 8dd06a5a1e..bd6e818fe5 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -10,6 +10,7 @@ #include "class_drawpanel.h" #include "confirm.h" #include "kicad_string.h" +#include "colors_selection.h" #include "pcbnew.h" #include "class_board_design_settings.h" @@ -167,7 +168,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) return; - color = g_DesignSettings.m_LayerColor[m_Layer]; + color = g_ColorsSettings.GetLayerColor(m_Layer); frame = (WinEDA_BasePcbFrame*) panel->GetParent(); diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index 30f550940b..59cf8c269c 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -10,6 +10,7 @@ #include "pcbnew.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "trigo.h" #include "protos.h" @@ -109,7 +110,7 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) return; - gcolor = g_DesignSettings.m_LayerColor[m_Layer]; + gcolor = g_ColorsSettings.GetLayerColor(m_Layer); GRSetDrawMode( DC, mode_color ); typeaff = DisplayOpt.DisplayDrawItems; diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 432eba5c78..3227587944 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -15,6 +15,7 @@ #include "pcbnew.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "autorout.h" #include "drag.h" @@ -72,14 +73,15 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset if( ((BOARD*)m_Parent)->IsElementVisible( ANCHOR_VISIBLE ) ) { + int color = g_ColorsSettings.GetItemColor(ANCHOR_VISIBLE); 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, - 0, g_AnchorColor ); + 0, color ); 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, - 0, g_AnchorColor ); + 0, color ); } } diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index 237a10cb3d..d04ac97f45 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -8,6 +8,7 @@ #include "kicad_string.h" #include "pcbnew.h" #include "class_board_design_settings.h" +#include "colors_selection.h" /*********************************************************/ @@ -193,6 +194,7 @@ void RATSNEST_ITEM::Draw( WinEDA_DrawPanel* panel, const wxPoint& aOffset ) { GRSetDrawMode( DC, aDrawMode ); + int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE); 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 ); } diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index a91d7116dc..51620cc938 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -12,6 +12,7 @@ #include "pcbnew.h" #include "class_board_design_settings.h" +#include "colors_selection.h" /** Draw a pad: @@ -89,12 +90,12 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, if( m_Masque_Layer & LAYER_FRONT ) { - color = g_PadCMPColor; + color = g_ColorsSettings.GetItemColor(PAD_FR_VISIBLE); } if( m_Masque_Layer & LAYER_BACK ) { - color |= g_PadCUColor; + color |= g_ColorsSettings.GetItemColor(PAD_BK_VISIBLE); } if( color == 0 ) /* Not on copper layer */ @@ -104,55 +105,55 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, switch( m_Masque_Layer & ~ALL_CU_LAYERS ) { case ADHESIVE_LAYER_BACK: - color = g_DesignSettings.m_LayerColor[ADHESIVE_N_BACK]; + color = g_ColorsSettings.GetLayerColor(ADHESIVE_N_BACK); break; case ADHESIVE_LAYER_FRONT: - color = g_DesignSettings.m_LayerColor[ADHESIVE_N_FRONT]; + color = g_ColorsSettings.GetLayerColor(ADHESIVE_N_FRONT); break; case SOLDERPASTE_LAYER_BACK: - color = g_DesignSettings.m_LayerColor[SOLDERPASTE_N_BACK]; + color = g_ColorsSettings.GetLayerColor(SOLDERPASTE_N_BACK); break; case SOLDERPASTE_LAYER_FRONT: - color = g_DesignSettings.m_LayerColor[SOLDERPASTE_N_FRONT]; + color = g_ColorsSettings.GetLayerColor(SOLDERPASTE_N_FRONT); break; case SILKSCREEN_LAYER_BACK: - color = g_DesignSettings.m_LayerColor[SILKSCREEN_N_BACK]; + color = g_ColorsSettings.GetLayerColor(SILKSCREEN_N_BACK); break; case SILKSCREEN_LAYER_FRONT: - color = g_DesignSettings.m_LayerColor[SILKSCREEN_N_FRONT]; + color = g_ColorsSettings.GetLayerColor(SILKSCREEN_N_FRONT); break; case SOLDERMASK_LAYER_BACK: - color = g_DesignSettings.m_LayerColor[SOLDERMASK_N_BACK]; + color = g_ColorsSettings.GetLayerColor(SOLDERMASK_N_BACK); break; case SOLDERMASK_LAYER_FRONT: - color = g_DesignSettings.m_LayerColor[SOLDERMASK_N_FRONT]; + color = g_ColorsSettings.GetLayerColor(SOLDERMASK_N_FRONT); break; case DRAW_LAYER: - color = g_DesignSettings.m_LayerColor[DRAW_N]; + color = g_ColorsSettings.GetLayerColor(DRAW_N); break; case COMMENT_LAYER: - color = g_DesignSettings.m_LayerColor[COMMENT_N]; + color = g_ColorsSettings.GetLayerColor(COMMENT_N); break; case ECO1_LAYER: - color = g_DesignSettings.m_LayerColor[ECO1_N]; + color = g_ColorsSettings.GetLayerColor(ECO1_N); break; case ECO2_LAYER: - color = g_DesignSettings.m_LayerColor[ECO2_N]; + color = g_ColorsSettings.GetLayerColor(ECO2_N); break; case EDGE_LAYER: - color = g_DesignSettings.m_LayerColor[EDGE_N]; + color = g_ColorsSettings.GetLayerColor(EDGE_N); break; default: @@ -217,7 +218,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, { 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 // layer shows the pad size with the mask clearance diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index c53ae653a0..0f0186e220 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -12,6 +12,7 @@ #include "pcbnew.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "trigo.h" #include "protos.h" @@ -190,16 +191,18 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) return; - int color = g_DesignSettings.m_LayerColor[m_Layer]; + int color = g_ColorsSettings.GetLayerColor(m_Layer); GRTraceMode fillmode = FILLED; if ( DisplayOpt.DisplayDrawItems == 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, - DrawMode, fillmode, - g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) ? - (EDA_Colors) g_AnchorColor : UNSPECIFIED_COLOR ); + DrawMode, fillmode, (EDA_Colors) anchor_color ); } diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 6b0c2abf85..3be7884c4e 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -13,6 +13,7 @@ #include "kicad_string.h" #include "pcbcommon.h" #include "class_board_design_settings.h" +#include "colors_selection.h" /*******************************************************************/ /* 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, if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) ) { + color = g_ColorsSettings.GetItemColor(ANCHOR_VISIBLE); int anchor_size = screen->Unscale( 2 ); GRLine( &panel->m_ClipBox, DC, 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, 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( g_DesignSettings.IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false ) return; - color = g_ModuleTextCUColor; + color = g_ColorsSettings.GetItemColor(MOD_TEXT_BK_VISIBLE); } else if( Module->GetLayer() == LAYER_N_FRONT ) { if( g_DesignSettings.IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false ) return; - color = g_ModuleTextCMPColor; + color = g_ColorsSettings.GetItemColor(MOD_TEXT_FR_VISIBLE); } if( m_NoShow ) { if( g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ) == false ) return; - color = g_ModuleTextNOVColor; + color = g_ColorsSettings.GetItemColor(MOD_TEXT_INVISIBLE); } /* If the text is mirrored : negate size.x (mirror / Y axis) */ diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index e0796d1725..e245ddafec 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -12,6 +12,7 @@ #include "pcbnew.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "protos.h" @@ -557,7 +558,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin } 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 ) != HIGHT_LIGHT_FLAG ) @@ -723,7 +724,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi 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 && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 2b6947a273..c5fca93a38 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -14,6 +14,7 @@ #include "pcbnew.h" #include "zones.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "protos.h" @@ -443,9 +444,10 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con wxPoint seg_start, seg_end; 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; GRSetDrawMode( DC, draw_mode ); @@ -531,7 +533,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, return; 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 ) return; @@ -685,7 +687,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, if( DC == NULL ) return; 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 ) { diff --git a/pcbnew/dialog_general_options.cpp b/pcbnew/dialog_general_options.cpp index fec3fbfdb0..334b433eb5 100644 --- a/pcbnew/dialog_general_options.cpp +++ b/pcbnew/dialog_general_options.cpp @@ -34,6 +34,8 @@ void Dialog_GeneralOptions::init() { SetFocus(); + m_Board = m_Parent->GetBoard(); + /* Set display options */ m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 ); m_UnitsSelection->SetSelection( g_UnitMetric ? 1 : 0 ); @@ -58,7 +60,7 @@ void Dialog_GeneralOptions::init() m_DrcOn->SetValue( Drc_On ); 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_Track_45_Only_Ctrl->SetValue( Track_45_Only ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); @@ -94,10 +96,9 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) /* Updating the combobox to display the active layer. */ g_MaxLinksShowed = m_MaxShowLinks->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_Parent->Ratsnest_On_Off( NULL ); + m_Board->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() ); m_Parent->DrawPanel->Refresh( ); } g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue(); @@ -144,7 +145,7 @@ void WinEDA_ModuleEditFrame::InstallOptionsFrame( const wxPoint& pos ) /* 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 ) { @@ -163,8 +164,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) break; case ID_TB_OPTIONS_SHOW_RATSNEST: - g_Show_Ratsnest = m_OptionsToolBar->GetToolState( id ); - Ratsnest_On_Off( NULL ); + GetBoard()->SetElementVisibility(RATSNEST_VISIBLE, m_OptionsToolBar->GetToolState( id )); DrawPanel->Refresh( ); break; diff --git a/pcbnew/dialog_general_options.h b/pcbnew/dialog_general_options.h index 691e601f46..8bad664f8b 100644 --- a/pcbnew/dialog_general_options.h +++ b/pcbnew/dialog_general_options.h @@ -9,6 +9,7 @@ class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base { private: WinEDA_PcbFrame* m_Parent; + BOARD * m_Board; void init(); diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index 09c0d08f5f..d4b37d832a 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -14,40 +14,6 @@ #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: * The track must be on one layer of work, @@ -324,7 +290,7 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ) D_PAD* pt_pad = NULL; MODULE* Module = NULL; - if( g_Show_Ratsnest ) + if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) return; if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 ) diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 2372ca8b92..9fd5da46ff 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -9,6 +9,7 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "drc_stuff.h" #include "trigo.h" @@ -705,7 +706,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) { 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, g_CurrentTrackSegment->m_End.y, @@ -775,7 +776,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) { 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, g_CurrentTrackSegment->m_End.y, diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 0b1b02890a..0da3b9d664 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -104,7 +104,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC ) DrawPanel->MouseToCursorSchema(); /* Show ratsnest. */ - if( g_Show_Ratsnest ) + if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) DrawGeneralRatsnest( DC ); if( g_DragSegmentList ) /* Should not occur ! */ @@ -224,7 +224,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC ) // Display ratsnest is allowed pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST; - if( g_Show_Ratsnest ) + if( pcbframe->GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) pcbframe->DrawGeneralRatsnest( DC ); } @@ -365,7 +365,7 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC ) } /* Show ratsnest if necessary. */ - if( DC && g_Show_Ratsnest ) + if( DC && GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) DrawGeneralRatsnest( DC ); g_Offset_Module.x = 0; @@ -518,7 +518,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module, DrawPanel->PostDirtyRect( module->GetBoundingBox() ); module->m_Flags = tmp; - if( g_Show_Ratsnest ) + if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) DrawGeneralRatsnest( DC ); } } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index c3dc453a2d..c7deeb4111 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -394,6 +394,7 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) // Keys used in read/write config +#define PCB_SHOW_FULL_RATSNET_OPT wxT( "PcbFulRatsnest" ) #define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" ) #define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" ) #define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" ) @@ -837,6 +838,9 @@ void WinEDA_PcbFrame::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_TRACKS_OPT, &g_MagneticTrackOption ); config->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools ); @@ -855,6 +859,8 @@ void WinEDA_PcbFrame::SaveSettings() 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_TRACKS_OPT, (long) g_MagneticTrackOption ); config->Write( SHOW_MICROWAVE_TOOLS, diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index a8824714cb..1955482eac 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -21,17 +21,21 @@ #include "zones.h" #include "drag.h" #include "eda_dde.h" +#include "colors_selection.h" + #include "id.h" #include "build_version.h" #include "protos.h" +// Colors for layers and items +COLORS_DESIGN_SETTINGS g_ColorsSettings; + bool Drc_On = true; bool g_AutoDeleteOldTrack = true; bool g_No_Via_Route; bool g_Drag_Pistes_On; -bool g_Show_Ratsnest; bool g_Show_Module_Ratsnest; bool g_Show_Pads_Module_in_Move = true; bool g_Raccord_45_Auto = true; diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index f96a213f63..6de5bdcf57 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -49,13 +49,11 @@ #define APPEND_PCB 1 /* used to append the new board to the existing board */ #define NEWPCB 0 /* used for normal load file */ - /* variables */ extern bool Drc_On; extern bool g_AutoDeleteOldTrack; extern bool g_No_Via_Route; extern bool g_Drag_Pistes_On; -extern bool g_Show_Ratsnest; extern bool g_Show_Module_Ratsnest; extern bool g_Show_Pads_Module_in_Move; extern bool g_Raccord_45_Auto; diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index d7bf224381..5579ae269d 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -12,7 +12,6 @@ #include "wxPcbStruct.h" #include "class_board_design_settings.h" #include "pcbplot.h" -#include "pcbnew_config.h" #include "worksheet.h" #include "pcbnew_id.h" #include "hotkeys.h" @@ -21,6 +20,7 @@ #include "dialog_mask_clearance.h" #include "dialog_general_options.h" +#include "pcbnew_config.h" #define HOTKEY_FILENAME wxT( "pcbnew" ) @@ -193,7 +193,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName ) * Because it could creates SERIOUS mistakes for the user, * if some items are not visible after loading a board... */ - g_DesignSettings.SetVisibleAlls( ); + GetBoard()->m_BoardSettings->SetVisibleAlls( ); DisplayOpt.DisplayPadNoConn = true; return TRUE; diff --git a/pcbnew/pcbnew_config.h b/pcbnew/pcbnew_config.h index 87f3970ab6..6636322054 100644 --- a/pcbnew/pcbnew_config.h +++ b/pcbnew/pcbnew_config.h @@ -3,6 +3,7 @@ /*****************************************************/ #include "param_config.h" +#include "colors_selection.h" #define GROUP wxT( "/pcbnew" ) #define GROUPLIB wxT( "/pcbnew/libraries" ) @@ -15,6 +16,9 @@ // project, in .pro file) #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. */ @@ -226,7 +230,7 @@ static PARAM_CFG_SETCOLOR ColorLayer0Cfg // CU Layer Color ( INSETUP, wxT( "ColLay0" ), - &g_DesignSettings.m_LayerColor[0], + LOC_COLOR(0), GREEN ); @@ -234,7 +238,7 @@ static PARAM_CFG_SETCOLOR ColorLayer1Cfg ( INSETUP, wxT( "ColLay1" ), - &g_DesignSettings.m_LayerColor[1], + LOC_COLOR(1), BLUE ); @@ -242,7 +246,7 @@ static PARAM_CFG_SETCOLOR ColorLayer2Cfg ( INSETUP, wxT( "ColLay2" ), - &g_DesignSettings.m_LayerColor[2], + LOC_COLOR(2), LIGHTGRAY ); @@ -250,7 +254,7 @@ static PARAM_CFG_SETCOLOR ColorLayer3Cfg ( INSETUP, wxT( "ColLay3" ), - &g_DesignSettings.m_LayerColor[3], + LOC_COLOR(3), 5 ); @@ -258,7 +262,7 @@ static PARAM_CFG_SETCOLOR ColorLayer4Cfg ( INSETUP, wxT( "ColLay4" ), - &g_DesignSettings.m_LayerColor[4], + LOC_COLOR(4), 4 ); @@ -266,7 +270,7 @@ static PARAM_CFG_SETCOLOR ColorLayer5Cfg ( INSETUP, wxT( "ColLay5" ), - &g_DesignSettings.m_LayerColor[5], + LOC_COLOR(5), 5 ); @@ -274,7 +278,7 @@ static PARAM_CFG_SETCOLOR ColorLayer6Cfg ( INSETUP, wxT( "ColLay6" ), - &g_DesignSettings.m_LayerColor[6], + LOC_COLOR(6), 6 ); @@ -282,7 +286,7 @@ static PARAM_CFG_SETCOLOR ColorLayer7Cfg ( INSETUP, wxT( "ColLay7" ), - &g_DesignSettings.m_LayerColor[7], + LOC_COLOR(7), 5 ); @@ -290,7 +294,7 @@ static PARAM_CFG_SETCOLOR ColorLayer8Cfg ( INSETUP, wxT( "ColLay8" ), - &g_DesignSettings.m_LayerColor[8], + LOC_COLOR(8), 7 ); @@ -298,7 +302,7 @@ static PARAM_CFG_SETCOLOR ColorLayer9Cfg ( INSETUP, wxT( "ColLay9" ), - &g_DesignSettings.m_LayerColor[9], + LOC_COLOR(9), 1 ); @@ -306,7 +310,7 @@ static PARAM_CFG_SETCOLOR ColorLayer10Cfg ( INSETUP, wxT( "ColLayA" ), - &g_DesignSettings.m_LayerColor[10], + LOC_COLOR(10), 2 ); @@ -314,7 +318,7 @@ static PARAM_CFG_SETCOLOR ColorLayer11Cfg ( INSETUP, wxT( "ColLayB" ), - &g_DesignSettings.m_LayerColor[11], + LOC_COLOR(11), 3 ); @@ -322,7 +326,7 @@ static PARAM_CFG_SETCOLOR ColorLayer12Cfg ( INSETUP, wxT( "ColLayC" ), - &g_DesignSettings.m_LayerColor[12], + LOC_COLOR(12), 12 ); @@ -330,7 +334,7 @@ static PARAM_CFG_SETCOLOR ColorLayer13Cfg ( INSETUP, wxT( "ColLayD" ), - &g_DesignSettings.m_LayerColor[13], + LOC_COLOR(13), 13 ); @@ -338,7 +342,7 @@ static PARAM_CFG_SETCOLOR ColorLayer14Cfg ( INSETUP, wxT( "ColLayE" ), - &g_DesignSettings.m_LayerColor[14], + LOC_COLOR(14), 14 ); @@ -346,7 +350,7 @@ static PARAM_CFG_SETCOLOR ColorLayer15Cfg // CMP Layer Color ( INSETUP, wxT( "ColLayF" ), - &g_DesignSettings.m_LayerColor[15], + LOC_COLOR(15), RED ); @@ -354,7 +358,7 @@ static PARAM_CFG_SETCOLOR ColorLayer16Cfg // Adhesive CU Layer Color ( INSETUP, wxT( "ColLayG" ), - &g_DesignSettings.m_LayerColor[16], + LOC_COLOR(16), 1 ); @@ -362,7 +366,7 @@ static PARAM_CFG_SETCOLOR ColorLayer17Cfg // Adhesive CMP Layer Color ( INSETUP, wxT( "ColLayH" ), - &g_DesignSettings.m_LayerColor[17], + LOC_COLOR(17), 5 ); @@ -370,7 +374,7 @@ static PARAM_CFG_SETCOLOR ColorLayer18Cfg // Solder Mask CU Layer Color ( INSETUP, wxT( "ColLayI" ), - &g_DesignSettings.m_LayerColor[18], + LOC_COLOR(18), 11 ); @@ -378,7 +382,7 @@ static PARAM_CFG_SETCOLOR ColorLayer19Cfg // Solder Mask CMP Layer Color ( INSETUP, wxT( "ColLayJ" ), - &g_DesignSettings.m_LayerColor[19], + LOC_COLOR(19), 4 ); @@ -386,7 +390,7 @@ static PARAM_CFG_SETCOLOR ColorLayer20Cfg // Silk Screen CU Layer Color ( INSETUP, wxT( "ColLayK" ), - &g_DesignSettings.m_LayerColor[20], + LOC_COLOR(20), 5 ); @@ -394,7 +398,7 @@ static PARAM_CFG_SETCOLOR ColorLayer21Cfg // Silk Screen CMP Layer Color ( INSETUP, wxT( "ColLayL" ), - &g_DesignSettings.m_LayerColor[21], + LOC_COLOR(21), 3 ); @@ -402,7 +406,7 @@ static PARAM_CFG_SETCOLOR ColorLayer22Cfg // Mask CU Layer Color ( INSETUP, wxT( "ColLayM" ), - &g_DesignSettings.m_LayerColor[22], + LOC_COLOR(22), 6 ); @@ -410,7 +414,7 @@ static PARAM_CFG_SETCOLOR ColorLayer23Cfg // Mask CMP Layer Color ( INSETUP, wxT( "ColLayN" ), - &g_DesignSettings.m_LayerColor[23], + LOC_COLOR(23), 5 ); @@ -418,7 +422,7 @@ static PARAM_CFG_SETCOLOR ColorLayer24Cfg // DRAW Layer Color ( INSETUP, wxT( "ColLayO" ), - &g_DesignSettings.m_LayerColor[24], + LOC_COLOR(24), LIGHTGRAY ); @@ -426,7 +430,7 @@ static PARAM_CFG_SETCOLOR ColorLayer25Cfg // Comment Layer Color ( INSETUP, wxT( "ColLayP" ), - &g_DesignSettings.m_LayerColor[25], + LOC_COLOR(25), 1 ); @@ -434,7 +438,7 @@ static PARAM_CFG_SETCOLOR ColorLayer26Cfg // ECO1 Layer Color ( INSETUP, wxT( "ColLayQ" ), - &g_DesignSettings.m_LayerColor[26], + LOC_COLOR(26), 2 ); @@ -442,7 +446,7 @@ static PARAM_CFG_SETCOLOR ColorLayer27Cfg //ECO2 Layer Color ( INSETUP, wxT( "ColLayR" ), - &g_DesignSettings.m_LayerColor[27], + LOC_COLOR(27), 14 ); @@ -450,7 +454,7 @@ static PARAM_CFG_SETCOLOR ColorLayer28Cfg // EDGES Layer Color ( INSETUP, wxT( "ColLayS" ), - &g_DesignSettings.m_LayerColor[28], + LOC_COLOR(28), YELLOW ); @@ -458,7 +462,7 @@ static PARAM_CFG_SETCOLOR ColorLayer29Cfg ( INSETUP, wxT( "ColLayT" ), - &g_DesignSettings.m_LayerColor[29], + LOC_COLOR(29), 13 ); @@ -466,7 +470,7 @@ static PARAM_CFG_SETCOLOR ColorLayer30Cfg ( INSETUP, wxT( "ColLayU" ), - &g_DesignSettings.m_LayerColor[30], + LOC_COLOR(30), 14 ); @@ -474,7 +478,7 @@ static PARAM_CFG_SETCOLOR ColorLayer31Cfg ( INSETUP, wxT( "ColLayV" ), - &g_DesignSettings.m_LayerColor[31], + LOC_COLOR(31), 7 ); @@ -482,7 +486,7 @@ static PARAM_CFG_SETCOLOR ColorTxtModCmpCfg ( INSETUP, wxT( "CTxtMoC" ), - &g_ModuleTextCMPColor, + ITEM_COLOR(MOD_TEXT_FR_VISIBLE), LIGHTGRAY ); @@ -490,15 +494,15 @@ static PARAM_CFG_SETCOLOR ColorTxtModCuCfg ( INSETUP, wxT( "CTxtMoS" ), - &g_ModuleTextCUColor, - 1 + ITEM_COLOR(MOD_TEXT_BK_VISIBLE), + BLUE ); static PARAM_CFG_SETCOLOR VisibleTxtModCfg ( INSETUP, wxT( "CTxtVis" ), - &g_ModuleTextNOVColor, + ITEM_COLOR(MOD_TEXT_INVISIBLE), DARKGRAY ); @@ -530,7 +534,7 @@ static PARAM_CFG_SETCOLOR ColorAncreModCfg ( INSETUP, wxT( "CAncreM" ), - &g_AnchorColor, + ITEM_COLOR(ANCHOR_VISIBLE), BLUE ); @@ -538,7 +542,7 @@ static PARAM_CFG_SETCOLOR ColorPadCuCfg ( INSETUP, wxT( "CoPadCu" ), - &g_PadCUColor, + ITEM_COLOR(PAD_BK_VISIBLE), GREEN ); @@ -546,7 +550,7 @@ static PARAM_CFG_SETCOLOR ColorPadCmpCfg ( INSETUP, wxT( "CoPadCm" ), - &g_PadCMPColor, + ITEM_COLOR(PAD_FR_VISIBLE), RED ); @@ -554,7 +558,7 @@ static PARAM_CFG_SETCOLOR ColorViaThroughCfg ( INSETUP, wxT( "CoViaTh" ), - &g_DesignSettings.m_ViaColor[VIA_THROUGH], + ITEM_COLOR(VIA_THROUGH_VISIBLE), LIGHTGRAY ); @@ -562,7 +566,7 @@ static PARAM_CFG_SETCOLOR ColorViaBlindBuriedCfg ( INSETUP, wxT( "CoViaBu" ), - &g_DesignSettings.m_ViaColor[VIA_BLIND_BURIED], + ITEM_COLOR(VIA_BBLIND_VISIBLE), BROWN ); @@ -570,7 +574,7 @@ static PARAM_CFG_SETCOLOR ColorViaMicroViaCfg // Buried Via Color ( INSETUP, wxT( "CoViaMi" ), - &g_DesignSettings.m_ViaColor[VIA_MICROVIA], + ITEM_COLOR(VIA_MICROVIA_VISIBLE), CYAN ); @@ -586,7 +590,7 @@ static PARAM_CFG_SETCOLOR ColorCheveluCfg ( INSETUP, wxT( "CoRatsN" ), - &g_DesignSettings.m_RatsnestColor, + ITEM_COLOR(RATSNEST_VISIBLE), WHITE ); @@ -700,14 +704,6 @@ static PARAM_CFG_INT PrmMaxLinksShowed 0, 15 ); -static PARAM_CFG_BOOL ShowRatsnestCfg -( - INSETUP, - wxT( "ShowRat" ), - &g_Show_Ratsnest, - FALSE -); - static PARAM_CFG_BOOL ShowModuleRatsnestCfg ( INSETUP, @@ -813,7 +809,6 @@ PARAM_CFG_BASE* ParamCfgList[] = &TimeOutCfg, &DisplPolairCfg, &PrmMaxLinksShowed, - &ShowRatsnestCfg, &ShowModuleRatsnestCfg, &TwoSegmentTrackBuildCfg, diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 1ca8d286ec..8400b6a64d 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -11,6 +11,7 @@ #include "class_board_design_settings.h" #include "pcbplot.h" #include "printout_controler.h" +#include "colors_selection.h" #include "protos.h" @@ -111,7 +112,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */ { 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 ); GRFilledCircle( &m_ClipBox, aDC, pt_piste->m_Start.x, diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 65b8ccfb18..6d0afdcb0d 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -11,6 +11,7 @@ #include "pcbnew.h" #include "autorout.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "protos.h" @@ -157,7 +158,7 @@ void WinEDA_BasePcbFrame::Compile_Ratsnest( wxDC* DC, bool display_status_pcb ) Tst_Ratsnest( DC, 0 ); // Redraw the active ratsnest ( if enabled ) - if( g_Show_Ratsnest && DC ) + if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) && DC ) DrawGeneralRatsnest( DC, 0 ); if( display_status_pcb ) @@ -505,7 +506,7 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC ) // erase the ratsnest displayed on screen if needed 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; if( DC ) @@ -1002,18 +1003,18 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC ) if( ( m_Pcb->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK ) == 0 ) 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++ ) { RATSNEST_ITEM* rats = &m_Pcb->m_LocalRatsnest[ii]; 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 ); } else { - g_DesignSettings.m_RatsnestColor = tmpcolor; + g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, tmpcolor); wxPoint tmp = rats->m_PadStart->m_Pos; rats->m_PadStart->m_Pos -= g_Offset_Module; rats->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) ); @@ -1021,7 +1022,7 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC ) } } - g_DesignSettings.m_RatsnestColor = tmpcolor; + g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, tmpcolor); } diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 03201389f1..0d0a7a341b 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -8,6 +8,7 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "class_board_design_settings.h" +#include "colors_selection.h" #include "bitmaps.h" @@ -68,25 +69,25 @@ void WinEDA_PcbFrame::PrepareLayerIndicator() previous_Route_Layer_BOTTOM_color, previous_via_color; /* 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 ) { previous_active_layer_color = active_layer_color; 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 ) { previous_Route_Layer_TOP_color = Route_Layer_TOP_color; 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 ) { previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color; 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 ) { previous_via_color = via_color; diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index 3006a963bf..4a83290906 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -214,9 +214,9 @@ void WinEDA_PcbFrame::SetToolbars() m_CursorShape ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST, - g_Show_Ratsnest ); + GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ); m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST, - g_Show_Ratsnest ? + GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ? _( "Hide board ratsnest" ) : _( "Show board ratsnest" ) );