Logo Search packages:      
Sourcecode: ygraph version File versions  Download package

void plot_area_write_location ( Plot plot,
gint  i,
gint  j 
) [inline]

Create a popup containing the pointer location.

Parameters:
plot The Plot on which the grid is to be drawn.
pixmap The backing pixmap holding the image.

Definition at line 484 of file plot_area.c.

References _Plot::font, _Plot::i_origin, _Plot::i_size, i_to_x(), j_to_y(), and _Plot::plot_area.

Referenced by plot_area_button_press_event().

{
  gchar location_str[RANGE_STR_MAX_SIZE];
  gint len;
  gdouble x;
  gdouble y;
  gint text_height;
  gint text_width;
  gint text_x;
  gint text_y;
  
  x = i_to_x(plot, i);
  y = j_to_y(plot, j);

  g_snprintf(location_str, RANGE_STR_MAX_SIZE, "(%g,%g)", x, y);
  len = strlen(location_str);

  text_height = gdk_text_height(plot->font, location_str, len);
  text_width = gdk_text_width(plot->font, location_str, len);
  text_x = i + 2*CROSS_SIZE;
  text_y = j - 2*CROSS_SIZE;

  if ((text_x + text_width) > (plot->i_origin + plot->i_size))
    text_x = plot->i_origin + plot->i_size - text_width;

  gdk_draw_line
    (plot->plot_area->window,
     plot->plot_area->style->fg_gc[GTK_WIDGET_STATE(plot->plot_area)],
     i - CROSS_SIZE, j, i + CROSS_SIZE, j);
  gdk_draw_line
    (plot->plot_area->window,
     plot->plot_area->style->fg_gc[GTK_WIDGET_STATE(plot->plot_area)],
     i, j - CROSS_SIZE, i, j + CROSS_SIZE);

  gdk_draw_text
    (plot->plot_area->window,
     plot->font,
     plot->plot_area->style->fg_gc[GTK_WIDGET_STATE(plot->plot_area)],
     text_x, text_y, location_str, len);
}


Generated by  Doxygen 1.6.0   Back to index