Ejemplo n.º 1
0
/*! \brief draw rubbernet lines to the gc
 *  \par Function Description
 *  This function draws the rubbernets to the graphic context
 */
void o_net_draw_rubber(GSCHEM_TOPLEVEL *w_current)
{
  int size = 0, w_magnetic_halfsize;

  if (w_current->toplevel->net_style == THICK)
    size = NET_WIDTH;

  gschem_cairo_set_source_color (w_current,
                                 x_color_lookup_dark (SELECT_COLOR));

  if (w_current->magneticnet_mode) {
    if (w_current->magnetic_wx != -1 && w_current->magnetic_wy != -1) {
      w_magnetic_halfsize = max (4 * size,
                                 WORLDabs (w_current, MAGNETIC_HALFSIZE));
      gschem_cairo_arc (w_current, size, w_current->magnetic_wx,
                                         w_current->magnetic_wy,
                                         w_magnetic_halfsize, 0, 360);
    }
  }

  /* Primary line */
  gschem_cairo_line (w_current, END_NONE, size,
                     w_current->first_wx,  w_current->first_wy,
                     w_current->second_wx, w_current->second_wy);

  /* Secondary line */
  gschem_cairo_line (w_current, END_NONE, size,
                     w_current->second_wx, w_current->second_wy,
                     w_current->third_wx,  w_current->third_wy);

  gschem_cairo_stroke (w_current, TYPE_SOLID, END_NONE, size, -1, -1);
}
Ejemplo n.º 2
0
/*! \brief Fill inside of box with single line pattern.
 *  \par Function Description
 *  This function fills the inside of the box with a pattern made of lines.
 *  The lines are drawn inside the box with an angle <B>angle1</B> from the
 *  horizontal. The distance between two of these lines is given by
 *  <B>pitch1</B> and their width by <B>fill_width</B>.
 *  Parameters <B>angle2</B> and <B>pitch2</B> are unused here but kept for
 *  compatbility with other box filling functions.
 *
 *  The box is defined in the same way as it is in GDK : one point and the
 *  width and height of the box.
 *
 *  All parameters are given in pixel.
 *
 *  Negative or null values for <B>pitch1</B> are not allowed as it leads to
 *  an endless loop.
 *
 *  \param [in] w_current   Schematic top level
 *  \param [in] color       Box fill color.
 *  \param [in] box         Box definition
 *  \param [in] fill_width  BOX pattern fill width.
 *  \param [in] angle1      1st angle for pattern.
 *  \param [in] pitch1      1st pitch for pattern.
 *  \param [in] angle2      (unused)
 *  \param [in] pitch2      (unused)
 */
static void
o_box_fill_hatch (GSCHEM_TOPLEVEL *w_current,
                  COLOR *color, BOX *box,
                  gint fill_width,
                  gint angle1, gint pitch1,
                  gint angle2, gint pitch2)
{
  int i;
  GArray *lines;

  gschem_cairo_set_source_color (w_current, color);

  lines = g_array_new (FALSE, FALSE, sizeof (LINE));
  m_hatch_box (box, angle1, pitch1, lines);

  for (i=0; i < lines->len; i++) {
    LINE *line = &g_array_index (lines, LINE, i);

    gschem_cairo_line (w_current, END_NONE, fill_width, line->x[0], line->y[0],
                                                        line->x[1], line->y[1]);
  }
  gschem_cairo_stroke (w_current, TYPE_SOLID, END_NONE, fill_width, -1, -1);

  g_array_free (lines, TRUE);
}
Ejemplo n.º 3
0
/*! \brief Draw a line on screen.
 *  \par Function Description
 *  This function is used to draw a line on screen. The line is described
 *  in the object which is referred by <B>o_current</B>. The line is displayed
 *  according to the current state, described in the GSCHEM_TOPLEVEL object pointed
 *  by <B>w_current</B>.
 *
 *  It first checks if the object is valid or not. If not it returns and do
 *  not output anything. That should never happen though.
 *
 *  \param [in] w_current  The GSCHEM_TOPLEVEL object.
 *  \param [in] o_current  The line OBJECT to draw.
 */
