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

gEDA-cvs: CVS update: pcb.scm



  User: danmc   
  Date: 06/04/23 23:59:48

  Modified:    .        pcb.scm
  Log:
  - add the add-hook calls to this file.  We only want the user to have
  
    to load this file to get everything going.
  
  
  
  - add some real stuff to the custom menu.  We can actually launch pcb
  
    now!  
  
  
  
  - update the TODO list
  
  
  
  
  Revision  Changes    Path
  1.2       +74 -19    eda/geda/devel/gschem/scheme/pcb.scm
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: pcb.scm
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/scheme/pcb.scm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- pcb.scm	23 Apr 2006 03:48:28 -0000	1.1
  +++ pcb.scm	24 Apr 2006 03:59:48 -0000	1.2
  @@ -1,18 +1,32 @@
   ;; -*- Scheme -*-
   ;;
  -;; $Id: pcb.scm,v 1.1 2006/04/23 03:48:28 danmc Exp $
  +;; $Id: pcb.scm,v 1.2 2006/04/24 03:59:48 danmc Exp $
  +;;
  +;; Copyright (C) 2006 Dan McMahill
  +;;
  +;; This program is free software; you can redistribute it and/or modify
  +;; it under the terms of the GNU General Public License as published by
  +;; the Free Software Foundation; either version 2 of the License, or
  +;; (at your option) any later version.
  +;;
  +;; This program is distributed in the hope that it will be useful,
  +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  +;; GNU General Public License for more details.
  +;;
  +;; You should have received a copy of the GNU General Public License
  +;; along with this program; if not, write to the Free Software
  +;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   ;;
   ;;
   
  +
   ;; ** WARNING **
   ;; This file contains highly experimental code.  Use at your own risk.
   ;;
   ;; TODO
   ;;  Note:  This list is incomplete.
   ;;
  -;; - Instead of being lame and writing our output to a fixed file name,
  -;;   we should actualy open pcb with popen and talk to it directly.
  -;;
   ;; - Find a way to configure path to pcb and/or a log file to tee the
   ;;   commands to (cat | tee /path/to/logfile | pcb --listen)
   ;;
  @@ -21,20 +35,22 @@
   ;;   choice and then in all the hooks, just return without doing anything
   ;;   if the pcb pipe is not open.
   ;;
  -;; - figure out how to add real menu choices (including the callback functions)
  -;;   in scheme only so we can isolate everything related to pcb into this
  -;;   one file and not have to touch the core of gschem in c code.  Menu items
  -;;   needed include:
  -;;
  -;;    =) launch pcb (do this with a two-way pipe so we can talk to it)
  -;;    =) run gsch2pcb (and maybe tell the listening pcb to load the new
  -;;       netlist and also load the new elements to the paste buffer).
  +;;   Menu items
  +;;
  +;;    =) tell the listening pcb to load the new netlist and also load the
  +;;       new elements to the paste buffer after running gsch2pcb
  +;;
   ;;    =) back annotate (once we implement it)
   ;;
   ;;    =) figure out how to have pcb talk back to gschem for selecting/deselecting
   ;;       elements.
   ;;
  -
  +;;
  +;; - Add a gschem exit-hook which will gracefully shutdown pcb instead of just
  +;;   having pcb abort due to a terminated input pipe.  Maybe need to catch this
  +;;   in pcb too?
  +;;
  +;; - Have this module detect if the user exited from pcb which breaks the pipe
   
   (use-modules (ice-9 popen))
   
  @@ -140,19 +156,58 @@
   
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;;
  +;; Add the hooks
  +;;
  +(add-hook! deselect-component-hook pcb-deselect-component-hook)
  +(add-hook! deselect-net-hook pcb-deselect-net-hook)
  +(add-hook! deselect-all-hook pcb-deselect-all-hook)
  +(add-hook! select-component-hook pcb-select-component-hook)
  +(add-hook! select-net-hook pcb-select-net-hook)
  +
  +
  +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  +;;
   ;; Menus
   ;;
   ;;
   ;;
  +(define (pcb:about)
  +  (display "This is the pcb major mode for gschem\n")
  +  (display "pcb.scm version $Id: pcb.scm,v 1.2 2006/04/24 03:59:48 danmc Exp $\n")
  +  (display "***** WARNING *****\n")
  +  (display "This is highly experimental\n")
  +  (display "You should save your work often\n")
  +  (display "and keep backup copies.  You have\n")
  +  (display "been warned.\n")
  +)
  +
  +(define (pcb:launch-pcb)
  +  (set! pcb:pipe (open-output-pipe "pcb --listen"))
  +)
  +
  +(define (pcb:run-gsch2pcb)
  +  (system "gsch2pcb")
  +)
  +
  +; All keys in this keymap *must* be unique
  +(define pcb:pcb-keymap
  +  '(
  +    ("?" . pcb:about)
  +    ("l" . pcb:launch-pcb)
  +    ("n" . pcb:run-gsch2pcb)
  +    )
  +  )
  +
   (define pcb:menu-items 
   ;;
   ;;          menu item name      menu action     	menu hotkey action
   ;;
  -	'( ("About..."		help-about      	help-about)
  -	   ("Manual..."         help-manual             help-manual)
  -	   ("Hotkeys..."        help-hotkeys            help-hotkeys)
  -	   ("Component..."      hierarchy-documentation
  -						    hierarchy-documentation)))
  +	'( ("About..."		pcb:about       	pcb:about)
  +	   ("Launch PCB"        pcb:launch-pcb          pcb:launch-pcb)
  +	   ("Run gsch2pcb"      pcb:run-gsch2pcb        pcb:run-gsch2pcb)
  +	   )
  +)
  +
  +(add-menu "PCB" pcb:menu-items)
   
  -;;(add-menu "PCB" pcb:menu-items)