示例#1
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);
  }
}
示例#2
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);
  }
}
示例#3
0
文件: o_pin.c 项目: fvila/geda-gaf
/*! \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);
  }
}