void o_line_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
  int x1, y1, x2, y2;

  if (o_current->line == NULL) {
    return;
  }

  if (!o_line_visible (w_current, o_current->line, &x1, &y1, &x2, &y2)) {
    return;
  }

  gschem_cairo_line (w_current, o_current->line_end,
                                o_current->line_width,
                                x1, y1, x2, y2);

  gschem_cairo_set_source_color (w_current,
                                 o_drawing_color (w_current, o_current));
  gschem_cairo_stroke (w_current, o_current->line_type,
                                  o_current->line_end,
                                  o_current->line_width,
                                  o_current->line_length,
                                  o_current->line_space);

  if (o_current->selected && w_current->draw_grips) {
    o_line_draw_grips (w_current, o_current);
  }
}
Ejemplo n.º 4
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
void o_net_draw_stretch (GSCHEM_TOPLEVEL *w_current,
                         int dx, int dy, int whichone, OBJECT *o_current)
{
  int color;
  int dx1 = -1, dx2 = -1, dy1 = -1,dy2 = -1;

  if (o_current->line == NULL) {
    return;
  }

  if (o_current->saved_color != -1) {
    color = o_current->saved_color;
  } else {
    color = o_current->color;
  }

  if (whichone == 0) {
    dx1 = dx;
    dy1 = dy;
    dx2 = dy2 = 0;
  } else if (whichone == 1) {
    dx1 = dy1 = 0;
    dx2 = dx;
    dy2 = dy;
  } else {
    fprintf(stderr, _("Got an invalid which one in o_net_draw_stretch\n"));
  }

  gschem_cairo_line (w_current, END_NONE, 0,
                     o_current->line->x[0] + dx1, o_current->line->y[0] + dy1,
                     o_current->line->x[1] + dx2, o_current->line->y[1] + dy2);

  gschem_cairo_set_source_color (w_current, x_color_lookup_dark (color));
  gschem_cairo_stroke (w_current, TYPE_SOLID, END_NONE, 0, -1, -1);
}
Ejemplo n.º 5
0
/*! \brief Draw line from GSCHEM_TOPLEVEL object.
 *  \par Function Description
 *  This function draws a line with an exclusive or function over the sheet.
 *  The color of the box is <B>SELECT_COLOR</B>. The line is
 *  described by the two points (<B>w_current->first_wx</B>,
 *  <B>w_current->first_wy</B>) and (<B>w_current->second_wx</B>,<B>w_current->second_wy</B>).
 *
 *  \param [in] w_current  The GSCHEM_TOPLEVEL object.
 */
void o_line_draw_rubber (GSCHEM_TOPLEVEL *w_current)
{
  gschem_cairo_line (w_current, END_NONE, 0,
                     w_current->first_wx, w_current->first_wy,
                     w_current->second_wx, w_current->second_wy);

  gschem_cairo_set_source_color (w_current,
                                 x_color_lookup_dark (SELECT_COLOR));
  gschem_cairo_stroke (w_current, TYPE_SOLID, END_NONE, 0, -1, -1);
}
Ejemplo n.º 6
0
/*! \brief Draw a line object after applying translation.
 *  \par Function Description
 *  This function is used to draw the line object described by
 *  <B>*o_current</B> after applying a translation on the two directions of
 *  <B>dx</B> and <B>dy</B> in world units.
 *
 *  \param [in] w_current  The GSCHEM_TOPLEVEL object.
 *  \param [in] dx         Delta x coordinate for line.
 *  \param [in] dy         Delta y coordinate for line.
 *  \param [in] o_current  Line OBJECT to draw.
 */
