[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Option to not display polygons



Colin D Bennett wrote:

> I wish it was possible to toggle visibility of individual layers within
> a group. 

Your wish is my command!  :-)

See the attached patch. With this patch you can use the control key to 
only toggle the visibility of the layer given by the clicked layer button. 

---<)kaimartin(>---
-- 
Kai-Martin Knaak
Email: kmk@xxxxxxxxxxxxxxx
http://pool.sks-keyservers.net:11371/pks/lookup?search=0x6C0B9F53
not happy with moderation of geda-user
From 889ed183fa8ee5ce0c646abcf192750781e3ee9a Mon Sep 17 00:00:00 2001
From: Kai-Martin Knaak <kmk@xxxxxxxxxxxx>
Date: Sat, 30 Jul 2011 00:35:21 +0200
Subject: [PATCH] Only toggle the visibility of the current layer if control
 is pressed

This adds the ability to toggle the visibility of the current group only,
rather than change the whole layer group. To access, press [control] during
the left-mouse-click on the layer button.
---
 src/misc.c |   26 +++++++++++++++++++++-----
 src/misc.h |    1 +
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/misc.c b/src/misc.c
index ce2ab4a..c56f679 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1196,6 +1196,26 @@ PushOnTopOfLayerStack (int NewTop)
 }
 
 
+/*-----------------------------------------------------------------------
+ * changes the visibility of a group
+ * returns 1
+ */
+int
+ChangeLayerVisibility (int Layer, bool On, bool ChangeStackOrder)
+{
+  int changed = 1;
+
+  PCB->Data->Layer[Layer].On = On;
+  if (On && ChangeStackOrder)
+    PushOnTopOfLayerStack (Layer);
+
+  /* update control panel */
+  hid_action ("LayersChanged");
+
+  return (changed);
+}
+
+
 /* ----------------------------------------------------------------------
  * changes the visibility of all layers in a group
  * returns the number of changed layers
@@ -1232,12 +1252,8 @@ ChangeGroupVisibility (int Layer, bool On, bool ChangeStackOrder)
       }
 
   /* change at least the passed layer */
-  PCB->Data->Layer[Layer].On = On;
-  if (On && ChangeStackOrder)
-    PushOnTopOfLayerStack (Layer);
+  ChangeLayerVisibility (Layer, On, ChangeStackOrder);
 
-  /* update control panel and exit */
-  hid_action ("LayersChanged");
   return (changed);
 }
 
diff --git a/src/misc.h b/src/misc.h
index 45d6e52..16eb7ac 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -73,6 +73,7 @@ int GetLayerNumber (DataTypePtr, LayerTypePtr);
 int GetLayerGroupNumberByPointer (LayerTypePtr);
 int GetLayerGroupNumberByNumber (Cardinal);
 int GetGroupOfLayer (int);
+int ChangeLayerVisibility (int, bool, bool);
 int ChangeGroupVisibility (int, bool, bool);
 void LayerStringToLayerStack (char *);
 
-- 
1.7.5.4



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user