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

void plot_window_unzoom ( Plot plot  ) 

Handle an unzoom event.

If the unzoom event is called, then reset the axis ranges to their original value and redraw the plot.

Parameters:
plot The Plot in question.
Returns:
void

Definition at line 236 of file callbacks.c.

References _Plot::fixed_range, plot_window_display_all(), plot_window_reconfigure(), _Plot::x_range, _Plot::y_range, _Plot::zoom_history_end, and _Plot::zoom_history_start.

{
  /* If there was no zoom, just return */
  if (!plot->zoom_history_start || !plot->zoom_history_start)
    return;
  /* remove the last entry in the zoom history */
  g_array_remove_index(plot->zoom_history_start,
                       plot->zoom_history_start->len-1);
  g_array_remove_index(plot->zoom_history_end,
                       plot->zoom_history_end->len-1);
  /* if the array is empty now, free the memory */
  if (plot->zoom_history_start->len==0)
    {
      plot->fixed_range = FALSE;
      g_array_free(plot->zoom_history_start, TRUE);
      plot->zoom_history_start=NULL;
    }
  if (plot->zoom_history_end->len==0)
    {
      plot->fixed_range = FALSE;
      g_array_free(plot->zoom_history_end, TRUE);
      plot->zoom_history_end=NULL;
    }
  /* If it is still fixed range (== zoomed), then emulate the zoom done by
   * clicking into the window */
  if (plot->fixed_range==TRUE)
    {
      plot->x_range[0] = g_array_index(plot->zoom_history_start, Point_Double,
                                       plot->zoom_history_start->len-1).x;
      plot->y_range[0] = g_array_index(plot->zoom_history_start, Point_Double,
                                       plot->zoom_history_start->len-1).y;
      plot->x_range[1] = g_array_index(plot->zoom_history_end, Point_Double,
                                       plot->zoom_history_end->len-1).x;
      plot->y_range[1] = g_array_index(plot->zoom_history_end, Point_Double,
                                          plot->zoom_history_end->len-1).y;
    }
  plot_window_reconfigure(plot);
  plot_window_display_all(plot);
  return;
}


Generated by  Doxygen 1.6.0   Back to index