Wayne,

Good point. The attached patch set modifies the default sheet background to
UNSPECIFIED.

Regarding the ability to unset the color. Any suggestions on how best to do
this? I have played around with a few options without success.

The best I came up with:

Add a checkbox to the color selection window e.g. "Fill sheet background"
which overrides the actual color selection. But I cannot find a way to pass
this information to SCH_SHEET::Draw

On Fri, Sep 15, 2017 at 12:22 AM, Wayne Stambaugh <stambau...@gmail.com>
wrote:

> Oliver,
>
> I just tested this patch and I like it.  I would like you to please set
> the default color to COLOR4D::UNSPECIFIED if possible so that no filling
> occurs unless the user selects a color.  It is rather jarring to
> suddenly have all of the sheets in your schematic turn blue.  It might
> also be nice if you could select COLOR4D::UNSPECIFIED in the standard
> color selector for users who prefer no fill on sheets but that could be
> in a separate patch.
>
> Wayne
>
> On 9/12/2017 5:11 AM, Oliver Walters wrote:
> > This small patch adds a configurable background color for hierarchical
> > sheets.
> >
> > Image: http://i.imgur.com/53zgcy9.png
> >
> > Oliver
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to     : kicad-developers@lists.launchpad.net
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help   : https://help.launchpad.net/ListHelp
> >
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
From 56378f72ced51a82f0dedc0c7261327e1fc25c3f Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walt...@gmail.com>
Date: Tue, 12 Sep 2017 19:07:00 +1000
Subject: [PATCH 1/2] 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

From a5843f61386e290a1caae082615ea9e95bd6e777 Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walt...@gmail.com>
Date: Fri, 15 Sep 2017 12:26:02 +1000
Subject: [PATCH 2/2] Default sheet fill to COLOR4D::UNSPECIFIED

---
 eeschema/eeschema.cpp  | 2 +-
 eeschema/sch_sheet.cpp | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp
index 47c4584..e944828 100644
--- a/eeschema/eeschema.cpp
+++ b/eeschema/eeschema.cpp
@@ -209,7 +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( "Color4DSheetBackground",    LAYER_SHEETBACKGROUND,      COLOR4D::UNSPECIFIED )
         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 bffc386..da18a98 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -630,8 +630,12 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
 
     GRSetDrawMode( aDC, aDrawMode );
 
-    GRFilledRect( clipbox, aDC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y,
-                  lineWidth, bgColor, bgColor );
+    // Only draw background if background color has been specified
+    if( bgColor != COLOR4D::UNSPECIFIED )
+    {
+        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 );
-- 
2.7.4

_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to