atomes 1.1.14
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-2024 by CNRS and University of Strasbourg */
15
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);
72int ** extrarid;
73// gchar * curve_act[3]={"edit", "add", "rem"};
74
82void autoscale (gpointer data)
83{
84 tint * id = (tint *)data;
85 get_project_by_id(id -> a) -> curves[id -> b][id -> c] -> autoscale[0] = TRUE;
86 get_project_by_id(id -> a) -> curves[id -> b][id -> c] -> autoscale[1] = TRUE;
87 update_curve (data);
88}
89
98{
99 CurveExtra * ctmp = g_malloc0 (sizeof*ctmp);
100 ctmp -> id.a = id -> a;
101 ctmp -> id.b = id -> b;
102 ctmp -> id.c = id -> c;
103 ctmp -> layout = curve_default_layout (get_project_by_id(id -> a), id -> b, id -> c);
104 ctmp -> layout -> datacolor.red = 0.0;
105 ctmp -> layout -> datacolor.green = 0.0;
106 ctmp -> layout -> datacolor.blue = 0.0;
107 return ctmp;
108}
109
118void add_extra (ExtraSets * sets, tint * id)
119{
120 if (sets -> extras == 0)
121 {
122 sets -> first = init_extra (id);
123 sets -> last = sets -> first;
124 }
125 else
126 {
127 sets -> last -> next = init_extra (id);
128 sets -> last -> next -> prev = sets -> last;
129 sets -> last = sets -> last -> next;
130 }
131 sets -> extras ++;
132}
133
142void remove_extra (ExtraSets * sets, CurveExtra * ctmp)
143{
144 if (sets -> extras == 1)
145 {
146 g_free (ctmp);
147 sets -> first = NULL;
148 sets -> last = NULL;
149 }
150 else
151 {
152 if (ctmp -> prev == NULL)
153 {
154 sets -> first = ctmp -> next;
155 g_free (ctmp);
156 sets -> first -> prev = NULL;
157 }
158 else if (ctmp -> next == NULL)
159 {
160 ctmp = ctmp -> prev;
161 g_free (ctmp -> next);
162 ctmp -> next = NULL;
163 sets -> last = ctmp;
164 }
165 else
166 {
167 ctmp -> prev -> next = ctmp -> next;
168 ctmp -> next -> prev = ctmp -> prev;
169 g_free (ctmp);
170 }
171 }
172 sets -> extras --;
173}
174
175void curve_window_add_menu_bar (tint * data);
176
184void prep_extra_rid (tint * data)
185{
186 int i;
188 project * this_proj = get_project_by_id (data -> a);
189 if (this_proj -> curves[data -> b][data -> c] -> extrac -> extras > 0)
190 {
191 CurveExtra * ctmp = this_proj -> curves[data -> b][data -> c] -> extrac -> first;
192 for (i=0; i<this_proj -> curves[data -> b][data -> c] -> extrac -> extras; i++)
193 {
194 extrarid[ctmp -> id.a][ctmp -> id.b] ++;
195 if (ctmp -> next != NULL) ctmp = ctmp -> next;
196 }
197 }
198}
199
207void action_to_plot (gpointer data)
208{
209 int i;
210 tint * id = (tint *)data;
211 gboolean remove = FALSE;
212 project * this_proj = get_project_by_id (activeg);
213 if (this_proj -> curves[activer][activec] -> extrac > 0)
214 {
215 CurveExtra * ctmp = this_proj -> curves[activer][activec] -> extrac -> first;
216 for (i=0; i<this_proj -> curves[activer][activec] -> extrac -> extras; i++)
217 {
218 if (ctmp -> id.a == id -> a && ctmp -> id.b == id -> b && ctmp -> id.c == id -> c)
219 {
220 remove = TRUE;
221 break;
222 }
223 if (ctmp -> next != NULL) ctmp = ctmp -> next;
224 }
225 if (! remove)
226 {
227 add_extra (this_proj -> curves[activer][activec] -> extrac, id);
228 }
229 else
230 {
231 remove_extra (this_proj -> curves[activer][activec] -> extrac, ctmp);
232 }
233 }
234 else
235 {
236 add_extra (this_proj -> curves[activer][activec] -> extrac, id);
237 }
238 curve_window_add_menu_bar (& this_proj -> idcc[activer][activec]);
239 update_curve ((gpointer)& this_proj -> idcc[activer][activec]);
240}
241
251G_MODULE_EXPORT void curve_edit_menu_action (GSimpleAction * action, GVariant * parameter, gpointer data)
252{
253 edit_data (data);
254}
255
265G_MODULE_EXPORT void curve_add_remove_menu_action (GSimpleAction * action, GVariant * parameter, gpointer data)
266{
267 action_to_plot (data);
268}
269
279G_MODULE_EXPORT void curve_menu_bar_action (GSimpleAction * action, GVariant * parameter, gpointer data)
280{
281 gchar * name = g_strdup_printf ("%s", g_action_get_name(G_ACTION(action)));
282 if (g_strcmp0 (name, "save.data") == 0)
283 {
284 write_curve (data);
285 }
286 else if (g_strcmp0 (name, "close.curve") == 0)
287 {
288 hide_curve (data);
289 }
290 else if (g_strcmp0 (name, "edit.curve") == 0)
291 {
292 edit_curve (data);
293 }
294 else if (g_strcmp0 (name, "save.image") == 0)
295 {
296 save_image (data);
297 }
298 else if (g_strcmp0 (name, "autoscale.curve") == 0)
299 {
300 autoscale (data);
301 }
302}
303
314gboolean was_not_added (ExtraSets * sets, int a, int b, int c)
315{
316 int i, j;
317 CurveExtra * ctmp = sets -> first;
318 for (i=0; i<sets -> extras; i++)
319 {
320 if (ctmp -> id.a == a && ctmp -> id.b == b)
321 {
322 for (j=0; j<get_project_by_id(a) -> numc[b]; j++)
323 {
324 if (ctmp -> id.c == c) return FALSE;
325 }
326 }
327 if (ctmp -> next != NULL) ctmp = ctmp -> next;
328 }
329 return TRUE;
330}
331
346GMenu * curve_section (GSimpleActionGroup * action_group, gchar * act, ExtraSets * sets, gboolean add, int edit, int a, int b, tint * data)
347{
348 GMenu * menu = g_menu_new ();
349 gchar * str_a, * str_b, * str_c;
350 gchar * text[2] = {"curve.action", "edit.data"};
351 project * this_proj = get_project_by_id(a);
352 int i;
353 for (i=0; i<this_proj -> numc[b]; i++)
354 {
355 if (this_proj -> curves[b][i] -> ndata > 0)
356 {
357 if (((a != data -> a || b != data -> b || i != data -> c) && add == was_not_added(sets, a, b, i)) || (a == data -> a && b == data -> b && i == data -> c && edit))
358 {
359 str_a = g_strdup_printf ("%s", this_proj -> curves[b][i] -> name);
360 str_b = g_strdup_printf ("%s.%d-%d-%d", text[edit], a, b, i);
361 str_c = g_strdup_printf ("%s.%s", act, str_b);
362 append_menu_item (menu, (const gchar *)str_a, (const gchar *)str_c, NULL, NULL, IMG_NONE, NULL, FALSE, FALSE, FALSE, NULL);
363 g_free (str_a);
364 g_free (str_c);
365 if (edit)
366 {
367 widget_add_action (action_group, (const gchar *)str_b, G_CALLBACK(curve_edit_menu_action), & this_proj -> idcc[b][i], FALSE, FALSE, FALSE, NULL);
368 }
369 else
370 {
371 widget_add_action (action_group, (const gchar *)str_b, G_CALLBACK(curve_add_remove_menu_action), & this_proj -> idcc[b][i], FALSE, FALSE, FALSE, NULL);
372 }
373 g_free (str_b);
374 }
375 }
376 }
377 return menu;
378}
379
391GMenu * create_curve_submenu (GSimpleActionGroup * action_group, gchar * act, tint * data, gboolean add, int edit)
392{
393 project * this_proj;
394 GMenu * menu = g_menu_new ();
395 int i, j, k;
396 gboolean * create_proj = allocbool (nprojects);
397 gboolean ** create_menu = allocdbool (nprojects, NCALCS);
398 for (i=0; i<nprojects; i++)
399 {
400 this_proj = get_project_by_id(i);
401 create_menu[i][data -> b] = FALSE;
402 create_proj[i] = FALSE;
403 j = 0;
404 if (data -> b == GR || data -> b == GK)
405 {
406 j = 1;
407 k = (data -> b == GR) ? GK : GR;
408 }
409 else if (data -> b == SQ || data -> b == SK)
410 {
411 j = 1;
412 k = (data -> b == SQ) ? SK : SQ;
413 }
414
415 if (((add && extrarid[i][data -> b] < this_proj -> numc[data -> b])
416 || (! add && extrarid[i][data -> b] > 0)) && this_proj -> visok[data -> b])
417 {
418 create_menu[i][data -> b] = TRUE;
419 create_proj[i] = TRUE;
420 }
421
422 if (j && this_proj -> visok[k])
423 {
424 create_menu[i][k] = FALSE;
425 if (this_proj -> curves[k][0] -> ndata > 0)
426 {
427 if ((add && extrarid[i][k] < this_proj -> numc[k])
428 || (! add && extrarid[i][k] > 0))
429 {
430 create_menu[i][k] = TRUE;
431 create_proj[i] = TRUE;
432 }
433 }
434 }
435 }
436 if (edit)
437 {
438 create_menu[data -> a][data -> b] = TRUE;
439 create_proj[data -> a] = TRUE;
440 }
441 this_proj = get_project_by_id(data -> a);
442 GMenu * smenu;
443 for (i=0; i<nprojects; i++)
444 {
445 if (create_proj[i])
446 {
447 smenu = g_menu_new ();
448 if (create_menu[i][data -> b]) append_submenu (smenu, graph_name[data -> b], curve_section(action_group, act, this_proj -> curves[data -> b][data -> c] -> extrac, add, edit, i, data -> b, data));
449 if (j && create_menu[i][k]) append_submenu (smenu, graph_name[k], curve_section(action_group, act, this_proj -> curves[data -> b][data -> c] -> extrac, add, edit, i, k, data));
450 append_submenu (menu, get_project_by_id(i) -> name, smenu);
451 }
452 }
453 g_free (create_proj);
454 g_free (create_menu);
455 return menu;
456}
457
458extern GIcon * get_gicon_from_data (int format, const gchar * icon);
459
467GMenu * create_curve_menu (gchar * str)
468{
469 GMenu * menu = g_menu_new ();
470 gchar * act = g_strdup_printf ("%s.edit.curve", str);
471 append_menu_item (menu, "Edit Curve", (const gchar *)act, "<CTRL>E", NULL, IMG_STOCK, PAGE_SETUP, FALSE, FALSE, FALSE, NULL);
472 g_free (act);
473 act = g_strdup_printf ("%s.save.image", str);
474 append_menu_item (menu, "Export Image", (const gchar *)act, "<CTRL>I", NULL, IMG_FILE, PACKAGE_IMG, FALSE, FALSE, FALSE, NULL);
475 g_free (act);
476 return menu;
477}
478
488GMenu * edit_data_section (GSimpleActionGroup * action_group, gchar * str, tint * data)
489{
490 GMenu * menu = g_menu_new ();
491 GMenuItem * item = g_menu_item_new ("Edit Data", NULL);
492 gchar * str_edit = g_strdup_printf ("%s-win-edit", str);
493 g_menu_item_set_attribute (item, "custom", "s", str_edit, NULL);
494 g_free (str_edit);
495#ifdef MENU_ICONS
496 GIcon * gicon = get_gicon_from_data (IMG_STOCK, EDITA);
497 g_menu_item_set_icon (item, gicon);
498 g_object_unref (gicon);
499#endif
500 g_menu_item_set_submenu (item, (GMenuModel *)create_curve_submenu (action_group, str, data, FALSE, 1));
501 g_menu_append_item (menu, item);
502 g_object_unref (item);
503 return menu;
504}
505
513GMenu * curve_close_section (gchar * str)
514{
515 GMenu * menu = g_menu_new ();
516 gchar * act = g_strdup_printf ("%s.close.curve", str);
517 append_menu_item (menu, "Close", (const gchar *)act, "<CTRL>C", NULL, IMG_STOCK, FCLOSE, FALSE, FALSE, FALSE, NULL);
518 g_free (act);
519 return menu;
520}
521
532GMenu * create_data_menu (GSimpleActionGroup * action_group, int pop, gchar * str, tint * data)
533{
534 GMenu * menu = g_menu_new ();
535 g_menu_append_section (menu, NULL, (GMenuModel*)edit_data_section(action_group, str, data));
536 gchar * act = g_strdup_printf ("%s.save.data", str);
537 append_menu_item (menu, "Save Data", (const gchar *)act, "<CTRL>S", NULL, IMG_STOCK, FSAVEAS, FALSE, FALSE, FALSE, NULL);
538 g_free (act);
539 if (! pop) g_menu_append_section (menu, NULL, (GMenuModel *)curve_close_section(str));
540 return menu;
541}
542
553GMenu * curve_menu_bar (project * this_proj, GSimpleActionGroup * action_group, gchar * str, tint * data)
554{
555 GMenu * menu = g_menu_new ();
556 prep_extra_rid (data);
557 append_submenu (menu, "Data", create_data_menu(action_group, 0, str, data));
558 g_free (extrarid);
559 append_submenu (menu, "Curve", create_curve_menu(str));
560 return menu;
561}
562
571{
572 project * this_proj = get_project_by_id (data -> a);
573 this_proj -> curves[data -> b][data -> c] -> pos = destroy_this_widget (this_proj -> curves[data -> b][data -> c] -> pos);
574 this_proj -> curves[data -> b][data -> c] -> pos = gtk_label_new (" ");
575 this_proj -> curves[data -> b][data -> c] -> curve_hbox = destroy_this_widget (this_proj -> curves[data -> b][data -> c] -> curve_hbox);
576 this_proj -> curves[data -> b][data -> c] -> curve_hbox = create_hbox (0);
577 add_box_child_start (GTK_ORIENTATION_VERTICAL, this_proj -> curves[data -> b][data -> c] -> curve_vbox, this_proj -> curves[data -> b][data -> c] -> curve_hbox, FALSE, FALSE, 0);
578 gchar * str = g_strdup_printf ("c-%d", this_proj -> curves[data -> b][data -> c] -> action_id);
579#ifdef GTK3
580 GtkWidget * menu = gtk_menu_bar_new_from_model ((GMenuModel *)curve_menu_bar(this_proj, this_proj -> curves[data -> b][data -> c] -> action_group, str, data));
581#else
582 GtkWidget * menu = gtk_popover_menu_bar_new_from_model ((GMenuModel *)curve_menu_bar(this_proj, this_proj -> curves[data -> b][data -> c] -> action_group, str, data));
583#endif
584 g_free (str);
585 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, this_proj -> curves[data -> b][data -> c] -> curve_hbox, menu, TRUE, TRUE, 0);
586 gtk_label_align (this_proj -> curves[data -> b][data -> c] -> pos, 1.0, 0.5);
587 add_box_child_end (this_proj -> curves[data -> b][data -> c] -> curve_hbox, this_proj -> curves[data -> b][data -> c] -> pos, FALSE, FALSE, 0);
588 show_the_widgets (this_proj -> curves[data -> b][data -> c] -> curve_hbox);
589}
590
601GMenu * create_add_remove_section (GSimpleActionGroup * action_group, gchar * act, int num, tint * data)
602{
603 GMenu * menu = g_menu_new ();
604 GMenuItem * item = g_menu_item_new ("Add Data Set", NULL);
605#ifdef MENU_ICONS
606 GIcon * gicon = get_gicon_from_data (IMG_STOCK, LIST_ADD);
607 g_menu_item_set_icon (item, gicon);
608 g_object_unref (gicon);
609#endif
610 project * this_proj = get_project_by_id (data -> a);
611 if (this_proj -> curves[data -> b][data -> c] -> extrac -> extras < num)
612 {
613 g_menu_item_set_submenu (item, (GMenuModel *)create_curve_submenu (action_group, act, data, TRUE, 0));
614 }
615 else
616 {
617 g_menu_item_set_attribute (item, "action", "s", "None", NULL);
618 }
619 g_menu_append_item (menu, item);
620 g_object_unref (item);
621
622 item = g_menu_item_new ("Remove Data Set", NULL);
623#ifdef MENU_ICONS
625 g_menu_item_set_icon (item, gicon);
626 g_object_unref (gicon);
627#endif
628 if (this_proj -> curves[data -> b][data -> c] -> extrac -> extras > 0)
629 {
630 g_menu_item_set_submenu (item, (GMenuModel *)create_curve_submenu (action_group, act, data, FALSE, 0));
631 }
632 else
633 {
634 g_menu_item_set_attribute (item, "action", "s", "None", NULL);
635 }
636 g_menu_append_item (menu, item);
637 g_object_unref (item);
638 return menu;
639}
640
648GMenu * autoscale_section (gchar * str)
649{
650 GMenu * menu = g_menu_new ();
651 gchar * act = g_strdup_printf ("%s.autoscale.curve", str);
652 append_menu_item (menu, "Autoscale", (const gchar *)act, "<CTRL>A", NULL, IMG_STOCK, FITBEST, FALSE, FALSE, FALSE, NULL);
653 g_free (act);
654 return menu;
655}
656
664GtkWidget * curve_popup_menu (gpointer data)
665{
666 GtkWidget * curve_pop_menu;
667 int i, j;
668 CurveState * cstate = (CurveState *)data;
669 GSimpleActionGroup * curve_popup_actions = g_simple_action_group_new ();
670 GSimpleAction * curve_popup_action[5];
671 curve_popup_action[0] = g_simple_action_new ("save.data", NULL);
672 curve_popup_action[1] = g_simple_action_new ("close.curve", NULL);
673 curve_popup_action[2] = g_simple_action_new ("edit.curve", NULL);
674 curve_popup_action[3] = g_simple_action_new ("save.image", NULL);
675 curve_popup_action[4] = g_simple_action_new ("autoscale.curve", NULL);
676 for (i=0; i<5; i++)
677 {
678 g_action_map_add_action (G_ACTION_MAP(curve_popup_actions), G_ACTION(curve_popup_action[i]));
679 g_signal_connect (curve_popup_action[i], "activate", G_CALLBACK(curve_menu_bar_action), cstate -> id);
680 }
681 prep_extra_rid (cstate -> id);
682 gchar * str = g_strdup_printf ("mc-%d", get_project_by_id(cstate -> id -> a) -> curves[cstate -> id -> b][cstate -> id -> c] -> action_id);
683 GMenu * menu = g_menu_new ();
684 g_menu_append_section (menu, NULL, (GMenuModel *)create_data_menu(curve_popup_actions, 1, str, cstate -> id));
685 g_menu_append_section (menu, NULL, (GMenuModel *)create_curve_menu(str));
686 i = -1;
687 for ( j=0 ; j < nprojects; j++ )
688 {
689 i += get_project_by_id(j) -> numc[cstate -> id -> b];
690 if (cstate -> id -> b == GR || cstate -> id -> b == GK)
691 {
692 i += get_project_by_id(j) -> numc[(cstate -> id -> b == GR) ? GK : GR];
693 }
694 else if (cstate -> id -> b == SQ || cstate -> id -> b == SK)
695 {
696 i += get_project_by_id(j) -> numc[(cstate -> id -> b == SQ) ? SK : SQ];
697 }
698 }
699 g_menu_append_section (menu, NULL, (GMenuModel *)create_add_remove_section(curve_popup_actions, str, i, cstate -> id));
700 g_menu_append_section (menu, NULL, (GMenuModel *)autoscale_section(str));
701 g_menu_append_section (menu, NULL, (GMenuModel *)curve_close_section(str));
702 g_free (extrarid);
703#ifdef GTK4
704 curve_pop_menu = gtk_popover_menu_new_from_model_full ((GMenuModel *)menu, GTK_POPOVER_MENU_NESTED);
705 gtk_widget_set_parent (curve_pop_menu, get_project_by_id(cstate -> id -> a) -> curves[cstate -> id -> b][cstate -> id -> c] -> window);
706 gtk_widget_set_size_request (curve_pop_menu, -1, 305);
707#else
708 curve_pop_menu = gtk_menu_new_from_model ((GMenuModel *)menu);
709#endif
710 // Finally adding actions to the menu
711 gtk_widget_insert_action_group (curve_pop_menu, str, G_ACTION_GROUP(curve_popup_actions));
712 g_free (str);
713 return curve_pop_menu;
714}
Callback declarations for main window.
void edit_curve(gpointer data)
create the curve edition dialog
Definition cedit.c:347
Variable declarations for the curve layout edition window.
void update_curve(gpointer data)
update curve rendering
Definition curve.c:589
PangoLayout * layout
Definition curve.c:79
Variable declarations for the curve widget Functions for interactions with the curve widget.
int activer
Definition w_curve.c:74
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:326
int activec
Definition w_curve.c:73
int activeg
Definition w_curve.c:72
void write_curve(gpointer idata)
save curve data - creating the dialog
Definition w_data.c:164
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:342
gboolean * allocbool(int val)
allocate a gboolean * pointer
Definition global.c:266
int nprojects
Definition global.c:158
gboolean ** allocdbool(int xal, int yal)
allocate a gboolean ** pointer
Definition global.c:282
GtkWidget * pop
Definition global.c:217
Global variable declarations Global convenience function declarations Global data structure defin...
@ IMG_NONE
Definition global.h:232
@ IMG_STOCK
Definition global.h:236
@ IMG_FILE
Definition global.h:235
#define FITBEST
Definition global.h:171
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:515
#define EDITA
Definition global.h:174
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:602
#define GR
Definition global.h:294
#define NGRAPHS
#define SQ
Definition global.h:295
#define LIST_ADD
Definition global.h:185
#define LIST_REM
Definition global.h:186
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:279
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:793
void gtk_label_align(GtkWidget *lab, float ax, float ay)
set text alignment in a GtkLabel
Definition gtk-misc.c:681
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2010
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:257
char * graph_name[NGRAPHS]
Definition gui.c:118
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:632
#define FCLOSE
Definition global.h:183
#define SK
Definition global.h:296
#define GK
Definition global.h:297
#define PAGE_SETUP
Definition global.h:169
#define NCALCS
#define FSAVEAS
Definition global.h:182
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:169
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
action
Definition glview.h:189
void prep_extra_rid(tint *data)
look up extra data set(s) for curve
Definition m_curve.c:184
G_MODULE_EXPORT void curve_menu_bar_action(GSimpleAction *action, GVariant *parameter, gpointer data)
curve menu action callback
Definition m_curve.c:279
DataLayout * curve_default_layout(project *pid, int rid, int cid)
prepare the default layout for a curve
Definition cwidget.c:57
GtkWidget * curve_popup_menu(gpointer data)
create curve popup menu
Definition m_curve.c:664
GMenu * create_add_remove_section(GSimpleActionGroup *action_group, gchar *act, int num, tint *data)
create the add / remove curve submenus
Definition m_curve.c:601
G_MODULE_EXPORT void curve_edit_menu_action(GSimpleAction *action, GVariant *parameter, gpointer data)
curve menu edit action callback
Definition m_curve.c:251
GMenu * curve_close_section(gchar *str)
create the close menu item
Definition m_curve.c:513
GIcon * get_gicon_from_data(int format, const gchar *icon)
Definition gui.c:484
void autoscale(gpointer data)
autoscale callback
Definition m_curve.c:82
CurveExtra * init_extra(tint *id)
create extra data set
Definition m_curve.c:97
int ** extrarid
Definition m_curve.c:72
gboolean was_not_added(ExtraSets *sets, int a, int b, int c)
test if already in the menu or not
Definition m_curve.c:314
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:265
GMenu * curve_menu_bar(project *this_proj, GSimpleActionGroup *action_group, gchar *str, tint *data)
create the curve window menu bar
Definition m_curve.c:553
void curve_window_add_menu_bar(tint *data)
add menu bar to the curve window
Definition m_curve.c:570
GMenu * create_curve_menu(gchar *str)
create the curve submenu
Definition m_curve.c:467
GMenu * autoscale_section(gchar *str)
create autoscale menu item
Definition m_curve.c:648
void add_extra(ExtraSets *sets, tint *id)
add set to the extra set(s)
Definition m_curve.c:118
void remove_extra(ExtraSets *sets, CurveExtra *ctmp)
remove data from extra set(s)
Definition m_curve.c:142
GMenu * edit_data_section(GSimpleActionGroup *action_group, gchar *str, tint *data)
create the edit data submenu
Definition m_curve.c:488
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:346
GMenu * create_data_menu(GSimpleActionGroup *action_group, int pop, gchar *str, tint *data)
create the save data submenu
Definition m_curve.c:532
GMenu * create_curve_submenu(GSimpleActionGroup *action_group, gchar *act, tint *data, gboolean add, int edit)
create curve add / remove submenus
Definition m_curve.c:391
void action_to_plot(gpointer data)
add to plot, or, remove curve from plot
Definition m_curve.c:207
Definition global.h:98
int b
Definition tab-1.c:95
int c
Definition tab-1.c:95
int a
Definition tab-1.c:95