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

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-142-g39d552c)



The branch, master has been updated
       via  39d552cd16af51eaae793f3837bb1f77fac0723f (commit)
       via  a57db7244d9789c4b92cbec61072497c031016ad (commit)
       via  1bd789ec463564710ab71c4bd7b7d01311237919 (commit)
      from  21ad139e3bc59d796a2a54f1cb35b71060848687 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/src/gschem_cairo.c |   10 +++++++++-
 gschem/src/o_arc.c        |   24 +++++++++++++-----------
 gschem/src/o_box.c        |   23 ++++++-----------------
 gschem/src/o_circle.c     |   15 ++++-----------
 gschem/src/o_cue.c        |    9 +++------
 gschem/src/o_grips.c      |   16 ++++++++++------
 gschem/src/o_line.c       |   13 ++++---------
 gschem/src/o_path.c       |   10 +++-------
 gschem/src/o_picture.c    |   30 +++++++++++++++++-------------
 9 files changed, 69 insertions(+), 81 deletions(-)


=================
 Commit Messages
=================

commit 39d552cd16af51eaae793f3837bb1f77fac0723f
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Jan 5 03:36:24 2009 +0000

    gschem: Use gschem_cairo_box() to create path for box cues.

:100644 100644 a4575d7... b3c2529... M	gschem/src/o_cue.c

commit a57db7244d9789c4b92cbec61072497c031016ad
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Jan 5 00:59:13 2009 +0000

    gschem_cairo_box(): Allow passing line_width as -1 to switch off hinting
    
    This may be useful for drawing a box path which is to be filled. If at
    some point, gschem_cairo_* were to take 0 line-width as instruction to
    draw "hardware" type lines, passing 0 to avoid hinting would clash with
    that feature.
    
    When the line_width is passed as -1, an extra pixel is added to the
    larger X and Y coordinates, so the fill touches the pixel which would
    be lit if a line was drawn at the passed coordinates.

:100644 100644 53b18ca... 4d18239... M	gschem/src/gschem_cairo.c

commit 1bd789ec463564710ab71c4bd7b7d01311237919
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 4 22:51:04 2009 +0000

    gschem: Make o_grips_draw() take world coordinates

:100644 100644 295caa3... 7eba7ec... M	gschem/src/o_arc.c
:100644 100644 edb8b36... b4b19d0... M	gschem/src/o_box.c
:100644 100644 4145d26... 2c91c91... M	gschem/src/o_circle.c
:100644 100644 ec28bb4... 4673e7b... M	gschem/src/o_grips.c
:100644 100644 f283fe7... 4bc4d5b... M	gschem/src/o_line.c
:100644 100644 d5ebeb2... 58115ab... M	gschem/src/o_path.c
:100644 100644 314788d... ca26de5... M	gschem/src/o_picture.c

=========
 Changes
=========

commit 39d552cd16af51eaae793f3837bb1f77fac0723f
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Jan 5 03:36:24 2009 +0000

    gschem: Use gschem_cairo_box() to create path for box cues.

