atomes 1.3.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
m_curve.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2026 by CNRS and University of Strasbourg */
15
21
22/*
23* This file: 'm_curve.c'
24*
25* Contains:
26*
27
28 - The curve context menu (mouse right click)
29
30*
31* List of functions:
32
33 gboolean was_not_added (ExtraSets * sets, int a, int b, int c);
34
35 void autoscale (gpointer data);
36 void action_to_plot (pointer data);
37 void add_extra (ExtraSets * sets, tint * id);
38 void remove_extra (ExtraSets * sets, CurveExtra * ctmp);
39 void prep_extra_rid (tint * data);
40 void curve_window_add_menu_bar (tint * data);
41
42 G_MODULE_EXPORT void curve_edit_menu_action (GSimpleAction * action, GVariant * parameter, gpointer data);
43 G_MODULE_EXPORT void curve_add_remove_menu_action (GSimpleAction * action, GVariant * parameter, gpointer data);
44 G_MODULE_EXPORT void curve_menu_bar_action (GSimpleAction * action, GVariant * parameter, gpointer data);
45
46 GtkWidget * curve_popup_menu (gpointer data);
47
48 GMenu * curve_section (GSimpleActionGroup * action_group, gchar * act, ExtraSets * sets, gboolean add, int edit, int a, int b, tint * data);
49 GMenu * create_curve_submenu (GSimpleActionGroup * action_group, gchar * act, tint * data, gboolean add, int edit);
50 GMenu * create_curve_menu (gchar * str);
51 GMenu * edit_data_section (GSimpleActionGroup * action_group, gchar * str, tint * data);
52 GMenu * curve_close_section (gchar * str);
53 GMenu * create_data_menu (GSimpleActionGroup * action_group, int pop, gchar * str, tint * data);
54 GMenu * curve_menu_bar (project * this_proj, GSimpleActionGroup * action_group, gchar * str, tint * data);
55 GMenu * create_add_remove_section (GSimpleActionGroup * action_group, gchar * act, int num, tint * data);
56 GMenu * autoscale_section (gchar * str);
57
58 CurveExtra * init_extra (tint * id);
59
60*/
61
62#include <gtk/gtk.h>
63#include <stdlib.h>
64
65#include "global.h"
66#include "callbacks.h"
67#include "curve.h"
68#include "cedit.h"
69#include "datab.h"
70
71extern DataLayout * curve_default_layout (project * pid, int rid, int cid);
72extern GtkWidget * shortcuts_window (int sections, int group_by_section[sections], int groups, int shortcut_by_group[groups],
73 gchar * section_names[sections], gchar * group_names[groups], shortcuts shortcs[]);
74int ** extrarid;
75
76gchar * curve_section_names[]={i18n("Curve window")};
78gchar * curve_group_names[]={i18n("Edition "), i18n("Export")};
79int curve_shortcut_by_group[] = { 3, 2 };
80
82//
83// Global
84//
85 { i18n("Autoscale"), i18n("Autoscale"), GDK_KEY_a, "<Ctrl>a" },
86 { i18n("Edit curve"), i18n("Edit curve"), GDK_KEY_e, "<Ctrl>e" },
87 { i18n("Close curve"), i18n("Close curve"), GDK_KEY_c, "<Ctrl>c" },
88 { i18n("Export data"), i18n("Export data"), GDK_KEY_s, "<Ctrl>s" },
89 { i18n("Save image"), i18n("Save image"), GDK_KEY_i, "<Ctrl>i" }
90};
91
99void autoscale (gpointer data)
100{
101 Curve * this_curve = get_curve_from_pointer (data);
102 this_curve -> autoscale[0] = TRUE;
103 this_curve -> autoscale[1] = TRUE;
104 update_curve (data);
105}
106
115{
116 CurveExtra * ctmp = g_malloc0(sizeof*ctmp);
117 ctmp -> id.a = id -> a;
118 ctmp -> id.b = id -> b;
119 ctmp -> id.c = id -> c;
120 ctmp -> layout = curve_default_layout (get_project_by_id(id -> a), id -> b, id -> c);
121 ctmp -> layout -> datacolor.red = 0.0;
122 ctmp -> layout -> datacolor.green = 0.0;
123 ctmp -> layout -> datacolor.blue = 0.0;
124 return ctmp;
125}
126
135void add_extra (ExtraSets * sets, tint * id)
136{
137 if (sets -> extras == 0)
138 {
139 sets -> first = init_extra (id);
140 sets -> last = sets -> first;
141 }
142 else
143 {
144 sets -> last -> next = init_extra (id);
145 sets -> last -> next -> prev = sets -> last;
146 sets -> last = sets -> last -> next;
147 }
148 sets -> extras ++;
149}
150
159void remove_extra (ExtraSets * sets, CurveExtra * ctmp)
160{
161 if (sets -> extras == 1)
162 {
163 g_free (ctmp);
164 sets -> first = NULL;
165 sets -> last = NULL;
166 }
167 else
168 {
169 if (ctmp -> prev == NULL)
170 {
171 sets -> first = ctmp -> next;
172 g_free (ctmp);
173 sets -> first -> prev = NULL;
174 }
175 else if (ctmp -> next == NULL)
176 {
177 ctmp = ctmp -> prev;
178 g_free (ctmp -> next);
179 ctmp -> next = NULL;
180 sets -> last = ctmp;
181 }
182 else
183 {
184 ctmp -> prev -> next = ctmp -> next;
185 ctmp -> next -> prev = ctmp -> prev;
186 g_free (ctmp);
187 }
188 }
189 sets -> extras --;
190}
191
192void curve_window_add_menu_bar (tint * data);
193
201void prep_extra_rid (tint * data)
202{
203 int i;
205 Curve * this_curve = get_curve_from_pointer (data);
206 if (this_curve -> extrac)
207 {
208 if (this_curve -> extrac -> extras > 0)
209 {
210 CurveExtra * ctmp = this_curve -> extrac -> first;
211 for (i=0; i<this_curve -> extrac -> extras; i++)
212 {
213 extrarid[ctmp -> id.a][ctmp -> id.b] ++;
214 if (ctmp -> next != NULL) ctmp = ctmp -> next;
215 }
216 }
217 }
218}
219
227void action_to_plot (gpointer data)
228{
229 int i;
230 tint * id = (tint *)data;
231 gboolean remove = FALSE;
232 project * this_proj = get_project_by_id (activeg);
233 Curve * this_curve = this_proj -> analysis[activer] -> curves[activec];
234 if (this_curve -> extrac > 0)
235 {
236 CurveExtra * ctmp = this_curve -> extrac -> first;
237 for (i=0; i<this_curve -> extrac -> extras; i++)
238 {
239 if (ctmp -> id.a == id -> a && ctmp -> id.b == id -> b && ctmp -> id.c == id -> c)
240 {
241 remove = TRUE;
242 break;
243 }
244 if (ctmp -> next != NULL) ctmp = ctmp -> next;
245 }
246 if (! remove)
247 {
248 add_extra (this_curve -> extrac, id);
249 }
250 else
251 {
252 remove_extra (this_curve -> extrac, ctmp);
253 }
254 }
255 else
256 {
257 add_extra (this_curve -> extrac, id);
258 }
259 curve_window_add_menu_bar (& this_proj -> analysis[activer] -> idcc[activec]);
260 update_curve ((gpointer)& this_proj -> analysis[activer] -> idcc[activec]);
261}
262
272G_MODULE_EXPORT void curve_edit_menu_action (GSimpleAction * action, GVariant * parameter, gpointer data)
273{
274 edit_data (data);
275}
276
286G_MODULE_EXPORT void curve_add_remove_menu_action (GSimpleAction * action, GVariant * parameter, gpointer data)
287{
288 action_to_plot (data);
289}
290
300G_MODULE_EXPORT void curve_menu_bar_action (GSimpleAction * action, GVariant * parameter, gpointer data)
301{
302 gchar * name = g_strdup_printf ("%s", g_action_get_name(G_ACTION(action)));
303 if (g_strcmp0 (name, "save.data") == 0)
304 {
305 write_curve (data);
306 }
307 else if (g_strcmp0 (name, "close.curve") == 0)
308 {
309 hide_curve (data);
310 }
311 else if (g_strcmp0 (name, "edit.curve") == 0)
312 {
313 edit_curve (data);
314 }
315 else if (g_strcmp0 (name, "save.image") == 0)
316 {
317 save_image (data);
318 }
319 else if (g_strcmp0 (name, "autoscale.curve") == 0)
320 {
321 autoscale (data);
322 }
323 else if (g_strcmp0 (name, "shortcuts.curve") == 0)
324 {
325 Curve * this_curve = get_curve_from_pointer (data);
326 this_curve -> shortcuts = destroy_this_widget (this_curve -> shortcuts);
329 }
330}
331
342gboolean was_not_added (ExtraSets * sets, int a, int b, int c)
343{
344 int i, j;
345 CurveExtra * ctmp = sets -> first;
346 for (i=0; i<sets -> extras; i++)
347 {
348 if (ctmp -> id.a == a && ctmp -> id.b == b)
349 {
350 for (j=0; j<get_project_by_id(a) -> analysis[b] -> numc; j++)
351 {
352 if (ctmp -> id.c == c) return FALSE;
353 }
354 }
355 if (ctmp -> next != NULL) ctmp = ctmp -> next;
356 }
357 return TRUE;
358}
359
374GMenu * curve_section (GSimpleActionGroup * action_group, gchar * act, ExtraSets * sets, gboolean add, int edit, int a, int b, tint * data)
375{
376 GMenu * menu = g_menu_new ();
377 gchar * str_a, * str_b, * str_c;
378 gchar * text[2] = {"curve.action", "edit.data"};
379 project * this_proj = get_project_by_id(a);
380 int g, h, i;
381 if (b == SKT)
382 {
383 g = (data -> c < get_project_by_id(data -> a) -> skt_sets) ? this_proj -> skt_sets : this_proj -> sqw_sets;
384 h = (data -> c < get_project_by_id(data -> a) -> skt_sets) ? 0 : this_proj -> skt_sets;
385 }
386 else
387 {
388 g = this_proj -> analysis[b] -> numc;
389 h = 0;
390 }
391 for (i=0; i<g; i++)
392 {
393 if (this_proj -> analysis[b] -> curves[i+h] -> ndata > 0)
394 {
395 if (((a != data -> a || b != data -> b || i+h != data -> c) && add == was_not_added(sets, a, b, i+h)) || (a == data -> a && b == data -> b && i+h == data -> c && edit))
396 {
397#ifdef GTK3
398 str_a = g_strdup_printf ("%s", prepare_for_title(this_proj -> analysis[b] -> curves[i+h] -> name));
399#else
400 str_a = g_strdup_printf ("%s", this_proj -> analysis[b] -> curves[i+h] -> name);
401#endif
402 str_b = g_strdup_printf ("%s.%d-%d-%d", text[edit], a, b, i+h);
403 str_c = g_strdup_printf ("%s.%s", act, str_b);
404 append_menu_item (menu, (const gchar *)str_a, (const gchar *)str_c, NULL, NULL, IMG_NONE, NULL, FALSE, FALSE, FALSE, NULL);
405 g_free (str_a);
406 g_free (str_c);
407 if (edit)
408 {
409 widget_add_action (action_group, (const gchar *)str_b, G_CALLBACK(curve_edit_menu_action), & this_proj -> analysis[b] -> idcc[i+h], FALSE, FALSE, FALSE, NULL);
410 }
411 else
412 {
413 widget_add_action (action_group, (const gchar *)str_b, G_CALLBACK(curve_add_remove_menu_action), & this_proj -> analysis[b] -> idcc[i+h], FALSE, FALSE, FALSE, NULL);
414 }
415 g_free (str_b);
416 }
417 }
418 }
419 return menu;
420}
421
433GMenu * create_curve_submenu (GSimpleActionGroup * action_group, gchar * act, tint * data, gboolean add, int edit)
434{
435 project * this_proj;
436 GMenu * menu = g_menu_new ();
437 int i, j, k, l;
438 gboolean * create_proj = allocbool (nprojects);
439 gboolean ** create_menu = allocdbool (nprojects, NCALCS);
440 for (i=0; i<nprojects; i++)
441 {
442 this_proj = get_project_by_id(i);
443 create_proj[i] = FALSE;
444 if (this_proj -> analysis[data -> b])
445 {
446 for (j=0; j<this_proj -> analysis[data -> b] -> c_sets; j++)
447 {
448 k = this_proj -> analysis[data -> b] -> compat_id[j];
449 create_menu[i][k] = FALSE;
450 if (data -> b == SKT)
451 {
452 l = (data -> c < get_project_by_id(data -> a) -> skt_sets) ? this_proj -> skt_sets : this_proj -> sqw_sets;
453 }
454 else
455 {
456 l = this_proj -> analysis[k] -> numc;
457 }
458 if (((add && extrarid[i][k] < l)
459 || (! add && extrarid[i][k] > 0)) && this_proj -> analysis[k] -> calc_ok)
460 {
461 create_menu[i][k] = TRUE;
462 create_proj[i] = TRUE;
463 }
464 }
465 }
466 }
467 if (edit)
468 {
469 create_menu[data -> a][data -> b] = TRUE;
470 create_proj[data -> a] = TRUE;
471 }
472 Curve * this_curve = get_curve_from_pointer (data);
473 GMenu * smenu;
474 for (i=0; i<nprojects; i++)
475 {
476 if (create_proj[i])
477 {
478 smenu = g_menu_new ();
479 for (j=0; j<NCALCS; j++)
480 {
481 if (create_menu[i][j]) append_submenu (smenu, graph_name[j], curve_section(action_group, act, this_curve -> extrac, add, edit, i, j, data));
482 }
483 // This way GTK3 will not be able to apply markup
484#ifdef GTK3
485 append_submenu (menu, prepare_for_title(get_project_by_id(i) -> name), smenu);
486#else
487 append_submenu (menu, get_project_by_id(i) -> name, smenu);
488#endif
489 g_object_unref (smenu);
490 }
491 }
492 g_free (create_proj);
493 g_free (create_menu);
494 return menu;
495}
496
497extern GIcon * get_gicon_from_data (int format, const gchar * icon);
498
506GMenu * create_curve_menu (gchar * str)
507{
508 GMenu * menu = g_menu_new ();
509 gchar * act = g_strdup_printf ("%s.edit.curve", str);
510 append_menu_item (menu, _("Edit Curve"), (const gchar *)act, "<CTRL>E", NULL, IMG_STOCK, PAGE_SETUP, FALSE, FALSE, FALSE, NULL);
511 g_free (act);
512 act = g_strdup_printf ("%s.save.image", str);
513 append_menu_item (menu, _("Export Image"), (const gchar *)act, "<CTRL>I", NULL, IMG_FILE, PACKAGE_IMG, FALSE, FALSE, FALSE, NULL);
514 g_free (act);
515 return menu;
516}
517
527GMenu * edit_data_section (GSimpleActionGroup * action_group, gchar * str, tint * data)
528{
529 GMenu * menu = g_menu_new ();
530 GMenuItem * item = g_menu_item_new (_("Edit Data"), NULL);
531 gchar * str_edit = g_strdup_printf ("%s-win-edit", str);
532 g_menu_item_set_attribute (item, "custom", "s", str_edit, NULL);
533 g_free (str_edit);
534#ifdef MENU_ICONS
535 GIcon * gicon = get_gicon_from_data (IMG_STOCK, EDITA);
536 g_menu_item_set_icon (item, gicon);
537 g_object_unref (gicon);
538#endif
539 g_menu_item_set_submenu (item, (GMenuModel *)create_curve_submenu (action_group, str, data, FALSE, 1));
540 g_menu_append_item (menu, item);
541 g_object_unref (item);
542 return menu;
543}
544
552GMenu * curve_close_section (gchar * str)
553{
554 GMenu * menu = g_menu_new ();
555 gchar * act = g_strdup_printf ("%s.close.curve", str);
556 append_menu_item (menu, _("Close"), (const gchar *)act, "<CTRL>C", NULL, IMG_STOCK, FCLOSE, FALSE, FALSE, FALSE, NULL);
557 g_free (act);
558 return menu;
559}
560
568GMenu * curve_help_menu (gchar * str)
569{
570 GMenu * menu = g_menu_new ();
571 gchar * act = g_strdup_printf ("%s.shortcuts.curve", str);
572 append_menu_item (menu, _("Shortcuts"), (const gchar *)act, NULL, NULL, IMG_NONE, NULL, FALSE, FALSE, FALSE, NULL);
573 g_free (act);
574 return menu;
575}
576
587GMenu * create_data_menu (GSimpleActionGroup * action_group, int pop, gchar * str, tint * data)
588{
589 GMenu * menu = g_menu_new ();
590 g_menu_append_section (menu, NULL, (GMenuModel*)edit_data_section(action_group, str, data));
591 gchar * act = g_strdup_printf ("%s.save.data", str);
592 append_menu_item (menu, _("Save Data"), (const gchar *)act, "<CTRL>S", NULL, IMG_STOCK, FSAVEAS, FALSE, FALSE, FALSE, NULL);
593 g_free (act);
594 if (! pop) g_menu_append_section (menu, NULL, (GMenuModel *)curve_close_section(str));
595 return menu;
596}
597
607GMenu * curve_menu_bar (GSimpleActionGroup * action_group, gchar * str, tint * data)
608{
609 GMenu * menu = g_menu_new ();
610 prep_extra_rid (data);
611 append_submenu (menu, _("Data"), create_data_menu(action_group, 0, str, data));
612 g_free (extrarid);
613 append_submenu (menu, _("Curve"), create_curve_menu(str));
614 append_submenu (menu, _("Help"), curve_help_menu(str));
615 return menu;
616}
617
626{
627 Curve * this_curve = get_curve_from_pointer (data);
628 this_curve -> pos = destroy_this_widget (this_curve -> pos);
629 this_curve -> pos = gtk_label_new (" ");
630 this_curve -> curve_hbox = destroy_this_widget (this_curve -> curve_hbox);
631 this_curve -> curve_hbox = create_hbox (0);
632 add_box_child_start (GTK_ORIENTATION_VERTICAL, this_curve -> curve_vbox, this_curve -> curve_hbox, FALSE, FALSE, 0);
633 gchar * str = g_strdup_printf ("c-%d", this_curve -> action_id);
634#ifdef GTK3
635 GtkWidget * menu = gtk_menu_bar_new_from_model ((GMenuModel *)curve_menu_bar(this_curve -> action_group, str, data));
636#else
637 GtkWidget * menu = gtk_popover_menu_bar_new_from_model ((GMenuModel *)curve_menu_bar(this_curve -> action_group, str, data));
638#endif
639 g_free (str);
640 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, this_curve -> curve_hbox, menu, TRUE, TRUE, 0);
641 gtk_label_align (this_curve -> pos, 1.0, 0.5);
642 add_box_child_end (this_curve -> curve_hbox, this_curve -> pos, FALSE, FALSE, 0);
643 show_the_widgets (this_curve -> curve_hbox);
644}
645
656GMenu * create_add_remove_section (GSimpleActionGroup * action_group, gchar * act, int num, tint * data)
657{
658 GMenu * menu = g_menu_new ();
659 GMenuItem * item = g_menu_item_new (_("Add Data Set"), NULL);
660#ifdef MENU_ICONS
661 GIcon * gicon = get_gicon_from_data (IMG_STOCK, LIST_ADD);
662 g_menu_item_set_icon (item, gicon);
663 g_object_unref (gicon);
664#endif
665 Curve * this_curve = get_curve_from_pointer (data);
666 if (this_curve -> extrac -> extras < num)
667 {
668 g_menu_item_set_submenu (item, (GMenuModel *)create_curve_submenu (action_group, act, data, TRUE, 0));
669 }
670 else
671 {
672 g_menu_item_set_attribute (item, "action", "s", "None", NULL);
673 }
674 g_menu_append_item (menu, item);
675 g_object_unref (item);
676
677 item = g_menu_item_new (_("Remove Data Set"), NULL);
678#ifdef MENU_ICONS
680 g_menu_item_set_icon (item, gicon);
681 g_object_unref (gicon);
682#endif
683 if (this_curve -> extrac -> extras > 0)
684 {
685 g_menu_item_set_submenu (item, (GMenuModel *)create_curve_submenu (action_group, act, data, FALSE, 0));
686 }
687 else
688 {
689 g_menu_item_set_attribute (item, "action", "s", "None", NULL);
690 }
691 g_menu_append_item (menu, item);
692 g_object_unref (item);
693 return menu;
694}
695
703GMenu * autoscale_section (gchar * str)
704{
705 GMenu * menu = g_menu_new ();
706 gchar * act = g_strdup_printf ("%s.autoscale.curve", str);
707 append_menu_item (menu, _("Autoscale"), (const gchar *)act, "<CTRL>A", NULL, IMG_STOCK, FITBEST, FALSE, FALSE, FALSE, NULL);
708 g_free (act);
709 return menu;
710}
711
719GtkWidget * curve_popup_menu (gpointer data)
720{
721 GtkWidget * curve_pop_menu;
722 int i, j, k, l;
723 CurveState * cstate = (CurveState *)data;
724 activeg = cstate -> id -> a;
725 activer = cstate -> id -> b;
726 activec = cstate -> id -> c;
727 GSimpleActionGroup * curve_popup_actions = g_simple_action_group_new ();
728 GSimpleAction * curve_popup_action[6];
729 curve_popup_action[0] = g_simple_action_new ("save.data", NULL);
730 curve_popup_action[1] = g_simple_action_new ("close.curve", NULL);
731 curve_popup_action[2] = g_simple_action_new ("edit.curve", NULL);
732 curve_popup_action[3] = g_simple_action_new ("save.image", NULL);
733 curve_popup_action[4] = g_simple_action_new ("autoscale.curve", NULL);
734 curve_popup_action[5] = g_simple_action_new ("shortcuts.curve", NULL);
735 for (i=0; i<6; i++)
736 {
737 g_action_map_add_action (G_ACTION_MAP(curve_popup_actions), G_ACTION(curve_popup_action[i]));
738 g_signal_connect (curve_popup_action[i], "activate", G_CALLBACK(curve_menu_bar_action), cstate -> id);
739 }
740 prep_extra_rid (cstate -> id);
741 Curve * this_curve = get_project_by_id(cstate -> id -> a) -> analysis[cstate -> id -> b] -> curves[cstate -> id -> c];
742 gchar * str = g_strdup_printf ("mc-%d", this_curve -> action_id);
743 GMenu * menu = g_menu_new ();
744 g_menu_append_section (menu, NULL, (GMenuModel *)create_data_menu(curve_popup_actions, 1, str, cstate -> id));
745 g_menu_append_section (menu, NULL, (GMenuModel *)create_curve_menu(str));
746 i = -1;
747 project * this_proj = get_project_by_id (activeg);
748 for ( j=0 ; j < this_proj -> analysis[activer] -> c_sets; j++)
749 {
750 k = this_proj -> analysis[activer] -> compat_id[j];
751 for ( l=0 ; l < nprojects; l++ )
752 {
753 if (get_project_by_id(l) -> analysis)
754 {
755 if (get_project_by_id(l) -> analysis[k])
756 {
757 if (activer == SKT)
758 {
759 i += (activec < this_proj -> skt_sets) ? get_project_by_id(l) -> skt_sets : get_project_by_id(l) -> sqw_sets;
760 }
761 else
762 {
763 i += get_project_by_id(l) -> analysis[k] -> numc;
764 }
765 }
766 }
767 }
768 }
769 // i is the potential number of extra curves, skt is messing with that
770 g_menu_append_section (menu, NULL, (GMenuModel *)create_add_remove_section(curve_popup_actions, str, i, cstate -> id));
771 g_menu_append_section (menu, NULL, (GMenuModel *)autoscale_section(str));
772 g_menu_append_section (menu, NULL, (GMenuModel *)curve_close_section(str));
773 g_menu_append_section (menu, NULL, (GMenuModel *)curve_help_menu(str));
774 g_free (extrarid);
775#ifdef GTK4
776 curve_pop_menu = gtk_popover_menu_new_from_model_full ((GMenuModel *)menu, GTK_POPOVER_MENU_NESTED);
777 gtk_widget_set_parent (curve_pop_menu, this_curve -> window);
778 gtk_widget_set_size_request (curve_pop_menu, -1, 305);
779#else
780 curve_pop_menu = gtk_menu_new_from_model ((GMenuModel *)menu);
781#endif
782 // Finally adding actions to the menu
783 gtk_widget_insert_action_group (curve_pop_menu, str, G_ACTION_GROUP(curve_popup_actions));
784 g_free (str);
785 return curve_pop_menu;
786}
Callback declarations for main window.
gchar * groups[230]
Definition cbuild_sg.c:43
int activer
Definition cedit.c:77
int activec
Definition cedit.c:76
void edit_curve(gpointer data)
create the curve edition dialog
Definition cedit.c:348
int activeg
Definition cedit.c:75
Variable declarations for the curve layout edition window.
Curve * get_curve_from_pointer(gpointer data)
get Curve pointer from pointer
Definition curve.c:313
void update_curve(gpointer data)
update curve rendering
Definition curve.c:635
PangoLayout * layout
Definition curve.c:80
Variable declarations for the curve widget Functions for interactions with the curve widget.
void hide_curve(gpointer data)
hide curve
Definition show.c:312
void save_image(gpointer cdata)
export curve window plot to image - creating the dialog
Definition w_img.c:309
void write_curve(gpointer idata)
save curve data - creating the dialog
Definition w_data.c:170
gchar * text
Definition datab.c:105
void edit_data(gpointer data)
create edit curve data dialog
Definition datab.c:1037
Variable declarations for the curve data edition window.
int ** allocdint(int xal, int yal)
allocate an int ** pointer
Definition global.c:317
gchar * PACKAGE_IMG
Definition global.c:92
gboolean * allocbool(int val)
allocate a gboolean * pointer
Definition global.c:241
int nprojects
Definition global.c:161
gboolean ** allocdbool(int xal, int yal)
allocate a gboolean ** pointer
Definition global.c:257
#define i18n(String)
Definition global.c:80
GtkWidget * pop
Definition global.c:210
Global variable declarations Global convenience function declarations Global data structure defin...
#define SKT
Definition global.h:347
@ IMG_NONE
Definition global.h:276
@ IMG_STOCK
Definition global.h:280
@ IMG_FILE
Definition global.h:279
#define FITBEST
Definition global.h:215
char * graph_name[]
Definition gui.c:123
void widget_add_action(GSimpleActionGroup *action_group, const gchar *act, GCallback handler, gpointer data, gboolean check, gboolean status, gboolean radio, const gchar *stat)
add an action to an action group
Definition gui.c:627
#define EDITA
Definition global.h:218
void append_submenu(GMenu *menu, const gchar *label, GMenu *submenu)
append a GMenuItem with a subenu to a GMenu, and use markup for the GMenuItem
Definition gui.c:714
#define LIST_ADD
Definition global.h:229
#define LIST_REM
Definition global.h:230
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.
Definition gtk-misc.c:340
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:849
void gtk_label_align(GtkWidget *lab, float ax, float ay)
set text alignment in a GtkLabel
Definition gtk-misc.c:756
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2213
void add_box_child_end(GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the end position.
Definition gtk-misc.c:318
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
Definition tools.c:71
void append_menu_item(GMenu *menu, const gchar *label, const gchar *action, const gchar *accel, const gchar *custom, int format, const gchar *icon, gboolean check, gboolean status, gboolean radio, const gchar *rstatus)
create a menu item, then append it to a menu
Definition gui.c:745
#define FCLOSE
Definition global.h:227
#define PAGE_SETUP
Definition global.h:213
#define NCALCS
#define FSAVEAS
Definition global.h:226
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:202
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
action
Definition glview.h:198
void prep_extra_rid(tint *data)
look up extra data set(s) for curve
Definition m_curve.c:201
int curve_shortcut_by_group[]
Definition m_curve.c:79
G_MODULE_EXPORT void curve_menu_bar_action(GSimpleAction *action, GVariant *parameter, gpointer data)
curve menu action callback
Definition m_curve.c:300
DataLayout * curve_default_layout(project *pid, int rid, int cid)
prepare the default layout for a curve
Definition cwidget.c:58
GtkWidget * curve_popup_menu(gpointer data)
create curve popup menu
Definition m_curve.c:719
GMenu * create_add_remove_section(GSimpleActionGroup *action_group, gchar *act, int num, tint *data)
create the add / remove curve submenus
Definition m_curve.c:656
G_MODULE_EXPORT void curve_edit_menu_action(GSimpleAction *action, GVariant *parameter, gpointer data)
curve menu edit action callback
Definition m_curve.c:272
GMenu * curve_close_section(gchar *str)
create the close menu item
Definition m_curve.c:552
GIcon * get_gicon_from_data(int format, const gchar *icon)
create a new icon using data
Definition gui.c:596
void autoscale(gpointer data)
autoscale callback
Definition m_curve.c:99
CurveExtra * init_extra(tint *id)
create extra data set
Definition m_curve.c:114
gchar * curve_group_names[]
Definition m_curve.c:78
int ** extrarid
Definition m_curve.c:74
gboolean was_not_added(ExtraSets *sets, int a, int b, int c)
test if already in the menu or not
Definition m_curve.c:342
G_MODULE_EXPORT void curve_add_remove_menu_action(GSimpleAction *action, GVariant *parameter, gpointer data)
curve menu add / remove action callback
Definition m_curve.c:286
GtkWidget * shortcuts_window(int sections, int group_by_section[sections], int groups, int shortcut_by_group[groups], gchar *section_names[sections], gchar *group_names[groups], shortcuts shortcs[])
Create the shortcuts information window.
Definition gui.c:183
void curve_window_add_menu_bar(tint *data)
add menu bar to the curve window
Definition m_curve.c:625
shortcuts curve_shortcuts[]
Definition m_curve.c:81
GMenu * curve_menu_bar(GSimpleActionGroup *action_group, gchar *str, tint *data)
create the curve window menu bar
Definition m_curve.c:607
GMenu * create_curve_menu(gchar *str)
create the curve submenu
Definition m_curve.c:506
GMenu * autoscale_section(gchar *str)
create autoscale menu item
Definition m_curve.c:703
void add_extra(ExtraSets *sets, tint *id)
add set to the extra set(s)
Definition m_curve.c:135
void remove_extra(ExtraSets *sets, CurveExtra *ctmp)
remove data from extra set(s)
Definition m_curve.c:159
GMenu * edit_data_section(GSimpleActionGroup *action_group, gchar *str, tint *data)
create the edit data submenu
Definition m_curve.c:527
GMenu * curve_section(GSimpleActionGroup *action_group, gchar *act, ExtraSets *sets, gboolean add, int edit, int a, int b, tint *data)
create curve submenu
Definition m_curve.c:374
GMenu * create_data_menu(GSimpleActionGroup *action_group, int pop, gchar *str, tint *data)
create the save data submenu
Definition m_curve.c:587
int curve_group_by_section[]
Definition m_curve.c:77
GMenu * create_curve_submenu(GSimpleActionGroup *action_group, gchar *act, tint *data, gboolean add, int edit)
create curve add / remove submenus
Definition m_curve.c:433
void action_to_plot(gpointer data)
add to plot, or, remove curve from plot
Definition m_curve.c:227
GMenu * curve_help_menu(gchar *str)
create the help menu item
Definition m_curve.c:568
gchar * curve_section_names[]
Definition m_curve.c:76
Definition global.h:118