void o_line_draw_place (GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
  if (o_current->line == NULL) {
    return;
  }

  gschem_cairo_line (w_current, END_NONE, 0,
                     o_current->line->x[0] + dx, o_current->line->y[0] + dy,
                     o_current->line->x[1] + dx, o_current->line->y[1] + dy);
  gschem_cairo_set_source_color (w_current,
                                 x_color_lookup_dark (o_current->color));
  gschem_cairo_stroke (w_current, TYPE_SOLID, END_NONE, 0, -1, -1);
}
Ejemplo n.º 7
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
void o_pin_draw_rubber (GSCHEM_TOPLEVEL *w_current)
{
  int size = 0;

  /* Pins are always first created as net pins, use net pin width */
  if (w_current->toplevel->net_style == THICK)
    size = PIN_WIDTH_NET;

  gschem_cairo_line (w_current, END_NONE, size,
                     w_current->first_wx,  w_current->first_wy,
                     w_current->second_wx, w_current->second_wy);

  gschem_cairo_set_source_color (w_current,
                                 x_color_lookup_dark (SELECT_COLOR));
  gschem_cairo_stroke (w_current, TYPE_SOLID, END_NONE, size, -1, -1);
}
Ejemplo n.º 8
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
void o_net_draw_place (GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
  int size = 0;

  if (o_current->line == NULL) {
    return;
  }

  if (w_current->toplevel->net_style == THICK)
    size = NET_WIDTH;

  gschem_cairo_line (w_current, END_NONE, size,
                     o_current->line->x[0] + dx, o_current->line->y[0] + dy,
                     o_current->line->x[1] + dx, o_current->line->y[1] + dy);
  gschem_cairo_set_source_color (w_current,
                                 x_color_lookup_dark (o_current->color));
  gschem_cairo_stroke (w_current, TYPE_SOLID, END_NONE, size, -1, -1);
}
Ejemplo n.º 9
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
void o_net_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
  TOPLEVEL *toplevel = w_current->toplevel;
  int x1, y1, x2, y2;
  int size = 0;

#if NET_DEBUG /* debug */
  char *tempstring;
  GdkFont *font;
#endif

  if (o_current == NULL) {
    return;
  }

  if (o_current->line == NULL) {
    return;
  }

  /* reuse line's routine */
  if ( (toplevel->DONT_REDRAW == 1) ||
       (!o_line_visible (w_current, o_current->line, &x1, &y1, &x2, &y2)) ) {
    return;
  }

  if (toplevel->net_style == THICK)
    size = NET_WIDTH;

  if (toplevel->override_color != -1 ) {
    gschem_cairo_set_source_color (w_current, x_color_lookup (toplevel->override_color));
  } else {
    gschem_cairo_set_source_color (w_current, x_color_lookup (o_current->color));
  }

  gschem_cairo_line (w_current, END_SQUARE, size, x1, y1, x2, y2);
  gschem_cairo_stroke (w_current, TYPE_SOLID, END_SQUARE, size, -1, -1);

  if (o_current->selected && w_current->draw_grips) {
    o_line_draw_grips (w_current, o_current);
  }
}
Ejemplo n.º 10
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
void o_pin_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
  TOPLEVEL *toplevel = w_current->toplevel;
  int x1, y1, x2, y2;
  int size = 0;
  OBJECT_END end;

  if (o_current->line == NULL) {
    return;
  }

  /* reuse line's routine */
  if (!o_line_visible (w_current, o_current->line, &x1, &y1, &x2, &y2)) {
    return;
  }

  if (toplevel->pin_style == THICK)
    size = o_current->line_width;

  end = o_get_line_end (toplevel->print_output_capstyle);

  gschem_cairo_line (w_current, end, size, x1, y1, x2, y2);

  gschem_cairo_set_source_color (w_current,
                                 o_drawing_color (w_current, o_current));
  gschem_cairo_stroke (w_current, TYPE_SOLID, end, size, -1, -1);

  /* draw the cue directly */
  o_cue_draw_lowlevel(w_current, o_current, o_current->whichend);

#if DEBUG
  printf("drawing pin\n");
#endif

  if (o_current->selected && w_current->draw_grips) {
    o_line_draw_grips (w_current, o_current);
  }
}