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

gEDA-cvs: CVS update: g_rc.nw



  User: ahvezda 
  Date: 05/08/14 21:26:51

  Modified:    .        g_rc.nw g_register.nw i_vars.nw x_grid.nw
  Log:
  Commited Carlos Azevedo gnetlist rename patch, also his chdir and rc expand 
  
  patch.  Added grid-mode and grid-fixed-threshold keywords and implementation.
  
  Added add-attribute-offset (but not the implementation; still under devel)
  
  
  
  
  Revision  Changes    Path
  1.31      +86 -0     eda/geda/devel/gschem/noweb/g_rc.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: g_rc.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/g_rc.nw,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -b -r1.30 -r1.31
  --- g_rc.nw	21 Feb 2005 03:07:27 -0000	1.30
  +++ g_rc.nw	15 Aug 2005 01:26:51 -0000	1.31
  @@ -95,7 +95,10 @@
   <<g_rc.c : g_rc_bus_ripper_rotation()>>
   <<g_rc.c : g_rc_force_boundingbox()>>
   <<g_rc.c : g_rc_grid_dot_size()>>
  +<<g_rc.c : g_rc_grid_mode()>>
  +<<g_rc.c : g_rc_grid_fixed_threshold()>>
   <<g_rc.c : g_rc_output_vector_threshold()>>
  +<<g_rc.c : g_rc_add_attribute_offset()>>
   
   @
   
  @@ -1978,6 +1981,58 @@
   @ %def g_rc_grid_dot_size
   
   
  +@section Function @code{g_rc_grid_mode()}
  +
  +@defun g_rc_grid_mode mode
  +@end defun
  +
  +<<g_rc.c : g_rc_grid_mode()>>=
  +SCM
  +g_rc_grid_mode(SCM mode)
  +{
  +  static const vstbl_entry mode_table[] = {
  +    {GRID_VARIABLE_MODE,  "variable" },
  +    {GRID_FIXED_MODE, "fixed"  }
  +  };
  +
  +  RETURN_G_RC_MODE("grid-mode", default_grid_mode, 2);
  +}
  +
  +
  +@ %def g_rc_grid_mode
  +
  +
  +@section Function @code{g_rc_grid_fixed_threshold()}
  +
  +@defun g_rc_grid_fixed_threshold size
  +@end defun
  +
  +<<g_rc.c : g_rc_grid_fixed_threshold()>>=
  +SCM
  +g_rc_grid_fixed_threshold(SCM spacing)
  +{
  +  int val;
  +
  +  SCM_ASSERT (SCM_INUMP (spacing), spacing, SCM_ARG1, "grid-fixed-threshold");
  +  
  +  val = SCM_INUM (spacing);
  +
  +  if (val <= 0) {
  +    fprintf(stderr, _("Invalid pixel spacing [%d] passed to grid-fixed-threshold\n"),
  +            val);
  +    val = 10; /* absolute default */
  +  }
  +
  +  default_grid_fixed_threshold = val;
  +
  +  return SCM_BOOL_T;
  +}
  +
  +
  +@ %def g_rc_grid_fixed_threshold
  +
  +
  +
   @section Function @code{g_rc_output_vector_threshold()}
   
   @defun g_output_vector_threshold dotsize
  @@ -2008,3 +2063,34 @@
   
   @ %def g_rc_output_vector_threshold
   
  +
  +@section Function @code{g_rc_add_attribute_offset()}
  +
  +@defun g_add_attribute_offset offset
  +@end defun
  +
  +<<g_rc.c : g_rc_add_attribute_offset()>>=
  +SCM
  +g_rc_add_attribute_offset(SCM offset)
  +{
  +  int val;
  +
  +  SCM_ASSERT (SCM_INUMP (offset), offset,
  +              SCM_ARG1, "add-attribute-offset");
  +  
  +  val = SCM_INUM (offset);
  +
  +  if (val < 0) {
  +    fprintf(stderr, _("Invalid offset [%d] passed to add-attribute-offset\n"),
  +            val);
  +    val = 50; /* absolute default */
  +  }
  +
  +  default_add_attribute_offset = val;
  +
  +  return SCM_BOOL_T;
  +}
  +
  +
  +@ %def g_rc_add_attribute_offset
  +
  
  
  
  1.27      +3 -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.26
  retrieving revision 1.27
  diff -u -b -r1.26 -r1.27
  --- g_register.nw	19 Feb 2005 23:27:07 -0000	1.26
  +++ g_register.nw	15 Aug 2005 01:26:51 -0000	1.27
  @@ -168,7 +168,10 @@
     { "bus-ripper-rotation",       1, 0, 0, g_rc_bus_ripper_rotation },
     { "force-boundingbox",         1, 0, 0, g_rc_force_boundingbox },
     { "grid-dot-size",             1, 0, 0, g_rc_grid_dot_size },
  +  { "grid-mode",		 1, 0, 0, g_rc_grid_mode },
  +  { "grid-fixed-threshold",   	 1, 0, 0, g_rc_grid_fixed_threshold },
     { "output-vector-threshold",   1, 0, 0, g_rc_output_vector_threshold },
  +  { "add-attribute-offset",      1, 0, 0, g_rc_add_attribute_offset },
   
     /* general guile functions */
     { "gschem-print",              1, 0, 0, g_funcs_print },
  
  
  
  1.18      +6 -0      eda/geda/devel/gschem/noweb/i_vars.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: i_vars.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/i_vars.nw,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -b -r1.17 -r1.18
  --- i_vars.nw	19 Jun 2005 00:08:51 -0000	1.17
  +++ i_vars.nw	15 Aug 2005 01:26:51 -0000	1.18
  @@ -138,7 +138,10 @@
   int   default_bus_ripper_rotation = NON_SYMMETRIC;
   int   default_force_boundingbox = FALSE;
   int   default_grid_dot_size = 1;
  +int   default_grid_mode = GRID_VARIABLE_MODE;
  +int   default_grid_fixed_threshold = 10;
   int   default_print_vector_threshold = 3;
  +int   default_add_attribute_offset = 50;
   
   int   default_width = 800;  /* these variables are used in x_window.c */
   int   default_height = 600;
  @@ -258,7 +261,10 @@
   
     w_current->force_boundingbox  = default_force_boundingbox;
     w_current->grid_dot_size  = default_grid_dot_size;
  +  w_current->grid_mode  = default_grid_mode;
  +  w_current->grid_fixed_threshold  = default_grid_fixed_threshold;
     w_current->print_vector_threshold  = default_print_vector_threshold;
  +  w_current->add_attribute_offset  = default_add_attribute_offset;
   }
   
   
  
  
  
  1.9       +27 -19    eda/geda/devel/gschem/noweb/x_grid.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_grid.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/x_grid.nw,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- x_grid.nw	4 Feb 2005 04:39:30 -0000	1.8
  +++ x_grid.nw	15 Aug 2005 01:26:51 -0000	1.9
  @@ -82,34 +82,42 @@
     int count = 0;
   
     int incr = 100;
  +  int screen_incr = 0;
   
     if (!w_current->grid) {
       return;
     }
   
  -  /*think this is a better alternativ, because the definition of */
  -  /* w_current->page_current->zoom_factor is very bad (hw) */
  -  /* (agreed avh) */
  -  /* now there are no incr-limits as above (100-1000), could be added */
  -  /* if wished, (this is fine for now avh) */
  -  /* around every 30th screenpixel will be grid-point; */
  +  if (w_current->grid_mode == GRID_VARIABLE_MODE)
  +  {
  +    /* In the variable mode around every 30th screenpixel will be grid-point */
     /* adding 0.1 for correct cast*/
  -  incr = round_5_2_1(w_current->page_current->to_world_x_constant *30)
  -  +0.1;
  +    incr = round_5_2_1(w_current->page_current->to_world_x_constant *30)+0.1;
  +
     /*limit grid to snap_size; only a idea of mine, hope you like it (hw) */
     if (incr < w_current->snap_size) {
       incr = w_current->snap_size;
     }
     /* usually this should never happen */
     if (incr < 1){
  -    incr =1;
  +      incr = 1;
  +    }
  +  }
  +  else
  +  {
  +    incr = w_current->snap_size;
  +    screen_incr = SCREENabs(w_current, incr);
  +    if (screen_incr < w_current->grid_fixed_threshold)
  +    {
  +      /* don't draw the grid if the screen incr spacing is less than the */
  +      /* threshold */
  +      return;
     }
  +  }
  +
   #if DEBUG
     printf("---------x_grid_draw\n incr: %d\n",incr);
  -#endif	
  -
   
  -#if DEBUG
     printf("x1 %d\n", pix_x(w_current, 100));
     printf("x2 %d\n", pix_x(w_current, 200));
     printf("y1 %d\n", pix_y(w_current, 100));