75 j = GPOINTER_TO_INT(data);
76 text[0] =
"X size must be > 0";
77 text[1] =
"Y size must be > 0";
100G_MODULE_EXPORT
void set_background (GtkCheckButton * backb, gpointer data)
114 if (gtk_check_button_get_active (backb))
116 if (gtk_toggle_button_get_active (backb))
137 forme = gtk_combo_box_get_active (box);
142 gtk_check_button_set_active (GTK_CHECK_BUTTON(imf ->
a), 0);
144 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(imf ->
a), 0);
157 gtk_image_set_from_file (GTK_IMAGE(imf ->
b), PACKAGE_PNG);
160 gtk_image_set_from_file (GTK_IMAGE(imf ->
b), PACKAGE_PDF);
163 gtk_image_set_from_file (GTK_IMAGE(imf ->
b), PACKAGE_SVG);
166 gtk_image_set_from_file (GTK_IMAGE(imf ->
b), PACKAGE_EPS);
172gchar *
i_title[4]={
"Portable Network Graphics",
173 "Portable Document File",
174 "Scalable Vector Graphics",
175 "Encapsulated Post-Script Image"};
191G_MODULE_EXPORT
void run_write_image (GtkNativeDialog * info, gint response_id, gpointer data)
193 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkFileChooserNative *)info);
204G_MODULE_EXPORT
void run_write_image (GtkDialog * info, gint response_id, gpointer data)
206 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkWidget *)info);
209 if (response_id == GTK_RESPONSE_ACCEPT)
213 this_proj -> curves[cd ->
b][cd ->
c] -> format =
forme + 1;
217 GdkSurface * surf = gtk_native_get_surface ((GtkNative *)this_proj -> curves[cd ->
b][cd ->
c] ->
plot);
218 cairo_t * rec = (cairo_t *)gdk_cairo_context_cairo_create (gdk_surface_create_cairo_context (surf));
243 gchar * i_filter[4]={
"PNG file (*.png)",
251 show_warning (
"To save an image please enter a file format", this_proj -> curves[
b][
c] -> window);
255 show_warning (
"You need to specify the size of the image", this_proj -> curves[
b][
c] -> window);
260 GtkFileChooserNative * info;
265 GTK_WINDOW(this_proj -> curves[
b][
c] -> window),
266 GTK_FILE_CHOOSER_ACTION_SAVE,
268 GtkFileChooser * chooser = GTK_FILE_CHOOSER(info);
270 gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
272 filter = gtk_file_filter_new();
273 gtk_file_filter_set_name(GTK_FILE_FILTER(
filter), i_filter[
forme]);
275 gtk_file_chooser_add_filter (chooser,
filter);
277 run_this_gtk_native_dialog ((GtkNativeDialog *)info, G_CALLBACK(
run_write_image), curetow);
293G_MODULE_EXPORT
void run_save_image (GtkDialog * save_img, gint response_id, gpointer data)
295 gboolean done = FALSE;
300 case GTK_RESPONSE_APPLY:
328 GtkWidget * save_img;
330 GtkWidget * comboformat;
333 GtkWidget * background;
345 gtk_window_set_resizable (GTK_WINDOW (save_img), FALSE);
347 gtk_window_set_icon (GTK_WINDOW (save_img),
THETD);
350 gtk_box_set_spacing (GTK_BOX(
vbox), 15);
355 GtkWidget * fixed = gtk_fixed_new ();
364 gtk_fixed_put (GTK_FIXED(fixed), comboformat, -1, 10);
365 gtk_widget_set_size_request (comboformat, -1, 30);
367 log = gtk_image_new_from_file (PACKAGE_VOID);
374 xlgt = gtk_widget_get_allocated_width (this_proj -> curves[
b][
c] ->
plot);
375 ylgt = gtk_widget_get_allocated_height (this_proj -> curves[
b][
c] ->
plot);
GtkFileFilter * filter[NCFORMATS+1]
Variable declarations for the curve widget Functions for interactions with the curve widget.
void show_curve(GtkDrawingArea *area, cairo_t *cr, int width, int height, gpointer curve)
show curve callback GTK3
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * dialog_cancel_apply(gchar *title, GtkWidget *parent, gboolean resiz)
create a dialog modal offering a choice to apply something or not
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
gchar * file_chooser_get_file_name(GtkFileChooser *chooser)
get a file name from a GtkFileChooser (single file selected)
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
void add_box_child_start(int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the initial position.
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
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
void show_warning(char *warning, GtkWidget *win)
show warning
Messaging function declarations.
void write_image(gpointer curetow)
write image - creating the file chooser dialog
G_MODULE_EXPORT void run_save_image(GtkDialog *save_img, gint response_id, gpointer data)
export curve window plot to image - running the dialog
G_MODULE_EXPORT void set_background(GtkToggleButton *backb, gpointer data)
show / hide image background toggle callback GTK3
G_MODULE_EXPORT void set_size(GtkEntry *val, gpointer data)
set image size entry callback
G_MODULE_EXPORT void choose_format(GtkComboBox *box, gpointer cid)
change image format
void save_image(gpointer cdata)
export curve window plot to image - creating the dialog
G_MODULE_EXPORT void run_write_image(GtkDialog *info, gint response_id, gpointer data)
write image - running the dialog GTK3