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

gEDA-cvs: CVS update: o_arc.c



  User: pcjc2   
  Date: 07/02/11 21:18:36

  Modified:    .        Tag: noscreen o_arc.c o_box.c o_circle.c o_line.c
                        o_picture.c
  Log:
  Modified grip drawing / undrawing code to calculate coordinates directly 
  
  from object world coords.
  
  
  
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.26.2.1  +5 -7      eda/geda/gaf/gschem/src/o_arc.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_arc.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_arc.c,v
  retrieving revision 1.26
  retrieving revision 1.26.2.1
  diff -u -b -r1.26 -r1.26.2.1
  --- o_arc.c	7 Dec 2006 04:24:17 -0000	1.26
  +++ o_arc.c	12 Feb 2007 02:18:34 -0000	1.26.2.1
  @@ -1305,14 +1305,13 @@
      *   <DT>*</DT><DD>one at the end of the arc - at (<B>x2</B>,<B>y2</B>).
      */
   
  -  x           = o_current->arc->screen_x;
  -  y           = o_current->arc->screen_y;
  -  radius      = o_current->arc->screen_width / 2;
  +  WORLDtoSCREEN( w_current, o_current->arc->x, o_current->arc->y, &x, &y );
  +  radius      = SCREENabs( w_current, o_current->arc->width / 2 );
     start_angle = o_current->arc->start_angle;
     end_angle   = o_current->arc->end_angle;
   
     x1 = x + radius * cos(((double) start_angle) * M_PI / 180);
  -  y1 = y - radius * sin(((double) start_angle  ) * M_PI / 180);
  +  y1 = y - radius * sin(((double) start_angle) * M_PI / 180);
     x2 = x + radius * cos(((double) (start_angle + end_angle)) * M_PI / 180);
     y2 = y - radius * sin(((double) (start_angle + end_angle)) * M_PI / 180);
   
  @@ -1350,9 +1349,8 @@
      * and (<B>x2</B>,<B>y2</B>).
      */
   
  -  x           = o_current->arc->screen_x;
  -  y           = o_current->arc->screen_y;
  -  radius      = o_current->arc->screen_width / 2;
  +  WORLDtoSCREEN( w_current, o_current->arc->x, o_current->arc->y, &x, &y );
  +  radius      = SCREENabs( w_current, o_current->arc->width / 2 );
     start_angle = o_current->arc->start_angle;
     end_angle   = o_current->arc->end_angle;
   
  
  
  
  1.24.2.1  +24 -25    eda/geda/gaf/gschem/src/o_box.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_box.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_box.c,v
  retrieving revision 1.24
  retrieving revision 1.24.2.1
  diff -u -b -r1.24 -r1.24.2.1
  --- o_box.c	7 Dec 2006 04:24:17 -0000	1.24
  +++ o_box.c	12 Feb 2007 02:18:34 -0000	1.24.2.1
  @@ -1092,28 +1092,27 @@
    */
   void o_box_draw_grips(TOPLEVEL *w_current, OBJECT *o_current) 
   {
  +  int s_upper_x, s_upper_y, s_lower_x, s_lower_y;
  +
     if (w_current->draw_grips == FALSE)
   	  return;
   
  +  WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->upper_y, 
  +                 &s_upper_x, &s_upper_y );
  +  WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->lower_y, 
  +                 &s_lower_x, &s_lower_y );
  +
     /* grip on upper left corner (whichone = BOX_UPPER_LEFT) */
  -  o_grips_draw(w_current,
  -			   o_current->box->screen_upper_x,
  -			   o_current->box->screen_upper_y);
  +  o_grips_draw(w_current, s_upper_x, s_upper_y);
   
     /* grip on upper right corner (whichone = BOX_UPPER_RIGHT) */
  -  o_grips_draw(w_current,
  -			   o_current->box->screen_lower_x,
  -			   o_current->box->screen_upper_y);
  +  o_grips_draw(w_current, s_lower_x, s_upper_y);
     
     /* grip on lower left corner (whichone = BOX_LOWER_LEFT) */
  -  o_grips_draw(w_current,
  -			   o_current->box->screen_upper_x,
  -			   o_current->box->screen_lower_y);
  +  o_grips_draw(w_current, s_upper_x, s_lower_y);
   
     /* grip on lower right corner (whichone = BOX_LOWER_RIGHT) */
  -  o_grips_draw(w_current,
  -			   o_current->box->screen_lower_x,
  -			   o_current->box->screen_lower_y);
  +  o_grips_draw(w_current, s_lower_x, s_lower_y);
   
   }
   
  @@ -1127,27 +1126,27 @@
    */
   void o_box_erase_grips(TOPLEVEL *w_current, OBJECT *o_current) 
   {
  +  int s_upper_x, s_upper_y, s_lower_x, s_lower_y;
  +
     if (w_current->draw_grips == FALSE)
   	  return;
   
  +  WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->upper_y, 
  +                 &s_upper_x, &s_upper_y );
  +  WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->lower_y, 
  +                 &s_lower_x, &s_lower_y );
  +
     /* grip on upper left corner (whichone = BOX_UPPER_LEFT) */
  -  o_grips_erase(w_current,
  -				o_current->box->screen_upper_x,
  -				o_current->box->screen_upper_y);
  +  o_grips_erase(w_current, s_upper_x, s_upper_y);
   
     /* grip on upper right corner (whichone = BOX_UPPER_RIGHT) */
  -  o_grips_erase(w_current,
  -				o_current->box->screen_lower_x,
  -				o_current->box->screen_upper_y);
  +  o_grips_erase(w_current, s_lower_x, s_upper_y);
     
     /* grip on lower left corner (whichone = BOX_LOWER_LEFT) */
  -  o_grips_erase(w_current,
  -				o_current->box->screen_upper_x,
  -				o_current->box->screen_lower_y);
  +  o_grips_erase(w_current, s_upper_x, s_lower_y);
   
     /* grip on lower right corner (whichone = BOX_LOWER_RIGHT) */
  -  o_grips_erase(w_current,
  -				o_current->box->screen_lower_x,
  -				o_current->box->screen_lower_y);
  +  o_grips_erase(w_current, s_lower_x, s_lower_y);
     
   }
  +
  
  
  
  1.22.2.1  +8 -4      eda/geda/gaf/gschem/src/o_circle.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_circle.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_circle.c,v
  retrieving revision 1.22
  retrieving revision 1.22.2.1
  diff -u -b -r1.22 -r1.22.2.1
  --- o_circle.c	7 Dec 2006 04:24:17 -0000	1.22
  +++ o_circle.c	12 Feb 2007 02:18:35 -0000	1.22.2.1
  @@ -801,8 +801,10 @@
   	  return;
   
     /* coords of the lower right corner of the square */
  -  x = o_current->circle->screen_x + o_current->circle->screen_radius;
  -  y = o_current->circle->screen_y + o_current->circle->screen_radius;
  +  WORLDtoSCREEN( w_current,
  +                 o_current->circle->center_x + o_current->circle->radius,
  +                 o_current->circle->center_y - o_current->circle->radius,
  +                 &x, &y );
     
     /* grip on lower right corner of the square */
     o_grips_draw(w_current, x, y);
  @@ -827,8 +829,10 @@
   	  return;
   
     /* coords of the lower right corner of square */
  -  x = o_current->circle->screen_x + o_current->circle->screen_radius;
  -  y = o_current->circle->screen_y + o_current->circle->screen_radius;
  +  WORLDtoSCREEN( w_current,
  +                 o_current->circle->center_x + o_current->circle->radius,
  +                 o_current->circle->center_y - o_current->circle->radius,
  +                 &x, &y );
     
     /* grip on lower right corner of the square */
     o_grips_erase(w_current, x, y);
  
  
  
  1.23.2.1  +14 -12    eda/geda/gaf/gschem/src/o_line.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_line.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_line.c,v
  retrieving revision 1.23
  retrieving revision 1.23.2.1
  diff -u -b -r1.23 -r1.23.2.1
  --- o_line.c	7 Dec 2006 04:24:17 -0000	1.23
  +++ o_line.c	12 Feb 2007 02:18:35 -0000	1.23.2.1
  @@ -996,18 +996,19 @@
    */
   void o_line_draw_grips(TOPLEVEL *w_current, OBJECT *o_current) 
   {
  +  int x[2], y[2];
  +
     if (w_current->draw_grips == FALSE)
   	  return;
   
  +  WORLDtoSCREEN( w_current, o_current->line->x[0], o_current->line->y[0], &x[0], &y[0] );
  +  WORLDtoSCREEN( w_current, o_current->line->x[1], o_current->line->y[1], &x[1], &y[1] );
  +
     /* draw the grip on line end 1 */
  -  o_grips_draw(w_current, 
  -	       o_current->line->screen_x[LINE_END1], 
  -	       o_current->line->screen_y[LINE_END1]);
  +  o_grips_draw(w_current, x[LINE_END1], y[LINE_END1]);
     
     /* draw the grip on line end 2 */
  -  o_grips_draw(w_current,
  -	       o_current->line->screen_x[LINE_END2], 
  -	       o_current->line->screen_y[LINE_END2]);
  +  o_grips_draw(w_current, x[LINE_END2], y[LINE_END2]);
   }
   
   /*! \brief Erase grip marks from line.
  @@ -1021,17 +1022,18 @@
    */
   void o_line_erase_grips(TOPLEVEL *w_current, OBJECT *o_current) 
   {
  +  int x[2], y[2];
  +
     if (w_current->draw_grips == FALSE)
       return;
     
  +  WORLDtoSCREEN( w_current, o_current->line->x[0], o_current->line->y[0], &x[0], &y[0] );
  +  WORLDtoSCREEN( w_current, o_current->line->x[1], o_current->line->y[1], &x[1], &y[1] );
  +  
     /* erase the grip on line end 1 */
  -  o_grips_erase(w_current, 
  -		o_current->line->screen_x[LINE_END1],
  -		o_current->line->screen_y[LINE_END1]);
  +  o_grips_erase(w_current, x[LINE_END1], y[LINE_END1]);
     
     /* erase the grip on line end 2 */
  -  o_grips_erase(w_current,
  -		o_current->line->screen_x[LINE_END2],
  -		o_current->line->screen_y[LINE_END2]);
  +  o_grips_erase(w_current, x[LINE_END2], y[LINE_END2]);
     
   }
  
  
  
  1.6.6.3   +36 -48    eda/geda/gaf/gschem/src/o_picture.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_picture.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_picture.c,v
  retrieving revision 1.6.6.2
  retrieving revision 1.6.6.3
  diff -u -b -r1.6.6.2 -r1.6.6.3
  --- o_picture.c	11 Feb 2007 23:58:57 -0000	1.6.6.2
  +++ o_picture.c	12 Feb 2007 02:18:35 -0000	1.6.6.3
  @@ -487,47 +487,41 @@
    */
   void o_picture_draw_grips(TOPLEVEL *w_current, OBJECT *o_current) 
   {
  +  int s_upper_x, s_upper_y, s_lower_x, s_lower_y;
  +
   #if DEBUG
     printf("o_picture_draw_grips called\n");
   #endif
     if (w_current->draw_grips == FALSE)
   	  return;
   
  +  WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->upper_y,
  +                 &s_upper_x, &s_upper_y );
  +  WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->lower_y,
  +                 &s_lower_x, &s_lower_y );
  +  
  +
     /* grip on upper left corner (whichone = PICTURE_UPPER_LEFT) */
  -  o_grips_draw(w_current,
  -	       o_current->picture->screen_upper_x,
  -	       o_current->picture->screen_upper_y);
  +  o_grips_draw(w_current, s_upper_x, s_upper_y);
     
     /* grip on upper right corner (whichone = PICTURE_UPPER_RIGHT) */
  -  o_grips_draw(w_current,
  -	       o_current->picture->screen_lower_x,
  -	       o_current->picture->screen_upper_y);
  +  o_grips_draw(w_current, s_lower_x, s_upper_y);
     
     /* grip on lower left corner (whichone = PICTURE_LOWER_LEFT) */
  -  o_grips_draw(w_current,
  -	       o_current->picture->screen_upper_x,
  -	       o_current->picture->screen_lower_y);
  +  o_grips_draw(w_current, s_upper_x, s_lower_y);
     
     /* grip on lower right corner (whichone = PICTURE_LOWER_RIGHT) */
  -  o_grips_draw(w_current,
  -	       o_current->picture->screen_lower_x,
  -	       o_current->picture->screen_lower_y);
  +  o_grips_draw(w_current, s_lower_x, s_lower_y);
     
     /* Box surrounding the picture */
     gdk_draw_rectangle(w_current->window, w_current->gc, FALSE, 
  -		     o_current->picture->screen_upper_x,
  -		     o_current->picture->screen_upper_y,
  -		     abs(o_current->picture->screen_upper_x -
  -			 o_current->picture->screen_lower_x),
  -		     abs(o_current->picture->screen_upper_y -
  -			 o_current->picture->screen_lower_y));
  +		     s_upper_x, s_upper_y,
  +		     abs(s_upper_x - s_lower_x),
  +		     abs(s_upper_y - s_lower_y));
     gdk_draw_rectangle(w_current->backingstore, w_current->gc, FALSE, 
  -		     o_current->picture->screen_upper_x,
  -		     o_current->picture->screen_upper_y,
  -		     abs(o_current->picture->screen_upper_x -
  -			 o_current->picture->screen_lower_x),
  -		     abs(o_current->picture->screen_upper_y -
  -			 o_current->picture->screen_lower_y));
  +		     s_upper_x, s_upper_y,
  +		     abs(s_upper_x - s_lower_x),
  +		     abs(s_upper_y - s_lower_y));
   }
   
   /*! \brief Erase grip marks from box.
  @@ -540,47 +534,41 @@
    */
   void o_picture_erase_grips(TOPLEVEL *w_current, OBJECT *o_current) 
   {
  +  int s_upper_x, s_upper_y, s_lower_x, s_lower_y;
  +
   #if DEBUG
     printf("o_picture_erase_grips called\n");
   #endif
     if (w_current->draw_grips == FALSE)
   	  return;
   
  +  WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->upper_y,
  +                 &s_upper_x, &s_upper_y );
  +  WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->lower_y,
  +                 &s_lower_x, &s_lower_y );
  +  
     /* grip on upper left corner (whichone = PICTURE_UPPER_LEFT) */
  -  o_grips_erase(w_current,
  -		o_current->picture->screen_upper_x,
  -		o_current->picture->screen_upper_y);
  +  o_grips_erase(w_current, s_upper_x, s_upper_y);
     
     /* grip on upper right corner (whichone = PICTURE_UPPER_RIGHT) */
  -  o_grips_erase(w_current,
  -		o_current->picture->screen_lower_x,
  -		o_current->picture->screen_upper_y);
  +  o_grips_erase(w_current, s_lower_x, s_upper_y);
     
     /* grip on lower left corner (whichone = PICTURE_LOWER_LEFT) */
  -  o_grips_erase(w_current,
  -		o_current->picture->screen_upper_x,
  -		o_current->picture->screen_lower_y);
  +  o_grips_erase(w_current, s_upper_x, s_lower_y);
     
     /* grip on lower right corner (whichone = PICTURE_LOWER_RIGHT) */
  -  o_grips_erase(w_current,
  -		o_current->picture->screen_lower_x,
  -		o_current->picture->screen_lower_y);
  +  o_grips_erase(w_current, s_lower_x, s_lower_y);
     
     /* Box surrounding the picture */
     gdk_draw_rectangle(w_current->window, w_current->gc, FALSE, 
  -		     o_current->picture->screen_upper_x,
  -		     o_current->picture->screen_upper_y,
  -		     abs(o_current->picture->screen_upper_x -
  -			 o_current->picture->screen_lower_x),
  -		     abs(o_current->picture->screen_upper_y -
  -			 o_current->picture->screen_lower_y));
  +		     s_upper_x, s_upper_y,
  +		     abs(s_upper_x - s_lower_x),
  +		     abs(s_upper_y - s_lower_y));
     gdk_draw_rectangle(w_current->backingstore, w_current->gc, FALSE, 
  -		     o_current->picture->screen_upper_x,
  -		     o_current->picture->screen_upper_y,
  -		     abs(o_current->picture->screen_upper_x -
  -			 o_current->picture->screen_lower_x),
  -		     abs(o_current->picture->screen_upper_y -
  -			 o_current->picture->screen_lower_y));
  +		     s_upper_x, s_upper_y,
  +		     abs(s_upper_x - s_lower_x),
  +		     abs(s_upper_y - s_lower_y));
  +  
   }
   
   /*! \brief Erase a picture described by OBJECT.
  
  
  


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