[Kicad-developers] [PATCH] Add background color for subsheets

2017-09-12 Thread Oliver Walters
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 
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

___
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


Re: [Kicad-developers] [PATCH] Add background color for subsheets

2017-09-13 Thread Maciej Suminski
Hi Oliver,

Seems good to me, I vote for merging.

Regards,
Orson

On 09/12/2017 11: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


Re: [Kicad-developers] [PATCH] Add background color for subsheets

2017-09-14 Thread Wayne Stambaugh
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


Re: [Kicad-developers] [PATCH] Add background color for subsheets

2017-09-14 Thread Andrey Kuznetsov
I hope there's an option to remove color as well, after color has been
added.

I can't remember, is text color modifiable? If not, that kind of limits the
background color choices.

On Thu, Sep 14, 2017 at 7:22 AM Wayne Stambaugh 
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
>
-- 
Remember The Past, Live The Present, Change The Future
Those who look only to the past or the present are certain to miss the
future [JFK]

kandre...@gmail.com
Live Long and Prosper,
Andrey
___
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


Re: [Kicad-developers] [PATCH] Add background color for subsheets

2017-09-14 Thread Wayne Stambaugh
On 9/14/2017 11:40 AM, Andrey Kuznetsov wrote:
> I hope there's an option to remove color as well, after color has been
> added.

That's why I asked if we could set the color to unspecified so users can
turn off the fill and background color will displayed in the sheet.
Otherwise, the user will have to modify their config files by hand which
isn't a reasonable solution.

> 
> I can't remember, is text color modifiable? If not, that kind of limits
> the background color choices.

Text color is modifiable depending on the type of text.  Take a look at
the Eeschema color settings.  Obviously you can only change the color
for an entire type of text not each text object.  The new file format
will support per object colors but that will not be available until well
after the stable 5 release.

> 
> On Thu, Sep 14, 2017 at 7:22 AM Wayne Stambaugh  > 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
> 
> -- 
> Remember The Past, Live The Present, Change The Future
> Those who look only to the past or the present are certain to miss the
> future [JFK]
> 
> kandre...@gmail.com 
> Live Long and Prosper,
> Andrey

___
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


Re: [Kicad-developers] [PATCH] Add background color for subsheets

2017-09-14 Thread Oliver Walters
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 
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 
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 1

Re: [Kicad-developers] [PATCH] Add background color for subsheets

2017-09-18 Thread Wayne Stambaugh
Hey Oliver,

I just tested your updates it seems to work OK except for the fact that
the fill color cannot be set to unspecified without manually editing the
config file.  It would be nice (hint hint) if someone would add an
optional none color selection to our color selector dialog.

I also thought of a one other major issue that I missed during my first
review.  None of the plot formats support the sheet filling.  I
confirmed this.  I can almost guarantee that a bug report will be filed
on this not long after it gets packaged.  I don't know how difficult
this will be to implement due to the fact that the fill state is
determined outside the sheet object itself where as for graphic objects
it is contained in the graphic item itself.

I am a bit on the fence about this now that I've taken a closer look at
it.  Sheet filling will be part of the new schematic file format which
will change the way this is defined in the future so there is that to
consider.  If the plotting issues and color selection issues are
addressed by the time the 5 stable branch is created, then I would merge
this if there were no objections.  If you or someone else cannot ensure
this, than I would prefer to hold off until after the stable 5 release.

Cheers,

Wayne

On 9/14/2017 10:30 PM, Oliver Walters wrote:
> 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  > 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
> 
> 
> 

___
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


Re: [Kicad-developers] [PATCH] Add background color for subsheets

2017-09-18 Thread Oliver Walters
It makes more sense to me to wait then, rather than duplicating efforts on
non critical features.

Thanks

On 19 Sep 2017 01:03, "Wayne Stambaugh"  wrote:

> Hey Oliver,
>
> I just tested your updates it seems to work OK except for the fact that
> the fill color cannot be set to unspecified without manually editing the
> config file.  It would be nice (hint hint) if someone would add an
> optional none color selection to our color selector dialog.
>
> I also thought of a one other major issue that I missed during my first
> review.  None of the plot formats support the sheet filling.  I
> confirmed this.  I can almost guarantee that a bug report will be filed
> on this not long after it gets packaged.  I don't know how difficult
> this will be to implement due to the fact that the fill state is
> determined outside the sheet object itself where as for graphic objects
> it is contained in the graphic item itself.
>
> I am a bit on the fence about this now that I've taken a closer look at
> it.  Sheet filling will be part of the new schematic file format which
> will change the way this is defined in the future so there is that to
> consider.  If the plotting issues and color selection issues are
> addressed by the time the 5 stable branch is created, then I would merge
> this if there were no objections.  If you or someone else cannot ensure
> this, than I would prefer to hold off until after the stable 5 release.
>
> Cheers,
>
> Wayne
>
> On 9/14/2017 10:30 PM, Oliver Walters wrote:
> > 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  > > 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  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
> > 
> >
> >
>
___
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