ADDED separate user-defined color for page limits.

Fixes https://gitlab.com/kicad/code/kicad/issues/5271
This commit is contained in:
Jeff Young 2022-03-24 14:10:47 +00:00
parent 93066004f1
commit 92a229eec7
15 changed files with 99 additions and 68 deletions

View File

@ -2,6 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2013-2020 CERN
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -44,7 +45,7 @@ DS_PROXY_VIEW_ITEM::DS_PROXY_VIEW_ITEM( int aMils2IUscalefactor, const PAGE_INFO
m_isFirstPage( false ),
m_project( aProject ),
m_colorLayer( LAYER_DRAWINGSHEET ),
m_pageBorderColorLayer( LAYER_GRID )
m_pageBorderColorLayer( LAYER_PAGE_LIMITS )
{
}

View File

@ -141,6 +141,7 @@ wxString LayerName( int aLayer )
case LAYER_HIDDEN: return _( "Hidden items" );
case LAYER_SELECTION_SHADOWS: return _( "Selection highlight" );
case LAYER_SCHEMATIC_DRAWINGSHEET: return _( "Drawing sheet" );
case LAYER_SCHEMATIC_PAGE_LIMITS: return _( "Page limits" );
// GAL_LAYER_ID
@ -170,6 +171,7 @@ wxString LayerName( int aLayer )
case LAYER_MARKER_SHADOWS: return _( "DRC marker shadows" );
case LAYER_ANCHOR: return _( "Anchors" );
case LAYER_DRAWINGSHEET: return _( "Drawing sheet" );
case LAYER_PAGE_LIMITS: return _( "Page limits" );
case LAYER_CURSOR: return _( "Cursor" );
case LAYER_AUX_ITEMS: return _( "Helper items" );
case LAYER_GRID: return _( "Grid" );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2022 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
@ -69,14 +69,16 @@ static const std::map<int, COLOR4D> s_defaultTheme =
{ LAYER_SHEETNAME, CSS_COLOR( 0, 100, 100, 1 ) },
{ LAYER_VALUEPART, CSS_COLOR( 0, 100, 100, 1 ) },
{ LAYER_WIRE, CSS_COLOR( 0, 150, 0, 1 ) },
{ LAYER_SCHEMATIC_DRAWINGSHEET, CSS_COLOR( 132, 0, 0, 1 ) },
{ LAYER_SCHEMATIC_DRAWINGSHEET, CSS_COLOR( 132, 0, 0, 1 ) },
{ LAYER_SCHEMATIC_PAGE_LIMITS, CSS_COLOR( 181, 181, 181, 1 ) },
{ LAYER_GERBVIEW_AXES, CSS_COLOR( 0, 0, 132, 1 ) },
{ LAYER_GERBVIEW_BACKGROUND, CSS_COLOR( 0, 0, 0, 1 ) },
{ LAYER_DCODES, CSS_COLOR( 255, 255, 255, 1 ) },
{ LAYER_GERBVIEW_GRID, CSS_COLOR( 132, 132, 132, 1 ) },
{ LAYER_NEGATIVE_OBJECTS, CSS_COLOR( 132, 132, 132, 1 ) },
{ LAYER_GERBVIEW_DRAWINGSHEET, CSS_COLOR( 0, 0, 132, 1 ) },
{ LAYER_GERBVIEW_DRAWINGSHEET, CSS_COLOR( 0, 0, 132, 1 ) },
{ LAYER_GERBVIEW_PAGE_LIMITS, CSS_COLOR( 132, 132, 132, 1 ) },
{ LAYER_ANCHOR, CSS_COLOR( 255, 38, 226, 1 ) },
{ LAYER_LOCKED_ITEM_SHADOW, CSS_COLOR( 255, 38, 226, 0.5 ) },
@ -100,6 +102,7 @@ static const std::map<int, COLOR4D> s_defaultTheme =
{ LAYER_VIA_HOLES, CSS_COLOR( 227, 183, 46, 1 ) },
{ LAYER_VIA_MICROVIA, CSS_COLOR( 0, 132, 132, 1 ) },
{ LAYER_DRAWINGSHEET, CSS_COLOR( 200, 114, 171, 1 ) },
{ LAYER_PAGE_LIMITS, CSS_COLOR( 132, 132, 132, 1 ) },
{ F_Cu, CSS_COLOR( 200, 52, 52, 1 ) },
{ In1_Cu, CSS_COLOR( 127, 200, 127, 1 ) },
@ -225,7 +228,8 @@ static const std::map<int, COLOR4D> s_classicTheme =
{ LAYER_DCODES, COLOR4D( WHITE ) },
{ LAYER_GERBVIEW_GRID, COLOR4D( MAGENTA ) },
{ LAYER_NEGATIVE_OBJECTS, COLOR4D( DARKGRAY ) },
{ LAYER_GERBVIEW_DRAWINGSHEET, COLOR4D( RED ) },
{ LAYER_GERBVIEW_DRAWINGSHEET, COLOR4D( DARKRED ) },
{ LAYER_GERBVIEW_PAGE_LIMITS, COLOR4D( MAGENTA ) },
{ LAYER_ANCHOR, COLOR4D( BLUE ) },
{ LAYER_LOCKED_ITEM_SHADOW, COLOR4D( BLUE ) },
@ -249,6 +253,7 @@ static const std::map<int, COLOR4D> s_classicTheme =
{ LAYER_VIA_HOLES, COLOR4D( 0.5, 0.4, 0, 0.8 ) },
{ LAYER_VIA_MICROVIA, COLOR4D( CYAN ) },
{ LAYER_DRAWINGSHEET, COLOR4D( DARKRED ) },
{ LAYER_PAGE_LIMITS, COLOR4D( DARKGRAY) },
{ F_Cu, COLOR4D( RED ) },
{ In1_Cu, COLOR4D( YELLOW ) },

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 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
@ -30,7 +30,7 @@
///! Update the schema version whenever a migration is required
const int colorsSchemaVersion = 3;
const int colorsSchemaVersion = 4;
COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath ) :
@ -100,12 +100,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "schematic.pin_name", LAYER_PINNAM );
CLR( "schematic.pin_number", LAYER_PINNUM );
CLR( "schematic.reference", LAYER_REFERENCEPART );
// Macs look better with a lighter shadow
#ifdef __WXMAC__
CLR( "schematic.shadow", LAYER_SELECTION_SHADOWS );
#else
CLR( "schematic.shadow", LAYER_SELECTION_SHADOWS );
#endif
CLR( "schematic.sheet", LAYER_SHEET );
CLR( "schematic.sheet_background", LAYER_SHEET_BACKGROUND );
CLR( "schematic.sheet_filename", LAYER_SHEETFILENAME );
@ -115,6 +110,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "schematic.value", LAYER_VALUEPART );
CLR( "schematic.wire", LAYER_WIRE );
CLR( "schematic.worksheet", LAYER_SCHEMATIC_DRAWINGSHEET );
CLR( "schematic.page_limits", LAYER_SCHEMATIC_PAGE_LIMITS );
CLR( "gerbview.axes", LAYER_GERBVIEW_AXES );
CLR( "gerbview.background", LAYER_GERBVIEW_BACKGROUND );
@ -122,6 +118,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "gerbview.grid", LAYER_GERBVIEW_GRID );
CLR( "gerbview.negative_objects", LAYER_NEGATIVE_OBJECTS );
CLR( "gerbview.worksheet", LAYER_GERBVIEW_DRAWINGSHEET );
CLR( "gerbview.page_limits", LAYER_GERBVIEW_PAGE_LIMITS );
for( int i = 0, id = GERBVIEW_LAYER_ID_START;
id < GERBER_DRAWLAYERS_COUNT + GERBVIEW_LAYER_ID_START; ++i, ++id )
@ -151,7 +148,8 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "board.via_hole", LAYER_VIA_HOLES );
CLR( "board.via_micro", LAYER_VIA_MICROVIA );
CLR( "board.via_through", LAYER_VIA_THROUGH );
CLR( "board.worksheet", LAYER_DRAWINGSHEET );
CLR( "board.worksheet", LAYER_DRAWINGSHEET );
CLR( "board.page_limits", LAYER_PAGE_LIMITS );
CLR( "board.copper.f", F_Cu );
CLR( "board.copper.in1", In1_Cu );
@ -257,6 +255,18 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
return true;
} );
registerMigration( 3, 4,
[&]()
{
if( OPT<COLOR4D> optval = Get<COLOR4D>( "board.grid" ) )
Set( "board.page_limits", optval.get() );
if( OPT<COLOR4D> optval = Get<COLOR4D>( "schematic.grid" ) )
Set( "schematic.page_limits", optval.get() );
return true;
} );
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2022 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
@ -249,6 +249,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
m_drawingSheet = new DS_PROXY_VIEW_ITEM( (int) IU_PER_MILS, m_page, nullptr, m_titleBlock );
m_drawingSheet->SetColorLayer( LAYER_SCHEMATIC_DRAWINGSHEET );
m_drawingSheet->SetPageBorderColorLayer( LAYER_SCHEMATIC_PAGE_LIMITS );
view->Add( m_drawingSheet );
// TODO: It would be nice to parse a schematic file here.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2018 CERN
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
@ -102,7 +102,7 @@ void SCH_VIEW::DisplaySheet( const SCH_SCREEN *aScreen )
m_drawingSheet->SetSheetCount( aScreen->GetPageCount() );
m_drawingSheet->SetFileName( TO_UTF8( aScreen->GetFileName() ) );
m_drawingSheet->SetColorLayer( LAYER_SCHEMATIC_DRAWINGSHEET );
m_drawingSheet->SetPageBorderColorLayer( LAYER_SCHEMATIC_GRID );
m_drawingSheet->SetPageBorderColorLayer( LAYER_SCHEMATIC_PAGE_LIMITS );
m_drawingSheet->SetIsFirstPage( aScreen->GetVirtualPageNumber() == 1 );
if( m_frame && m_frame->IsType( FRAME_SCH ) )

