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

gboolean range_reset ( Plot plot  ) 

Sets the plot range based on values returned from the plot dialog.

Parameters:
plot The Plot whose range should be set.

Definition at line 963 of file axis.c.

References _Plot::fixed_range, message_dialog(), _Plot::x_range, and _Plot::y_range.

Referenced by axis_set_from_dialog().

{
  gchar* new_xmin_str;
  gchar* new_xmax_str;
  gchar* new_ymin_str;
  gchar* new_ymax_str;
  gdouble new_xmin;
  gdouble new_xmax;
  gdouble new_ymin;
  gdouble new_ymax;

  if ((entry_xmin == NULL) || (entry_xmax == NULL) || (entry_ymin == NULL)
      || (entry_ymax == NULL))
    return;
    
  new_xmin_str = gtk_entry_get_text(GTK_ENTRY(entry_xmin));
  new_xmax_str = gtk_entry_get_text(GTK_ENTRY(entry_xmax));
  new_ymin_str = gtk_entry_get_text(GTK_ENTRY(entry_ymin));
  new_ymax_str = gtk_entry_get_text(GTK_ENTRY(entry_ymax));

  new_xmin = g_strtod(new_xmin_str, NULL);
  new_xmax = g_strtod(new_xmax_str, NULL);
  new_ymin = g_strtod(new_ymin_str, NULL);
  new_ymax = g_strtod(new_ymax_str, NULL);

  if (new_xmin >= new_xmax)
      message_dialog("Invalid x range");
  else
    {
      plot->x_range[0] = new_xmin;
      plot->x_range[1] = new_xmax;
    }

  if (new_ymin >= new_ymax)
      message_dialog("Invalid y range");
  else
    {
      plot->y_range[0] = new_ymin;
      plot->y_range[1] = new_ymax;
    }
  
  plot->fixed_range = TRUE;

  return TRUE;
}


Generated by  Doxygen 1.6.0   Back to index