diff --git a/3d-viewer/3d_canvas/cinfo3d_visu.cpp b/3d-viewer/3d_canvas/cinfo3d_visu.cpp index ef7626d246..346f978403 100644 --- a/3d-viewer/3d_canvas/cinfo3d_visu.cpp +++ b/3d-viewer/3d_canvas/cinfo3d_visu.cpp @@ -33,7 +33,6 @@ #include <class_board.h> #include <3d_math.h> #include "3d_fastmath.h" -#include <colors_selection.h> /** * Trace mask used to enable or disable the trace output of this class. @@ -530,7 +529,7 @@ SFVEC3F CINFO3D_VISU::GetLayerColor( PCB_LAYER_ID aLayerId ) const { wxASSERT( aLayerId < PCB_LAYER_ID_COUNT ); - const COLOR4D color = g_ColorsSettings.GetLayerColor( aLayerId ); + const COLOR4D color = m_board->Colors().GetLayerColor( aLayerId ); return SFVEC3F( color.r, color.g, color.b ); } @@ -538,7 +537,7 @@ SFVEC3F CINFO3D_VISU::GetLayerColor( PCB_LAYER_ID aLayerId ) const SFVEC3F CINFO3D_VISU::GetItemColor( int aItemId ) const { - return GetColor( g_ColorsSettings.GetItemColor( aItemId ) ); + return GetColor( m_board->Colors().GetItemColor( aItemId ) ); } diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp index bab981c0a7..82e28890eb 100644 --- a/bitmap2component/bitmap2cmp_gui.cpp +++ b/bitmap2component/bitmap2cmp_gui.cpp @@ -31,7 +31,6 @@ #include <gestfich.h> #include <wildcards_and_files_ext.h> #include <bitmap_io.h> -#include <colors_selection.h> #include <build_version.h> #include <menus_helpers.h> #include <kiway.h> diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 2d30d24dd0..0d07554c18 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -280,6 +280,7 @@ set( COMMON_SRCS searchhelpfilefullpath.cpp search_stack.cpp selcolor.cpp + settings.cpp systemdirsappend.cpp trigo.cpp utf8.cpp diff --git a/common/class_colors_design_settings.cpp b/common/class_colors_design_settings.cpp index 38deb2bc5f..d3453c4e02 100644 --- a/common/class_colors_design_settings.cpp +++ b/common/class_colors_design_settings.cpp @@ -100,6 +100,13 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS() { m_LayersColors[dst] = COLOR4D( default_items_color[src++] ); } + + m_LayersColors[ LAYER_PCB_BACKGROUND ] = BLACK; + m_LayersColors[ LAYER_CURSOR ] = WHITE; + m_LayersColors[ LAYER_AUX_ITEMS ] = WHITE; + m_LayersColors[ LAYER_WORKSHEET ] = DARKRED; + + setupConfigParams(); } @@ -147,3 +154,46 @@ void COLORS_DESIGN_SETTINGS::SetAllColorsAs( COLOR4D aColor ) for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ ) m_LayersColors[ii] = aColor; } + +#define LOC_COLOR(layer) &m_LayersColors[layer] +#define ITEM_COLOR(item_visible) &m_LayersColors[item_visible] + +void COLORS_DESIGN_SETTINGS::setupConfigParams() +{ + wxASSERT( DIM( m_LayersColors ) >= PCB_LAYER_ID_COUNT ); + for( int i = 0; i<PCB_LAYER_ID_COUNT; ++i ) + { + wxString vn = wxString::Format( + wxT( "ColorPCBLayer_%s" ), + LSET::Name( PCB_LAYER_ID( i ) ) ); + + Add( vn, LOC_COLOR(i), m_LayersColors[i] ); + } + + Add( wxT( "ColorTxtFrontEx" ), ITEM_COLOR( LAYER_MOD_TEXT_FR ), LIGHTGRAY ); + Add( wxT( "ColorTxtBackEx" ), ITEM_COLOR( LAYER_MOD_TEXT_BK ), BLUE ); + Add( wxT( "ColorTxtInvisEx" ), ITEM_COLOR( LAYER_MOD_TEXT_INVISIBLE ), DARKGRAY ); + Add( wxT( "ColorPadBackEx" ), ITEM_COLOR( LAYER_PAD_BK ), GREEN ); + Add( wxT( "ColorAnchorEx" ), ITEM_COLOR( LAYER_ANCHOR ), BLUE ); + Add( wxT( "ColorPadFrontEx" ), ITEM_COLOR( LAYER_PAD_FR ), RED ); + Add( wxT( "ColorViaThruEx" ), ITEM_COLOR( LAYER_VIA_THROUGH ), LIGHTGRAY ); + Add( wxT( "ColorViaBBlindEx" ), ITEM_COLOR( LAYER_VIA_BBLIND ), BROWN ); + Add( wxT( "ColorViaMicroEx" ), ITEM_COLOR( LAYER_VIA_MICROVIA ), CYAN ); + Add( wxT( "ColorNonPlatedEx" ), ITEM_COLOR( LAYER_NON_PLATED ), YELLOW ); + Add( wxT( "ColorRatsEx" ), ITEM_COLOR( LAYER_RATSNEST ), WHITE ); + Add( wxT( "ColorPCBBackground" ), ITEM_COLOR( LAYER_PCB_BACKGROUND ), BLACK ); + Add( wxT( "ColorPCBCursor" ), ITEM_COLOR( LAYER_CURSOR ), WHITE ); + Add( wxT( "ColorAuxItems" ), ITEM_COLOR( LAYER_AUX_ITEMS ), WHITE ); + Add( wxT( "ColorWorksheet" ), ITEM_COLOR( LAYER_WORKSHEET ), DARKRED ); + +} + +void COLORS_DESIGN_SETTINGS::Load( wxConfigBase *aConfig ) +{ + SETTINGS::Load(aConfig); +} + +void COLORS_DESIGN_SETTINGS::Save( wxConfigBase *aConfig ) +{ + SETTINGS::Save(aConfig); +} diff --git a/common/class_layer_box_selector.cpp b/common/class_layer_box_selector.cpp index 3a8d4b7351..23e6cd9f25 100644 --- a/common/class_layer_box_selector.cpp +++ b/common/class_layer_box_selector.cpp @@ -23,7 +23,6 @@ */ #include <common.h> -#include <colors_selection.h> #include <layers_id_colors_and_visibility.h> #include <bitmaps.h> diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index 6a3d2d7bea..bcfb0d2b82 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -179,7 +179,9 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) try { m_gal->BeginDrawing(); - m_gal->ClearScreen( settings->GetBackgroundColor() ); + m_gal->SetClearColor( settings->GetBackgroundColor() ); + m_gal->SetCursorColor( settings->GetLayerColor( LAYER_CURSOR ) ); + m_gal->ClearScreen( ); KIGFX::COLOR4D gridColor = settings->GetLayerColor( LAYER_GRID ); m_gal->SetGridColor( gridColor ); diff --git a/common/gal/cairo/cairo_compositor.cpp b/common/gal/cairo/cairo_compositor.cpp index f8b7cf1e76..b0009e36ed 100644 --- a/common/gal/cairo/cairo_compositor.cpp +++ b/common/gal/cairo/cairo_compositor.cpp @@ -123,7 +123,7 @@ void CAIRO_COMPOSITOR::Begin() { } -void CAIRO_COMPOSITOR::ClearBuffer() +void CAIRO_COMPOSITOR::ClearBuffer( const COLOR4D& aColor ) { // Clear the pixel storage memset( m_buffers[m_current].bitmap.get(), 0x00, m_bufferSize * sizeof(int) ); diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index 1324811a0b..e0748818ad 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -381,10 +381,10 @@ void CAIRO_GAL::Flush() } -void CAIRO_GAL::ClearScreen( const COLOR4D& aColor ) +void CAIRO_GAL::ClearScreen( ) { - backgroundColor = aColor; - cairo_set_source_rgb( currentContext, aColor.r, aColor.g, aColor.b ); + backgroundColor = m_clearColor; + cairo_set_source_rgb( currentContext, backgroundColor.r, backgroundColor.g, backgroundColor.b ); cairo_rectangle( currentContext, 0.0, 0.0, screenSize.x, screenSize.y ); cairo_fill( currentContext ); } @@ -850,7 +850,7 @@ void CAIRO_GAL::ClearTarget( RENDER_TARGET aTarget ) break; } - compositor->ClearBuffer(); + compositor->ClearBuffer( COLOR4D::BLACK ); // Restore the previous state compositor->SetBuffer( currentBuffer ); @@ -1014,8 +1014,9 @@ void CAIRO_GAL::initSurface() cairo_set_antialias( context, CAIRO_ANTIALIAS_NONE ); + m_clearColor = backgroundColor; // Clear the screen - ClearScreen( backgroundColor ); + ClearScreen( ); // Compute the world <-> screen transformations ComputeWorldScreenMatrix(); diff --git a/common/gal/opengl/antialiasing.cpp b/common/gal/opengl/antialiasing.cpp index 13dabd6ff5..276b4d0646 100644 --- a/common/gal/opengl/antialiasing.cpp +++ b/common/gal/opengl/antialiasing.cpp @@ -24,6 +24,7 @@ #include <gal/opengl/antialiasing.h> #include <gal/opengl/opengl_compositor.h> #include <gal/opengl/utils.h> +#include <gal/color4d.h> #include <tuple> @@ -181,7 +182,7 @@ VECTOR2U ANTIALIASING_SUPERSAMPLING::GetInternalBufferSize() void ANTIALIASING_SUPERSAMPLING::Begin() { compositor->SetBuffer( ssaaMainBuffer ); - compositor->ClearBuffer(); + compositor->ClearBuffer( COLOR4D::BLACK ); } @@ -445,7 +446,7 @@ void ANTIALIASING_SMAA::DrawBuffer( GLuint buffer ) void ANTIALIASING_SMAA::Begin() { compositor->SetBuffer( smaaBaseBuffer ); - compositor->ClearBuffer(); + compositor->ClearBuffer( COLOR4D::BLACK ); } @@ -487,7 +488,7 @@ void ANTIALIASING_SMAA::Present() // pass 1: main-buffer -> smaaEdgesBuffer // compositor->SetBuffer( smaaEdgesBuffer ); - compositor->ClearBuffer(); + compositor->ClearBuffer( COLOR4D::BLACK ); glActiveTexture( GL_TEXTURE0 ); glBindTexture( GL_TEXTURE_2D, sourceTexture ); checkGlError( "binding colorTex" ); @@ -499,7 +500,7 @@ void ANTIALIASING_SMAA::Present() // pass 2: smaaEdgesBuffer -> smaaBlendBuffer // compositor->SetBuffer( smaaBlendBuffer ); - compositor->ClearBuffer(); + compositor->ClearBuffer( COLOR4D::BLACK ); auto edgesTex = compositor->GetBufferTexture( smaaEdgesBuffer ); @@ -518,7 +519,7 @@ void ANTIALIASING_SMAA::Present() // pass 3: colorTex + BlendBuffer -> output // compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING ); - compositor->ClearBuffer(); + compositor->ClearBuffer( COLOR4D::BLACK ); auto blendTex = compositor->GetBufferTexture( smaaBlendBuffer ); glActiveTexture( GL_TEXTURE0 ); diff --git a/common/gal/opengl/opengl_compositor.cpp b/common/gal/opengl/opengl_compositor.cpp index aeb5c76e00..8b7e3d1a70 100644 --- a/common/gal/opengl/opengl_compositor.cpp +++ b/common/gal/opengl/opengl_compositor.cpp @@ -31,6 +31,8 @@ #include <gal/opengl/opengl_compositor.h> #include <gal/opengl/utils.h> +#include <gal/color4d.h> + #include <stdexcept> #include <cassert> @@ -245,7 +247,7 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2U aDimensions ) return 0; } - ClearBuffer(); + ClearBuffer( COLOR4D::BLACK ); // Return to direct rendering (we were asked only to create a buffer, not switch to one) bindFb( DIRECT_RENDERING ); @@ -290,11 +292,11 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle ) } -void OPENGL_COMPOSITOR::ClearBuffer() +void OPENGL_COMPOSITOR::ClearBuffer( const COLOR4D& aColor ) { assert( m_initialized ); - glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); + glClearColor( aColor.r, aColor.g, aColor.b, 0.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); } diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 5634edb4e6..88347ca590 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -1145,11 +1145,11 @@ void OPENGL_GAL::Flush() } -void OPENGL_GAL::ClearScreen( const COLOR4D& aColor ) +void OPENGL_GAL::ClearScreen( ) { // Clear screen compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING ); - glClearColor( aColor.r, aColor.g, aColor.b, aColor.a ); + glClearColor( m_clearColor.r, m_clearColor.g, m_clearColor.b, m_clearColor.a ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); } @@ -1312,7 +1312,11 @@ void OPENGL_GAL::ClearTarget( RENDER_TARGET aTarget ) break; } - compositor->ClearBuffer(); + + if( aTarget != TARGET_OVERLAY ) + compositor->ClearBuffer( m_clearColor ); + else + compositor->ClearBuffer( COLOR4D::BLACK ); // Restore the previous state compositor->SetBuffer( oldTarget ); @@ -1675,6 +1679,7 @@ void OPENGL_GAL::blitCursor() const COLOR4D color( cColor.r * cColor.a, cColor.g * cColor.a, cColor.b * cColor.a, 1.0 ); + glActiveTexture( GL_TEXTURE0 ); glDisable( GL_TEXTURE_2D ); glLineWidth( 1.0 ); glColor4d( color.r, color.g, color.b, color.a ); diff --git a/common/preview_items/arc_assistant.cpp b/common/preview_items/arc_assistant.cpp index 43739a6665..7331b9d189 100644 --- a/common/preview_items/arc_assistant.cpp +++ b/common/preview_items/arc_assistant.cpp @@ -26,6 +26,7 @@ #include <preview_items/preview_utils.h> #include <gal/graphics_abstraction_layer.h> #include <view/view.h> +#include <pcb_painter.h> #include <common.h> #include <base_units.h> @@ -88,40 +89,47 @@ double angleIsSpecial( double aRadians ) } -static void drawLineWithHilight( KIGFX::GAL& aGal, +static void drawLineWithHilight( KIGFX::VIEW *aView, const VECTOR2I& aStart, const VECTOR2I& aEnd, bool aDim ) { + auto gal = aView->GetGAL(); + auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() ); + const auto vec = aEnd - aStart; - COLOR4D strokeColor = PreviewOverlayDefaultColor(); + COLOR4D strokeColor = rs->GetLayerColor( LAYER_AUX_ITEMS ); if( angleIsSpecial( vec.Angle() ) ) - strokeColor = PreviewOverlaySpecialAngleColor(); + strokeColor = rs->IsBackgroundDark() ? COLOR4D( 0.5, 1.0, 0.5, 1.0 ) : COLOR4D( 0.0, 0.7, 0.0, 1.0 ) ; - aGal.SetStrokeColor( strokeColor.WithAlpha( PreviewOverlayDeemphAlpha( aDim ) ) ); - aGal.DrawLine( aStart, aEnd ); + gal->SetStrokeColor( strokeColor.WithAlpha( PreviewOverlayDeemphAlpha( aDim ) ) ); + gal->DrawLine( aStart, aEnd ); } -static void drawArcWithHilight( KIGFX::GAL& aGal, +static void drawArcWithHilight( KIGFX::VIEW *aView, const VECTOR2I& aOrigin, double aRad, double aStartAngle, double aEndAngle ) { - COLOR4D color = PreviewOverlayDefaultColor(); + auto gal = aView->GetGAL(); + auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() ); + + auto color = rs->GetLayerColor( LAYER_AUX_ITEMS ); if( angleIsSpecial( aStartAngle - aEndAngle ) ) - color = PreviewOverlaySpecialAngleColor(); + color = rs->IsBackgroundDark() ? COLOR4D( 0.5, 1.0, 0.5, 1.0 ) : COLOR4D( 0.0, 0.7, 0.0, 1.0 ) ; - aGal.SetStrokeColor( color ); - aGal.SetFillColor( color.WithAlpha( 0.2 ) ); + gal->SetStrokeColor( color ); + gal->SetFillColor( color.WithAlpha( 0.2 ) ); // draw the angle reference arc - aGal.DrawArc( aOrigin, aRad, -aStartAngle, -aEndAngle ); + gal->DrawArc( aOrigin, aRad, -aStartAngle, -aEndAngle ); } void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const { auto& gal = *aView->GetGAL(); + auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() ); // not in a position to draw anything if( m_constructMan.IsReset() ) @@ -144,7 +152,7 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const // draw first radius line bool dimFirstLine = m_constructMan.GetStep() > ARC_GEOM_MANAGER::SET_START; - drawLineWithHilight( gal, origin, m_constructMan.GetStartRadiusEnd(), dimFirstLine ); + drawLineWithHilight( aView, origin, m_constructMan.GetStartRadiusEnd(), dimFirstLine ); std::vector<wxString> cursorStrings; @@ -156,11 +164,11 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const const auto angleRefLineEnd = m_constructMan.GetOrigin() + VECTOR2D( innerRad * 1.5, 0.0 ); - gal.SetStrokeColor( PreviewOverlayDefaultColor() ); + gal.SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ) ); gal.DrawLine( origin, angleRefLineEnd ); // draw the angle reference arc - drawArcWithHilight( gal, origin, innerRad, initAngle, 0.0 ); + drawArcWithHilight( aView, origin, innerRad, initAngle, 0.0 ); double degs = getNormDeciDegFromRad( initAngle ); @@ -169,18 +177,18 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const } else { - drawLineWithHilight( gal, origin, m_constructMan.GetEndRadiusEnd(), false ); + drawLineWithHilight( aView, origin, m_constructMan.GetEndRadiusEnd(), false ); auto start = m_constructMan.GetStartAngle(); auto subtended = m_constructMan.GetSubtended(); - drawArcWithHilight( gal, origin, innerRad, start, start + subtended ); + drawArcWithHilight( aView, origin, innerRad, start, start + subtended ); double subtendedDeg = getNormDeciDegFromRad( subtended ); double endAngleDeg = getNormDeciDegFromRad( start + subtended ); // draw dimmed extender line to cursor - drawLineWithHilight( gal, origin, m_constructMan.GetLastPoint(), true ); + drawLineWithHilight( aView, origin, m_constructMan.GetLastPoint(), true ); cursorStrings.push_back( DimensionLabel( "Δθ", subtendedDeg, DEGREES ) ); cursorStrings.push_back( DimensionLabel( "θ", endAngleDeg, DEGREES ) ); @@ -194,7 +202,7 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const } // place the text next to cursor, on opposite side from radius - DrawTextNextToCursor( gal, m_constructMan.GetLastPoint(), + DrawTextNextToCursor( aView, m_constructMan.GetLastPoint(), origin - m_constructMan.GetLastPoint(), cursorStrings ); } diff --git a/common/preview_items/centreline_rect_item.cpp b/common/preview_items/centreline_rect_item.cpp index b5c5cae39e..e2b71ce0c8 100644 --- a/common/preview_items/centreline_rect_item.cpp +++ b/common/preview_items/centreline_rect_item.cpp @@ -26,7 +26,7 @@ #include <preview_items/two_point_geom_manager.h> #include <gal/graphics_abstraction_layer.h> - +#include <view/view.h> using namespace KIGFX::PREVIEW; @@ -93,8 +93,10 @@ const BOX2I CENTRELINE_RECT_ITEM::ViewBBox() const } -void CENTRELINE_RECT_ITEM::drawPreviewShape( KIGFX::GAL& aGal ) const +void CENTRELINE_RECT_ITEM::drawPreviewShape( KIGFX::VIEW* aView ) const { - aGal.DrawLine( m_geomMgr.GetOrigin(), m_geomMgr.GetEnd() ); - aGal.DrawPolygon( getOutline() ); + auto& gal = *aView->GetGAL(); + + gal.DrawLine( m_geomMgr.GetOrigin(), m_geomMgr.GetEnd() ); + gal.DrawPolygon( getOutline() ); } diff --git a/common/preview_items/polygon_item.cpp b/common/preview_items/polygon_item.cpp index 08da8c70de..7185a5aa6d 100644 --- a/common/preview_items/polygon_item.cpp +++ b/common/preview_items/polygon_item.cpp @@ -27,6 +27,7 @@ #include <gal/graphics_abstraction_layer.h> #include <view/view.h> +#include <pcb_painter.h> using namespace KIGFX::PREVIEW; @@ -59,14 +60,17 @@ void POLYGON_ITEM::SetPoints( const std::vector<VECTOR2I>& aLockedPts, } -void POLYGON_ITEM::drawPreviewShape( KIGFX::GAL& aGal ) const +void POLYGON_ITEM::drawPreviewShape( KIGFX::VIEW* aView ) const { - aGal.DrawPolyline( m_lockedChain ); - aGal.DrawPolygon( m_polyfill ); + auto& gal = *aView->GetGAL(); + auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() ); + + gal.DrawPolyline( m_lockedChain ); + gal.DrawPolygon( m_polyfill ); // draw the leader line in a different color - aGal.SetStrokeColor( PreviewOverlayDefaultColor() ); - aGal.DrawPolyline( m_leaderChain ); + gal.SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ) ); + gal.DrawPolyline( m_leaderChain ); } diff --git a/common/preview_items/preview_utils.cpp b/common/preview_items/preview_utils.cpp index 7479c7dcb5..897cd5afbf 100644 --- a/common/preview_items/preview_utils.cpp +++ b/common/preview_items/preview_utils.cpp @@ -24,19 +24,8 @@ #include <preview_items/preview_utils.h> #include <gal/graphics_abstraction_layer.h> #include <base_units.h> - - -COLOR4D KIGFX::PREVIEW::PreviewOverlayDefaultColor() -{ - return COLOR4D( 1.0, 1.0, 1.0, 1.0 ); -} - - -double KIGFX::PREVIEW::PreviewOverlayFillAlpha() -{ - return 0.2; -} - +#include <pcb_painter.h> +#include <view/view.h> double KIGFX::PREVIEW::PreviewOverlayDeemphAlpha( bool aDeemph ) { @@ -44,12 +33,6 @@ double KIGFX::PREVIEW::PreviewOverlayDeemphAlpha( bool aDeemph ) } -COLOR4D KIGFX::PREVIEW::PreviewOverlaySpecialAngleColor() -{ - return COLOR4D( 0.5, 1.0, 0.5, 1.0 ); -} - - static wxString getDimensionUnit( EDA_UNITS_T aUnits ) { switch( aUnits ) @@ -129,11 +112,13 @@ void KIGFX::PREVIEW::SetConstantGlyphHeight( KIGFX::GAL& aGal, double aHeight ) } -void KIGFX::PREVIEW::DrawTextNextToCursor( KIGFX::GAL& aGal, +void KIGFX::PREVIEW::DrawTextNextToCursor( KIGFX::VIEW* aView, const VECTOR2D& aCursorPos, const VECTOR2D& aTextQuadrant, const std::vector<wxString>& aStrings ) { - auto glyphSize = aGal.GetGlyphSize(); + auto gal = aView->GetGAL(); + auto glyphSize = gal->GetGlyphSize(); + auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() ); const auto lineSpace = glyphSize.y * 0.2; auto linePitch = glyphSize.y + lineSpace; @@ -151,23 +136,23 @@ void KIGFX::PREVIEW::DrawTextNextToCursor( KIGFX::GAL& aGal, if( aTextQuadrant.x < 0 ) { - aGal.SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); - textPos.x += 15.0 / aGal.GetWorldScale(); + gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); + textPos.x += 15.0 / gal->GetWorldScale(); } else { - aGal.SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); - textPos.x -= 15.0 / aGal.GetWorldScale(); + gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); + textPos.x -= 15.0 / gal->GetWorldScale(); } - aGal.SetStrokeColor( PreviewOverlayDefaultColor().WithAlpha( + gal->SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ).WithAlpha( PreviewOverlayDeemphAlpha( true ) ) ); - aGal.SetIsFill( false ); + gal->SetIsFill( false ); // write strings top-to-bottom for( const auto& str : aStrings ) { textPos.y += linePitch; - aGal.BitmapText( str, textPos, 0.0 ); + gal->BitmapText( str, textPos, 0.0 ); } } diff --git a/common/preview_items/ruler_item.cpp b/common/preview_items/ruler_item.cpp index 76f3c3bd27..8afee9f163 100644 --- a/common/preview_items/ruler_item.cpp +++ b/common/preview_items/ruler_item.cpp @@ -27,6 +27,7 @@ #include <gal/graphics_abstraction_layer.h> #include <layers_id_colors_and_visibility.h> #include <view/view.h> +#include <pcb_painter.h> #include <base_units.h> #include <common.h> @@ -38,7 +39,7 @@ static const double midTickLengthFactor = 1.5; static const double majorTickLengthFactor = 2.5; -static void drawCursorStrings( KIGFX::GAL& aGal, const VECTOR2D& aCursor, +static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor, const VECTOR2D& aRulerVec ) { // draw the cursor labels @@ -56,7 +57,7 @@ static void drawCursorStrings( KIGFX::GAL& aGal, const VECTOR2D& aCursor, } auto temp = aRulerVec; - DrawTextNextToCursor( aGal, aCursor, -temp, cursorStrings ); + DrawTextNextToCursor( aView, aCursor, -temp, cursorStrings ); } @@ -117,13 +118,14 @@ static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace ) * @param aLine line vector * @param aMinorTickLen length of minor ticks in IU */ -void drawTicksAlongLine( KIGFX::GAL& aGal, const VECTOR2D& aOrigin, +void drawTicksAlongLine( KIGFX::VIEW *aView, const VECTOR2D& aOrigin, const VECTOR2D& aLine, double aMinorTickLen ) { VECTOR2D tickLine = aLine.Rotate( -M_PI_2 ); - + auto gal = aView->GetGAL(); double tickSpace; - TICK_FORMAT tickF = getTickFormatForScale( aGal.GetWorldScale(), tickSpace ); + TICK_FORMAT tickF = getTickFormatForScale( gal->GetWorldScale(), tickSpace ); + auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() ); // number of ticks in whole ruler int numTicks = (int) std::ceil( aLine.EuclideanNorm() / tickSpace ); @@ -133,16 +135,16 @@ void drawTicksAlongLine( KIGFX::GAL& aGal, const VECTOR2D& aOrigin, if( aLine.Angle() > 0 ) { - aGal.SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); + gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); } else { - aGal.SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); + gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); labelAngle += M_PI; } // text and ticks are dimmed - aGal.SetStrokeColor( PreviewOverlayDefaultColor().WithAlpha( PreviewOverlayDeemphAlpha( true ) ) ); + gal->SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ).WithAlpha( PreviewOverlayDeemphAlpha( true ) ) ); const auto labelOffset = tickLine.Resize( aMinorTickLen * ( majorTickLengthFactor + 1 ) ); @@ -164,7 +166,7 @@ void drawTicksAlongLine( KIGFX::GAL& aGal, const VECTOR2D& aOrigin, length *= midTickLengthFactor; } - aGal.DrawLine( tickPos, tickPos + tickLine.Resize( length ) ); + gal->DrawLine( tickPos, tickPos + tickLine.Resize( length ) ); if( drawLabel ) { @@ -173,7 +175,7 @@ void drawTicksAlongLine( KIGFX::GAL& aGal, const VECTOR2D& aOrigin, // FIXME: spaces choke OpenGL lp:1668455 label.erase( std::remove( label.begin(), label.end(), ' ' ), label.end() ); - aGal.BitmapText( label, tickPos + labelOffset, labelAngle ); + gal->BitmapText( label, tickPos + labelOffset, labelAngle ); } } } @@ -230,6 +232,7 @@ void RULER_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const { auto& gal = *aView->GetGAL(); + auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() ); const auto origin = m_geomMgr.GetOrigin(); const auto end = m_geomMgr.GetEnd(); @@ -237,7 +240,7 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const gal.SetLineWidth( 1.0 ); gal.SetIsStroke( true ); gal.SetIsFill( false ); - gal.SetStrokeColor( PreviewOverlayDefaultColor() ); + gal.SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ) ); gal.ResetTextAttributes(); @@ -249,7 +252,7 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const // constant text size on screen SetConstantGlyphHeight( gal, 12.0 ); - drawCursorStrings( gal, end, rulerVec ); + drawCursorStrings( aView, end, rulerVec ); // tick label size SetConstantGlyphHeight( gal, 10.0 ); @@ -257,9 +260,9 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const // basic tick size const double minorTickLen = 5.0 / gal.GetWorldScale(); - drawTicksAlongLine( gal, origin, rulerVec, minorTickLen ); + drawTicksAlongLine( aView, origin, rulerVec, minorTickLen ); - gal.SetStrokeColor( PreviewOverlayDefaultColor().WithAlpha( PreviewOverlayDeemphAlpha( true ) ) ); + gal.SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ).WithAlpha( PreviewOverlayDeemphAlpha( true ) ) ); drawBacksideTicks( gal, origin, rulerVec, minorTickLen * majorTickLengthFactor, 2 ); // draw the back of the origin "crosshair" diff --git a/common/preview_items/selection_area.cpp b/common/preview_items/selection_area.cpp index 6038640925..7cb5f48e8e 100644 --- a/common/preview_items/selection_area.cpp +++ b/common/preview_items/selection_area.cpp @@ -26,23 +26,44 @@ #include <gal/graphics_abstraction_layer.h> #include <view/view.h> +#include <pcb_painter.h> using namespace KIGFX::PREVIEW; -// Selection area colours -const COLOR4D SELECT_MODE_NORMAL( 0.3, 0.3, 0.7, 0.3 ); // Slight blue -const COLOR4D SELECT_MODE_ADDITIVE( 0.3, 0.7, 0.3, 0.3 ); // Slight green -const COLOR4D SELECT_MODE_SUBTRACT( 0.7, 0.3, 0.3, 0.3 ); // Slight red +struct SELECTION_COLORS +{ + COLOR4D normal; + COLOR4D additive; + COLOR4D subtract; + COLOR4D outline_l2r; + COLOR4D outline_r2l; +}; + +static const SELECTION_COLORS selectionColorScheme[2] = { + { // dark background + COLOR4D( 0.3, 0.3, 0.7, 0.3 ), // Slight blue + COLOR4D( 0.3, 0.7, 0.3, 0.3 ), // Slight green + COLOR4D( 0.7, 0.3, 0.3, 0.3 ), // Slight red + + COLOR4D( 1.0, 1.0, 0.4, 1.0 ), // yellow + COLOR4D( 0.4, 0.4, 1.0, 1.0 ) // blue + }, + { // bright background + COLOR4D( 0.5, 0.3, 1.0, 0.5 ), // Slight blue + COLOR4D( 0.5, 1.0, 0.5, 0.5 ), // Slight green + COLOR4D( 1.0, 0.5, 0.5, 0.5 ), // Slight red + + COLOR4D( 0.7, 0.7, 0.0, 1.0 ), // yellow + COLOR4D( 0.1, 0.1, 1.0, 1.0 ) // blue + } +}; -const COLOR4D SELECT_OUTLINE_L2R( 1.0, 1.0, 0.4, 1.0 ); -const COLOR4D SELECT_OUTLINE_R2L( 0.4, 0.4, 1.0, 1.0 ); SELECTION_AREA::SELECTION_AREA() : m_additive( false ), m_subtractive( false ) { - SetStrokeColor( SELECT_OUTLINE_L2R ); - SetFillColor( SELECT_MODE_NORMAL ); + } @@ -74,26 +95,33 @@ const BOX2I SELECTION_AREA::ViewBBox() const return tmp; } - -void SELECTION_AREA::drawPreviewShape( KIGFX::GAL& aGal ) const +void SELECTION_AREA::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const { + auto& gal = *aView->GetGAL(); + + auto rs = static_cast<PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() ); + + const auto& scheme = rs->IsBackgroundDark() ? selectionColorScheme[0] : selectionColorScheme[1]; + // Set the fill of the selection rectangle // based on the selection mode if( m_additive ) { - aGal.SetFillColor( SELECT_MODE_ADDITIVE ); + gal.SetFillColor( scheme.additive ); } else if( m_subtractive ) { - aGal.SetFillColor( SELECT_MODE_SUBTRACT ); + gal.SetFillColor( scheme.subtract ); } else { - aGal.SetFillColor( SELECT_MODE_NORMAL ); + gal.SetFillColor( scheme.normal ); } - // Set the stroke color to indicate window or crossing selection - aGal.SetStrokeColor( ( m_origin.x <= m_end.x ) ? SELECT_OUTLINE_L2R : SELECT_OUTLINE_R2L ); + gal.SetIsStroke( true ); + gal.SetIsFill( true ); - aGal.DrawRectangle( m_origin, m_end ); + // Set the stroke color to indicate window or crossing selection + gal.SetStrokeColor( ( m_origin.x <= m_end.x ) ? scheme.outline_l2r : scheme.outline_r2l ); + gal.DrawRectangle( m_origin, m_end ); } diff --git a/common/preview_items/simple_overlay_item.cpp b/common/preview_items/simple_overlay_item.cpp index 32b1de5da7..e1b5f0c26a 100644 --- a/common/preview_items/simple_overlay_item.cpp +++ b/common/preview_items/simple_overlay_item.cpp @@ -44,7 +44,7 @@ void SIMPLE_OVERLAY_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const auto& gal = *aView->GetGAL(); setupGal( gal ); - drawPreviewShape( gal ); + drawPreviewShape( aView ); } diff --git a/include/colors_selection.h b/common/settings.cpp similarity index 56% rename from include/colors_selection.h rename to common/settings.cpp index d0bd568f9e..8b64b82e47 100644 --- a/include/colors_selection.h +++ b/common/settings.cpp @@ -1,8 +1,7 @@ /* - * This program source code file is part of KiCad, a free EDA CAD application. + * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 2010-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2017 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,13 +21,30 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/* colors_selection.h */ +#include <core/settings.h> -#ifndef _COLORS_SELECTION_H_ -#define _COLORS_SELECTION_H_ +void SETTINGS::Load( wxConfigBase *aConfig ) +{ + for( const PARAM_CFG_BASE& param : m_params ) + { + if( !!param.m_Group ) + aConfig->SetPath( param.m_Group ); + else + aConfig->SetPath( wxT("") ); -#include <class_colors_design_settings.h> -// Colors for layers and items -extern COLORS_DESIGN_SETTINGS g_ColorsSettings; + param.ReadParam( aConfig ); + } +} -#endif // _COLORS_SELECTION_H_ +void SETTINGS::Save( wxConfigBase *aConfig ) +{ + for( PARAM_CFG_BASE& param : m_params ) + { + if( !!param.m_Group ) + aConfig->SetPath( param.m_Group ); + else + aConfig->SetPath( wxT("") ); + + param.SaveParam( aConfig ); + } +} diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index 0c7508a5f1..832e2e50bf 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -36,6 +36,7 @@ set( CVPCB_DIALOGS set( CVPCB_SRCS ../common/base_units.cpp ../pcbnew/board_items_to_polygon_shape_transform.cpp + ../pcbnew/pcb_general_settings.cpp ../pcbnew/class_drc_item.cpp autosel.cpp cfg.cpp diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index fc28d59655..056add7f67 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -432,7 +432,7 @@ void DISPLAY_FOOTPRINTS_FRAME::SetGridVisibility(bool aVisible) } -COLOR4D DISPLAY_FOOTPRINTS_FRAME::GetGridColor() const +COLOR4D DISPLAY_FOOTPRINTS_FRAME::GetGridColor() { return COLOR4D( DARKGRAY ); } diff --git a/cvpcb/class_DisplayFootprintsFrame.h b/cvpcb/class_DisplayFootprintsFrame.h index e82f61ae19..7b674cb16e 100644 --- a/cvpcb/class_DisplayFootprintsFrame.h +++ b/cvpcb/class_DisplayFootprintsFrame.h @@ -87,7 +87,7 @@ public: * Function GetGridColor() , virtual * @return the color of the grid */ - virtual COLOR4D GetGridColor() const override; + virtual COLOR4D GetGridColor() override; void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override; void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override; diff --git a/cvpcb/cvpcb.cpp b/cvpcb/cvpcb.cpp index 5d65456b81..f87aa23d1f 100644 --- a/cvpcb/cvpcb.cpp +++ b/cvpcb/cvpcb.cpp @@ -38,7 +38,6 @@ #include <cvpcb.h> #include <zones.h> #include <cvpcb_mainframe.h> -#include <colors_selection.h> #include <cvpcb_id.h> #include <build_version.h> diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt index 060afeec6e..ffbde6a668 100644 --- a/gerbview/CMakeLists.txt +++ b/gerbview/CMakeLists.txt @@ -71,6 +71,8 @@ set( GERBVIEW_EXTRA_SRCS ../common/eda_text.cpp ../common/class_layer_box_selector.cpp ../common/class_page_info.cpp + ../common/lset.cpp + ../common/settings.cpp ../pcbnew/layer_widget.cpp ) diff --git a/gerbview/class_gbr_layer_box_selector.cpp b/gerbview/class_gbr_layer_box_selector.cpp index 7ebb47d14d..7ae5b7aaae 100644 --- a/gerbview/class_gbr_layer_box_selector.cpp +++ b/gerbview/class_gbr_layer_box_selector.cpp @@ -30,7 +30,6 @@ */ #include <common.h> -#include <colors_selection.h> #include <gerbview_frame.h> #include <class_gerber_file_image_list.h> diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp index 2d7b4b4005..75c1ceacab 100644 --- a/gerbview/gerbview_config.cpp +++ b/gerbview/gerbview_config.cpp @@ -34,7 +34,6 @@ #include <common.h> #include <class_drawpanel.h> #include <config_params.h> -#include <colors_selection.h> #include <gerbview.h> #include <gerbview_frame.h> diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 85d99b6929..0853de3552 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -34,7 +34,6 @@ #include <build_version.h> #include <trigo.h> #include <base_units.h> -#include <colors_selection.h> #include <class_gbr_layer_box_selector.h> #include <msgpanel.h> #include <bitmaps.h> @@ -607,7 +606,7 @@ bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const } -COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible ) const +COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible ) { COLOR4D color = COLOR4D::UNSPECIFIED; @@ -659,7 +658,7 @@ void GERBVIEW_FRAME::SetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible, } } -COLOR4D GERBVIEW_FRAME::GetNegativeItemsColor() const +COLOR4D GERBVIEW_FRAME::GetNegativeItemsColor() { if( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) ) return GetVisibleElementColor( LAYER_NEGATIVE_OBJECTS ); diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 6819fb2331..31f23e9fb0 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -40,6 +40,9 @@ #include <class_gbr_screen.h> #include <class_page_info.h> #include <class_gbr_display_options.h> +#include <class_colors_design_settings.h> + +extern COLORS_DESIGN_SETTINGS g_ColorsSettings; #define NO_AVAILABLE_LAYERS UNDEFINED_LAYER @@ -335,7 +338,7 @@ public: * Function GetVisibleElementColor * returns the color of a gerber visible element. */ - COLOR4D GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible ) const; + COLOR4D GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible ); void SetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible, COLOR4D aColor ); @@ -357,7 +360,7 @@ public: * This is usually the background color, but can be an other color * in order to see negative objects */ - COLOR4D GetNegativeItemsColor() const; + COLOR4D GetNegativeItemsColor(); /** * Function DisplayLinesSolidMode diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h index aa0ffc0bf7..633a9ba7ca 100644 --- a/include/class_colors_design_settings.h +++ b/include/class_colors_design_settings.h @@ -31,14 +31,20 @@ #define COLORS_DESIGN_SETTING_H #include <gal/color4d.h> #include <layers_id_colors_and_visibility.h> +#include <core/settings.h> using KIGFX::COLOR4D; +class wxConfigBase; +class wxString; + +class PARAM_CFG_ARRAY; + /** * Class COLORS_DESIGN_SETTINGS * is a list of color settings for designs in Eeschema, Pcbnew and GerbView */ -class COLORS_DESIGN_SETTINGS +class COLORS_DESIGN_SETTINGS : public SETTINGS { public: // Color options for screen display of the Printed Board and schematic: @@ -49,6 +55,8 @@ public: public: COLORS_DESIGN_SETTINGS(); + virtual void Load( wxConfigBase *aConfig ); + virtual void Save( wxConfigBase *aConfig ); /** * Function GetLayerColor * @return the color for aLayer which is one of the layer indices given @@ -83,6 +91,11 @@ public: * Usefull to create a monochrome color selection for printing purpose */ void SetAllColorsAs( COLOR4D aColor ); + +private: + + void setupConfigParams(); + }; #endif // COLORS_DESIGN_SETTING_H diff --git a/include/core/settings.h b/include/core/settings.h new file mode 100644 index 0000000000..485c1b68fc --- /dev/null +++ b/include/core/settings.h @@ -0,0 +1,118 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015 CERN + * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#ifndef __SETTINGS_H +#define __SETTINGS_H + +#include <wx/confbase.h> +#include <config_params.h> + + +/** + * Class TOOL_SETTINGS + * + * Manages persistent settings for a tool (just a simple wrapper to wxConfigBase) + */ +class SETTINGS +{ + public: + SETTINGS() + {} + + ~SETTINGS() + {} + + void SetConfigPrefix ( const wxString& aPrefix ) + { + m_prefix = aPrefix; + } + + virtual void Load( wxConfigBase *aConfig ); + virtual void Save( wxConfigBase *aConfig ); + + #if 0 + template<class T> + T Get( const wxString& aName, T aDefaultValue ) const + { + wxConfigBase* config = getConfigBase(); + + if( !config ) + return aDefaultValue; + + T tmp = aDefaultValue; + + config->Read( getKeyName( aName ), &tmp ); + return tmp; + } + + template<class T> + void Set( const wxString& aName, const T &aValue ) + { + wxConfigBase* config = getConfigBase(); + + if( !config ) + return; + + config->Write( getKeyName( aName ), aValue ); + } + #endif + + + void Add ( const wxString& name, int* aPtr, int aDefaultValue ) + { + m_params.push_back ( new PARAM_CFG_INT ( name, aPtr, aDefaultValue ) ); + } + + void Add ( const wxString& name, bool* aPtr, bool aDefaultValue ) + { + m_params.push_back ( new PARAM_CFG_BOOL ( name, aPtr, aDefaultValue ) ); + } + + void Add ( const wxString& name, KIGFX::COLOR4D* aPtr, KIGFX::COLOR4D aDefaultValue ) + { + m_params.push_back ( new PARAM_CFG_SETCOLOR ( name, aPtr, aDefaultValue ) ); + } + + void Add ( const wxString& name, KIGFX::COLOR4D* aPtr, EDA_COLOR_T aDefaultValue ) + { + m_params.push_back ( new PARAM_CFG_SETCOLOR ( name, aPtr, aDefaultValue ) ); + } + + + protected: + + virtual wxString getKeyName( const wxString& aEntryName ) const + { + return aEntryName; + } + + private: + wxString m_prefix; + PARAM_CFG_ARRAY m_params; +}; + + + +#endif diff --git a/include/draw_frame.h b/include/draw_frame.h index 6c27e616d0..842d920639 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -445,7 +445,7 @@ public: * Function GetGridColor() , virtual * @return the color of the grid */ - virtual COLOR4D GetGridColor() const + virtual COLOR4D GetGridColor() { return m_gridColor; } diff --git a/include/gal/cairo/cairo_compositor.h b/include/gal/cairo/cairo_compositor.h index 3b3fb92bbe..a21cd123c3 100644 --- a/include/gal/cairo/cairo_compositor.h +++ b/include/gal/cairo/cairo_compositor.h @@ -66,7 +66,7 @@ public: virtual void Begin() override; /// @copydoc COMPOSITOR::ClearBuffer() - virtual void ClearBuffer() override; + virtual void ClearBuffer( const COLOR4D& aColor ) override; /// @copydoc COMPOSITOR::DrawBuffer() virtual void DrawBuffer( unsigned int aBufferHandle ) override; diff --git a/include/gal/cairo/cairo_gal.h b/include/gal/cairo/cairo_gal.h index f86b5bfaf7..fe2d2c462e 100644 --- a/include/gal/cairo/cairo_gal.h +++ b/include/gal/cairo/cairo_gal.h @@ -150,7 +150,7 @@ public: virtual void Flush() override; /// @copydoc GAL::ClearScreen() - virtual void ClearScreen( const COLOR4D& aColor ) override; + virtual void ClearScreen( ) override; // ----------------- // Attribute setting diff --git a/include/gal/compositor.h b/include/gal/compositor.h index 48f60551a1..9e68397efc 100644 --- a/include/gal/compositor.h +++ b/include/gal/compositor.h @@ -34,6 +34,8 @@ namespace KIGFX { +class COLOR4D; + class COMPOSITOR { public: @@ -91,7 +93,7 @@ public: * Function ClearBuffer() * clears the selected buffer (set by the SetBuffer() function). */ - virtual void ClearBuffer() = 0; + virtual void ClearBuffer( const COLOR4D& aColor ) = 0; /** * Function Begin() diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h index 1cac4e9288..9de7344127 100644 --- a/include/gal/graphics_abstraction_layer.h +++ b/include/gal/graphics_abstraction_layer.h @@ -198,11 +198,21 @@ public: /// @brief Force all remaining objects to be drawn. virtual void Flush() {}; + void SetClearColor( const COLOR4D& aColor ) + { + m_clearColor = aColor; + } + + const COLOR4D& GetClearColor( ) const + { + return m_clearColor; + } + /** * @brief Clear the screen. * @param aColor is the color used for clearing. */ - virtual void ClearScreen( const COLOR4D& aColor ) {}; + virtual void ClearScreen() {}; // ----------------- // Attribute setting @@ -988,6 +998,7 @@ protected: COLOR4D fillColor; ///< The fill color COLOR4D strokeColor; ///< The color of the outlines + COLOR4D m_clearColor; double layerDepth; ///< The actual layer depth VECTOR2D depthRange; ///< Range of the depth diff --git a/include/gal/opengl/opengl_compositor.h b/include/gal/opengl/opengl_compositor.h index 2c22de59cd..c549209e14 100644 --- a/include/gal/opengl/opengl_compositor.h +++ b/include/gal/opengl/opengl_compositor.h @@ -68,7 +68,7 @@ public: } /// @copydoc COMPOSITOR::ClearBuffer() - virtual void ClearBuffer() override; + virtual void ClearBuffer( const COLOR4D& aColor ) override; /// @copydoc COMPOSITOR::DrawBuffer() virtual void DrawBuffer( unsigned int aBufferHandle ) override; diff --git a/include/gal/opengl/opengl_gal.h b/include/gal/opengl/opengl_gal.h index 6aa7e67382..6a2b189d68 100644 --- a/include/gal/opengl/opengl_gal.h +++ b/include/gal/opengl/opengl_gal.h @@ -171,7 +171,7 @@ public: virtual void Flush() override; /// @copydoc GAL::ClearScreen() - virtual void ClearScreen( const COLOR4D& aColor ) override; + virtual void ClearScreen( ) override; // -------------- // Transformation diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index c2f39895f1..a3ee7f36d8 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -193,6 +193,9 @@ enum GAL_LAYER_ID: int LAYER_DRC, ///< drc markers LAYER_WORKSHEET, ///< worksheet frame LAYER_GP_OVERLAY, ///< general purpose overlay + LAYER_PCB_BACKGROUND, ///< PCB background color + LAYER_CURSOR, ///< PCB cursor + LAYER_AUX_ITEMS, ///< Auxillary items (guides, rulre, etc) /// This is the end of the layers used for visibility bitmasks in Pcbnew /// There can be at most 32 layers above here. diff --git a/include/preview_items/centreline_rect_item.h b/include/preview_items/centreline_rect_item.h index 5c6bbf8028..b75a4b5ae2 100644 --- a/include/preview_items/centreline_rect_item.h +++ b/include/preview_items/centreline_rect_item.h @@ -33,6 +33,7 @@ namespace KIGFX { class GAL; +class VIEW; namespace PREVIEW { @@ -64,7 +65,7 @@ private: SHAPE_POLY_SET getOutline() const; ///> Draw rectangle and centre line onto GAL - void drawPreviewShape( KIGFX::GAL& aGal ) const override; + void drawPreviewShape( KIGFX::VIEW* aView ) const override; const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr; diff --git a/include/preview_items/polygon_item.h b/include/preview_items/polygon_item.h index 00560e4add..480f6595f8 100644 --- a/include/preview_items/polygon_item.h +++ b/include/preview_items/polygon_item.h @@ -33,6 +33,7 @@ namespace KIGFX { class GAL; +class VIEW; namespace PREVIEW { @@ -67,7 +68,7 @@ public: private: ///> Draw rectangle and centre line onto GAL - void drawPreviewShape( KIGFX::GAL& aGal ) const override; + void drawPreviewShape( KIGFX::VIEW* aView ) const override; ///> complete polyline of locked in and leader points SHAPE_LINE_CHAIN m_lockedChain, m_leaderChain; diff --git a/include/preview_items/preview_utils.h b/include/preview_items/preview_utils.h index 24d3f190c0..d16414170c 100644 --- a/include/preview_items/preview_utils.h +++ b/include/preview_items/preview_utils.h @@ -31,30 +31,17 @@ namespace KIGFX { class GAL; +class VIEW; namespace PREVIEW { -/** - * The default fill/stroke color of preview overlay items - */ -COLOR4D PreviewOverlayDefaultColor(); - -/** - * The default alpha of overlay fills - */ -double PreviewOverlayFillAlpha(); - /** * Default alpha of "de-emphasised" features (like previously locked-in * lines */ double PreviewOverlayDeemphAlpha( bool aDeemph = true ); -/** - * The colour of "special" angle overlay features - */ -COLOR4D PreviewOverlaySpecialAngleColor(); /** * Get a formatted string showing a dimension to a sane precision @@ -81,7 +68,7 @@ void SetConstantGlyphHeight( KIGFX::GAL& aGal, double aHeight ); * text in * @param aStrings list of strings to draw, top to bottom */ -void DrawTextNextToCursor( KIGFX::GAL& aGal, +void DrawTextNextToCursor( KIGFX::VIEW* aView, const VECTOR2D& aCursorPos, const VECTOR2D& aTextQuadrant, const std::vector<wxString>& aStrings ); diff --git a/include/preview_items/selection_area.h b/include/preview_items/selection_area.h index a2b1db2059..d2dd1aef25 100644 --- a/include/preview_items/selection_area.h +++ b/include/preview_items/selection_area.h @@ -86,17 +86,13 @@ public: void SetAdditive( bool aAdditive ); void SetSubtractive( bool aSubtractive ); + void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final; private: bool m_additive; bool m_subtractive; - /** - * Draw the selection rectangle onto the GAL - */ - void drawPreviewShape( KIGFX::GAL& aGal ) const override; - VECTOR2I m_origin, m_end; }; diff --git a/include/preview_items/simple_overlay_item.h b/include/preview_items/simple_overlay_item.h index 37f358189d..5ae64d961b 100644 --- a/include/preview_items/simple_overlay_item.h +++ b/include/preview_items/simple_overlay_item.h @@ -69,7 +69,7 @@ public: * or direct access to the VIEW, you probably should make a new * class. */ - void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final; + void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override; #if defined(DEBUG) @@ -123,7 +123,7 @@ private: * Subclasses should implement this in terms of their own graphical * data. */ - virtual void drawPreviewShape( KIGFX::GAL& aGal ) const = 0; + virtual void drawPreviewShape( KIGFX::VIEW* aView ) const { }; COLOR4D m_fillColor; diff --git a/include/tool/tool_settings.h b/include/tool/tool_settings.h index 64d26126c3..a3a5909997 100644 --- a/include/tool/tool_settings.h +++ b/include/tool/tool_settings.h @@ -26,7 +26,7 @@ #ifndef __TOOL_SETTINGS_H #define __TOOL_SETTINGS_H -#include <wx/confbase.h> +#include <core/settings.h> /** * Class TOOL_SETTINGS @@ -35,7 +35,7 @@ */ class TOOL_BASE; -class TOOL_SETTINGS +class TOOL_SETTINGS : public SETTINGS { public: TOOL_SETTINGS( TOOL_BASE* aTool = NULL ); diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 0c7f9f6bc7..888e69a0dd 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -43,6 +43,8 @@ #include <pcbstruct.h> #include <class_draw_panel_gal.h> +#include <pcb_general_settings.h> + /* Forward declarations of classes. */ class BOARD; class BOARD_CONNECTED_ITEM; @@ -58,6 +60,7 @@ class ZONE_SETTINGS; class PCB_PLOT_PARAMS; class FP_LIB_TABLE; class LIB_ID; +class PCB_GENERAL_SETTINGS ; /** * class PCB_BASE_FRAME @@ -76,6 +79,7 @@ public: protected: BOARD* m_Pcb; GENERAL_COLLECTOR* m_Collector; + PCB_GENERAL_SETTINGS m_configSettings; /// Auxiliary tool bar typically shown below the main tool bar at the top of the /// main window. @@ -702,6 +706,17 @@ public: */ bool SaveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ); + PCB_GENERAL_SETTINGS& Settings() + { + return m_configSettings; + } + + const PCB_GENERAL_SETTINGS& CSettings() const + { + return m_configSettings; + } + + ///> Key in KifaceSettings to store the canvas type. static const wxChar CANVAS_TYPE_KEY[]; diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index e1de925db6..e05c2b0b28 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -95,7 +95,7 @@ protected: DRC* m_drc; ///< the DRC controller, see drc.cpp - PARAM_CFG_ARRAY m_configSettings; ///< List of Pcbnew configuration settings. + PARAM_CFG_ARRAY m_configParams; ///< List of Pcbnew configuration settings. wxString m_lastNetListRead; ///< Last net list read with relative path. @@ -362,7 +362,7 @@ public: * Function GetGridColor() , virtual * @return the color of the grid */ - virtual COLOR4D GetGridColor() const override; + virtual COLOR4D GetGridColor() override; /** * Function SetGridColor() , virtual diff --git a/pcb_calculator/pcb_calculator.cpp b/pcb_calculator/pcb_calculator.cpp index 50a19b1119..be74df91c1 100644 --- a/pcb_calculator/pcb_calculator.cpp +++ b/pcb_calculator/pcb_calculator.cpp @@ -35,7 +35,6 @@ #include <pcb_calculator.h> #include <bitmaps.h> -#include <colors_selection.h> #include <build_version.h> // Pcb_calculator data file extension: diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index f63743a728..85a1144786 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -260,6 +260,7 @@ set( PCBNEW_CLASS_SRCS pcbnew_config.cpp pcbplot.cpp pcb_draw_panel_gal.cpp + pcb_general_settings.cpp plot_board_layers.cpp plot_brditems_plotter.cpp print_board_functions.cpp diff --git a/pcbnew/autorouter/auto_place_footprints.cpp b/pcbnew/autorouter/auto_place_footprints.cpp index 331bc1b50b..e3987d85db 100644 --- a/pcbnew/autorouter/auto_place_footprints.cpp +++ b/pcbnew/autorouter/auto_place_footprints.cpp @@ -41,7 +41,6 @@ #include <autorout.h> #include <cell.h> -#include <colors_selection.h> #include <class_board.h> #include <class_module.h> diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index ba16929b76..3cfd182af4 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -176,6 +176,7 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard ) { delete m_Pcb; m_Pcb = aBoard; + m_Pcb->SetColorsSettings( &Settings().Colors() ); } } diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 183c322670..0eda751bea 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -46,7 +46,6 @@ #include <worksheet_viewitem.h> #include <pcbnew.h> -#include <colors_selection.h> #include <collectors.h> #include <class_board.h> @@ -76,8 +75,6 @@ BOARD::BOARD() : m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION; m_Status_Pcb = 0; // Status word: bit 1 = calculate. - SetColorsSettings( &g_ColorsSettings ); - m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the // zone contour currently in progress @@ -789,72 +786,6 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID LAYER_aPCB, bool isEnabled ) } -COLOR4D BOARD::GetVisibleElementColor( GAL_LAYER_ID aLayerId ) -{ - COLOR4D color = COLOR4D::UNSPECIFIED; - - switch( aLayerId ) - { - case LAYER_NON_PLATED: - case LAYER_VIA_THROUGH: - case LAYER_VIA_MICROVIA: - case LAYER_VIA_BBLIND: - case LAYER_MOD_TEXT_FR: - case LAYER_MOD_TEXT_BK: - case LAYER_MOD_TEXT_INVISIBLE: - case LAYER_ANCHOR: - case LAYER_PAD_FR: - case LAYER_PAD_BK: - case LAYER_RATSNEST: - case LAYER_GRID: - color = GetColorsSettings()->GetItemColor( aLayerId ); - break; - - default: - wxLogDebug( wxT( "BOARD::GetVisibleElementColor(): bad arg %d" ), aLayerId ); - } - - return color; -} - - -void BOARD::SetVisibleElementColor( GAL_LAYER_ID aLayerId, COLOR4D aColor ) -{ - switch( aLayerId ) - { - case LAYER_NON_PLATED: - case LAYER_VIA_THROUGH: - case LAYER_VIA_MICROVIA: - case LAYER_VIA_BBLIND: - case LAYER_MOD_TEXT_FR: - case LAYER_MOD_TEXT_BK: - case LAYER_MOD_TEXT_INVISIBLE: - case LAYER_ANCHOR: - case LAYER_PAD_FR: - case LAYER_PAD_BK: - case LAYER_GRID: - case LAYER_RATSNEST: - GetColorsSettings()->SetItemColor( aLayerId, aColor ); - break; - - default: - wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aLayerId ); - } -} - - -void BOARD::SetLayerColor( PCB_LAYER_ID aLayer, COLOR4D aColor ) -{ - GetColorsSettings()->SetLayerColor( aLayer, aColor ); -} - - -COLOR4D BOARD::GetLayerColor( PCB_LAYER_ID aLayer ) const -{ - return GetColorsSettings()->GetLayerColor( aLayer ); -} - - bool BOARD::IsModuleLayerVisible( PCB_LAYER_ID layer ) { switch( layer ) diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 8f1eca48ee..a7b154a8a6 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -517,15 +517,6 @@ public: */ bool IsModuleLayerVisible( PCB_LAYER_ID layer ); - /** - * Function GetVisibleElementColor - * returns the color of a pcb visible element. - * @see enum GAL_LAYER_ID - */ - COLOR4D GetVisibleElementColor( GAL_LAYER_ID LAYER_aPCB ); - - void SetVisibleElementColor( GAL_LAYER_ID LAYER_aPCB, COLOR4D aColor ); - /** * Function GetDesignSettings * @return the BOARD_DESIGN_SETTINGS for this BOARD @@ -561,7 +552,7 @@ public: * Function GetColorSettings * @return the current COLORS_DESIGN_SETTINGS in use */ - COLORS_DESIGN_SETTINGS* GetColorsSettings() const { return m_colorsSettings; } + const COLORS_DESIGN_SETTINGS& Colors() const { return *m_colorsSettings; } /** * Function SetColorsSettings @@ -571,7 +562,6 @@ public: { m_colorsSettings = aColorsSettings; } - /** * Function GetBoardPolygonOutlines * Extracts the board outlines and build a closed polygon @@ -682,18 +672,6 @@ public: */ bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType ); - /** - * Function SetLayerColor - * changes a layer color for any valid layer, including non-copper ones. - */ - void SetLayerColor( PCB_LAYER_ID aLayer, COLOR4D aColor ); - - /** - * Function GetLayerColor - * gets a layer color for any valid layer, including non-copper ones. - */ - COLOR4D GetLayerColor( PCB_LAYER_ID aLayer ) const; - /** Functions to get some items count */ int GetNumSegmTrack() const; diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 706d41e073..5e4abeb1e0 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -34,10 +34,10 @@ #include <trigo.h> #include <wxstruct.h> #include <class_drawpanel.h> -#include <colors_selection.h> #include <kicad_string.h> #include <richio.h> #include <bitmaps.h> +#include <wxPcbStruct.h> #include <class_board.h> #include <class_pcb_text.h> @@ -316,7 +316,6 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, const wxPoint& offset ) { - COLOR4D gcolor; BOARD* brd = GetBoard(); if( brd->IsLayerVisible( m_Layer ) == false ) @@ -324,7 +323,8 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, m_Text.Draw( panel, DC, mode_color, offset ); - gcolor = brd->GetLayerColor( m_Layer ); + auto frame = static_cast<PCB_EDIT_FRAME*> ( panel->GetParent() ); + auto gcolor = frame->Settings().Colors().GetLayerColor( m_Layer ); GRSetDrawMode( DC, mode_color ); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 68dbd15866..e3e2588859 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -36,11 +36,12 @@ #include <bezier_curves.h> #include <class_drawpanel.h> #include <class_pcb_screen.h> -#include <colors_selection.h> #include <trigo.h> #include <msgpanel.h> #include <bitmaps.h> +#include <wxPcbStruct.h> + #include <pcbnew.h> #include <class_board.h> @@ -206,14 +207,14 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, int radius; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; - COLOR4D color; BOARD * brd = GetBoard( ); if( brd->IsLayerVisible( GetLayer() ) == false ) return; - color = brd->GetLayerColor( GetLayer() ); + auto frame = static_cast<PCB_EDIT_FRAME*> ( panel->GetParent() ); + auto color = frame->Settings().Colors().GetLayerColor( GetLayer() ); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 9eca984b0f..b79305ab1a 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -37,7 +37,6 @@ #include <class_pcb_screen.h> #include <confirm.h> #include <kicad_string.h> -#include <colors_selection.h> #include <richio.h> #include <macros.h> #include <math_for_graphics.h> @@ -46,6 +45,7 @@ #include <base_units.h> #include <bitmaps.h> +#include <wxPcbStruct.h> #include <class_board.h> #include <class_module.h> #include <class_edge_mod.h> @@ -119,7 +119,10 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, if( brd->IsLayerVisible( m_Layer ) == false ) return; - COLOR4D color = brd->GetLayerColor( m_Layer ); + + auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() ); + auto color = frame->Settings().Colors().GetLayerColor( m_Layer ); + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); if(( draw_mode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay ) diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index 287f08d16b..6f8e70f40b 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -34,11 +34,11 @@ #include <common.h> #include <class_drawpanel.h> #include <kicad_string.h> -#include <colors_selection.h> #include <trigo.h> #include <macros.h> #include <richio.h> #include <bitmaps.h> +#include <wxPcbStruct.h> #include <class_board.h> #include <class_mire.h> @@ -89,7 +89,8 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, if( brd->IsLayerVisible( m_Layer ) == false ) return; - COLOR4D gcolor = brd->GetLayerColor( m_Layer ); + auto frame = static_cast<PCB_EDIT_FRAME*> ( panel->GetParent() ); + auto gcolor = frame->Settings().Colors().GetLayerColor( m_Layer ); GRSetDrawMode( DC, mode_color ); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 035fbe31a4..fe47505093 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -38,13 +38,13 @@ #include <confirm.h> #include <kicad_string.h> #include <pcbnew.h> -#include <colors_selection.h> #include <richio.h> #include <filter_reader.h> #include <macros.h> #include <msgpanel.h> #include <bitmaps.h> +#include <wxPcbStruct.h> #include <class_board.h> #include <class_edge_mod.h> #include <class_module.h> @@ -237,13 +237,15 @@ void MODULE::ClearAllNets() void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, int dim_ancre, GR_DRAWMODE draw_mode ) { + auto frame = (PCB_EDIT_FRAME*) panel->GetParent(); + GRSetDrawMode( DC, draw_mode ); if( GetBoard()->IsElementVisible( LAYER_ANCHOR ) ) { GRDrawAnchor( panel->GetClipBox(), DC, m_Pos.x, m_Pos.y, dim_ancre, - g_ColorsSettings.GetItemColor( LAYER_ANCHOR ) ); + frame->Settings().Colors().GetItemColor( LAYER_ANCHOR ) ); } } diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index 4259f61d94..93ee60c298 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -34,7 +34,6 @@ #include <common.h> #include <kicad_string.h> #include <pcbnew.h> -#include <colors_selection.h> #include <richio.h> #include <macros.h> #include <msgpanel.h> diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 02b5eddab0..050df2216f 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -37,6 +37,7 @@ #include <drawtxt.h> #include <layers_id_colors_and_visibility.h> #include <wxBasePcbFrame.h> +#include <wxPcbStruct.h> #include <pcbnew_id.h> // ID_TRACK_BUTT #include <pcbnew.h> #include <class_board.h> @@ -102,6 +103,10 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, */ BOARD* brd = GetBoard(); + + auto frame = static_cast<PCB_EDIT_FRAME*> ( aPanel->GetParent() ); + const auto& cds = frame->Settings().Colors(); + bool frontVisible = brd->IsElementVisible( LAYER_PAD_FR ); bool backVisible = brd->IsElementVisible( LAYER_PAD_BK ); @@ -118,7 +123,6 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, if( !backVisible && !( m_layerMask & LSET::FrontMask() ).any() ) return; - PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent(); wxCHECK_RET( frame != NULL, wxT( "Panel has no parent frame window." ) ); @@ -134,12 +138,12 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, if( m_layerMask[F_Cu] ) { - color = brd->GetVisibleElementColor( LAYER_PAD_FR ); + color = cds.GetItemColor( LAYER_PAD_FR ); } if( m_layerMask[B_Cu] ) { - color = color.LegacyMix( brd->GetVisibleElementColor( LAYER_PAD_BK ) ); + color = color.LegacyMix( cds.GetItemColor( LAYER_PAD_BK ) ); } if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show) @@ -162,7 +166,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, break; default: - color = brd->GetLayerColor( pad_layer ); + color = cds.GetLayerColor( pad_layer ); #ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR showActualMaskSize = pad_layer; #endif @@ -240,7 +244,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, { if( IsOnLayer( screen->m_Active_Layer ) ) { - color = brd->GetLayerColor( screen->m_Active_Layer ); + color = cds.GetLayerColor( screen->m_Active_Layer ); // In high contrast mode, and if the active layer is the mask // layer shows the pad size with the mask clearance @@ -276,7 +280,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, brd->IsElementVisible( LAYER_NON_PLATED ) ) { drawInfo.m_ShowNotPlatedHole = true; - drawInfo.m_NPHoleColor = brd->GetVisibleElementColor( LAYER_NON_PLATED ); + drawInfo.m_NPHoleColor = cds.GetItemColor( LAYER_NON_PLATED ); } drawInfo.m_DrawMode = aDraw_mode; diff --git a/pcbnew/class_pcb_layer_box_selector.cpp b/pcbnew/class_pcb_layer_box_selector.cpp index 2eec02213c..fdd4f8ce2e 100644 --- a/pcbnew/class_pcb_layer_box_selector.cpp +++ b/pcbnew/class_pcb_layer_box_selector.cpp @@ -32,7 +32,6 @@ #include <pcbnew.h> #include <wxPcbStruct.h> #include <class_board_design_settings.h> -#include <colors_selection.h> #include <layers_id_colors_and_visibility.h> #include <class_board.h> @@ -149,10 +148,8 @@ LSET PCB_LAYER_BOX_SELECTOR::getEnabledLayers() const COLOR4D PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const { wxASSERT( m_boardFrame ); - BOARD* board = m_boardFrame->GetBoard(); - wxASSERT( board ); - return board->GetLayerColor( ToLAYER_ID( aLayer ) ); + return m_boardFrame->Settings().Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); } @@ -165,4 +162,3 @@ wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const return board->GetLayerName( ToLAYER_ID( aLayer ) ); } - diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 6adf67cdf4..56ff74a5d9 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -78,6 +78,10 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = { RR( _( "Footprints Back" ), LAYER_MOD_BK, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's back") ), RR( _( "Values" ), LAYER_MOD_VALUES, COLOR4D::UNSPECIFIED, _( "Show footprint's values") ), RR( _( "References" ), LAYER_MOD_REFERENCES, COLOR4D::UNSPECIFIED, _( "Show footprint's references") ), + RR( _( "Worksheet" ), LAYER_WORKSHEET, DARKRED, _( "Show worksheet") ), + RR( _( "Cursor" ), LAYER_CURSOR, WHITE, _( "PCB Cursor" ), true, false ), + RR( _( "Aux items" ), LAYER_AUX_ITEMS, WHITE, _( "Auxillary items (rulers, assistants, axes, etc.)" ), true, false ), + RR( _( "Background" ), LAYER_PCB_BACKGROUND, BLACK, _( "PCB Background" ), true, false ) }; static int s_allowed_in_FpEditor[] = @@ -398,7 +402,7 @@ void PCB_LAYER_WIDGET::ReFillRender() if( renderRow.color != COLOR4D::UNSPECIFIED ) // does this row show a color? { // this window frame must have an established BOARD, i.e. after SetBoard() - renderRow.color = board->GetVisibleElementColor( static_cast<GAL_LAYER_ID>( renderRow.id ) ); + renderRow.color = myframe->Settings().Colors().GetItemColor( static_cast<GAL_LAYER_ID>( renderRow.id ) ); } renderRow.state = board->IsElementVisible( static_cast<GAL_LAYER_ID>( renderRow.id ) ); @@ -475,7 +479,7 @@ void PCB_LAYER_WIDGET::ReFill() } AppendLayerRow( LAYER_WIDGET::ROW( - brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), + brd->GetLayerName( layer ), layer, myframe->Settings().Colors().GetLayerColor( layer ), dsc, true ) ); if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) ) @@ -522,7 +526,7 @@ void PCB_LAYER_WIDGET::ReFill() continue; AppendLayerRow( LAYER_WIDGET::ROW( - brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), + brd->GetLayerName( layer ), layer, myframe->Settings().Colors().GetLayerColor( layer ), wxGetTranslation( non_cu_seq[i].tooltip ), true ) ); if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) ) @@ -546,16 +550,16 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor ) // destroys the GAL color setup if( !myframe->IsGalCanvasActive() ) { - COLOR4D oldColor = myframe->GetBoard()->GetLayerColor( ToLAYER_ID( aLayer ) ); + COLOR4D oldColor = myframe->Settings().Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); aColor.a = oldColor.a; } - myframe->GetBoard()->SetLayerColor( ToLAYER_ID( aLayer ), aColor ); + myframe->Settings().Colors().SetLayerColor( ToLAYER_ID( aLayer ), aColor ); if( myframe->IsGalCanvasActive() ) { KIGFX::VIEW* view = myframe->GetGalCanvas()->GetView(); - view->GetPainter()->GetSettings()->ImportLegacyColors( myframe->GetBoard()->GetColorsSettings() ); + view->GetPainter()->GetSettings()->ImportLegacyColors( &myframe->Settings().Colors() ); view->UpdateLayerColor( aLayer ); view->UpdateLayerColor( GetNetnameLayer( aLayer ) ); } @@ -624,15 +628,14 @@ void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor ) { wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END ); - BOARD* brd = myframe->GetBoard(); - brd->SetVisibleElementColor( static_cast<GAL_LAYER_ID>( aId ), aColor ); + myframe->Settings().Colors().SetItemColor( static_cast<GAL_LAYER_ID>( aId ), aColor ); EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); if( galCanvas && myframe->IsGalCanvasActive() ) { KIGFX::VIEW* view = galCanvas->GetView(); - view->GetPainter()->GetSettings()->ImportLegacyColors( brd->GetColorsSettings() ); + view->GetPainter()->GetSettings()->ImportLegacyColors( &myframe->Settings().Colors() ); view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // useful to update rastnest view->UpdateLayerColor( aId ); galCanvas->Refresh(); diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index e17c07a4bb..4edae5ad16 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -35,11 +35,10 @@ #include <drawtxt.h> #include <kicad_string.h> #include <trigo.h> -#include <colors_selection.h> #include <richio.h> #include <class_drawpanel.h> #include <macros.h> -#include <wxBasePcbFrame.h> +#include <wxPcbStruct.h> #include <msgpanel.h> #include <base_units.h> #include <bitmaps.h> @@ -75,7 +74,8 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, if( brd->IsLayerVisible( m_Layer ) == false ) return; - COLOR4D color = brd->GetLayerColor( m_Layer ); + auto frame = static_cast<PCB_EDIT_FRAME*> ( panel->GetParent() ); + auto color = frame->Settings().Colors().GetLayerColor( m_Layer ); EDA_DRAW_MODE_T fillmode = FILLED; DISPLAY_OPTIONS* displ_opts = @@ -96,7 +96,7 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, COLOR4D anchor_color = COLOR4D::UNSPECIFIED; if( brd->IsElementVisible( LAYER_ANCHOR ) ) - anchor_color = brd->GetVisibleElementColor( LAYER_ANCHOR ); + anchor_color = frame->Settings().Colors().GetItemColor( LAYER_ANCHOR ); EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; EDA_TEXT::Draw( clipbox, DC, offset, color, diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 41240ca3ba..c9c451df38 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -35,10 +35,9 @@ #include <class_drawpanel.h> #include <drawtxt.h> #include <kicad_string.h> -#include <colors_selection.h> #include <richio.h> #include <macros.h> -#include <wxBasePcbFrame.h> +#include <wxPcbStruct.h> #include <msgpanel.h> #include <base_units.h> #include <bitmaps.h> @@ -234,7 +233,10 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod wxASSERT( m_Parent ); BOARD* brd = GetBoard( ); - COLOR4D color = brd->GetLayerColor( GetLayer() ); + + auto frame = static_cast<PCB_BASE_FRAME*> ( aPanel->GetParent() ); + auto color = frame->Settings().Colors().GetLayerColor( GetLayer() ); + PCB_LAYER_ID text_layer = GetLayer(); if( !brd->IsLayerVisible( m_Layer ) @@ -249,7 +251,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod if( !brd->IsElementVisible( LAYER_MOD_TEXT_INVISIBLE ) ) return; - color = brd->GetVisibleElementColor( LAYER_MOD_TEXT_INVISIBLE ); + color = frame->Settings().Colors().GetItemColor( LAYER_MOD_TEXT_INVISIBLE ); } DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions(); @@ -275,7 +277,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod // Draw the text anchor point if( brd->IsElementVisible( LAYER_ANCHOR ) ) { - COLOR4D anchor_color = brd->GetVisibleElementColor( LAYER_ANCHOR ); + COLOR4D anchor_color = frame->Settings().Colors().GetItemColor( LAYER_ANCHOR ); GRDrawAnchor( aPanel->GetClipBox(), aDC, pos.x, pos.y, DIM_ANCRE_TEXTE, anchor_color ); } diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 31f721a2f1..7f3f0a0358 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -37,7 +37,6 @@ #include <class_drawpanel.h> #include <class_pcb_screen.h> #include <drawtxt.h> -#include <colors_selection.h> #include <wxstruct.h> #include <wxBasePcbFrame.h> #include <class_board.h> @@ -637,7 +636,9 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset ) { BOARD* brd = GetBoard(); - COLOR4D color = brd->GetLayerColor( m_Layer ); + + auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() ); + auto color = frame->Settings().Colors().GetLayerColor( m_Layer ); if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) return; @@ -706,7 +707,9 @@ void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, return; BOARD* brd = GetBoard(); - COLOR4D color = brd->GetLayerColor( m_Layer ); + + auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() ); + auto color = frame->Settings().Colors().GetLayerColor( m_Layer ); if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) return; @@ -794,7 +797,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w GRSetDrawMode( aDC, aDrawMode ); BOARD * brd = GetBoard(); - COLOR4D color = brd->GetVisibleElementColor( LAYER_VIAS + GetViaType() ); + COLOR4D color = frame->Settings().Colors().GetItemColor( LAYER_VIAS + GetViaType() ); if( brd->IsElementVisible( LAYER_VIAS + GetViaType() ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index ec780f5255..1980d2194e 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -34,7 +34,6 @@ #include <class_pcb_screen.h> #include <class_drawpanel.h> #include <kicad_string.h> -#include <colors_selection.h> #include <richio.h> #include <macros.h> #include <wxBasePcbFrame.h> @@ -187,7 +186,9 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; BOARD* brd = GetBoard(); - COLOR4D color = brd->GetLayerColor( m_Layer ); + auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() ); + + auto color = frame->Settings().Colors().GetLayerColor( m_Layer ); if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) return; @@ -259,7 +260,9 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, BOARD* brd = GetBoard(); PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; - COLOR4D color = brd->GetLayerColor( m_Layer ); + + auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() ); + auto color = frame->Settings().Colors().GetLayerColor( m_Layer ); if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) return; @@ -385,7 +388,10 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; BOARD* brd = GetBoard(); - COLOR4D color = brd->GetLayerColor( m_Layer ); + + auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() ); + auto color = frame->Settings().Colors().GetLayerColor( m_Layer ); + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); if( displ_opts->m_ContrastModeDisplay ) diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index 041754ce00..70cb8caefe 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -325,7 +325,7 @@ bool PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KE { // If there's no intrusion and DRC is active, we pass the cursor // "as is", and let ShowNewTrackWhenMovingCursor figure out what to do. - if( !g_Drc_On || !g_CurrentTrackSegment || + if( !Settings().m_legacyDrcOn || !g_CurrentTrackSegment || (BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() || !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment, GetScreen()->m_Active_Layer, RefPos( true ) ) ) diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index 3b3059559c..cae59375a3 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -61,7 +61,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) // delete the most recently entered delete g_CurrentTrackList.PopBack(); - if( g_TwoSegmentTrackBuild ) + if( Settings().m_legacyUseTwoSegmentTracks ) { // if in 2 track mode, and the next most recent is a segment // not a via, and the one previous to that is a via, then @@ -88,7 +88,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) UpdateStatusBar(); - if( g_TwoSegmentTrackBuild ) // We must have 2 segments or more, or 0 + if( Settings().m_legacyUseTwoSegmentTracks ) // We must have 2 segments or more, or 0 { if( g_CurrentTrackList.GetCount() == 1 && g_CurrentTrackSegment->Type() != PCB_VIA_T ) diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 106e43a1a1..17e1b3d460 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -253,7 +253,7 @@ void DIALOG_COPPER_ZONE::initDialog() msg.Trim(); - COLOR4D layerColor = board->GetLayerColor( layer ); + COLOR4D layerColor = m_Parent->Settings().Colors().GetLayerColor( layer ); imageList->Add( makeLayerBitmap( layerColor ) ); diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index 3d20294fc3..a6c8b1c6b3 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -72,19 +72,19 @@ void DIALOG_GENERALOPTIONS::init() wxString timevalue; timevalue << GetParent()->GetAutoSaveInterval() / 60; m_SaveTime->SetValue( timevalue ); - m_MaxShowLinks->SetValue( displ_opts->m_MaxLinksShowed ); - m_DrcOn->SetValue( g_Drc_On ); + m_DrcOn->SetValue( GetParent()->Settings().m_legacyDrcOn ); m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible( LAYER_RATSNEST ) ); - m_TrackAutodel->SetValue( g_AutoDeleteOldTrack ); - m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed ); - m_Segments_45_Only_Ctrl->SetValue( g_Segments_45_Only ); + m_TrackAutodel->SetValue( GetParent()->Settings().m_legacyAutoDeleteOldTrack ); + m_Track_45_Only_Ctrl->SetValue( GetParent()->Settings().m_legacyUse45DegreeTracks ); + m_Segments_45_Only_Ctrl->SetValue( GetParent()->Settings().m_use45DegreeGraphicSegments ); m_ZoomCenterOpt->SetValue( ! GetParent()->GetCanvas()->GetEnableZoomNoCenter() ); m_MousewheelPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableMousewheelPan() ); m_AutoPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableAutoPan() ); - m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild ); - m_MagneticPadOptCtrl->SetSelection( g_MagneticPadOption ); - m_MagneticTrackOptCtrl->SetSelection( g_MagneticTrackOption ); + m_Track_DoubleSegm_Ctrl->SetValue( GetParent()->Settings().m_legacyUseTwoSegmentTracks ); + m_MagneticPadOptCtrl->SetSelection( GetParent()->Settings().m_magneticPads ); + m_MagneticTrackOptCtrl->SetSelection( GetParent()->Settings().m_magneticTracks ); + m_UseEditKeyForWidth->SetValue( GetParent()->Settings().m_editActionChangesTrackWidth ); } @@ -110,8 +110,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event ) GetParent()->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) ); /* Updating the combobox to display the active layer. */ - displ_opts->m_MaxLinksShowed = m_MaxShowLinks->GetValue(); - g_Drc_On = m_DrcOn->GetValue(); + GetParent()->Settings().m_legacyDrcOn = m_DrcOn->GetValue(); if( m_Board->IsElementVisible( LAYER_RATSNEST ) != m_ShowGlobalRatsnest->GetValue() ) { @@ -120,17 +119,18 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event ) GetParent()->OnModify(); } - g_AutoDeleteOldTrack = m_TrackAutodel->GetValue(); - g_Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue(); - g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue(); + GetParent()->Settings().m_legacyAutoDeleteOldTrack = m_TrackAutodel->GetValue(); + GetParent()->Settings().m_use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue(); + GetParent()->Settings().m_legacyUse45DegreeTracks = m_Track_45_Only_Ctrl->GetValue(); GetParent()->GetCanvas()->SetEnableZoomNoCenter( ! m_ZoomCenterOpt->GetValue() ); GetParent()->GetCanvas()->SetEnableMousewheelPan( m_MousewheelPANOpt->GetValue() ); GetParent()->GetCanvas()->SetEnableAutoPan( m_AutoPANOpt->GetValue() ); - g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue(); - g_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection(); - g_MagneticTrackOption = m_MagneticTrackOptCtrl->GetSelection(); + GetParent()->Settings().m_legacyUseTwoSegmentTracks = m_Track_DoubleSegm_Ctrl->GetValue(); + GetParent()->Settings().m_magneticPads = (MAGNETIC_PAD_OPTION_VALUES) m_MagneticPadOptCtrl->GetSelection(); + GetParent()->Settings().m_magneticTracks = (MAGNETIC_PAD_OPTION_VALUES) m_MagneticTrackOptCtrl->GetSelection(); + GetParent()->Settings().m_editActionChangesTrackWidth = m_UseEditKeyForWidth->GetValue(); EndModal( wxID_OK ); } diff --git a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp index 5fcd78ac80..652681de1a 100644 --- a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp +++ b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Feb 6 2017) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -49,15 +49,6 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticTextmaxlinks = new wxStaticText( this, wxID_ANY, _("&Maximum links:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextmaxlinks->Wrap( -1 ); - fgSizer1->Add( m_staticTextmaxlinks, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_MaxShowLinks = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 5, 1 ); - m_MaxShowLinks->SetToolTip( _("Adjust the number of ratsnets shown from cursor to closest pads.") ); - - fgSizer1->Add( m_MaxShowLinks, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxTOP, 5 ); - m_staticTextautosave = new wxStaticText( this, wxID_ANY, _("&Auto save (minutes):"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextautosave->Wrap( -1 ); fgSizer1->Add( m_staticTextautosave, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); @@ -79,43 +70,57 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( bMiddleLeftSizer->Add( fgSizer1, 0, wxEXPAND, 5 ); - wxStaticBoxSizer* bMiddleRightBoxSizer; - bMiddleRightBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL ); + wxStaticBoxSizer* bOptionsSizer; + bOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL ); - m_DrcOn = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_DRC_ONOFF, _("&Enforce design rules when routing"), wxDefaultPosition, wxDefaultSize, 0 ); - m_DrcOn->SetValue(true); - m_DrcOn->SetToolTip( _("Enable DRC control. When DRC control is disabled, all connections are allowed.") ); - - bMiddleRightBoxSizer->Add( m_DrcOn, 0, wxALL|wxEXPAND, 5 ); - - m_ShowGlobalRatsnest = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_GENERAL_RATSNEST, _("&Show ratsnest"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ShowGlobalRatsnest = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_GENERAL_RATSNEST, _("&Show ratsnest"), wxDefaultPosition, wxDefaultSize, 0 ); m_ShowGlobalRatsnest->SetValue(true); m_ShowGlobalRatsnest->SetToolTip( _("Show the full ratsnest.") ); - bMiddleRightBoxSizer->Add( m_ShowGlobalRatsnest, 0, wxALL, 5 ); + bOptionsSizer->Add( m_ShowGlobalRatsnest, 0, wxALL, 5 ); - m_TrackAutodel = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_TRACK_AUTODEL, _("&Delete unconnected tracks"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TrackAutodel->SetToolTip( _("Enable automatic track deletion when redrawing a track.") ); - - bMiddleRightBoxSizer->Add( m_TrackAutodel, 0, wxALL, 5 ); - - m_Track_45_Only_Ctrl = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_TRACKS45, _("&Limit tracks to 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Track_45_Only_Ctrl->SetToolTip( _("Force track directions to H, V or 45 degrees when drawing a track.") ); - - bMiddleRightBoxSizer->Add( m_Track_45_Only_Ctrl, 0, wxALL, 5 ); - - m_Segments_45_Only_Ctrl = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_SEGMENTS45, _("L&imit graphic lines to 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Segments_45_Only_Ctrl = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_SEGMENTS45, _("L&imit graphic lines to 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); m_Segments_45_Only_Ctrl->SetToolTip( _("Force line segment directions to H, V or 45 degrees when drawing on technical layers.") ); - bMiddleRightBoxSizer->Add( m_Segments_45_Only_Ctrl, 0, wxALL, 5 ); + bOptionsSizer->Add( m_Segments_45_Only_Ctrl, 0, wxALL, 5 ); - m_Track_DoubleSegm_Ctrl = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_ANY, _("&Use double segmented tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_UseEditKeyForWidth = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Edit action changes track width"), wxDefaultPosition, wxDefaultSize, 0 ); + m_UseEditKeyForWidth->SetToolTip( _("When active, hitting Edit hotkey or double-clicking on a track or via changes its width/diameter to the one selected in the main toolbar. ") ); + + bOptionsSizer->Add( m_UseEditKeyForWidth, 0, wxALL, 5 ); + + + bMiddleLeftSizer->Add( bOptionsSizer, 1, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* bLegacyOptionsSizer; + bLegacyOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Legacy Routing Options") ), wxVERTICAL ); + + m_DrcOn = new wxCheckBox( bLegacyOptionsSizer->GetStaticBox(), wxID_DRC_ONOFF, _("&Enforce design rules when routing"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DrcOn->SetValue(true); + m_DrcOn->SetToolTip( _("Enable DRC control. When DRC control is disabled, all connections are allowed.") ); + + bLegacyOptionsSizer->Add( m_DrcOn, 0, wxALL|wxEXPAND, 5 ); + + m_TrackAutodel = new wxCheckBox( bLegacyOptionsSizer->GetStaticBox(), wxID_TRACK_AUTODEL, _("&Delete unconnected tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TrackAutodel->SetValue(true); + m_TrackAutodel->SetToolTip( _("Enable automatic track deletion when redrawing a track.") ); + + bLegacyOptionsSizer->Add( m_TrackAutodel, 0, wxALL, 5 ); + + m_Track_45_Only_Ctrl = new wxCheckBox( bLegacyOptionsSizer->GetStaticBox(), wxID_TRACKS45, _("&Limit tracks to 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Track_45_Only_Ctrl->SetValue(true); + m_Track_45_Only_Ctrl->SetToolTip( _("Force track directions to H, V or 45 degrees when drawing a track.") ); + + bLegacyOptionsSizer->Add( m_Track_45_Only_Ctrl, 0, wxALL, 5 ); + + m_Track_DoubleSegm_Ctrl = new wxCheckBox( bLegacyOptionsSizer->GetStaticBox(), wxID_ANY, _("&Use double segmented tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Track_DoubleSegm_Ctrl->SetValue(true); m_Track_DoubleSegm_Ctrl->SetToolTip( _("Use two track segments, with 45 degrees angle between them, when drawing a new track ") ); - bMiddleRightBoxSizer->Add( m_Track_DoubleSegm_Ctrl, 0, wxALL, 5 ); + bLegacyOptionsSizer->Add( m_Track_DoubleSegm_Ctrl, 0, wxALL, 5 ); - bMiddleLeftSizer->Add( bMiddleRightBoxSizer, 4, wxALL|wxEXPAND, 5 ); + bMiddleLeftSizer->Add( bLegacyOptionsSizer, 0, wxEXPAND|wxALL, 5 ); bSizerUpper->Add( bMiddleLeftSizer, 0, wxALL|wxEXPAND, 5 ); @@ -126,7 +131,7 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( wxString m_MagneticPadOptCtrlChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; int m_MagneticPadOptCtrlNChoices = sizeof( m_MagneticPadOptCtrlChoices ) / sizeof( wxString ); m_MagneticPadOptCtrl = new wxRadioBox( this, wxID_ANY, _("Magnetic Pads"), wxDefaultPosition, wxDefaultSize, m_MagneticPadOptCtrlNChoices, m_MagneticPadOptCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_MagneticPadOptCtrl->SetSelection( 0 ); + m_MagneticPadOptCtrl->SetSelection( 2 ); m_MagneticPadOptCtrl->SetToolTip( _("Control capture of the cursor when the mouse enters a pad area.") ); bRightSizer->Add( m_MagneticPadOptCtrl, 0, wxALL|wxEXPAND, 5 ); @@ -158,7 +163,7 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( sbSizer2PAN->Add( m_AutoPANOpt, 0, wxALL, 5 ); - bRightSizer->Add( sbSizer2PAN, 1, wxEXPAND, 5 ); + bRightSizer->Add( sbSizer2PAN, 1, wxEXPAND|wxALL, 5 ); bSizerUpper->Add( bRightSizer, 0, wxALL|wxEXPAND, 5 ); diff --git a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp index 914e8c4f8a..7d1568e3e0 100644 --- a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp +++ b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp @@ -318,177 +318,6 @@ <property name="permission">none</property> <property name="rows">0</property> <property name="vgap">0</property> - <object class="sizeritem" expanded="0"> - <property name="border">5</property> - <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property> - <property name="proportion">0</property> - <object class="wxStaticText" expanded="0"> - <property name="BottomDockable">1</property> - <property name="LeftDockable">1</property> - <property name="RightDockable">1</property> - <property name="TopDockable">1</property> - <property name="aui_layer"></property> - <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> - <property name="best_size"></property> - <property name="bg"></property> - <property name="caption"></property> - <property name="caption_visible">1</property> - <property name="center_pane">0</property> - <property name="close_button">1</property> - <property name="context_help"></property> - <property name="context_menu">1</property> - <property name="default_pane">0</property> - <property name="dock">Dock</property> - <property name="dock_fixed">0</property> - <property name="docking">Left</property> - <property name="enabled">1</property> - <property name="fg"></property> - <property name="floatable">1</property> - <property name="font"></property> - <property name="gripper">0</property> - <property name="hidden">0</property> - <property name="id">wxID_ANY</property> - <property name="label">&Maximum links:</property> - <property name="max_size"></property> - <property name="maximize_button">0</property> - <property name="maximum_size"></property> - <property name="min_size"></property> - <property name="minimize_button">0</property> - <property name="minimum_size"></property> - <property name="moveable">1</property> - <property name="name">m_staticTextmaxlinks</property> - <property name="pane_border">1</property> - <property name="pane_position"></property> - <property name="pane_size"></property> - <property name="permission">protected</property> - <property name="pin_button">1</property> - <property name="pos"></property> - <property name="resize">Resizable</property> - <property name="show">1</property> - <property name="size"></property> - <property name="style"></property> - <property name="subclass"></property> - <property name="toolbar_pane">0</property> - <property name="tooltip"></property> - <property name="window_extra_style"></property> - <property name="window_name"></property> - <property name="window_style"></property> - <property name="wrap">-1</property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> - </object> - </object> - <object class="sizeritem" expanded="0"> - <property name="border">5</property> - <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxTOP</property> - <property name="proportion">0</property> - <object class="wxSpinCtrl" expanded="0"> - <property name="BottomDockable">1</property> - <property name="LeftDockable">1</property> - <property name="RightDockable">1</property> - <property name="TopDockable">1</property> - <property name="aui_layer"></property> - <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> - <property name="best_size"></property> - <property name="bg"></property> - <property name="caption"></property> - <property name="caption_visible">1</property> - <property name="center_pane">0</property> - <property name="close_button">1</property> - <property name="context_help"></property> - <property name="context_menu">1</property> - <property name="default_pane">0</property> - <property name="dock">Dock</property> - <property name="dock_fixed">0</property> - <property name="docking">Left</property> - <property name="enabled">1</property> - <property name="fg"></property> - <property name="floatable">1</property> - <property name="font"></property> - <property name="gripper">0</property> - <property name="hidden">0</property> - <property name="id">wxID_ANY</property> - <property name="initial">1</property> - <property name="max">5</property> - <property name="max_size"></property> - <property name="maximize_button">0</property> - <property name="maximum_size"></property> - <property name="min">1</property> - <property name="min_size"></property> - <property name="minimize_button">0</property> - <property name="minimum_size"></property> - <property name="moveable">1</property> - <property name="name">m_MaxShowLinks</property> - <property name="pane_border">1</property> - <property name="pane_position"></property> - <property name="pane_size"></property> - <property name="permission">protected</property> - <property name="pin_button">1</property> - <property name="pos"></property> - <property name="resize">Resizable</property> - <property name="show">1</property> - <property name="size"></property> - <property name="style">wxSP_ARROW_KEYS</property> - <property name="subclass"></property> - <property name="toolbar_pane">0</property> - <property name="tooltip">Adjust the number of ratsnets shown from cursor to closest pads.</property> - <property name="value">1</property> - <property name="window_extra_style"></property> - <property name="window_name"></property> - <property name="window_style"></property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnSpinCtrl"></event> - <event name="OnSpinCtrlText"></event> - <event name="OnTextEnter"></event> - <event name="OnUpdateUI"></event> - </object> - </object> <object class="sizeritem" expanded="0"> <property name="border">5</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property> @@ -838,13 +667,291 @@ </object> <object class="sizeritem" expanded="1"> <property name="border">5</property> - <property name="flag">wxALL|wxEXPAND</property> - <property name="proportion">4</property> + <property name="flag">wxEXPAND|wxALL</property> + <property name="proportion">1</property> <object class="wxStaticBoxSizer" expanded="1"> <property name="id">wxID_ANY</property> <property name="label">Options</property> <property name="minimum_size"></property> - <property name="name">bMiddleRightBoxSizer</property> + <property name="name">bOptionsSizer</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <event name="OnUpdateUI"></event> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">1</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_GENERAL_RATSNEST</property> + <property name="label">&Show ratsnest</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_ShowGlobalRatsnest</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip">Show the full ratsnest.</property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnCheckBox"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_SEGMENTS45</property> + <property name="label">L&imit graphic lines to 45 degrees</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_Segments_45_Only_Ctrl</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip">Force line segment directions to H, V or 45 degrees when drawing on technical layers.</property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnCheckBox"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Edit action changes track width</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_UseEditKeyForWidth</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip">When active, hitting Edit hotkey or double-clicking on a track or via changes its width/diameter to the one selected in the main toolbar. </property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnCheckBox"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxALL</property> + <property name="proportion">0</property> + <object class="wxStaticBoxSizer" expanded="1"> + <property name="id">wxID_ANY</property> + <property name="label">Legacy Routing Options</property> + <property name="minimum_size"></property> + <property name="name">bLegacyOptionsSizer</property> <property name="orient">wxVERTICAL</property> <property name="permission">none</property> <event name="OnUpdateUI"></event> @@ -968,94 +1075,6 @@ <property name="font"></property> <property name="gripper">0</property> <property name="hidden">0</property> - <property name="id">wxID_GENERAL_RATSNEST</property> - <property name="label">&Show ratsnest</property> - <property name="max_size"></property> - <property name="maximize_button">0</property> - <property name="maximum_size"></property> - <property name="min_size"></property> - <property name="minimize_button">0</property> - <property name="minimum_size"></property> - <property name="moveable">1</property> - <property name="name">m_ShowGlobalRatsnest</property> - <property name="pane_border">1</property> - <property name="pane_position"></property> - <property name="pane_size"></property> - <property name="permission">protected</property> - <property name="pin_button">1</property> - <property name="pos"></property> - <property name="resize">Resizable</property> - <property name="show">1</property> - <property name="size"></property> - <property name="style"></property> - <property name="subclass"></property> - <property name="toolbar_pane">0</property> - <property name="tooltip">Show the full ratsnest.</property> - <property name="validator_data_type"></property> - <property name="validator_style">wxFILTER_NONE</property> - <property name="validator_type">wxDefaultValidator</property> - <property name="validator_variable"></property> - <property name="window_extra_style"></property> - <property name="window_name"></property> - <property name="window_style"></property> - <event name="OnChar"></event> - <event name="OnCheckBox"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> - </object> - </object> - <object class="sizeritem" expanded="0"> - <property name="border">5</property> - <property name="flag">wxALL</property> - <property name="proportion">0</property> - <object class="wxCheckBox" expanded="0"> - <property name="BottomDockable">1</property> - <property name="LeftDockable">1</property> - <property name="RightDockable">1</property> - <property name="TopDockable">1</property> - <property name="aui_layer"></property> - <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> - <property name="best_size"></property> - <property name="bg"></property> - <property name="caption"></property> - <property name="caption_visible">1</property> - <property name="center_pane">0</property> - <property name="checked">0</property> - <property name="close_button">1</property> - <property name="context_help"></property> - <property name="context_menu">1</property> - <property name="default_pane">0</property> - <property name="dock">Dock</property> - <property name="dock_fixed">0</property> - <property name="docking">Left</property> - <property name="enabled">1</property> - <property name="fg"></property> - <property name="floatable">1</property> - <property name="font"></property> - <property name="gripper">0</property> - <property name="hidden">0</property> <property name="id">wxID_TRACK_AUTODEL</property> <property name="label">&Delete unconnected tracks</property> <property name="max_size"></property> @@ -1130,7 +1149,7 @@ <property name="caption"></property> <property name="caption_visible">1</property> <property name="center_pane">0</property> - <property name="checked">0</property> + <property name="checked">1</property> <property name="close_button">1</property> <property name="context_help"></property> <property name="context_menu">1</property> @@ -1218,95 +1237,7 @@ <property name="caption"></property> <property name="caption_visible">1</property> <property name="center_pane">0</property> - <property name="checked">0</property> - <property name="close_button">1</property> - <property name="context_help"></property> - <property name="context_menu">1</property> - <property name="default_pane">0</property> - <property name="dock">Dock</property> - <property name="dock_fixed">0</property> - <property name="docking">Left</property> - <property name="enabled">1</property> - <property name="fg"></property> - <property name="floatable">1</property> - <property name="font"></property> - <property name="gripper">0</property> - <property name="hidden">0</property> - <property name="id">wxID_SEGMENTS45</property> - <property name="label">L&imit graphic lines to 45 degrees</property> - <property name="max_size"></property> - <property name="maximize_button">0</property> - <property name="maximum_size"></property> - <property name="min_size"></property> - <property name="minimize_button">0</property> - <property name="minimum_size"></property> - <property name="moveable">1</property> - <property name="name">m_Segments_45_Only_Ctrl</property> - <property name="pane_border">1</property> - <property name="pane_position"></property> - <property name="pane_size"></property> - <property name="permission">protected</property> - <property name="pin_button">1</property> - <property name="pos"></property> - <property name="resize">Resizable</property> - <property name="show">1</property> - <property name="size"></property> - <property name="style"></property> - <property name="subclass"></property> - <property name="toolbar_pane">0</property> - <property name="tooltip">Force line segment directions to H, V or 45 degrees when drawing on technical layers.</property> - <property name="validator_data_type"></property> - <property name="validator_style">wxFILTER_NONE</property> - <property name="validator_type">wxDefaultValidator</property> - <property name="validator_variable"></property> - <property name="window_extra_style"></property> - <property name="window_name"></property> - <property name="window_style"></property> - <event name="OnChar"></event> - <event name="OnCheckBox"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> - </object> - </object> - <object class="sizeritem" expanded="0"> - <property name="border">5</property> - <property name="flag">wxALL</property> - <property name="proportion">0</property> - <object class="wxCheckBox" expanded="0"> - <property name="BottomDockable">1</property> - <property name="LeftDockable">1</property> - <property name="RightDockable">1</property> - <property name="TopDockable">1</property> - <property name="aui_layer"></property> - <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> - <property name="best_size"></property> - <property name="bg"></property> - <property name="caption"></property> - <property name="caption_visible">1</property> - <property name="center_pane">0</property> - <property name="checked">0</property> + <property name="checked">1</property> <property name="close_button">1</property> <property name="context_help"></property> <property name="context_menu">1</property> @@ -1439,7 +1370,7 @@ <property name="pin_button">1</property> <property name="pos"></property> <property name="resize">Resizable</property> - <property name="selection">0</property> + <property name="selection">2</property> <property name="show">1</property> <property name="size"></property> <property name="style">wxRA_SPECIFY_COLS</property> @@ -1571,7 +1502,7 @@ </object> <object class="sizeritem" expanded="1"> <property name="border">5</property> - <property name="flag">wxEXPAND</property> + <property name="flag">wxEXPAND|wxALL</property> <property name="proportion">1</property> <object class="wxStaticBoxSizer" expanded="1"> <property name="id">wxID_ANY</property> @@ -1847,108 +1778,6 @@ </object> </object> </object> - <object class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">1</property> - <object class="wxStaticBoxSizer" expanded="1"> - <property name="id">wxID_ANY</property> - <property name="label">Advanced/Developer</property> - <property name="minimum_size"></property> - <property name="name">sbSizer4</property> - <property name="orient">wxVERTICAL</property> - <property name="permission">none</property> - <event name="OnUpdateUI"></event> - <object class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">wxALL</property> - <property name="proportion">0</property> - <object class="wxCheckBox" expanded="1"> - <property name="BottomDockable">1</property> - <property name="LeftDockable">1</property> - <property name="RightDockable">1</property> - <property name="TopDockable">1</property> - <property name="aui_layer"></property> - <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> - <property name="best_size"></property> - <property name="bg"></property> - <property name="caption"></property> - <property name="caption_visible">1</property> - <property name="center_pane">0</property> - <property name="checked">0</property> - <property name="close_button">1</property> - <property name="context_help"></property> - <property name="context_menu">1</property> - <property name="default_pane">0</property> - <property name="dock">Dock</property> - <property name="dock_fixed">0</property> - <property name="docking">Left</property> - <property name="enabled">1</property> - <property name="fg"></property> - <property name="floatable">1</property> - <property name="font"></property> - <property name="gripper">0</property> - <property name="hidden">0</property> - <property name="id">wxID_ANY</property> - <property name="label">Use legacy connectivity algorithm</property> - <property name="max_size"></property> - <property name="maximize_button">0</property> - <property name="maximum_size"></property> - <property name="min_size"></property> - <property name="minimize_button">0</property> - <property name="minimum_size"></property> - <property name="moveable">1</property> - <property name="name">m_cbUseLegacyConnectivityAlgo</property> - <property name="pane_border">1</property> - <property name="pane_position"></property> - <property name="pane_size"></property> - <property name="permission">protected</property> - <property name="pin_button">1</property> - <property name="pos"></property> - <property name="resize">Resizable</property> - <property name="show">1</property> - <property name="size"></property> - <property name="style"></property> - <property name="subclass"></property> - <property name="toolbar_pane">0</property> - <property name="tooltip"></property> - <property name="validator_data_type"></property> - <property name="validator_style">wxFILTER_NONE</property> - <property name="validator_type">wxDefaultValidator</property> - <property name="validator_variable"></property> - <property name="window_extra_style"></property> - <property name="window_name"></property> - <property name="window_style"></property> - <event name="OnChar"></event> - <event name="OnCheckBox"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> - </object> - </object> - </object> - </object> </object> </object> </object> diff --git a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h index 0e1552a0c4..4edb31f4f3 100644 --- a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h +++ b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Feb 6 2017) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -44,28 +44,27 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM { wxID_POLAR_CTRL = 1000, wxID_UNITS, - wxID_DRC_ONOFF, wxID_GENERAL_RATSNEST, + wxID_SEGMENTS45, + wxID_DRC_ONOFF, wxID_TRACK_AUTODEL, wxID_TRACKS45, - wxID_SEGMENTS45, wxID_MAGNETIC_TRACKS, wxID_AUTOPAN }; wxRadioBox* m_PolarDisplay; wxRadioBox* m_UnitsSelection; - wxStaticText* m_staticTextmaxlinks; - wxSpinCtrl* m_MaxShowLinks; wxStaticText* m_staticTextautosave; wxSpinCtrl* m_SaveTime; wxStaticText* m_staticTextRotationAngle; wxTextCtrl* m_RotationAngle; - wxCheckBox* m_DrcOn; wxCheckBox* m_ShowGlobalRatsnest; + wxCheckBox* m_Segments_45_Only_Ctrl; + wxCheckBox* m_UseEditKeyForWidth; + wxCheckBox* m_DrcOn; wxCheckBox* m_TrackAutodel; wxCheckBox* m_Track_45_Only_Ctrl; - wxCheckBox* m_Segments_45_Only_Ctrl; wxCheckBox* m_Track_DoubleSegm_Ctrl; wxRadioBox* m_MagneticPadOptCtrl; wxRadioBox* m_MagneticTrackOptCtrl; diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp index 8e48fc4b35..987a02509c 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -165,7 +165,7 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() msg = board->GetLayerName( layer ); - COLOR4D layerColor = board->GetLayerColor( layer ); + COLOR4D layerColor = m_parent->Settings().Colors().GetLayerColor( layer ); imageList->Add( makeLayerBitmap( layerColor ) ); diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index 75aa82c608..30bf95a7b0 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -39,7 +39,6 @@ #include <netlist_reader.h> #include <reporter.h> -#include <pcbnew_config.h> #include <class_board_design_settings.h> #include <class_board.h> #include <class_module.h> diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp index 3bf55aba89..b6cecade0f 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp @@ -155,7 +155,8 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init() { PCB_LAYER_ID layer = *seq; - COLOR4D layerColor = board->GetLayerColor( layer ); + COLOR4D layerColor = m_parent->Settings().Colors().GetLayerColor( layer ); + imageList->Add( makeLayerBitmap( layerColor ) ); msg = board->GetLayerName( layer ); diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index da7427b8d1..7a184cbb92 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -131,7 +131,8 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP if( m_parent->IsGalCanvasActive() ) { - m_panelShowPadGal->UseColorScheme( m_board->GetColorsSettings() ); + + m_panelShowPadGal->UseColorScheme( &m_parent->Settings().Colors() ); m_panelShowPadGal->SwitchBackend( m_parent->GetGalCanvas()->GetBackend() ); m_panelShowPadGal->Show(); m_panelShowPad->Hide(); @@ -171,12 +172,12 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) if( m_dummyPad->GetLayerSet()[F_Cu] ) { - color = m_board->GetVisibleElementColor( LAYER_PAD_FR ); + color = m_parent->Settings().Colors().GetItemColor( LAYER_PAD_FR ); } if( m_dummyPad->GetLayerSet()[B_Cu] ) { - color = color.LegacyMix( m_board->GetVisibleElementColor( LAYER_PAD_BK ) ); + color = color.LegacyMix( m_parent->Settings().Colors().GetItemColor( LAYER_PAD_BK ) ); } // What could happen: the pad color is *actually* black, or no diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index e454d7f4d7..6e9ab4a991 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1447,7 +1447,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) break; case ID_TRACK_BUTT: - if( g_Drc_On ) + if( Settings().m_legacyDrcOn ) SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) ); else SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) ); diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index 8441c93b8f..519d84ecb8 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -119,7 +119,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, { int diagdrc = OK_DRC; - if( g_Drc_On ) + if( Settings().m_legacyDrcOn ) diagdrc = m_drc->Drc( aTrackItem, GetBoard()->m_Track ); if( diagdrc == OK_DRC ) diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 0787d1229f..a9020f27b8 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -343,7 +343,7 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem(); - + auto frame = (PCB_EDIT_FRAME*) ( aPanel->GetParent() ); if( Segment == NULL ) return; @@ -355,7 +355,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi if( aErase ) Segment->Draw( aPanel, aDC, GR_XOR ); - if( g_Segments_45_Only && Segment->GetShape() == S_SEGMENT ) + if( frame->Settings().m_use45DegreeGraphicSegments && Segment->GetShape() == S_SEGMENT ) { wxPoint pt; diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index bd496dda2f..32c76ca561 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -71,14 +71,14 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) } // Is the current segment Ok (no DRC error) ? - if( g_Drc_On ) + if( Settings().m_legacyDrcOn ) { if( BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) // DRC error, the change layer is not made return false; // Handle 2 segments. - if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() ) + if( Settings().m_legacyUseTwoSegmentTracks && g_CurrentTrackSegment->Back() ) { if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), GetBoard()->m_Track ) ) return false; @@ -151,7 +151,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) break; } - if( g_Drc_On && BAD_DRC == m_drc->Drc( via, GetBoard()->m_Track ) ) + if( Settings().m_legacyDrcOn && BAD_DRC == m_drc->Drc( via, GetBoard()->m_Track ) ) { // DRC fault: the Via cannot be placed here ... delete via; @@ -205,7 +205,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) g_CurrentTrackList.PushBack( track ); - if( g_TwoSegmentTrackBuild ) + if( Settings().m_legacyUseTwoSegmentTracks ) { // Create a second segment (we must have 2 track segments to adjust) g_CurrentTrackList.PushBack( (TRACK*)g_CurrentTrackSegment->Clone() ); diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 91a7819c1a..2c7f80359e 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -32,7 +32,6 @@ #include <class_drawpanel.h> #include <trigo.h> #include <wxPcbStruct.h> -#include <colors_selection.h> #include <pcbnew.h> #include <drc_stuff.h> @@ -194,7 +193,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) g_CurrentTrackSegment->start = pad; } - if( g_TwoSegmentTrackBuild ) + if( Settings().m_legacyUseTwoSegmentTracks ) { // Create 2nd segment g_CurrentTrackList.PushBack( (TRACK*)g_CurrentTrackSegment->Clone() ); @@ -213,7 +212,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) SetCurItem( g_CurrentTrackSegment, false ); m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false ); - if( g_Drc_On ) + if( Settings().m_legacyDrcOn ) { if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) { @@ -224,13 +223,13 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) else // Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor. { // Test for a D.R.C. error: - if( g_Drc_On ) + if( Settings().m_legacyDrcOn ) { if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) return NULL; // We must handle 2 segments - if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() ) + if( Settings().m_legacyUseTwoSegmentTracks && g_CurrentTrackSegment->Back() ) { if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), GetBoard()->m_Track ) ) return NULL; @@ -243,10 +242,10 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) */ bool CanCreateNewSegment = true; - if( !g_TwoSegmentTrackBuild && g_CurrentTrackSegment->IsNull() ) + if( !Settings().m_legacyUseTwoSegmentTracks && g_CurrentTrackSegment->IsNull() ) CanCreateNewSegment = false; - if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->IsNull() + if( Settings().m_legacyUseTwoSegmentTracks && g_CurrentTrackSegment->IsNull() && g_CurrentTrackSegment->Back() && g_CurrentTrackSegment->Back()->IsNull() ) CanCreateNewSegment = false; @@ -356,7 +355,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC ) else newTrack->SetEnd( wxPoint(newTrack->GetEnd().x - segm_step_45, newTrack->GetEnd().y) ); - if( g_Drc_On && BAD_DRC == m_drc->Drc( curTrack, GetBoard()->m_Track ) ) + if( Settings().m_legacyDrcOn && BAD_DRC == m_drc->Drc( curTrack, GetBoard()->m_Track ) ) { delete newTrack; return false; @@ -391,7 +390,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC ) else newTrack->SetEnd( wxPoint(newTrack->GetEnd().x, newTrack->GetEnd().y - segm_step_45) ); - if( g_Drc_On && BAD_DRC==m_drc->Drc( newTrack, GetBoard()->m_Track ) ) + if( Settings().m_legacyDrcOn && BAD_DRC==m_drc->Drc( newTrack, GetBoard()->m_Track ) ) { delete newTrack; return false; @@ -415,7 +414,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) if( aTrack == NULL ) return false; - if( g_Drc_On && BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) + if( Settings().m_legacyDrcOn && BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) return false; // Saving the coordinate of end point of the trace @@ -499,7 +498,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) } // delete the old track, if it exists and is redundant - if( g_AutoDeleteOldTrack ) + if( Settings().m_legacyAutoDeleteOldTrack ) { EraseRedundantTrack( aDC, firstTrack, newCount, &s_ItemsListPicker ); } @@ -705,7 +704,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) { - COLOR4D color = g_ColorsSettings.GetLayerColor( g_CurrentTrackSegment->GetLayer() ); + COLOR4D color = frame->Settings().Colors().GetLayerColor( g_CurrentTrackSegment->GetLayer() ); DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->GetEnd(), boardViaRadius, viaRadiusWithClearence, color); } @@ -721,7 +720,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo if( !frame->GetDesignSettings().m_UseConnectedTrackWidth ) g_CurrentTrackSegment->SetWidth( frame->GetDesignSettings().GetCurrentTrackWidth() ); - if( g_TwoSegmentTrackBuild ) + if( frame->Settings().m_legacyUseTwoSegmentTracks ) { TRACK* previous_track = g_CurrentTrackSegment->Back(); @@ -734,13 +733,13 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo } } - if( g_Track_45_Only_Allowed ) + if( frame->Settings().m_legacyUse45DegreeTracks ) { - if( g_TwoSegmentTrackBuild ) + if( frame->Settings().m_legacyUseTwoSegmentTracks ) { g_CurrentTrackSegment->SetEnd( frame->GetCrossHairPosition() ); - if( g_Drc_On ) + if( frame->Settings().m_legacyDrcOn ) PushTrack( aPanel ); ComputeBreakPoint( g_CurrentTrackSegment, @@ -769,7 +768,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) { - COLOR4D color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer()); + COLOR4D color = frame->Settings().Colors().GetLayerColor(g_CurrentTrackSegment->GetLayer()); //Via diameter must have taken what we are using, rather than netclass value. DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->GetEnd(), diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp index 124c826959..cd51c1b673 100644 --- a/pcbnew/footprint_preview_panel.cpp +++ b/pcbnew/footprint_preview_panel.cpp @@ -33,6 +33,7 @@ #include <boost/bind.hpp> #include <make_unique.h> +#include <class_colors_design_settings.h> #include <wx/stattext.h> @@ -258,8 +259,9 @@ FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL( EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas m_dummyBoard = std::make_unique<BOARD>(); + m_colorsSettings = std::make_unique<COLORS_DESIGN_SETTINGS>(); - UseColorScheme( m_dummyBoard->GetColorsSettings() ); + UseColorScheme( m_colorsSettings.get() ); SyncLayersVisibility( &*m_dummyBoard ); Raise(); diff --git a/pcbnew/footprint_preview_panel.h b/pcbnew/footprint_preview_panel.h index d44313d539..fd98db283c 100644 --- a/pcbnew/footprint_preview_panel.h +++ b/pcbnew/footprint_preview_panel.h @@ -42,6 +42,7 @@ class IO_MGR; class BOARD; class FP_LOADER_THREAD; class FP_THREAD_IFACE; +class COLORS_DESIGN_SETTINGS; /** @@ -91,6 +92,7 @@ private: std::shared_ptr<FP_THREAD_IFACE> m_iface; FOOTPRINT_STATUS_HANDLER m_handler; std::unique_ptr<BOARD> m_dummyBoard; + std::unique_ptr<COLORS_DESIGN_SETTINGS> m_colorsSettings; LIB_ID m_currentFPID; bool m_footprintDisplayed; diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 2fbf7be80d..58497aa92b 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -324,6 +324,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); shrinkFont( cb, m_PointSize ); cb->SetValue( aSpec.state ); + cb->Enable( aSpec.changeable ); cb->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LAYER_WIDGET::OnRenderCheckBox, this ); cb->SetToolTip( aSpec.tooltip ); m_RenderFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags ); diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index 99949b59d9..0b85b84f6e 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -88,15 +88,17 @@ public: COLOR4D color; ///< COLOR4D::UNSPECIFIED if none. bool state; ///< initial wxCheckBox state wxString tooltip; ///< if not empty, use this tooltip on row + bool changeable; ///< if true, the state can be changed ROW( const wxString& aRowName, int aId, COLOR4D aColor = COLOR4D::UNSPECIFIED, - const wxString& aTooltip = wxEmptyString, bool aState = true ) + const wxString& aTooltip = wxEmptyString, bool aState = true, bool aChangeable = true ) { rowName = aRowName; id = aId; color = aColor; state = aState; tooltip = aTooltip; + changeable = aChangeable; } }; diff --git a/pcbnew/magnetic_tracks_functions.cpp b/pcbnew/magnetic_tracks_functions.cpp index c206010eff..6d7548990e 100644 --- a/pcbnew/magnetic_tracks_functions.cpp +++ b/pcbnew/magnetic_tracks_functions.cpp @@ -129,7 +129,7 @@ bool FindBestGridPointOnTrack( wxPoint* aNearPos, wxPoint on_grid, const TRACK* bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, wxPoint on_grid, wxPoint* curpos ) { - bool doCheckNet = g_MagneticPadOption != CAPTURE_ALWAYS && g_Drc_On; + bool doCheckNet = frame->Settings().m_magneticPads != CAPTURE_ALWAYS && frame->Settings().m_legacyDrcOn; bool doTrack = false; bool doPad = false; bool amMovingVia = false; @@ -155,20 +155,20 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, currTrack = NULL; } - if( g_MagneticPadOption == CAPTURE_ALWAYS ) + if( frame->Settings().m_magneticPads == CAPTURE_ALWAYS ) doPad = true; - if( g_MagneticTrackOption == CAPTURE_ALWAYS ) + if( frame->Settings().m_magneticTracks == CAPTURE_ALWAYS ) doTrack = true; if( aCurrentTool == ID_TRACK_BUTT || amMovingVia ) { int q = CAPTURE_CURSOR_IN_TRACK_TOOL; - if( g_MagneticPadOption == q ) + if( frame->Settings().m_magneticPads == q ) doPad = true; - if( g_MagneticTrackOption == q ) + if( frame->Settings().m_magneticTracks == q ) doTrack = true; } @@ -225,7 +225,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, /* * In two segment mode, ignore the final segment if it's inside a grid square. */ - if( !amMovingVia && currTrack && g_TwoSegmentTrackBuild && currTrack->Back() + if( !amMovingVia && currTrack && frame->Settings().m_legacyUseTwoSegmentTracks && currTrack->Back() && currTrack->GetStart().x - aGridSize.x < currTrack->GetEnd().x && currTrack->GetStart().x + aGridSize.x > currTrack->GetEnd().x && currTrack->GetStart().y - aGridSize.y < currTrack->GetEnd().y diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 58c042f30e..207d30309c 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -63,7 +63,7 @@ #include <wildcards_and_files_ext.h> #include <menus_helpers.h> #include <footprint_wizard_frame.h> -#include <pcbnew_config.h> +#include <config_params.h> #include <functional> using namespace std::placeholders; @@ -989,9 +989,9 @@ void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent ) } -COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor() const +COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor() { - return g_ColorsSettings.GetItemColor( LAYER_GRID ); + return Settings().Colors().GetItemColor( LAYER_GRID ); } diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index 67badbf136..7e69919c21 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -459,7 +459,7 @@ public: * Function GetGridColor() , virtual * @return the color of the grid */ - virtual COLOR4D GetGridColor() const override; + virtual COLOR4D GetGridColor() override; ///> @copydoc PCB_BASE_FRAME::SetActiveLayer() void SetActiveLayer( PCB_LAYER_ID aLayer ) override; diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 43b8e7d00a..526d024d81 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -821,7 +821,9 @@ void FOOTPRINT_EDIT_FRAME::updateTitle() void FOOTPRINT_EDIT_FRAME::updateView() { - static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() ); + auto dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() ); + dp->UseColorScheme( &Settings().Colors() ); + dp->DisplayBoard( GetBoard() ); m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); } diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index 4289c52866..77cab7733d 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -51,7 +51,7 @@ #include <hotkeys.h> #include <wildcards_and_files_ext.h> -#include <pcbnew_config.h> +#include <config_params.h> #include <tool/tool_manager.h> #include <tool/tool_dispatcher.h> @@ -699,9 +699,9 @@ void FOOTPRINT_VIEWER_FRAME::Update3D_Frame( bool aForceReloadFootprint ) } -COLOR4D FOOTPRINT_VIEWER_FRAME::GetGridColor() const +COLOR4D FOOTPRINT_VIEWER_FRAME::GetGridColor() { - return g_ColorsSettings.GetItemColor( LAYER_GRID ); + return Settings().Colors().GetItemColor( LAYER_GRID ); } @@ -890,7 +890,9 @@ void FOOTPRINT_VIEWER_FRAME::updateView() { if( IsGalCanvasActive() ) { - static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() ); + auto dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() ); + dp->UseColorScheme( &Settings().Colors() ); + dp->DisplayBoard( GetBoard() ); m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); } diff --git a/pcbnew/modview_frame.h b/pcbnew/modview_frame.h index 9c6ce27c56..bb6abcbc50 100644 --- a/pcbnew/modview_frame.h +++ b/pcbnew/modview_frame.h @@ -52,7 +52,7 @@ protected: public: ~FOOTPRINT_VIEWER_FRAME(); - virtual COLOR4D GetGridColor() const override; + virtual COLOR4D GetGridColor() override; /** * Function ReCreateLibraryList diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index b381e3caf6..5ffba986ae 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -801,7 +801,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) int current_net_code = Track->GetNetCode(); // DRC control: - if( g_Drc_On ) + if( Settings().m_legacyDrcOn ) { errdrc = m_drc->Drc( Track, GetBoard()->m_Track ); diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index 396909a3c5..7f44568cbd 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -73,6 +73,7 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard ) PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() ); drawPanel->DisplayBoard( aBoard ); + drawPanel->UseColorScheme( &Settings().Colors() ); m_toolManager->SetEnvironment( aBoard, drawPanel->GetView(), drawPanel->GetViewControls(), this ); diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index e97b2becbc..2c32aba38c 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -37,6 +37,8 @@ #include <class_track.h> #include <wxBasePcbFrame.h> +#include <gal/graphics_abstraction_layer.h> + #include <functional> using namespace std::placeholders; @@ -157,9 +159,6 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( const BOARD* aBoard ) // Ratsnest m_ratsnest.reset( new KIGFX::RATSNEST_VIEWITEM( aBoard->GetConnectivity() ) ); m_view->Add( m_ratsnest.get() ); - - // Display settings - UseColorScheme( aBoard->GetColorsSettings() ); } @@ -175,6 +174,7 @@ void PCB_DRAW_PANEL_GAL::UseColorScheme( const COLORS_DESIGN_SETTINGS* aSettings KIGFX::PCB_RENDER_SETTINGS* rs; rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() ); rs->ImportLegacyColors( aSettings ); + m_gal->SetCursorColor( aSettings->GetItemColor( LAYER_CURSOR ) ); } diff --git a/pcbnew/pcb_general_settings.cpp b/pcbnew/pcb_general_settings.cpp new file mode 100644 index 0000000000..7e8ea532a6 --- /dev/null +++ b/pcbnew/pcb_general_settings.cpp @@ -0,0 +1,49 @@ +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2012-2017 Kicad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <pcb_general_settings.h> + +PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS() +{ + Add( "LegacyDRCOn", &m_legacyDrcOn, true ); + Add( "LegacyAutoDeleteOldTrack", &m_legacyAutoDeleteOldTrack, true ); + Add( "LegacyUse45DegreeTracks",&m_legacyUse45DegreeTracks, true); + Add( "LegacyUseTwoSegmentTracks", &m_legacyUseTwoSegmentTracks, true); + Add( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false); + Add( "MagneticPads", reinterpret_cast<int*>( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL ); + Add( "MagneticTracks", reinterpret_cast<int*>( &m_magneticTracks ), CAPTURE_CURSOR_IN_TRACK_TOOL ); + Add( "EditActionChangesTrackWidth", &m_editActionChangesTrackWidth, false ); +} + +void PCB_GENERAL_SETTINGS::Load( wxConfigBase* aCfg ) +{ + m_colorsSettings.Load( aCfg ); + SETTINGS::Load( aCfg ); +} + + +void PCB_GENERAL_SETTINGS::Save( wxConfigBase* aCfg ) +{ + m_colorsSettings.Save( aCfg ); + SETTINGS::Save( aCfg ); +} diff --git a/pcbnew/pcb_general_settings.h b/pcbnew/pcb_general_settings.h new file mode 100644 index 0000000000..22e6e9c0e4 --- /dev/null +++ b/pcbnew/pcb_general_settings.h @@ -0,0 +1,68 @@ +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2012-2017 Kicad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __PCBNEW_GENERAL_SETTINGS_H +#define __PCBNEW_GENERAL_SETTINGS_H + +#include <class_colors_design_settings.h> + +class wxConfigBase; +class wxString; + +enum MAGNETIC_PAD_OPTION_VALUES +{ + NO_EFFECT, + CAPTURE_CURSOR_IN_TRACK_TOOL, + CAPTURE_ALWAYS +}; + +class PCB_GENERAL_SETTINGS : public SETTINGS +{ +public: + PCB_GENERAL_SETTINGS(); + + void Load ( wxConfigBase* aCfg ); + void Save( wxConfigBase* aCfg ); + + COLORS_DESIGN_SETTINGS m_colorsSettings; + + COLORS_DESIGN_SETTINGS& Colors() + { + return m_colorsSettings; + } + + bool m_legacyDrcOn = true; + bool m_legacyAutoDeleteOldTrack = true; + bool m_legacyAlternateTrackPosture = false; + bool m_legacyUse45DegreeTracks = true; // True to allow horiz, vert. and 45deg only tracks + bool m_use45DegreeGraphicSegments = false; // True to allow horiz, vert. and 45deg only graphic segments + bool m_legacyUseTwoSegmentTracks = true; + + bool m_editActionChangesTrackWidth = false; + bool m_showFilterDialogAfterEachSelection = false; + + MAGNETIC_PAD_OPTION_VALUES m_magneticPads = CAPTURE_CURSOR_IN_TRACK_TOOL; + MAGNETIC_PAD_OPTION_VALUES m_magneticTracks = CAPTURE_CURSOR_IN_TRACK_TOOL; +}; + +#endif diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 1293384e05..5cffa2f477 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -36,6 +36,7 @@ #include <class_mire.h> #include <class_marker_pcb.h> +#include <layers_id_colors_and_visibility.h> #include <pcb_painter.h> #include <gal/graphics_abstraction_layer.h> #include <convert_basic_shapes_to_polygon.h> @@ -87,7 +88,6 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet m_layerColors[LAYER_PADS_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 ); m_layerColors[LAYER_PAD_FR_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 ); m_layerColors[LAYER_PAD_BK_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 ); - m_layerColors[LAYER_WORKSHEET] = COLOR4D( 0.5, 0.0, 0.0, 0.8 ); m_layerColors[LAYER_DRC] = COLOR4D( 1.0, 0.0, 0.0, 0.8 ); // LAYER_NON_PLATED, LAYER_ANCHOR],LAYER_RATSNEST, @@ -98,9 +98,6 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet m_layerColors[LAYER_MOD_TEXT_FR] = m_layerColors[F_SilkS]; m_layerColors[LAYER_MOD_TEXT_BK] = m_layerColors[B_SilkS]; - // Make ratsnest lines slightly transparent - m_layerColors[LAYER_RATSNEST].a = 0.8; - // Netnames for copper layers for( LSEQ cu = LSET::AllCuMask().CuStack(); cu; ++cu ) { @@ -114,6 +111,8 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet m_layerColors[GetNetnameLayer( layer )] = lightLabel; } + SetBackgroundColor ( aSettings->GetItemColor( LAYER_PCB_BACKGROUND ) ); + update(); } diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index 4c716a84ca..895e57e452 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -126,6 +126,13 @@ public: return m_sketchMode[aItemLayer]; } + inline bool IsBackgroundDark() const + { + auto luma = m_layerColors[ LAYER_PCB_BACKGROUND ].GetBrightness(); + + return luma < 0.5; + } + protected: ///> Flag determining if items on a given layer should be drawn as an outline or a filled item bool m_sketchMode[GAL_LAYER_ID_END]; diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 1f9fe85410..d622069c8e 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -50,7 +50,7 @@ #include <dialog_design_rules.h> #include <class_pcb_layer_widget.h> #include <hotkeys.h> -#include <pcbnew_config.h> +#include <config_params.h> #include <module_editor_frame.h> #include <dialog_helpers.h> #include <dialog_plot.h> @@ -731,15 +731,15 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable ) void PCB_EDIT_FRAME::forceColorsToLegacy() { - COLORS_DESIGN_SETTINGS* cds = GetBoard()->GetColorsSettings(); + COLORS_DESIGN_SETTINGS& cds = Settings().Colors(); - for( unsigned i = 0; i < DIM( cds->m_LayersColors ); i++ ) + for( unsigned i = 0; i < DIM( cds.m_LayersColors ); i++ ) { - COLOR4D c = cds->GetLayerColor( i ); + COLOR4D c = cds.GetLayerColor( i ); c.SetToNearestLegacyColor(); // Note the alpha chanel is not modified. Therefore the value // is the previous value used in GAL canvas. - cds->SetLayerColor( i, c ); + cds.SetLayerColor( i, c ); } } @@ -794,6 +794,8 @@ void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); + m_configSettings.Load( aCfg ); + double dtmp; aCfg->Read( PlotLineWidthEntry, &dtmp, 0.1 ); // stored in mm @@ -805,8 +807,6 @@ void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) g_DrawDefaultLineThickness = Millimeter2iu( dtmp ); - aCfg->Read( MagneticPadsEntry, &g_MagneticPadOption ); - aCfg->Read( MagneticTracksEntry, &g_MagneticTrackOption ); aCfg->Read( ShowMicrowaveEntry, &m_show_microwave_tools ); aCfg->Read( ShowLayerManagerEntry, &m_show_layer_manager_tools ); aCfg->Read( ShowPageLimitsEntry, &m_showPageLimits ); @@ -815,14 +815,14 @@ void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) void PCB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) { + m_configSettings.Save( aCfg ); + PCB_BASE_FRAME::SaveSettings( aCfg ); wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); // This value is stored in mm ) aCfg->Write( PlotLineWidthEntry, MM_PER_IU * g_DrawDefaultLineThickness ); - aCfg->Write( MagneticPadsEntry, (long) g_MagneticPadOption ); - aCfg->Write( MagneticTracksEntry, (long) g_MagneticTrackOption ); aCfg->Write( ShowMicrowaveEntry, (long) m_show_microwave_tools ); aCfg->Write( ShowLayerManagerEntry, (long)m_show_layer_manager_tools ); aCfg->Write( ShowPageLimitsEntry, m_showPageLimits ); @@ -841,16 +841,16 @@ void PCB_EDIT_FRAME::SetGridVisibility(bool aVisible) } -COLOR4D PCB_EDIT_FRAME::GetGridColor() const +COLOR4D PCB_EDIT_FRAME::GetGridColor() { - return GetBoard()->GetVisibleElementColor( LAYER_GRID ); + return Settings().Colors().GetItemColor( LAYER_GRID ); } void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor ) { - GetBoard()->SetVisibleElementColor( LAYER_GRID, aColor ); + Settings().Colors().SetItemColor( LAYER_GRID, aColor ); if( IsGalCanvasActive() ) { diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 255aa37935..be5a4c9992 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -42,7 +42,6 @@ #include <class_drawpanel.h> #include <wxPcbStruct.h> #include <eda_dde.h> -#include <colors_selection.h> #include <wx/stdpaths.h> #include <wx/file.h> @@ -65,20 +64,11 @@ extern bool IsWxPythonLoaded(); // Colors for layers and items -COLORS_DESIGN_SETTINGS g_ColorsSettings; - -bool g_Drc_On = true; -bool g_AutoDeleteOldTrack = true; -bool g_Raccord_45_Auto = true; -bool g_Alternate_Track_Posture = false; -bool g_Track_45_Only_Allowed = true; // True to allow horiz, vert. and 45deg only tracks -bool g_Segments_45_Only; // True to allow horiz, vert. and 45deg only graphic segments -bool g_TwoSegmentTrackBuild = true; PCB_LAYER_ID g_Route_Layer_TOP; PCB_LAYER_ID g_Route_Layer_BOTTOM; -int g_MagneticPadOption = CAPTURE_CURSOR_IN_TRACK_TOOL; -int g_MagneticTrackOption = CAPTURE_CURSOR_IN_TRACK_TOOL; +bool g_Alternate_Track_Posture = false; +bool g_Raccord_45_Auto = true; wxPoint g_Offset_Module; // module offset used when moving a footprint diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index 55e2729538..228a5fab03 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -76,13 +76,8 @@ enum ENDPOINT_T { extern wxString g_DocModulesFileName; // variables -extern bool g_Drc_On; -extern bool g_AutoDeleteOldTrack; extern bool g_Raccord_45_Auto; -extern bool g_Track_45_Only_Allowed; extern bool g_Alternate_Track_Posture; -extern bool g_Segments_45_Only; - // Layer pair for auto routing and switch layers by hotkey extern PCB_LAYER_ID g_Route_Layer_TOP; extern PCB_LAYER_ID g_Route_Layer_BOTTOM; @@ -101,12 +96,6 @@ extern DLIST<TRACK> g_CurrentTrackList; #define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created -enum MAGNETICPAD_OPTION_VALUES -{ - NO_EFFECT, - CAPTURE_CURSOR_IN_TRACK_TOOL, - CAPTURE_ALWAYS -}; /** * Helper function PythonPluginsReloadBase diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index ec888800b4..a9042fbbdf 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -52,7 +52,6 @@ #include <pcbnew.h> #include <pcbnew_id.h> #include <hotkeys.h> -#include <pcbnew_config.h> #include <module_editor_frame.h> #include <modview_frame.h> @@ -328,95 +327,56 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() { DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); - if( m_configSettings.empty() ) + if( m_configParams.empty() ) { - COLORS_DESIGN_SETTINGS cds; // constructor fills this with sensible colors // Units used in dialogs and toolbars - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), + m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), (int*)&g_UserUnit, MILLIMETRES ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ), + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ), &displ_opts->m_DisplayPolarCood, false ) ); // Display options and modes: - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ), + m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ), &displ_opts->m_DisplayNetNamesMode, 3, 0, 3 ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ), + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ), &displ_opts->m_DisplayPcbTrackFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ), + m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ), (int*) &displ_opts->m_ShowTrackClearanceMode, SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ), + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ), &displ_opts->m_DisplayPadFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ), + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ), &displ_opts->m_DisplayViaFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ), + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ), &displ_opts->m_DisplayPadIsol, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ), + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ), &displ_opts->m_DisplayPadNum, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffC" ), + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffC" ), &displ_opts->m_DisplayModEdgeFill, FILLED ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffT" ), + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffT" ), &displ_opts->m_DisplayModTextFill, FILLED ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PcbAffT" ), + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PcbAffT" ), &displ_opts->m_DisplayDrawItemsFill, FILLED ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), + m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), &displ_opts->m_DisplayZonesMode, 0, 0, 2 ) ); // layer colors: - wxASSERT( DIM( cds.m_LayersColors ) >= PCB_LAYER_ID_COUNT ); - for( int i = 0; i<PCB_LAYER_ID_COUNT; ++i ) - { - wxString vn = wxString::Format( "ColorPCBLayer_%s", - LSET::Name( PCB_LAYER_ID( i ) ) ); - - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, vn, LOC_COLOR( i ), - cds.m_LayersColors[i] ) ); - } - - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtFrontEx" ), - ITEM_COLOR( LAYER_MOD_TEXT_FR ), - LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtBackEx" ), - ITEM_COLOR( LAYER_MOD_TEXT_BK ), - BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtInvisEx" ), - ITEM_COLOR( LAYER_MOD_TEXT_INVISIBLE ), - DARKGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorAnchorEx" ), - ITEM_COLOR( LAYER_ANCHOR ), BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadBackEx" ), - ITEM_COLOR( LAYER_PAD_BK ), GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadFrontEx" ), - ITEM_COLOR( LAYER_PAD_FR ), RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaThruEx" ), - ITEM_COLOR( LAYER_VIA_THROUGH ), - LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaBBlindEx" ), - ITEM_COLOR( LAYER_VIA_BBLIND ), - BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaMicroEx" ), - ITEM_COLOR( LAYER_VIA_MICROVIA ), - CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNonPlatedEx" ), - ITEM_COLOR( LAYER_NON_PLATED ), - YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRatsEx" ), - ITEM_COLOR( LAYER_RATSNEST ), - WHITE ) ); // Miscellaneous: - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &m_rotationAngle, + m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &m_rotationAngle, 900, 1, 900 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), + m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), &displ_opts->m_MaxLinksShowed, 3, 0, 15 ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "TwoSegT" ), + +//FIXMEd +/* m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "TwoSegT" ), &g_TwoSegmentTrackBuild, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SegmPcb45Only" ) - , &g_Segments_45_Only, true ) ); + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "SegmPcb45Only" ) + , &g_Segments_45_Only, true ) );*/ } - return m_configSettings; + return m_configParams; } diff --git a/pcbnew/pcbnew_config.h b/pcbnew/pcbnew_config.h index e2f9ac318f..823d18ef9f 100644 --- a/pcbnew/pcbnew_config.h +++ b/pcbnew/pcbnew_config.h @@ -7,11 +7,8 @@ #define _PCBNEW_CONFIG_H_ #include <config_params.h> -#include <colors_selection.h> /* Useful macro : */ -#define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer] -#define ITEM_COLOR(item_visible) &g_ColorsSettings.m_LayersColors[item_visible] #endif // _PCBNEW_CONFIG_H_ diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index b99aca98c1..a8b81c3dd1 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -101,10 +101,10 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, COLOR4D color = COLOR4D::BLACK; if( layersmask_plotpads[B_SilkS] ) - color = aBoard->GetLayerColor( B_SilkS ); + color = aBoard->Colors().GetLayerColor( B_SilkS ); if( layersmask_plotpads[F_SilkS] ) - color = ( color == COLOR4D::BLACK) ? aBoard->GetLayerColor( F_SilkS ) : color; + color = ( color == COLOR4D::BLACK) ? aBoard->Colors().GetLayerColor( F_SilkS ) : color; itemplotter.PlotPad( pad, color, SKETCH ); } @@ -417,10 +417,10 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, COLOR4D color = COLOR4D::BLACK; if( pad->GetLayerSet()[B_Cu] ) - color = aBoard->GetVisibleElementColor( LAYER_PAD_BK ); + color = aBoard->Colors().GetItemColor( LAYER_PAD_BK ); if( pad->GetLayerSet()[F_Cu] ) - color = color.LegacyMix( aBoard->GetVisibleElementColor( LAYER_PAD_FR ) ); + color = color.LegacyMix( aBoard->Colors().GetItemColor( LAYER_PAD_FR ) ); // Temporary set the pad size to the required plot size: wxSize tmppadsize = pad->GetSize(); @@ -513,7 +513,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, gbr_metadata.SetNetName( Via->GetNetname() ); - COLOR4D color = aBoard->GetVisibleElementColor( LAYER_VIAS + Via->GetViaType() ); + COLOR4D color = aBoard->Colors().GetItemColor( LAYER_VIAS + Via->GetViaType() ); // Set plot color (change WHITE to LIGHTGRAY because // the white items are not seen on a white paper or screen aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY); diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index b4a924294c..2d0d4b1b84 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -56,7 +56,7 @@ COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer ) { - COLOR4D color = m_board->GetLayerColor( ToLAYER_ID( aLayer ) ); + COLOR4D color = m_board->Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); if( color == COLOR4D::WHITE ) color = COLOR4D( LIGHTGRAY ); return color; @@ -339,9 +339,11 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim ) draw.SetWidth( aDim->GetWidth() ); draw.SetLayer( aDim->GetLayer() ); - COLOR4D color = getColor( aDim->GetLayer() ); + COLOR4D color = m_board->Colors().GetLayerColor( aDim->GetLayer() ); - m_plotter->SetColor( color ); + // Set plot color (change WHITE to LIGHTGRAY because + // the white items are not seen on a white paper or screen + m_plotter->SetColor( color != WHITE ? color : LIGHTGRAY); PlotTextePcb( &aDim->Text() ); diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 8fb90d7a1c..8766864eec 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -29,7 +29,6 @@ #include <class_drawpanel.h> #include <wxPcbStruct.h> #include <printout_controler.h> -#include <colors_selection.h> #include <class_board.h> #include <class_module.h> #include <class_edge_mod.h> @@ -223,7 +222,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, int radius = track->GetWidth() / 2; const VIA* via = static_cast<const VIA*>( track ); - COLOR4D color = g_ColorsSettings.GetItemColor( LAYER_VIAS + via->GetViaType() ); + COLOR4D color = Settings().Colors().GetItemColor( LAYER_VIAS + via->GetViaType() ); GRFilledCircle( m_canvas->GetClipBox(), aDC, via->GetStart().x, diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index f88e6c2776..7d1e1646cb 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -31,7 +31,6 @@ #include <gr_basic.h> #include <common.h> #include <class_drawpanel.h> -#include <colors_selection.h> #include <wxBasePcbFrame.h> #include <macros.h> @@ -97,7 +96,7 @@ void PCB_BASE_FRAME::DrawGeneralRatsnest( wxDC* aDC, int aNetcode ) auto connectivity = m_Pcb->GetConnectivity(); - COLOR4D color = g_ColorsSettings.GetItemColor( LAYER_RATSNEST ); + COLOR4D color = Settings().Colors().GetItemColor( LAYER_RATSNEST ); for( int i = 1; i < connectivity->GetNetCount(); ++i ) { @@ -133,7 +132,7 @@ void PCB_BASE_FRAME::TraceModuleRatsNest( wxDC* DC ) if( DC == NULL ) return; - COLOR4D tmpcolor = g_ColorsSettings.GetItemColor( LAYER_RATSNEST ); + COLOR4D tmpcolor = Settings().Colors().GetItemColor( LAYER_RATSNEST ); for( const auto& l : GetBoard()->GetConnectivity()->GetDynamicRatsnest() ) { diff --git a/pcbnew/ratsnest_data.cpp b/pcbnew/ratsnest_data.cpp index 3e144d1ae2..2814efa463 100644 --- a/pcbnew/ratsnest_data.cpp +++ b/pcbnew/ratsnest_data.cpp @@ -161,7 +161,73 @@ class RN_NET::TRIANGULATOR_STATE { private: std::vector<CN_ANCHOR_PTR> m_allNodes; - std::vector<hed::NODE_PTR> m_triangulationNodes; + std::vector<VECTOR2I> m_prevNodes; + std::vector<std::pair<int, int> > m_prevEdges; + + const std::list<hed::EDGE_PTR>& hedTriangulation( std::vector<hed::NODE_PTR>& aNodes ) + { + hed::TRIANGULATION triangulator; + triangulator.CreateDelaunay( aNodes.begin(), aNodes.end() ); + std::list<hed::EDGE_PTR> edges; + triangulator.GetEdges( edges ); + + return edges; + } + + + const std::list<hed::EDGE_PTR>& computeTriangulation( std::vector<hed::NODE_PTR>& aNodes ) + { + #if 0 + bool refresh = false; + // we assume aNodes are sorted + VECTOR2I prevDelta; + + if ( aNodes.size() == m_prevNodes.size() ) + { + for ( int i = 0; i < aNodes.size(); i++ ) + { + const auto& a = aNodes[i]; + const auto& b = m_prevNodes[i]; + + const auto delta = a->Pos() - b; + + if ( i > 0 && delta != prevDelta ) + { + refresh = true; + break; + } + + prevDelta = delta; + } + } + + if( refresh ) + { + m_prevNodes.resize( aNodes.size() ); + + for ( int i = 0; i < aNodes.size(); i++ ) + { + m_prevNodes[i] = aNodes[i]->Pos(); + } + + printf("need triang refresh\n"); + auto edges = hedTriangulation( aNodes ); + + m_prevEdges.resize( edges.size() ); + + int i = 0; + for ( auto e : edges ) + { + m_prevEdges[i].first = e->GetSourceNode()->Id(); + m_prevEdges[i].second = e->GetTargetNode()->Id(); + } + + } + + + #endif + return hedTriangulation( aNodes ); + } public: @@ -249,6 +315,7 @@ public: { hed::TRIANGULATION triangulator; triangulator.CreateDelaunay( triNodes.begin(), triNodes.end() ); +// std::list<hed::EDGE_PTR> edges; triangulator.GetEdges( triangEdges ); for( auto e : triangEdges ) diff --git a/pcbnew/ratsnest_viewitem.cpp b/pcbnew/ratsnest_viewitem.cpp index b4225cf30c..eeb7224603 100644 --- a/pcbnew/ratsnest_viewitem.cpp +++ b/pcbnew/ratsnest_viewitem.cpp @@ -68,7 +68,7 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const int highlightedNet = rs->GetHighlightNetCode(); - gal->SetStrokeColor( color.Brightened( 0.8 ) ); + gal->SetStrokeColor( color.Brightened(0.8) ); // Draw the "dynamic" ratsnest (i.e. for objects that may be currently being moved) for( const auto& l : m_data->GetDynamicRatsnest() ) diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 235ccc930e..7559836b8f 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -42,32 +42,32 @@ class PCB_LAYER_SELECTOR: public LAYER_SELECTOR { public: - PCB_LAYER_SELECTOR( BOARD* aBrd ) : + PCB_LAYER_SELECTOR( PCB_BASE_FRAME* aFrame ) : LAYER_SELECTOR() { - m_brd = aBrd; + m_frame = aFrame; } protected: - BOARD* m_brd; + PCB_BASE_FRAME* m_frame; // Returns true if the layer id is enabled (i.e. is it should be displayed) bool IsLayerEnabled( LAYER_NUM aLayer ) const override { - return m_brd->IsLayerEnabled( PCB_LAYER_ID( aLayer ) ); + return m_frame->GetBoard()->IsLayerEnabled( PCB_LAYER_ID( aLayer ) ); } // Returns a color index from the layer id // Virtual function COLOR4D GetLayerColor( LAYER_NUM aLayer ) const override { - return m_brd->GetLayerColor( ToLAYER_ID( aLayer ) ); + return m_frame->Settings().Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); } // Returns the name of the layer id wxString GetLayerName( LAYER_NUM aLayer ) const override { - return m_brd->GetLayerName( ToLAYER_ID( aLayer ) ); + return m_frame->GetBoard()->GetLayerName( ToLAYER_ID( aLayer ) ); } }; @@ -81,12 +81,12 @@ class PCB_ONE_LAYER_SELECTOR : public PCB_LAYER_SELECTOR, { PCB_LAYER_ID m_layerSelected; LSET m_notAllowedLayersMask; - + BOARD* m_brd; std::vector<PCB_LAYER_ID> m_layersIdLeftColumn; std::vector<PCB_LAYER_ID> m_layersIdRightColumn; public: - PCB_ONE_LAYER_SELECTOR( wxWindow* aParent, BOARD * aBrd, + PCB_ONE_LAYER_SELECTOR( PCB_BASE_FRAME* aParent, BOARD * aBrd, PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask ); @@ -101,12 +101,13 @@ private: }; -PCB_ONE_LAYER_SELECTOR::PCB_ONE_LAYER_SELECTOR( wxWindow* aParent, +PCB_ONE_LAYER_SELECTOR::PCB_ONE_LAYER_SELECTOR( PCB_BASE_FRAME* aParent, BOARD* aBrd, PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask ) - : PCB_LAYER_SELECTOR( aBrd ), DIALOG_LAYER_SELECTION_BASE( aParent ) + : PCB_LAYER_SELECTOR( aParent ), DIALOG_LAYER_SELECTION_BASE( aParent ) { m_layerSelected = aDefaultLayer; m_notAllowedLayersMask = aNotAllowedLayersMask; + m_brd = aBrd; buildList(); Layout(); GetSizer()->SetSizeHints( this ); @@ -246,6 +247,7 @@ class SELECT_COPPER_LAYERS_PAIR_DIALOG: public PCB_LAYER_SELECTOR, public DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE { private: + BOARD* m_brd; PCB_LAYER_ID m_frontLayer; PCB_LAYER_ID m_backLayer; int m_leftRowSelected; @@ -254,7 +256,7 @@ private: std::vector<PCB_LAYER_ID> m_layersId; public: - SELECT_COPPER_LAYERS_PAIR_DIALOG( wxWindow* aParent, BOARD* aPcb, + SELECT_COPPER_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* aParent, BOARD* aPcb, PCB_LAYER_ID aFrontLayer, PCB_LAYER_ID aBackLayer ); void GetLayerPair( PCB_LAYER_ID& aFrontLayer, PCB_LAYER_ID& aBackLayer ) @@ -306,14 +308,15 @@ void PCB_BASE_FRAME::SelectCopperLayerPair() SELECT_COPPER_LAYERS_PAIR_DIALOG::SELECT_COPPER_LAYERS_PAIR_DIALOG( - wxWindow* aParent, BOARD * aPcb, PCB_LAYER_ID aFrontLayer, PCB_LAYER_ID aBackLayer) : - PCB_LAYER_SELECTOR( aPcb ), + PCB_BASE_FRAME* aParent, BOARD * aPcb, PCB_LAYER_ID aFrontLayer, PCB_LAYER_ID aBackLayer) : + PCB_LAYER_SELECTOR( aParent ), DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE( aParent ) { m_frontLayer = aFrontLayer; m_backLayer = aBackLayer; m_leftRowSelected = 0; m_rightRowSelected = 0; + m_brd = aPcb; buildList(); SetFocus(); GetSizer()->SetSizeHints( this ); diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index cf7bf5edb0..c354c188b8 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -34,7 +34,6 @@ #include <help_common_strings.h> #include <dialog_helpers.h> #include <class_layer_box_selector.h> -#include <colors_selection.h> #include <wxPcbStruct.h> #include <class_drawpanel.h> #include <confirm.h> @@ -102,7 +101,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator() previous_Route_Layer_BOTTOM_color, previous_via_color; /* get colors, and redraw bitmap button only on changes */ - active_layer_color = GetBoard()->GetLayerColor(GetActiveLayer()); + active_layer_color = Settings().Colors().GetLayerColor(GetActiveLayer()); if( previous_active_layer_color != active_layer_color ) { @@ -111,7 +110,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator() } Route_Layer_TOP_color = - g_ColorsSettings.GetLayerColor( GetScreen()->m_Route_Layer_TOP ); + Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_TOP ); if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color ) { @@ -120,7 +119,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator() } Route_Layer_BOTTOM_color = - g_ColorsSettings.GetLayerColor( GetScreen()->m_Route_Layer_BOTTOM ); + Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_BOTTOM ); if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color ) { @@ -129,7 +128,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator() } int via_type = GetDesignSettings().m_CurrentViaType; - via_color = GetBoard()->GetVisibleElementColor( LAYER_VIAS + via_type ); + via_color = Settings().Colors().GetItemColor( LAYER_VIAS + via_type ); if( previous_via_color != via_color ) { @@ -736,11 +735,11 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) switch( id ) { case ID_TB_OPTIONS_DRC_OFF: - g_Drc_On = !state; + Settings().m_legacyDrcOn = !state; if( GetToolId() == ID_TRACK_BUTT ) { - if( g_Drc_On ) + if( Settings().m_legacyDrcOn ) m_canvas->SetCursor( wxCURSOR_PENCIL ); else m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW ); @@ -756,7 +755,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) break; case ID_TB_OPTIONS_AUTO_DEL_TRACK: - g_AutoDeleteOldTrack = state; + Settings().m_legacyAutoDeleteOldTrack = state; break; case ID_TB_OPTIONS_SHOW_ZONES: diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index 8c840613ab..a962274bbd 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -131,12 +131,12 @@ void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent ) { - bool state = !g_Drc_On; + bool state = !Settings().m_legacyDrcOn; aEvent.Check( state ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF, - g_Drc_On ? - _( "Disable design rule checking" ) : - _( "Enable design rule checking" ) ); + Settings().m_legacyDrcOn ? + _( "Disable design rule checking while routing/editing tracks" ) : + _( "Enable design rule checking while routing/editing tracks" ) ); } void PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent ) @@ -151,9 +151,9 @@ void PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent ) { - aEvent.Check( g_AutoDeleteOldTrack ); + aEvent.Check( Settings().m_legacyAutoDeleteOldTrack ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK, - g_AutoDeleteOldTrack ? + Settings().m_legacyAutoDeleteOldTrack ? _( "Disable auto delete old track" ) : _( "Enable auto delete old track" ) ); } diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index fc653e3a7a..abdcd46384 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -952,7 +952,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, cursorPos = m_controls->GetCursorPosition(); // 45 degree angle constraint enabled with an option and toggled with Ctrl - const bool limit45 = ( g_Segments_45_Only != !!( evt->Modifier( MD_CTRL ) ) ); + const bool limit45 = ( frame()->Settings().m_use45DegreeGraphicSegments != !!( evt->Modifier( MD_CTRL ) ) ); if( direction45 != limit45 && started && aShape == S_SEGMENT ) { diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 1c68b08b23..b430a49296 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -522,12 +522,49 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) // Tracks & vias are treated in a special way: if( ( SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) )( selection ) ) { - DIALOG_TRACK_VIA_PROPERTIES dlg( editFrame, selection ); - - if( dlg.ShowModal() ) + if ( selection.Size() == 1 && editFrame->Settings().m_editActionChangesTrackWidth ) { - dlg.Apply( *m_commit ); - m_commit->Push( _( "Edit track/via properties" ) ); + auto item = static_cast<BOARD_ITEM *>( selection[0] ); + + m_commit->Modify( item ); + + if( auto via = dyn_cast<VIA*>( item ) ) + { + int new_width, new_drill; + + if( via->GetViaType() == VIA_MICROVIA ) + { + auto net = via->GetNet(); + + new_width = net->GetMicroViaSize(); + new_drill = net->GetMicroViaDrillSize(); + } + else + { + new_width = board()->GetDesignSettings().GetCurrentViaSize(); + new_drill = board()->GetDesignSettings().GetCurrentViaDrill(); + } + + via->SetDrill( new_drill ); + via->SetWidth( new_width ); + } + else if ( auto track = dyn_cast<TRACK*>( item ) ) + { + int new_width = board()->GetDesignSettings().GetCurrentTrackWidth(); + track->SetWidth( new_width ); + } + + m_commit->Push( _("Edit track width/via size") ); + } + else + { + DIALOG_TRACK_VIA_PROPERTIES dlg( editFrame, selection ); + + if( dlg.ShowModal() ) + { + dlg.Apply( *m_commit ); + m_commit->Push( _( "Edit track/via properties" ) ); + } } } else if( selection.Size() == 1 ) // Properties are displayed when there is only one item selected diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index e92016e86f..2bb17533f2 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -197,6 +197,9 @@ public: /// Activation of the Push and Shove router (inline dragging mode) static TOOL_ACTION routerInlineDrag; + /// Break track action + static TOOL_ACTION breakTrack; + // Point Editor /// Break outline (insert additional points to an edge) static TOOL_ACTION pointEditorAddCorner; diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index a26829676d..d8e462386f 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -673,7 +673,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) // Add the duplicate corner: zone->AppendCorner( GetCrossHairPosition(), -1, true ); - if( g_Drc_On && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() ) + if( Settings().m_legacyDrcOn && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() ) { zone->ClearFlags(); zone->RemoveAllContours(); @@ -698,7 +698,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) // by Show_New_Edge_While_Move_Mouse if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) ) { - if( !g_Drc_On || !zone->IsOnCopperLayer() || ( m_drc->Drc( zone, ii - 1 ) == OK_DRC ) ) + if( !Settings().m_legacyDrcOn || !zone->IsOnCopperLayer() || ( m_drc->Drc( zone, ii - 1 ) == OK_DRC ) ) { // Ok, we can add a new corner if( m_canvas->IsMouseCaptured() ) @@ -742,10 +742,10 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ) int icorner = zone->GetNumCorners() - 1; if( zone->IsOnCopperLayer() ) { - if( g_Drc_On && m_drc->Drc( zone, icorner - 1 ) == BAD_DRC ) // we can't validate last edge + if( Settings().m_legacyDrcOn && m_drc->Drc( zone, icorner - 1 ) == BAD_DRC ) // we can't validate last edge return false; - if( g_Drc_On && m_drc->Drc( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge + if( Settings().m_legacyDrcOn && m_drc->Drc( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge { DisplayErrorMessage( this, _( "DRC error: closing this area creates a DRC error with an other area" ) );