kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #30663
[PATCH] Add background color for subsheets
This small patch adds a configurable background color for hierarchical
sheets.
Image: http://i.imgur.com/53zgcy9.png
Oliver
From b6f06edf51e0772c3a85917160d779e809388041 Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walters@xxxxxxxxx>
Date: Tue, 12 Sep 2017 19:07:00 +1000
Subject: [PATCH] Added SHEETBACKGROUND color
- Fill color for sub-sheet rectangle
- Added default color
- Added button to change color
---
eeschema/eeschema.cpp | 1 +
eeschema/sch_sheet.cpp | 10 ++++++++++
eeschema/widgets/widget_eeschema_color_config.cpp | 1 +
include/layers_id_colors_and_visibility.h | 1 +
4 files changed, 13 insertions(+)
diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp
index 593e5a8..47c4584 100644
--- a/eeschema/eeschema.cpp
+++ b/eeschema/eeschema.cpp
@@ -209,6 +209,7 @@ static PARAM_CFG_ARRAY& cfg_params()
CLR( "Color4DNetNameEx", LAYER_NETNAM, COLOR4D( DARKGRAY ) )
CLR( "Color4DPinEx", LAYER_PIN, COLOR4D( RED ) )
CLR( "Color4DSheetEx", LAYER_SHEET, COLOR4D( MAGENTA ) )
+ CLR( "Color4DSheetBackground", LAYER_SHEETBACKGROUND, COLOR4D( 0.53f, 0.69f, 0.76f, 1.0f ) )
CLR( "Color4DSheetFileNameEx", LAYER_SHEETFILENAME, COLOR4D( BROWN ) )
CLR( "Color4DSheetNameEx", LAYER_SHEETNAME, COLOR4D( CYAN ) )
CLR( "Color4DSheetLabelEx", LAYER_SHEETLABEL, COLOR4D( BROWN ) )
diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp
index 9a975d2..bffc386 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -610,6 +610,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
COLOR4D txtcolor;
wxString Text;
COLOR4D color;
+ COLOR4D bgColor;
int name_orientation;
wxPoint pos_sheetname,pos_filename;
wxPoint pos = m_pos + aOffset;
@@ -617,12 +618,21 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
if( aColor != COLOR4D::UNSPECIFIED )
+ {
color = aColor;
+ bgColor = aColor;
+ }
else
+ {
color = GetLayerColor( m_Layer );
+ bgColor = GetLayerColor( LAYER_SHEETBACKGROUND );
+ }
GRSetDrawMode( aDC, aDrawMode );
+ GRFilledRect( clipbox, aDC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y,
+ lineWidth, bgColor, bgColor );
+
GRRect( clipbox, aDC, pos.x, pos.y,
pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
diff --git a/eeschema/widgets/widget_eeschema_color_config.cpp b/eeschema/widgets/widget_eeschema_color_config.cpp
index b9d7940..08222af 100644
--- a/eeschema/widgets/widget_eeschema_color_config.cpp
+++ b/eeschema/widgets/widget_eeschema_color_config.cpp
@@ -81,6 +81,7 @@ static COLORBUTTON componentColorButtons[] = {
static COLORBUTTON sheetColorButtons[] = {
{ _( "Sheet" ), LAYER_SHEET },
+ { _( "Sheet background" ), LAYER_SHEETBACKGROUND },
{ _( "Sheet file name" ), LAYER_SHEETFILENAME },
{ _( "Sheet name" ), LAYER_SHEETNAME },
{ _( "Sheet label" ), LAYER_SHEETLABEL },
diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h
index 26404fe..4d06412 100644
--- a/include/layers_id_colors_and_visibility.h
+++ b/include/layers_id_colors_and_visibility.h
@@ -244,6 +244,7 @@ enum SCH_LAYER_ID: int
LAYER_NETNAM,
LAYER_PIN,
LAYER_SHEET,
+ LAYER_SHEETBACKGROUND,
LAYER_SHEETNAME,
LAYER_SHEETFILENAME,
LAYER_SHEETLABEL,
--
2.7.4
Follow ups