View File

@ -337,6 +337,8 @@ void GERBVIEW_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
SetElementVisibility( LAYER_GERBVIEW_DRAWINGSHEET,
cfg->m_Appearance.show_border_and_titleblock );
SetElementVisibility( LAYER_GERBVIEW_PAGE_LIMITS,
cfg->m_Display.m_DisplayPageLimits );
PAGE_INFO pageInfo( wxT( "GERBER" ) );
pageInfo.SetType( cfg->m_Appearance.page_type );
@ -441,6 +443,11 @@ void GERBVIEW_FRAME::SetElementVisibility( int aLayerID, bool aNewState )
SetGridVisibility( aNewState );
break;
case LAYER_GERBVIEW_PAGE_LIMITS:
gvconfig()->m_Display.m_DisplayPageLimits = aNewState;
SetPageSettings( GetPageSettings() );
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ),
aLayerID ) );
@ -646,6 +653,7 @@ bool GERBVIEW_FRAME::IsElementVisible( int aLayerID ) const
case LAYER_NEGATIVE_OBJECTS: return gvconfig()->m_Appearance.show_negative_objects;
case LAYER_GERBVIEW_GRID: return IsGridVisible();
case LAYER_GERBVIEW_DRAWINGSHEET: return gvconfig()->m_Appearance.show_border_and_titleblock;
case LAYER_GERBVIEW_PAGE_LIMITS: return gvconfig()->m_Display.m_DisplayPageLimits;
case LAYER_GERBVIEW_BACKGROUND: return true;
default:
@ -703,6 +711,7 @@ COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( int aLayerID )
case LAYER_NEGATIVE_OBJECTS:
case LAYER_DCODES:
case LAYER_GERBVIEW_DRAWINGSHEET:
case LAYER_GERBVIEW_PAGE_LIMITS:
case LAYER_GERBVIEW_BACKGROUND:
color = settings->GetColor( aLayerID );
break;
@ -731,35 +740,25 @@ void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, const COLOR4D& aColor
{
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
settings->SetColor( aLayerID, aColor );
switch( aLayerID )
{
case LAYER_NEGATIVE_OBJECTS:
case LAYER_DCODES:
settings->SetColor( aLayerID, aColor );
break;
case LAYER_GERBVIEW_DRAWINGSHEET:
settings->SetColor( LAYER_GERBVIEW_DRAWINGSHEET, aColor );
// LAYER_DRAWINGSHEET color is also used to draw the drawing-sheet
// FIX ME: why LAYER_DRAWINGSHEET must be set, although LAYER_GERBVIEW_DRAWINGSHEET
// is used to initialize the drawing-sheet color layer.
settings->SetColor( LAYER_DRAWINGSHEET, aColor );
case LAYER_GERBVIEW_PAGE_LIMITS:
SetPageSettings( GetPageSettings() );
break;
case LAYER_GERBVIEW_GRID:
SetGridColor( aColor );
settings->SetColor( aLayerID, aColor );
break;
case LAYER_GERBVIEW_BACKGROUND:
SetDrawBgColor( aColor );
settings->SetColor( aLayerID, aColor );
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ),
aLayerID ) );
break;
}
}
@ -826,6 +825,7 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
}
drawingSheet->SetColorLayer( LAYER_GERBVIEW_DRAWINGSHEET );
drawingSheet->SetPageBorderColorLayer( LAYER_GERBVIEW_PAGE_LIMITS );
// Draw panel takes ownership of the drawing-sheet
drawPanel->SetDrawingSheet( drawingSheet );
@ -1020,23 +1020,17 @@ void GERBVIEW_FRAME::setupUIConditions()
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
mgr->SetConditions( ACTIONS::zoomTool,
CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
mgr->SetConditions( ACTIONS::selectionTool,
CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
mgr->SetConditions( ACTIONS::measureTool,
CHECK( cond.CurrentTool( ACTIONS::measureTool ) ) );
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
mgr->SetConditions( ACTIONS::measureTool, CHECK( cond.CurrentTool( ACTIONS::measureTool ) ) );
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::togglePolarCoords, CHECK( cond.PolarCoordinates() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::togglePolarCoords, CHECK( cond.PolarCoordinates() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits,
CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits,
CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::milsUnits,
CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
auto flashedDisplayOutlinesCond =
[this] ( const SELECTION& )
@ -1092,8 +1086,7 @@ void GERBVIEW_FRAME::setupUIConditions()
return m_show_layer_manager_tools;
};
mgr->SetConditions( GERBVIEW_ACTIONS::flashedDisplayOutlines,
CHECK( flashedDisplayOutlinesCond ) );
mgr->SetConditions( GERBVIEW_ACTIONS::flashedDisplayOutlines, CHECK( flashedDisplayOutlinesCond ) );
mgr->SetConditions( GERBVIEW_ACTIONS::linesDisplayOutlines, CHECK( linesFillCond ) );
mgr->SetConditions( GERBVIEW_ACTIONS::polygonsDisplayOutlines, CHECK( polygonsFilledCond ) );
mgr->SetConditions( GERBVIEW_ACTIONS::negativeObjectDisplay, CHECK( negativeObjectsCond ) );
@ -1101,8 +1094,7 @@ void GERBVIEW_FRAME::setupUIConditions()
mgr->SetConditions( GERBVIEW_ACTIONS::toggleDiffMode, CHECK( diffModeCond ) );
mgr->SetConditions( GERBVIEW_ACTIONS::flipGerberView, CHECK( flipGerberCond ) );
mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastModeCond ) );
mgr->SetConditions( GERBVIEW_ACTIONS::toggleLayerManager,
CHECK( layersManagerShownCondition ) );
mgr->SetConditions( GERBVIEW_ACTIONS::toggleLayerManager, CHECK( layersManagerShownCondition ) );
#undef CHECK
#undef ENABLE

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2022 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
@ -76,8 +76,8 @@ void GERBVIEW_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
}
// Draw layers specific to Gerbview:
// LAYER_DCODES, LAYER_NEGATIVE_OBJECTS, LAYER_GERBVIEW_GRID,
// LAYER_GERBVIEW_AXES, LAYER_GERBVIEW_BACKGROUND, LAYER_GERBVIEW_DRAWINGSHEET,
// LAYER_DCODES, LAYER_NEGATIVE_OBJECTS, LAYER_GERBVIEW_GRID, LAYER_GERBVIEW_AXES,
// LAYER_GERBVIEW_BACKGROUND, LAYER_GERBVIEW_DRAWINGSHEET, LAYER_GERBVIEW_PAGE_LIMITS
for( int i = LAYER_DCODES; i < GERBVIEW_LAYER_ID_END; i++ )
m_layerColors[i] = aSettings->GetColor( i );

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 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
@ -153,6 +153,7 @@ bool GERBVIEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
migrateLegacyColor( "GridColorEx", LAYER_GERBVIEW_GRID );
migrateLegacyColor( "NegativeObjectsColorEx", LAYER_NEGATIVE_OBJECTS );
migrateLegacyColor( "WorksheetColorEx", LAYER_GERBVIEW_DRAWINGSHEET );
migrateLegacyColor( "GridColorEx", LAYER_GERBVIEW_PAGE_LIMITS );
wxString key;

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 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
@ -78,9 +78,11 @@ void GERBVIEW_FRAME::ReCreateHToolbar()
m_mainToolBar->AddScaledSeparator( this );
if( !m_SelLayerBox )
{
m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar,
ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
wxDefaultPosition, wxDefaultSize, 0, nullptr );
}
m_SelLayerBox->Resync();
m_mainToolBar->AddControl( m_SelLayerBox );
@ -503,7 +505,10 @@ void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
void GERBVIEW_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
{
if( m_SelLayerBox->GetSelection() != GetActiveLayer() )
m_SelLayerBox->SetSelection( GetActiveLayer() );
if( m_SelLayerBox->GetCount() )
{
if( m_SelLayerBox->GetSelection() != GetActiveLayer() )
m_SelLayerBox->SetSelection( GetActiveLayer() );
}
}

