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

gEDA-cvs: CVS update: g_register.nw



  User: danmc   
  Date: 06/04/22 23:48:28

  Modified:    .        g_register.nw globals.nw o_basic.nw o_buffer.nw
                        o_copy.nw o_find.nw o_select.nw o_text.nw
                        x_image.nw x_print.nw
  Log:
  add support for some new hooks:
  
  
  
  select_component_hook
  
  select_net_hook
  
  deselect_component_hook
  
  deselect_net_hook
  
  deselect_all
  
  
  
  In addition provide a partial example of how one can use these hooks to
  
  communicate to pcb.
  
  
  
  
  Revision  Changes    Path
  1.30      +5 -0      eda/geda/devel/gschem/noweb/g_register.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: g_register.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/g_register.nw,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -b -r1.29 -r1.30
  --- g_register.nw	25 Feb 2006 15:00:58 -0000	1.29
  +++ g_register.nw	23 Apr 2006 03:48:27 -0000	1.30
  @@ -365,6 +365,11 @@
   						1);
     copy_component_hook = scm_create_hook ("copy-component-hook", 1);
     move_component_hook = scm_create_hook ("move-component-hook", 1);
  +  deselect_component_hook = scm_create_hook ("deselect-component-hook", 1);
  +  deselect_net_hook = scm_create_hook ("deselect-net-hook", 1);
  +  deselect_all_hook = scm_create_hook ("deselect-all-hook", 1);
  +  select_component_hook = scm_create_hook ("select-component-hook", 1);
  +  select_net_hook = scm_create_hook ("select-net-hook", 1);
   
     add_pin_hook = scm_create_hook ("add-pin-hook", 1);
     mirror_pin_hook = scm_create_hook ("mirror-pin-hook", 1);
  
  
  
  1.11      +5 -0      eda/geda/devel/gschem/noweb/globals.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: globals.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/globals.nw,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- globals.nw	25 Feb 2006 15:00:58 -0000	1.10
  +++ globals.nw	23 Apr 2006 03:48:27 -0000	1.11
  @@ -117,6 +117,11 @@
   SCM add_pin_hook;
   SCM rotate_pin_hook;
   SCM mirror_pin_hook;
  +SCM deselect_component_hook;
  +SCM deselect_net_hook;
  +SCM deselect_all_hook;
  +SCM select_component_hook;
  +SCM select_net_hook;
   
   
   @ %def global_window_current rc_filename script_filename output_filename colormap visual white black do_logging logging_dest arc_draw_func box_draw_func circle_draw_func complex_draw_func line_draw_func net_draw_func bus_draw_func text_draw_func pin_draw_func select_func x_log_update_func quiet_mode verbose_mode stroke_info_mode object_buffer add_component_hook add_component_object_hook copy_component_hook move_component_hook add_pin_hook rotate_pin_hook mirror_pin_hook mirror_component_object_hook add_attrib_hook
  
  
  
  1.13      +1 -0      eda/geda/devel/gschem/noweb/o_basic.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_basic.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_basic.nw,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- o_basic.nw	14 Apr 2006 11:49:27 -0000	1.12
  +++ o_basic.nw	23 Apr 2006 03:48:27 -0000	1.13
  @@ -225,6 +225,7 @@
   o_unselect_all(TOPLEVEL *w_current)
   {
     if (!w_current->SHIFTKEY) {
  +    o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2);
       o_selection_remove_most(w_current, w_current->page_current->
                               selection2_head); 
     }
  
  
  
  1.9       +2 -1      eda/geda/devel/gschem/noweb/o_buffer.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_buffer.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_buffer.nw,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- o_buffer.nw	4 Feb 2005 04:39:29 -0000	1.8
  +++ o_buffer.nw	23 Apr 2006 03:48:27 -0000	1.9
  @@ -281,6 +281,7 @@
     g_list_free(connected_objects);
     connected_objects = NULL;
           
  +  o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2); 
     o_selection_remove_most(w_current,
                             w_current->page_current->selection2_head);
     o_selection_destroy_head(w_current->page_current->selection2_head);
  
  
  
  1.11      +1 -0      eda/geda/devel/gschem/noweb/o_copy.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_copy.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_copy.nw,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- o_copy.nw	19 Feb 2005 23:27:07 -0000	1.10
  +++ o_copy.nw	23 Apr 2006 03:48:27 -0000	1.11
  @@ -487,6 +487,7 @@
                      x_get_darkcolor(w_current->bb_color), TRUE);
     }
   
  +  o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2); 
     o_selection_remove_most(w_current,
                             w_current->page_current->selection2_head);
     o_selection_destroy_head(w_current->page_current->selection2_head);
  
  
  
  1.7       +1 -0      eda/geda/devel/gschem/noweb/o_find.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_find.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_find.nw,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- o_find.nw	4 Feb 2005 04:39:29 -0000	1.6
  +++ o_find.nw	23 Apr 2006 03:48:27 -0000	1.7
  @@ -135,6 +135,7 @@
   #if DEBUG
       o_selection_print_all( w_current->page_current->selection2_head);
   #endif
  +    o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2); 
       o_selection_remove_most(w_current, 
                               w_current->page_current->selection2_head);
     }
  
  
  
  1.9       +99 -1     eda/geda/devel/gschem/noweb/o_select.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_select.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_select.nw,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- o_select.nw	4 Feb 2005 04:39:30 -0000	1.8
  +++ o_select.nw	23 Apr 2006 03:48:27 -0000	1.9
  @@ -23,6 +23,7 @@
   /* the count == 0 stuff really only applies to when you are coming from a */
   /* multi select case */
   
  +<<o_select.c : o_select_run_hooks()>>
   <<o_select.c : o_select_object()>>
   <<o_select.c : o_select_box_start()>>
   <<o_select.c : o_select_box_end()>>
  @@ -66,6 +67,7 @@
   
   #include <libgeda/libgeda.h>
   
  +#include "../include/globals.h"
   #include "../include/x_states.h"
   #include "../include/prototype.h"
   
  @@ -75,6 +77,86 @@
   
   @ 
   
  +@section Function @code{o_select_run_hooks()}
  +
  +@defun o_select_run_hooks w_current o_current
  +@end defun
  +
  +<<o_select.c : o_select_run_hooks()>>=
  +void
  +o_select_run_hooks(TOPLEVEL *w_current, OBJECT *o_current, int flag)
  +{
  +  /*
  +   * Run the select_component_hook if the hook has been defined and we
  +   * are selecting a component.  This will likely be used for cross probing
  +   * between schematics and PCB layout or schematics and simulation results.
  +   */
  +  if ( (scm_hook_empty_p(deselect_all_hook) == SCM_BOOL_F) 
  +       && flag == 2 )
  +  {
  +    scm_run_hook(deselect_all_hook, 
  +		 scm_cons (g_make_attrib_smob_list(w_current, o_current), 
  +			   SCM_EOL));
  +  }
  +
  +  /*
  +   * Run the select_component_hook if the hook has been defined and we
  +   * are selecting a component.  This will likely be used for cross probing
  +   * between schematics and PCB layout or schematics and simulation results.
  +   */
  +  if ( (scm_hook_empty_p(select_component_hook) == SCM_BOOL_F) 
  +       && (o_current->type == OBJ_COMPLEX) 
  +       && flag == 1 )
  +  {
  +    scm_run_hook(select_component_hook, 
  +		 scm_cons (g_make_attrib_smob_list(w_current, o_current), 
  +			   SCM_EOL));
  +  }
  +
  +  /*
  +   * Run the deselect_component_hook if the hook has been defined and we
  +   * are deselecting a component.  This will likely be used for cross probing
  +   * between schematics and PCB layout or schematics and simulation results.
  +   */
  +  if ( (scm_hook_empty_p(deselect_component_hook) == SCM_BOOL_F) 
  +       && (o_current->type == OBJ_COMPLEX) 
  +       && flag == 0 )
  +  {
  +    scm_run_hook(deselect_component_hook, 
  +		 scm_cons (g_make_attrib_smob_list(w_current, o_current), 
  +			   SCM_EOL));
  +  }
  +
  +  /*
  +   * Run the select_net_hook if the hook has been defined and we
  +   * are selecting a net.  This will likely be used for cross probing
  +   * between schematics and PCB layout or schematics and simulation results.
  +   */
  +  if ( (scm_hook_empty_p(select_net_hook) == SCM_BOOL_F) 
  +       && (o_current->type == OBJ_NET) 
  +       && flag == 1) 
  +  {
  +    scm_run_hook(select_net_hook, 
  +		 scm_cons (g_make_attrib_smob_list(w_current, o_current), 
  +			   SCM_EOL));
  +  }
  +
  +  /*
  +   * Run the deselect_net_hook if the hook has been defined and we
  +   * are deselecting a net.  This will likely be used for cross probing
  +   * between schematics and PCB layout or schematics and simulation results.
  +   */
  +  if ( (scm_hook_empty_p(select_net_hook) == SCM_BOOL_F) 
  +       && (o_current->type == OBJ_NET) 
  +       && flag == 0) 
  +  {
  +    scm_run_hook(deselect_net_hook, 
  +		 scm_cons (g_make_attrib_smob_list(w_current, o_current), 
  +			   SCM_EOL));
  +  }
  +}
  +
  +@ %def o_select_run_hooks
   
   @section Function @code{o_select_object()}
   
  @@ -115,6 +197,7 @@
             /* condition: for both multiple and single object added */
             /* result: remove all objects from selection */
             if (count == 0 && !CONTROLKEY) {
  +            o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2);
               o_selection_remove_most(w_current,
                                       w_current->page_current->selection2_head);
             }
  @@ -123,6 +206,8 @@
         } /* end shift key switch */
   
         /* object not select, add it to the selection list */
  +      o_select_run_hooks(w_current->page_current->selection2_head,
  +			 o_current, 1);
         o_selection_add(w_current->page_current->selection2_head,
                         o_current);
   
  @@ -138,6 +223,8 @@
             /* condition: not doing multiple */
             /* result: remove object from selection */
             if (type != MULTIPLE) {
  +            o_select_run_hooks(w_current->page_current->selection2_head,
  +	   		       o_current, 0);
               o_selection_remove(
                                  w_current->page_current->selection2_head,
                                  o_current);
  @@ -153,9 +240,12 @@
             /* 1st result: remove all objects from selection */
             /* 2nd result: add object to selection */
             if (type == MULTIPLE && count == 0 && !CONTROLKEY) {
  +            o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2);
               o_selection_remove_most(w_current,
                                       w_current->page_current->selection2_head);
   
  +	    o_select_run_hooks(w_current->page_current->selection2_head,
  +			       o_current, 1);
               o_selection_add(
                               w_current->page_current->selection2_head,
                               o_current);
  @@ -166,15 +256,21 @@
             /* 1st result: remove all objects from selection */
             /* 2nd result: add object to selection list */
             if (type == SINGLE && !CONTROLKEY) {
  +            o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2);
               o_selection_remove_most(w_current,
                                       w_current->page_current->selection2_head);
   
  +            o_select_run_hooks(
  +			       w_current->page_current->selection2_head,
  +			       o_current, 1);
               o_selection_add(
                               w_current->page_current->selection2_head,
                               o_current);
             }
   
             if (CONTROLKEY) {
  +            o_select_run_hooks(w_current->page_current->selection2_head,
  +	   		       o_current, 0);
               o_selection_remove(
                                  w_current->page_current->selection2_head,
                                  o_current);
  @@ -401,6 +497,7 @@
     /* zero, and you need to deselect anything remaining (unless the shift */
     /* key was pressed */
     if (count == 0 && !SHIFTKEY) 
  +  o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2);
     o_selection_remove_most(w_current,
                             w_current->page_current->selection2_head);
   
  @@ -465,6 +562,7 @@
   void 
   o_select_unselect_all(TOPLEVEL *w_current)
   {
  +  o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2);
     o_selection_remove_most(w_current, 
                             w_current->page_current->selection2_head);
   }
  
  
  
  1.19      +1 -1      eda/geda/devel/gschem/noweb/o_text.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_text.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_text.nw,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -r1.18 -r1.19
  --- o_text.nw	11 Jan 2006 14:48:06 -0000	1.18
  +++ o_text.nw	23 Apr 2006 03:48:27 -0000	1.19
  @@ -655,7 +655,7 @@
     w_current->override_color = -1;
   
     w_current->page_current->CHANGED=1;
  -
  +  o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2); 
     o_selection_remove_most(w_current,
                             w_current->page_current->selection2_head);
     o_selection_add(w_current->page_current->selection2_head, 
  
  
  
  1.22      +1 -0      eda/geda/devel/gschem/noweb/x_image.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_image.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/x_image.nw,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -b -r1.21 -r1.22
  --- x_image.nw	6 Feb 2006 16:34:57 -0000	1.21
  +++ x_image.nw	23 Apr 2006 03:48:27 -0000	1.22
  @@ -361,6 +361,7 @@
                page_center_top + (page_height / 2));
   
     /* de select everything first */
  +  o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2); 
     o_selection_remove_most(w_current,
                             w_current->page_current->
                             selection2_head);
  
  
  
  1.16      +1 -0      eda/geda/devel/gschem/noweb/x_print.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_print.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/x_print.nw,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -b -r1.15 -r1.16
  --- x_print.nw	14 Apr 2006 11:49:27 -0000	1.15
  +++ x_print.nw	23 Apr 2006 03:48:27 -0000	1.16
  @@ -356,6 +356,7 @@
     if (filename[0] != '\0') {
   
       /* de select everything first */
  +    o_select_run_hooks(w_current, w_current->page_current->selection2_head, 2); 
       o_selection_remove_most(w_current,
                               w_current->page_current->
                               selection2_head);