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

gboolean file_subtract ( GtkObject *  ok_button,
Plot plot 
)

Prompts the user for a pair of files to subtract, then performs and plots the subtraction.

Parameters:
ok_button The calling button.
plot The calling plot.
Returns:
TRUE if things worked out.

Definition at line 738 of file special_fn.c.

References dataset_read_subtract_files(), plot_data_append(), plot_data_init(), plot_window_display_all(), and _Plot::window.

Referenced by subtract_select_dialog_create().

{
  Plot* new_plot;
  GArray* data;
  gchar* file_A;
  gchar* file_B;
  gint data_idx;
  gboolean new_window;

  UNUSED(ok_button);
  file_A = gtk_entry_get_text(GTK_ENTRY(file_entry_A));
  file_B = gtk_entry_get_text(GTK_ENTRY(file_entry_B));

  new_window = gtk_toggle_button_get_active
    (GTK_TOGGLE_BUTTON(new_window_check));
  
  data_idx = dataset_read_subtract_files(file_A, file_B);

  if (data_idx == FAIL)
    return TRUE;

  if (new_window)
    {
      data = g_array_new(FALSE, FALSE, sizeof(gint));
      g_array_append_val(data, data_idx);
      new_plot = plot_data_init(data);
      gtk_widget_show(new_plot->window);
    }
  else
    {
      plot_data_append(plot, data_idx);
      plot_window_display_all(plot);
    }

  return TRUE;
}


Generated by  Doxygen 1.6.0   Back to index