diff --git a/gschem/src/o_cue.c b/gschem/src/o_cue.c
index a4575d7..b3c2529 100644
--- a/gschem/src/o_cue.c
+++ b/gschem/src/o_cue.c
@@ -204,14 +204,11 @@ void o_cue_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichon
       if (object->type == OBJ_NET) { /* only nets have these cues */
         if (count < 1) { /* Didn't find anything connected there */
           size = SCREENabs (w_current, CUE_BOX_SIZE);
-          x2size = 2 * size;
           if (toplevel->DONT_REDRAW == 0) {
+            gschem_cairo_box (w_current->cr, -1,
+                              screen_x - size, screen_y - size,
+                              screen_x + size, screen_y + size);
             o_cue_set_color (w_current, NET_ENDPOINT_COLOR);
-            cairo_move_to (w_current->cr, screen_x - size, screen_y - size);
-            cairo_rel_line_to (w_current->cr, x2size + 1, 0);
-            cairo_rel_line_to (w_current->cr, 0, x2size + 1);
-            cairo_rel_line_to (w_current->cr, -x2size - 1, 0);
-            cairo_close_path (w_current->cr);
             cairo_fill (w_current->cr);
           }
 

commit a57db7244d9789c4b92cbec61072497c031016ad
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Jan 5 00:59:13 2009 +0000

    gschem_cairo_box(): Allow passing line_width as -1 to switch off hinting
    
    This may be useful for drawing a box path which is to be filled. If at
    some point, gschem_cairo_* were to take 0 line-width as instruction to
    draw "hardware" type lines, passing 0 to avoid hinting would clash with
    that feature.
    
    When the line_width is passed as -1, an extra pixel is added to the
    larger X and Y coordinates, so the fill touches the pixel which would
    be lit if a line was drawn at the passed coordinates.

diff --git a/gschem/src/gschem_cairo.c b/gschem/src/gschem_cairo.c
index 53b18ca..4d18239 100644
--- a/gschem/src/gschem_cairo.c
+++ b/gschem/src/gschem_cairo.c
@@ -88,7 +88,15 @@ void gschem_cairo_line (cairo_t *cr, int line_end, int width,
 void gschem_cairo_box (cairo_t *cr, int width,
                        int x1, int y1, int x2, int y2)
 {
-  double offset = ((width % 2) == 0) ? 0 : 0.5;
+  double offset = (width == -1 || (width % 2) == 0) ? 0 : 0.5;
+
+  /* Allow filled boxes (inferred from line_width == -1)
+   * to touch an extra pixel, so the filled span is inclusive */
+  if (width == -1) {
+    if (x1 > x2) x1 += 1; else x2 += 1;
+    if (y1 > y2) y1 += 1; else y2 += 1;
+  }
+
   cairo_move_to (cr, x2 + offset, y2 + offset);
   cairo_line_to (cr, x1 + offset, y2 + offset);
   cairo_line_to (cr, x1 + offset, y1 + offset);

commit 1bd789ec463564710ab71c4bd7b7d01311237919
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 4 22:51:04 2009 +0000

    gschem: Make o_grips_draw() take world coordinates

diff --git a/gschem/src/o_arc.c b/gschem/src/o_arc.c
index 295caa3..7eba7ec 100644
--- a/gschem/src/o_arc.c
+++ b/gschem/src/o_arc.c
@@ -424,8 +424,8 @@ void o_arc_draw_rubber (GSCHEM_TOPLEVEL *w_current)
  */
 void o_arc_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 {
-  int radius, x, y, start_angle, end_angle;
-  int x1, y1, x2, y2;
+  double radius, start_angle, end_angle;
+  int x1, y1, x2, y2, x3, y3;
 
   if (w_current->draw_grips == FALSE)
     return;
@@ -439,23 +439,25 @@ void o_arc_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
    *   <DT>*</DT><DD>one at the end of the arc - at (<B>x2</B>,<B>y2</B>).
    */
 
-  WORLDtoSCREEN (w_current, o_current->arc->x, o_current->arc->y, &x, &y);
-  radius      = SCREENabs (w_current, o_current->arc->width / 2);
+  x1 = o_current->arc->x;
+  y1 = o_current->arc->y;
+
+  radius      = 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);
-  x2 = x + radius * cos(((double) (start_angle + end_angle)) * M_PI / 180);
-  y2 = y - radius * sin(((double) (start_angle + end_angle)) * M_PI / 180);
+  x2 = x1 + radius * cos ( start_angle              * M_PI / 180);
+  y2 = y1 + radius * sin ( start_angle              * M_PI / 180);
+  x3 = x1 + radius * cos ((start_angle + end_angle) * M_PI / 180);
+  y3 = y1 + radius * sin ((start_angle + end_angle) * M_PI / 180);
 
   /* draw the grip at the center */
-  o_grips_draw(w_current,  x,  y);
+  o_grips_draw (w_current, x1, y1);
 
   /* draw the grip at the start_angle end of the arc */
-  o_grips_draw(w_current, x1, y1);
+  o_grips_draw (w_current, x2, y2);
 
   /* draw the grip at the end_angle end of the arc */
-  o_grips_draw(w_current, x2, y2);
+  o_grips_draw (w_current, x3, y3);
 
 }
diff --git a/gschem/src/o_box.c b/gschem/src/o_box.c
index edb8b36..b4b19d0 100644
--- a/gschem/src/o_box.c
+++ b/gschem/src/o_box.c
@@ -600,32 +600,21 @@ void o_box_draw_rubber (GSCHEM_TOPLEVEL *w_current)
  *
  *  \param [in] w_current  The GSCHEM_TOPLEVEL object.
  *  \param [in] o_current  Box OBJECT to draw grip points on.
- *
- *  \par Author's note
- *  p20011003 - modified the prototype : removed parameter 'GdkWindow *w'
  */
 void o_box_draw_grips(GSCHEM_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);
+    return;
 
   /* grip on upper left corner (whichone = BOX_UPPER_LEFT) */
-  o_grips_draw(w_current, s_upper_x, s_upper_y);
+  o_grips_draw (w_current, o_current->box->upper_x, o_current->box->upper_y);
 
   /* grip on upper right corner (whichone = BOX_UPPER_RIGHT) */
-  o_grips_draw(w_current, s_lower_x, s_upper_y);
-  
+  o_grips_draw (w_current, o_current->box->lower_x, o_current->box->upper_y);
+
   /* grip on lower left corner (whichone = BOX_LOWER_LEFT) */
-  o_grips_draw(w_current, s_upper_x, s_lower_y);
+  o_grips_draw (w_current, o_current->box->upper_x, o_current->box->lower_y);
 
   /* grip on lower right corner (whichone = BOX_LOWER_RIGHT) */
-  o_grips_draw(w_current, s_lower_x, s_lower_y);
-
+  o_grips_draw (w_current, o_current->box->lower_x, o_current->box->lower_y);
 }
diff --git a/gschem/src/o_circle.c b/gschem/src/o_circle.c
index 4145d26..2c91c91 100644
--- a/gschem/src/o_circle.c
+++ b/gschem/src/o_circle.c
@@ -605,18 +605,11 @@ void o_circle_draw_rubber (GSCHEM_TOPLEVEL *w_current)
  */
 void o_circle_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 {
-  int x, y;
-
   if (w_current->draw_grips == FALSE)
-	  return;
+    return;
 
-  /* coords of the lower right corner of the square */
-  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);
-
+  o_grips_draw (w_current,
+                o_current->circle->center_x + o_current->circle->radius,
+                o_current->circle->center_y - o_current->circle->radius);
 }
diff --git a/gschem/src/o_grips.c b/gschem/src/o_grips.c
index ec28bb4..4673e7b 100644
--- a/gschem/src/o_grips.c
+++ b/gschem/src/o_grips.c
@@ -1581,21 +1581,23 @@ int o_grips_size(GSCHEM_TOPLEVEL *w_current)
  *  <B>x</B> and <B>y</B> are in screen unit.
  *
  *  \param [in] w_current  The GSCHEM_TOPLEVEL object.
- *  \param [in] x          Center x screen coordinate for drawing grip.
- *  \param [in] y          Center y screen coordinate for drawing grip.
+ *  \param [in] x          Center x world coordinate for drawing grip.
+ *  \param [in] y          Center y world coordinate for drawing grip.
  */
-void o_grips_draw(GSCHEM_TOPLEVEL *w_current, int x, int y)
+void o_grips_draw(GSCHEM_TOPLEVEL *w_current, int wx, int wy)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
   int color;
-  int size;
+  int size, w_size;
+  int x1, y1, x2, y2;
 
   /*
    * Depending on the current zoom level, the size of the grip is
    * determined. <B>size</B> is half the width and height of the grip.
    */
   /* size is half the width of grip */
-  size = o_grips_size(w_current);
+  size = o_grips_size (w_current);
+  w_size = WORLDabs (w_current, size);
 
   /*
    * The grip can be displayed or erased : if <B>toplevel->override_color</B>
@@ -1616,7 +1618,9 @@ void o_grips_draw(GSCHEM_TOPLEVEL *w_current, int x, int y)
    * with a  width / height of 2 * <B>size</B>.
    */
   if (toplevel->DONT_REDRAW == 0) {
-    gschem_cairo_box (w_current->cr, 1, x - size, y - size, x + size, y + size);
+    WORLDtoSCREEN (w_current, wx - w_size, wy - w_size, &x1, &y1);
+    WORLDtoSCREEN (w_current, wx + w_size, wy + w_size, &x2, &y2);
+    gschem_cairo_box (w_current->cr, 1, x1, y1, x2, y2);
 
     gschem_cairo_set_source_color (w_current->cr, x_color_lookup (color));
     gschem_cairo_stroke (w_current->cr, TYPE_SOLID, END_NONE, 1, -1, -1);
diff --git a/gschem/src/o_line.c b/gschem/src/o_line.c
index f283fe7..4bc4d5b 100644
--- a/gschem/src/o_line.c
+++ b/gschem/src/o_line.c
@@ -315,19 +315,14 @@ void o_line_draw_rubber (GSCHEM_TOPLEVEL *w_current)
  */
 void o_line_draw_grips(GSCHEM_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]);
+    return;
 
   /* draw the grip on line end 1 */
-  o_grips_draw(w_current, x[LINE_END1], y[LINE_END1]);
-  
+  o_grips_draw(w_current, o_current->line->x[0], o_current->line->y[0]);
+
   /* draw the grip on line end 2 */
-  o_grips_draw(w_current, x[LINE_END2], y[LINE_END2]);
+  o_grips_draw(w_current, o_current->line->x[1], o_current->line->y[1]);
 }
 
 
