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

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-137-g95432cc)



The branch, master has been updated
       via  95432ccffdbb39434981f87050433c00f40125da (commit)
       via  5702951f92bb0c693f030c07ef61f0c5986fb5dd (commit)
      from  a50629e77c16758e44d857a929abe98437ab4583 (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/o_cue.c          |  121 +++++++++++++++++++-----------------------
 libgeda/include/defines.h   |    4 +-
 libgeda/include/prototype.h |    2 +-
 libgeda/src/s_cue.c         |   37 +++++--------
 4 files changed, 72 insertions(+), 92 deletions(-)


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

commit 95432ccffdbb39434981f87050433c00f40125da
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 4 19:38:11 2009 +0000

    gschem: Revert change in cue size "fixed" when introducing bus pins.
    
    The old behaviour was intentional.. smaller cues were in fact supposed
    to be used for buses, so that the dot was contained inside the bus
    graphic.
    
    Rename the variables defining the sizes to be clear about their purpose.

:100644 100644 bb1e922... a4575d7... M	gschem/src/o_cue.c
:100644 100644 536d82d... 93c91b9... M	libgeda/include/defines.h
:100644 100644 7fdd105... 6a3cd8f... M	libgeda/include/prototype.h
:100644 100644 9d7b681... 4dc059c... M	libgeda/src/s_cue.c

commit 5702951f92bb0c693f030c07ef61f0c5986fb5dd
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 4 19:03:06 2009 +0000

    gschem: Adjust position hinting when drawing round junction cues
    
    Apply hinting to the cue's position to match the position of the object
    it is sitting on. This is done by passing the on-screen width (pixels)
    of a net / bus into gschem_cairo_arc(). If the line-width is odd, that
    function will shift the origin of the arc by 0.5px. Refactor the places
    where we draw circular arcs to use a single helper function in o_cue.c

:100644 100644 e46efb8... bb1e922... M	gschem/src/o_cue.c

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

commit 95432ccffdbb39434981f87050433c00f40125da
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 4 19:38:11 2009 +0000

    gschem: Revert change in cue size "fixed" when introducing bus pins.
    
    The old behaviour was intentional.. smaller cues were in fact supposed
    to be used for buses, so that the dot was contained inside the bus
    graphic.
    
    Rename the variables defining the sizes to be clear about their purpose.

diff --git a/gschem/src/o_cue.c b/gschem/src/o_cue.c
index bb1e922..a4575d7 100644
--- a/gschem/src/o_cue.c
+++ b/gschem/src/o_cue.c
@@ -120,10 +120,10 @@ static void draw_junction_cue (GSCHEM_TOPLEVEL *w_current,
   WORLDtoSCREEN (w_current, x, y, &s_x, &s_y);
 
   if (bus_involved) {
-    size = SCREENabs (w_current, CUE_CIRCLE_LARGE_SIZE) / 2;
+    size = SCREENabs (w_current, JUNCTION_CUE_SIZE_BUS) / 2;
     line_width = SCREENabs (w_current, BUS_WIDTH);
   } else {
-    size = SCREENabs (w_current, CUE_CIRCLE_SMALL_SIZE) / 2;
+    size = SCREENabs (w_current, JUNCTION_CUE_SIZE_NET) / 2;
     line_width = SCREENabs (w_current, NET_WIDTH);
   }
   x2size = size * 2;
diff --git a/libgeda/include/defines.h b/libgeda/include/defines.h
index 536d82d..93c91b9 100644
--- a/libgeda/include/defines.h
+++ b/libgeda/include/defines.h
@@ -75,8 +75,8 @@
 
 /* various visual cue sizes (in mils) */
 #define CUE_BOX_SIZE 		30
-#define CUE_CIRCLE_SMALL_SIZE	30
-#define CUE_CIRCLE_LARGE_SIZE	60
+#define JUNCTION_CUE_SIZE_NET	60
+#define JUNCTION_CUE_SIZE_BUS	30
 #define PIN_CUE_SIZE_NET	30
 #define PIN_CUE_SIZE_BUS	50
 
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 7fdd105..6a3cd8f 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -359,7 +359,7 @@ GList *s_conn_return_others(GList *input_list, OBJECT *object);
 
 /* s_cue.c */
 void s_cue_postscript_fillbox(TOPLEVEL *toplevel, FILE *fp, int x, int y);
-void s_cue_postscript_fillcircle(TOPLEVEL *toplevel, FILE *fp, int x, int y, int size_flag);
+void s_cue_postscript_junction (TOPLEVEL *toplevel, FILE *fp, int x, int y, int bus_involved);
 void s_cue_output_all(TOPLEVEL *toplevel, const GList *obj_list, FILE *fp, int type);
 void s_cue_output_lowlevel(TOPLEVEL *toplevel, OBJECT *object, int whichone, FILE *fp, int output_type);
 void s_cue_output_lowlevel_midpoints(TOPLEVEL *toplevel, OBJECT *object, FILE *fp, int output_type);
diff --git a/libgeda/src/s_cue.c b/libgeda/src/s_cue.c
index 9d7b681..4dc059c 100644
--- a/libgeda/src/s_cue.c
+++ b/libgeda/src/s_cue.c
@@ -57,15 +57,15 @@ void s_cue_postscript_fillbox(TOPLEVEL * toplevel, FILE * fp, int x,
  *  \par Function Description
  *
  */
-void s_cue_postscript_fillcircle(TOPLEVEL * toplevel, FILE * fp,
-                                 int x, int y, int size_flag)
+void s_cue_postscript_junction (TOPLEVEL * toplevel, FILE * fp,
+                                int x, int y, int bus_involved)
 {
   int offset2;
 
-  if (!size_flag) {
-    offset2 = CUE_CIRCLE_LARGE_SIZE;
+  if (bus_involved) {
+    offset2 = JUNCTION_CUE_SIZE_BUS;
   } else {
-    offset2 = CUE_CIRCLE_SMALL_SIZE;
+    offset2 = JUNCTION_CUE_SIZE_NET;
   }
 
   f_print_set_color(toplevel, fp, JUNCTION_COLOR);
@@ -178,25 +178,16 @@ void s_cue_output_lowlevel(TOPLEVEL * toplevel, OBJECT * object, int whichone,
 
 
         } else if (count >= 2) {
-          if (output_type == POSTSCRIPT) {
-            if (!bus_involved) {
-              s_cue_postscript_fillcircle(toplevel, fp, x, y, FALSE);
-            } else {
-              s_cue_postscript_fillcircle(toplevel, fp, x, y, TRUE);
-            }
-          }
+          if (output_type == POSTSCRIPT)
+            s_cue_postscript_junction (toplevel, fp, x, y, bus_involved);
         }
       }
       break;
 
     case (CONN_MIDPOINT):
-      if (output_type == POSTSCRIPT) {
-        if (!bus_involved) {
-          s_cue_postscript_fillcircle(toplevel, fp, x, y, FALSE);
-        } else {
-          s_cue_postscript_fillcircle(toplevel, fp, x, y, TRUE);
-        }
-      }
+      if (output_type == POSTSCRIPT)
+        s_cue_postscript_junction (toplevel, fp, x, y, bus_involved);
+      break;
   }
 
 }
@@ -212,10 +203,10 @@ void s_cue_output_lowlevel_midpoints(TOPLEVEL * toplevel, OBJECT * object,
   int x, y;
   GList *cl_current;
   CONN *conn;
-  int size_flag = FALSE;
+  int bus_involved = FALSE;
 
   if (object->type == OBJ_BUS)
-    size_flag = TRUE;
+    bus_involved = TRUE;
 
   cl_current = object->conn_list;
   while (cl_current != NULL) {
@@ -228,10 +219,10 @@ void s_cue_output_lowlevel_midpoints(TOPLEVEL * toplevel, OBJECT * object,
         y = conn->y;
 
         if (conn->other_object && conn->other_object->type == OBJ_BUS)
-          size_flag = TRUE;
+          bus_involved = TRUE;
 
         if (output_type == POSTSCRIPT) {
-          s_cue_postscript_fillcircle(toplevel, fp, x, y, size_flag);
+          s_cue_postscript_junction (toplevel, fp, x, y, bus_involved);
         }
         break;
     }

commit 5702951f92bb0c693f030c07ef61f0c5986fb5dd
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 4 19:03:06 2009 +0000

    gschem: Adjust position hinting when drawing round junction cues
    
    Apply hinting to the cue's position to match the position of the object
    it is sitting on. This is done by passing the on-screen width (pixels)
    of a net / bus into gschem_cairo_arc(). If the line-width is odd, that
    function will shift the origin of the arc by 0.5px. Refactor the places
    where we draw circular arcs to use a single helper function in o_cue.c

diff --git a/gschem/src/o_cue.c b/gschem/src/o_cue.c
index e46efb8..bb1e922 100644
--- a/gschem/src/o_cue.c
+++ b/gschem/src/o_cue.c
@@ -92,6 +92,49 @@ static void o_cue_set_color(GSCHEM_TOPLEVEL *w_current, int color)
 }
 
 
+/*! \brief Draws a circular junction cue
+ *
+ *  \par Function Description
+ *  Draws a cue at the given world coordinate, picking the size based
+ *  on whether a bus forms a part of the connection.
+ *
+ *  The cue's drawn position is hinted to align with the widht a net or
+ *  bus would be drawn on screen. This helps to keep the cue looking
+ *  central when lines being hinted onto the pixel grid.
+ *
+ *  \param [in] w_current     The GSCHEM_TOPLEVEL object
+ *  \param [in] x             The X coordinate of the cue (world units)
+ *  \param [in] y             The Y coordinate of the cue (world units)
+ *  \param [in] bus_involved  If a bus forms part of the connection (TRUE/FALSE)
+ */
+static void draw_junction_cue (GSCHEM_TOPLEVEL *w_current,
+                               int x, int y, int bus_involved)
+{
+  int s_x, s_y;
+  int size, x2size;
+  int line_width;
+
+  if (w_current->toplevel->DONT_REDRAW)
+    return;
+
+  WORLDtoSCREEN (w_current, x, y, &s_x, &s_y);
+
+  if (bus_involved) {
+    size = SCREENabs (w_current, CUE_CIRCLE_LARGE_SIZE) / 2;
+    line_width = SCREENabs (w_current, BUS_WIDTH);
+  } else {
+    size = SCREENabs (w_current, CUE_CIRCLE_SMALL_SIZE) / 2;
+    line_width = SCREENabs (w_current, NET_WIDTH);
+  }
+  x2size = size * 2;
+  line_width = max (line_width, 1);
+
+  gschem_cairo_arc (w_current->cr, line_width, s_x, s_y, size, 0, 360);
+  o_cue_set_color (w_current, JUNCTION_COLOR);
+  cairo_fill (w_current->cr);
+}
+
+
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
@@ -173,20 +216,7 @@ void o_cue_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichon
           }
 
         } else if (count >= 2) {
-          /* draw circle */
-
-          if (bus_involved) {
-            size = SCREENabs (w_current, CUE_CIRCLE_LARGE_SIZE) / 2;
-          } else {
-            size = SCREENabs (w_current, CUE_CIRCLE_SMALL_SIZE) / 2;
-          }
-          x2size = 2 * size;
-          if (toplevel->DONT_REDRAW == 0) {
-            o_cue_set_color (w_current, JUNCTION_COLOR);
-            cairo_arc (w_current->cr, screen_x + 0.5, screen_y + 0.5, size, 0, 2. * M_PI);
-            cairo_fill (w_current->cr);
-
-          }
+          draw_junction_cue (w_current, x, y, bus_involved);
         }
       } else if (object->type == OBJ_PIN) {
         /* Didn't find anything connected there */
@@ -243,20 +273,7 @@ void o_cue_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichon
       break;
 
     case(CONN_MIDPOINT):
-  
-      /* draw circle */
-      if (bus_involved) {
-        size = SCREENabs (w_current, CUE_CIRCLE_LARGE_SIZE) / 2;
-      } else {
-        size = SCREENabs (w_current, CUE_CIRCLE_SMALL_SIZE) / 2;
-      }
-      x2size = size * 2;
-
-      if (toplevel->DONT_REDRAW == 0) {
-        o_cue_set_color (w_current, JUNCTION_COLOR);
-        cairo_arc (w_current->cr, screen_x + 0.5, screen_y + 0.5, size, 0, 2. * M_PI);
-        cairo_fill (w_current->cr);
-      }
+      draw_junction_cue (w_current, x, y, bus_involved);
       break;
 
       /* here is where you draw bus rippers */
@@ -273,50 +290,22 @@ void o_cue_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichon
  */
 void o_cue_draw_lowlevel_midpoints(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
 {
-  TOPLEVEL *toplevel = w_current->toplevel;
-  int x, y, screen_x, screen_y;
-  GList *cl_current;
-  CONN *conn;
-  int size, x2size;
-
-  if (toplevel->override_color != -1 ) {
-    gschem_cairo_set_source_color(w_current->cr, x_color_lookup (w_current->toplevel->override_color));
-  } else {
-    gschem_cairo_set_source_color(w_current->cr, x_color_lookup (JUNCTION_COLOR));
-  }
-  
-  cl_current = object->conn_list;
-  while(cl_current != NULL) {
-    conn = (CONN *) cl_current->data;
-
-    switch(conn->type) {        
-      case(CONN_MIDPOINT):
-
-        x = conn->x;
-        y = conn->y;
+  GList *iter;
+  int bus_involved;
 
-        WORLDtoSCREEN (w_current, x, y, &screen_x, &screen_y);
+  for (iter = object->conn_list; iter != NULL; iter = g_list_next (iter)) {
+    CONN *conn = iter->data;
 
-        /* draw circle */
-        if (conn->other_object &&
-            (object->type == OBJ_BUS || conn->other_object->type == OBJ_BUS)) {
-          size = SCREENabs (w_current, CUE_CIRCLE_LARGE_SIZE) / 2;
-        } else {
-          size = SCREENabs (w_current, CUE_CIRCLE_SMALL_SIZE) / 2;
-        }
-        x2size = size * 2;
-
-        if (toplevel->DONT_REDRAW == 0) {
-          cairo_arc (w_current->cr, screen_x + 0.5, screen_y + 0.5, size, 0, 2. * M_PI);
-          cairo_fill (w_current->cr);
-        }
-        break;
+    if (conn->type == CONN_MIDPOINT) {
+      bus_involved = (object->type == OBJ_BUS ||
+                       (conn->other_object &&
+                        conn->other_object->type == OBJ_BUS));
+      draw_junction_cue (w_current, conn->x, conn->y, bus_involved);
     }
-
-    cl_current = g_list_next(cl_current);
   }
 }
 
+
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description




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