View File

@ -42,7 +42,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
continue;
// Don't show unused layers
if ( images.GetGbrImage(layerid) == nullptr )
if ( images.GetGbrImage( layerid ) == nullptr )
continue;
// Prepare Bitmap
@ -58,15 +58,19 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
// (such as in cases where the font size is very large). So we select
// the first item, get the size of the control and make that the minimum size,
// then remove the selection (which was the initial state).
SetSelection( 0 );
if( GetCount() )
{
SetSelection( 0 );
SetMinSize( wxSize( -1, -1 ) );
wxSize bestSize = GetBestSize();
SetMinSize( wxSize( -1, -1 ) );
wxSize bestSize = GetBestSize();
bestSize.x = GetBestSize().x + BM_SIZE + 10;
SetMinSize( bestSize );
bestSize.x = GetBestSize().x + BM_SIZE + 10;
SetMinSize( bestSize );
SetSelection( wxNOT_FOUND );
}
SetSelection( wxNOT_FOUND );
Thaw();
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004-2010 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2022 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
@ -86,7 +86,7 @@ void GERBER_LAYER_WIDGET::ReFillRender()
// is changed before appending to the LAYER_WIDGET. This is an automatic variable
// not a static variable, change the color & state after copying from code to renderRows
// on the stack.
LAYER_WIDGET::ROW renderRows[6] = {
LAYER_WIDGET::ROW renderRows[7] = {
#define RR LAYER_WIDGET::ROW // Render Row abbreviation to reduce source width
@ -99,6 +99,8 @@ void GERBER_LAYER_WIDGET::ReFillRender()
_( "Show the (x,y) grid dots" ) ),
RR( _( "Drawing Sheet" ), LAYER_GERBVIEW_DRAWINGSHEET, DARKRED,
_( "Show drawing sheet border and title block") ),
RR( _( "Page Limits" ), LAYER_GERBVIEW_PAGE_LIMITS, WHITE,
_( "Show drawing sheet page limits" ) ),
RR( _( "Background" ), LAYER_GERBVIEW_BACKGROUND, BLACK,
_( "PCB Background" ), true, false )
};

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2007-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2007-2022 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
@ -244,6 +244,9 @@ enum GAL_LAYER_ID: int
LAYER_DRAWINGSHEET_PAGE1, ///< for drawingsheetEditor previewing
LAYER_DRAWINGSHEET_PAGEn, ///< for drawingsheetEditor previewing
LAYER_PAGE_LIMITS, ///< color for drawing the page extents (visibility stored in
///< PCBNEW_SETTINGS::m_ShowPageLimits)
/// Virtual layers for stacking zones and tracks on a given copper layer
LAYER_ZONE_START,
LAYER_ZONE_END = LAYER_ZONE_START + PCB_LAYER_ID_COUNT,
@ -368,6 +371,7 @@ enum SCH_LAYER_ID: int
LAYER_HIDDEN,
LAYER_SELECTION_SHADOWS,
LAYER_SCHEMATIC_DRAWINGSHEET,
LAYER_SCHEMATIC_PAGE_LIMITS,
LAYER_BUS_JUNCTION,
LAYER_SCHEMATIC_AUX_ITEMS,
LAYER_SCHEMATIC_ANCHOR,
@ -402,6 +406,7 @@ enum GERBVIEW_LAYER_ID: int
LAYER_GERBVIEW_AXES,
LAYER_GERBVIEW_BACKGROUND,
LAYER_GERBVIEW_DRAWINGSHEET,
LAYER_GERBVIEW_PAGE_LIMITS,
GERBVIEW_LAYER_ID_END
};

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2022 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
@ -402,6 +402,7 @@ PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS( wxWindow* aParent, BOA
}
m_validLayers.push_back( LAYER_LOCKED_ITEM_SHADOW );
m_validLayers.push_back( LAYER_PAGE_LIMITS );
// NOTE: Main board layers are added by createSwatches()
@ -503,6 +504,7 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems()
m_titleBlock );
drawingSheet->SetIsFirstPage( true );
drawingSheet->SetColorLayer( LAYER_DRAWINGSHEET );
drawingSheet->SetPageBorderColorLayer( LAYER_PAGE_LIMITS );
m_preview->SetDrawingSheet( drawingSheet );
zoomFitPreview();

View File

@ -811,6 +811,7 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
migrateLegacyColor( "Color4DViaMicroEx", LAYER_VIA_MICROVIA );
migrateLegacyColor( "Color4DViaThruEx", LAYER_VIA_THROUGH );
migrateLegacyColor( "Color4DWorksheet", LAYER_DRAWINGSHEET );
migrateLegacyColor( "Color4DGrid", LAYER_PAGE_LIMITS );
Pgm().GetSettingsManager().SaveColorSettings( cs, "board" );