48void save_to_file_ (
int *,
char *,
int *,
double *,
double *,
int *,
int *,
int *,
double *,
int *,
int *,
int *,
int *,
char *);
49void prep_file_ (
int *,
char *,
int *,
int *,
int *,
double *,
int *,
int *);
50void append_to_file_ (
int *,
double *,
double *,
double *,
int *,
int *,
int *,
int *,
int *,
int *,
int *,
char *);
64G_MODULE_EXPORT
void run_write_curve (GtkNativeDialog * info, gint response_id, gpointer data)
66 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkFileChooserNative *)info);
77G_MODULE_EXPORT
void run_write_curve (GtkDialog * info, gint response_id, gpointer data)
79 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkWidget *)info);
81 int a,
b,
c, i, j, k, l, m, n, o, p, q;
86 if (response_id == GTK_RESPONSE_ACCEPT)
90 GtkFileFilter * tmp = gtk_file_chooser_get_filter (chooser);
99 k = strlen(this_proj -> curves[
b][
c] -> cfile);
100 j = strlen (this_proj -> curves[
b][
c] -> title);
101 if (this_proj -> curves[
b][
c] -> extrac -> extras == 0)
104 & this_proj -> curves[
b][
c] -> ndata,
105 this_proj -> curves[
b][
c] -> data[0],
106 this_proj -> curves[
b][
c] -> data[1],
107 & this_proj -> curves[
b][
c] ->
scale[0],
108 & this_proj -> curves[
b][
c] ->
scale[1],
109 & this_proj -> curves[
b][
c] ->
layout -> aspect,
110 & this_proj -> delta[
b], &
b, &
c, & l,
111 & j, this_proj -> curves[
b][
c] -> title);
116 p = this_proj -> curves[
b][
c] -> extrac -> extras + 1;
118 prep_file_ (& k, this_proj -> curves[
b][
c] -> cfile, & l,
119 & this_proj -> curves[
b][
c] ->
scale[0],
120 & this_proj -> curves[
b][
c] ->
scale[1],
121 & this_proj -> delta[
b], &
b, &
c);
123 this_proj -> curves[
b][
c] -> data[0],
124 this_proj -> curves[
b][
c] -> data[1],
125 & this_proj -> delta[
b],
126 & this_proj -> curves[
b][
c] ->
layout -> aspect,
127 &
b, &
c, & l, & m, & p,
128 & j, this_proj -> curves[
b][
c] -> title);
129 j = this_proj -> curves[
b][
c] -> extrac -> extras;
130 CurveExtra * ctmp = this_proj -> curves[
b][
c] -> extrac -> first;
131 for (i=0 ; i < j ; i++ )
138 j = strlen (this_proj -> curves[o][n] -> title);
140 this_proj -> curves[o][n] -> data[0],
141 this_proj -> curves[o][n] -> data[1],
142 & this_proj -> delta[o],
143 & ctmp ->
layout -> aspect,
144 & o, & n, & l, & m, & p,
145 & j, this_proj -> curves[o][n] -> title);
146 if (ctmp -> next) ctmp = ctmp -> next;
167 GtkFileChooserNative * info;
178 GTK_WINDOW(this_proj -> curves[
b][
c] -> window),
179 GTK_FILE_CHOOSER_ACTION_SAVE,
181 GtkFileChooser * chooser = GTK_FILE_CHOOSER(info);
183 gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
185 filter1 = gtk_file_filter_new();
186 gtk_file_filter_set_name (GTK_FILE_FILTER(
filter1),
"Xmgrace file (*.agr)");
187 gtk_file_filter_add_pattern (GTK_FILE_FILTER(
filter1),
"*.agr");
188 gtk_file_chooser_add_filter (chooser,
filter1);
189 filter2 = gtk_file_filter_new();
190 gtk_file_filter_set_name (GTK_FILE_FILTER(
filter2),
"x/y ASCII file (*.dat)");
191 gtk_file_filter_add_pattern (GTK_FILE_FILTER(
filter2),
"*.dat");
192 gtk_file_chooser_add_filter (chooser,
filter2);
193 if (this_proj -> curves[
b][
c] -> cfile != NULL)
200 gtk_file_chooser_set_current_name (chooser, this_proj -> curves[
b][
c] -> name);
203 run_this_gtk_native_dialog ((GtkNativeDialog *)info, G_CALLBACK(
run_write_curve), idata);
double scale(double axe)
find appropriate major tick spacing based on axis length
Variable declarations for the curve widget Functions for interactions with the curve widget.
Global variable declarations Global convenience function declarations Global data structure defin...
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
void file_chooser_set_current_folder(GtkFileChooser *chooser)
set current folder in a GtkFilechooser
gchar * file_chooser_get_file_name(GtkFileChooser *chooser)
get a file name from a GtkFileChooser (single file selected)
gboolean file_chooser_set_file_name(GtkFileChooser *chooser, gchar *filename)
set file name in a GtkFilechooser
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
GtkWidget * create_file_chooser(const gchar *title, GtkWindow *parent, GtkFileChooserAction act, const gchar *act_name)
create a GtkFileChooser, utility to select file(s)
void destroy_this_native_dialog(GtkNativeDialog *dialog)
destroy a GtkNativeDialog
project * get_project_by_id(int p)
get project pointer using id number
Messaging function declarations.
void save_to_file_(int *, char *, int *, double *, double *, int *, int *, int *, double *, int *, int *, int *, int *, char *)
void append_to_file_(int *, double *, double *, double *, int *, int *, int *, int *, int *, int *, int *, char *)
void prep_file_(int *, char *, int *, int *, int *, double *, int *, int *)
G_MODULE_EXPORT void run_write_curve(GtkDialog *info, gint response_id, gpointer data)
save curve data - running the dialog GTK3
void write_curve(gpointer idata)
save curve data - creating the dialog