← Back to team overview

kicad-developers team mailing list archive

Re: [RFC] Change to object visibility system for usability/clarity

 

Patch (in attachment) for "Tracks" turned out to be very simple.
If it gets accepted, I could make more of these.

Andrzej


On 02/19/2018 02:12 PM, Andrzej Wolski wrote:
It would be also nice to have separate controls for:
1. Tracks
2. Drawing primitives (graphic lines, arcs, and circles)
3. Zones
4. Polygons
5. Text (now there is control only for footprint text)
6. Dimensions
7. Plated holes

That would make Render tab (almost) complete.

Andrzej

W dniu 2018-02-18 o 21:00, Jon Evans pisze:
Hi all,

Right now the behavior of the "Layer" and "Render" tabs of the layers widget are confusing to users, resulting in complaints on the forum and some bug reports:

https://bugs.launchpad.net/kicad/+bug/1748181
https://bugs.launchpad.net/kicad/+bug/1743890

I could take a crack at fixing this (before or after 5.0 depending on what the complexity ends up being) but before I write any code I wanted to propose how I think it should work.

I think the visibility of any object should be the AND of layer visibility and render visibility.

To get there:

1) In the Render tab, get rid of the distinction between front/back. For example "Pads Back" and "Pads Front" becomes just "Pads"

2) Change the visibility code so that an object is visible if (a) the associated Render setting is turned on for the type of object, and (b) at least one of the layers the object is on is enabled in the Layers tab.

3) (optionally) Rename "Render" to something more friendly like "Items" or "Item Types" to make it more clear to the user that this is where they can turn off the display of various types of items as opposed to various layerse

If this plan is OK, I will start working out the details of how to get there.  Right now the Render tab is directly controlling the visibility of certain "GAL Layers" but unfortunately the set of objects that appears on one GAL layer is not always equal to the set of objects that the user would expect to turn on and off, as seen by the bug reports.  So, there will have to be some additional logic created to manage these settings beyond just turning on and off layers in the GAL.

-Jon


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



>From 006ca0f34b1f3b3350de7a15ffcb3bb1c5b3f7da Mon Sep 17 00:00:00 2001
From: Andrzej Wolski <awolski.kicad@xxxxxxxxx>
Date: Mon, 19 Feb 2018 15:48:22 +0100
Subject: [PATCH] Add tracks display control to Render tab
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.7.4"

This is a multi-part message in MIME format.
--------------2.7.4
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 pcbnew/class_track.cpp      | 9 ++++++++-
 pcbnew/pcb_layer_widget.cpp | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)


--------------2.7.4
Content-Type: text/x-patch; name="0001-Add-tracks-display-control-to-Render-tab.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Add-tracks-display-control-to-Render-tab.patch"

diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp
index 1d5e3e7..1c5f69b 100644
--- a/pcbnew/class_track.cpp
+++ b/pcbnew/class_track.cpp
@@ -45,6 +45,7 @@
 #include <base_units.h>
 #include <msgpanel.h>
 #include <bitmaps.h>
+#include <view/view.h>
 
 /**
  * Function ShowClearance
@@ -670,7 +671,8 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
     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 ) )
+    if( ( !brd->IsLayerVisible( m_Layer ) || !brd->IsElementVisible( LAYER_TRACKS ) )
+        && !( aDrawMode & GR_HIGHLIGHT ) )
         return;
 
 #ifdef USE_WX_OVERLAY
@@ -798,6 +800,11 @@ void TRACK::ViewGetLayers( int aLayers[], int& aCount ) const
 
 unsigned int TRACK::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
 {
+    const int HIDE = std::numeric_limits<unsigned int>::max();
+
+    if( !aView->IsLayerVisible( LAYER_TRACKS ) )
+        return HIDE;
+
     // Netnames will be shown only if zoom is appropriate
     if( IsNetnameLayer( aLayer ) )
     {
diff --git a/pcbnew/pcb_layer_widget.cpp b/pcbnew/pcb_layer_widget.cpp
index f874e25..a2a184b 100644
--- a/pcbnew/pcb_layer_widget.cpp
+++ b/pcbnew/pcb_layer_widget.cpp
@@ -60,6 +60,7 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
 #define NOCOLOR COLOR4D::UNSPECIFIED    // specify rows that do not have a color selector icon
 
          // text                id                      color       tooltip
+    RR( _( "Tracks" ),          LAYER_TRACKS,         NOCOLOR,  _( "Show tracks" ) ),
     RR( _( "Through Via" ),     LAYER_VIA_THROUGH,    WHITE,    _( "Show through vias" ) ),
     RR( _( "Bl/Buried Via" ),   LAYER_VIA_BBLIND,     WHITE,    _( "Show blind or buried vias" )  ),
     RR( _( "Micro Via" ),       LAYER_VIA_MICROVIA,   WHITE,    _( "Show micro vias") ),

--------------2.7.4--



Follow ups

References