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

gEDA-user: PCB -> find, rip-up patch



Hi,

I was just looking into the lesstif hid from CVS a few hours ago and I
discovered the Rip Up and  Find buttons inside the netlist window. The
functionality provided is IMHO very neat so I thought I'd implement those
functions in the GTK hid also. The patch for gui-netlist-window.c is
attached...

Kind regards,

Hans



-- 

$ cat .sig /dev/null
--- pcb-mod2-lt/src/hid/gtk/gui-netlist-window.c	2007-02-03 01:26:09.000000000 +0100
+++ pcb-mod2/src/hid/gtk/gui-netlist-window.c	2007-02-03 02:15:39.000000000 +0100
@@ -54,6 +54,7 @@
 #include "select.h"
 #include "set.h"
 #include "undo.h"
+#include "remove.h"
 
 #include "gui.h"
 
@@ -488,6 +489,52 @@
   ghid_invalidate_all ();
 }
 
+static void
+netlist_find_cb (GtkWidget * widget, gpointer data)
+{
+  char *name = NULL;
+
+  if (!selected_net)
+    return;
+
+  name = selected_net->Name + 2;
+  hid_actionl ("connection", "reset", NULL);
+  hid_actionl ("netlist", "find", name, NULL);
+}
+
+static void
+netlist_rip_up_cb (GtkWidget * widget, gpointer data)
+{
+
+  if (!selected_net)
+    return;
+  netlist_find_cb(widget, data);
+
+  VISIBLELINE_LOOP (PCB->Data);
+  {
+    if (TEST_FLAG (FOUNDFLAG, line) && !TEST_FLAG (LOCKFLAG, line))
+      RemoveObject (LINE_TYPE, layer, line, line);
+  }
+  ENDALL_LOOP;
+
+  VISIBLEARC_LOOP (PCB->Data);
+  {
+    if (TEST_FLAG (FOUNDFLAG, arc) && !TEST_FLAG (LOCKFLAG, arc))
+      RemoveObject (ARC_TYPE, layer, arc, arc);
+  }
+  ENDALL_LOOP;
+
+  if (PCB->ViaOn)
+    VIA_LOOP (PCB->Data);
+  {
+    if (TEST_FLAG (FOUNDFLAG, via) && !TEST_FLAG (LOCKFLAG, via))
+      RemoveObject (VIA_TYPE, via, via, via);
+  }
+  END_LOOP;
+
+}
+
+
 /* Change the color of the net in the treeview selection
  */
 static void
@@ -939,14 +986,22 @@
 
   hbox = gtk_hbox_new (FALSE, 0);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4);
-  button = gtk_button_new_with_label (_("Select on Layout"));
+  button = gtk_button_new_with_label (_("Select"));
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
   g_signal_connect (G_OBJECT (button), "clicked",
 		    G_CALLBACK (netlist_select_cb), GINT_TO_POINTER (1));
-  button = gtk_button_new_with_label (_("Unselect on Layout"));
+  button = gtk_button_new_with_label (_("Unselect"));
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
   g_signal_connect (G_OBJECT (button), "clicked",
 		    G_CALLBACK (netlist_select_cb), GINT_TO_POINTER (0));
+  button = gtk_button_new_with_label (_("Find"));
+  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK (netlist_find_cb), GINT_TO_POINTER (0));
+  button = gtk_button_new_with_label (_("Rip Up"));
+  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK (netlist_rip_up_cb), GINT_TO_POINTER (0));
 
 
 

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