diff --git a/gschem/src/o_path.c b/gschem/src/o_path.c
index d5ebeb2..58115ab 100644
--- a/gschem/src/o_path.c
+++ b/gschem/src/o_path.c
@@ -679,7 +679,6 @@ void o_path_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 {
   PATH_SECTION *section;
   int i;
-  int x, y;
 
   if (w_current->draw_grips == FALSE)
     return;
@@ -692,17 +691,14 @@ void o_path_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
     switch (section->code) {
     case PATH_CURVETO:
       /* Two control point grips */
-      WORLDtoSCREEN (w_current, section->x1, section->y1, &x, &y);
-      o_grips_draw (w_current, x, y);
-      WORLDtoSCREEN (w_current, section->x2, section->y2, &x, &y);
-      o_grips_draw (w_current, x, y);
+      o_grips_draw (w_current, section->x1, section->y1);
+      o_grips_draw (w_current, section->x2, section->y2);
       /* Fall through */
     case PATH_MOVETO:
     case PATH_MOVETO_OPEN:
     case PATH_LINETO:
       /* Destination point grip */
-      WORLDtoSCREEN (w_current, section->x3, section->y3, &x, &y);
-      o_grips_draw (w_current, x, y);
+      o_grips_draw (w_current, section->x3, section->y3);
       break;
     case PATH_END:
       break;
diff --git a/gschem/src/o_picture.c b/gschem/src/o_picture.c
index 314788d..ca26de5 100644
--- a/gschem/src/o_picture.c
+++ b/gschem/src/o_picture.c
@@ -380,24 +380,28 @@ void o_picture_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   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, s_upper_x, s_upper_y);
-  
+  o_grips_draw (w_current, o_current->picture->upper_x,
+                           o_current->picture->upper_y);
+
   /* grip on upper right corner (whichone = PICTURE_UPPER_RIGHT) */
-  o_grips_draw(w_current, s_lower_x, s_upper_y);
-  
+  o_grips_draw (w_current, o_current->picture->lower_x,
+                           o_current->picture->upper_y);
+
   /* grip on lower left corner (whichone = PICTURE_LOWER_LEFT) */
-  o_grips_draw(w_current, s_upper_x, s_lower_y);
-  
+  o_grips_draw (w_current, o_current->picture->upper_x,
+                           o_current->picture->lower_y);
+
   /* grip on lower right corner (whichone = PICTURE_LOWER_RIGHT) */
-  o_grips_draw(w_current, s_lower_x, s_lower_y);
-  
+  o_grips_draw (w_current, o_current->picture->lower_x,
+                           o_current->picture->lower_y);
+
   /* Box surrounding the picture */
+  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 );
+
   gschem_cairo_box (w_current->cr, 1, s_lower_x, s_lower_y,
                                       s_upper_x, s_upper_y);
 




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