73 gchar * section_names[sections], gchar * group_names[
groups],
shortcuts shortcs[]);
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" }
117 ctmp ->
id.a =
id -> a;
118 ctmp ->
id.b =
id -> b;
119 ctmp ->
id.c =
id -> c;
121 ctmp ->
layout -> datacolor.red = 0.0;
122 ctmp ->
layout -> datacolor.green = 0.0;
123 ctmp ->
layout -> datacolor.blue = 0.0;
137 if (sets -> extras == 0)
140 sets -> last = sets -> first;
145 sets -> last -> next -> prev = sets -> last;
146 sets -> last = sets -> last -> next;
161 if (sets -> extras == 1)
164 sets -> first = NULL;
169 if (ctmp -> prev == NULL)
171 sets -> first = ctmp -> next;
173 sets -> first -> prev = NULL;
175 else if (ctmp -> next == NULL)
178 g_free (ctmp -> next);
184 ctmp -> prev -> next = ctmp -> next;
185 ctmp -> next -> prev = ctmp -> prev;
206 if (this_curve -> extrac)
208 if (this_curve -> extrac -> extras > 0)
210 CurveExtra * ctmp = this_curve -> extrac -> first;
211 for (i=0; i<this_curve -> extrac -> extras; i++)
213 extrarid[ctmp ->
id.a][ctmp ->
id.b] ++;
214 if (ctmp -> next != NULL) ctmp = ctmp -> next;
231 gboolean remove = FALSE;
234 if (this_curve -> extrac > 0)
236 CurveExtra * ctmp = this_curve -> extrac -> first;
237 for (i=0; i<this_curve -> extrac -> extras; i++)
239 if (ctmp ->
id.a ==
id -> a && ctmp ->
id.b ==
id -> b && ctmp ->
id.c ==
id -> c)
244 if (ctmp -> next != NULL) ctmp = ctmp -> next;
302 gchar * name = g_strdup_printf (
"%s", g_action_get_name(G_ACTION(
action)));
303 if (g_strcmp0 (name,
"save.data") == 0)
307 else if (g_strcmp0 (name,
"close.curve") == 0)
311 else if (g_strcmp0 (name,
"edit.curve") == 0)
315 else if (g_strcmp0 (name,
"save.image") == 0)
319 else if (g_strcmp0 (name,
"autoscale.curve") == 0)
323 else if (g_strcmp0 (name,
"shortcuts.curve") == 0)
346 for (i=0; i<sets -> extras; i++)
348 if (ctmp ->
id.a == a && ctmp ->
id.b == b)
352 if (ctmp ->
id.c == c)
return FALSE;
355 if (ctmp -> next != NULL) ctmp = ctmp -> next;
376 GMenu * menu = g_menu_new ();
377 gchar * str_a, * str_b, * str_c;
378 gchar *
text[2] = {
"curve.action",
"edit.data"};
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;
388 g = this_proj -> analysis[b] -> numc;
393 if (this_proj -> analysis[b] -> curves[i+h] -> ndata > 0)
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))
398 str_a = g_strdup_printf (
"%s",
prepare_for_title(this_proj -> analysis[b] -> curves[i+h] -> name));
400 str_a = g_strdup_printf (
"%s", this_proj -> analysis[b] -> curves[i+h] -> name);
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);
436 GMenu * menu = g_menu_new ();
443 create_proj[i] = FALSE;
444 if (this_proj -> analysis[data -> b])
446 for (j=0; j<this_proj -> analysis[data -> b] -> c_sets; j++)
448 k = this_proj -> analysis[data -> b] -> compat_id[j];
449 create_menu[i][k] = FALSE;
450 if (data -> b ==
SKT)
452 l = (data -> c <
get_project_by_id(data -> a) -> skt_sets) ? this_proj -> skt_sets : this_proj -> sqw_sets;
456 l = this_proj -> analysis[k] -> numc;
459 || (! add &&
extrarid[i][k] > 0)) && this_proj -> analysis[k] -> calc_ok)
461 create_menu[i][k] = TRUE;
462 create_proj[i] = TRUE;
469 create_menu[data -> a][data -> b] = TRUE;
470 create_proj[data -> a] = TRUE;
478 smenu = g_menu_new ();
489 g_object_unref (smenu);
492 g_free (create_proj);
493 g_free (create_menu);
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);
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);
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);
536 g_menu_item_set_icon (item, gicon);
537 g_object_unref (gicon);
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);
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);
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);
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);
609 GMenu * menu = g_menu_new ();
629 this_curve -> pos = gtk_label_new (
" ");
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);
635 GtkWidget * menu = gtk_menu_bar_new_from_model ((GMenuModel *)
curve_menu_bar(this_curve -> action_group, str, data));
637 GtkWidget * menu = gtk_popover_menu_bar_new_from_model ((GMenuModel *)
curve_menu_bar(this_curve -> action_group, str, data));
640 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, this_curve -> curve_hbox, menu, TRUE, TRUE, 0);
642 add_box_child_end (this_curve -> curve_hbox, this_curve -> pos, FALSE, FALSE, 0);
658 GMenu * menu = g_menu_new ();
659 GMenuItem * item = g_menu_item_new (_(
"Add Data Set"), NULL);
662 g_menu_item_set_icon (item, gicon);
663 g_object_unref (gicon);
666 if (this_curve -> extrac -> extras < num)
668 g_menu_item_set_submenu (item, (GMenuModel *)
create_curve_submenu (action_group, act, data, TRUE, 0));
672 g_menu_item_set_attribute (item,
"action",
"s",
"None", NULL);
674 g_menu_append_item (menu, item);
675 g_object_unref (item);
677 item = g_menu_item_new (_(
"Remove Data Set"), NULL);
680 g_menu_item_set_icon (item, gicon);
681 g_object_unref (gicon);
683 if (this_curve -> extrac -> extras > 0)
685 g_menu_item_set_submenu (item, (GMenuModel *)
create_curve_submenu (action_group, act, data, FALSE, 0));
689 g_menu_item_set_attribute (item,
"action",
"s",
"None", NULL);
691 g_menu_append_item (menu, item);
692 g_object_unref (item);
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);
721 GtkWidget * curve_pop_menu;
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);
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);
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));
748 for ( j=0 ; j < this_proj -> analysis[
activer] -> c_sets; j++)
750 k = this_proj -> analysis[
activer] -> compat_id[j];
773 g_menu_append_section (menu, NULL, (GMenuModel *)
curve_help_menu(str));
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);
780 curve_pop_menu = gtk_menu_new_from_model ((GMenuModel *)menu);
783 gtk_widget_insert_action_group (curve_pop_menu, str, G_ACTION_GROUP(curve_popup_actions));
785 return curve_pop_menu;
Callback declarations for main window.
void edit_curve(gpointer data)
create the curve edition dialog
Variable declarations for the curve layout edition window.
Curve * get_curve_from_pointer(gpointer data)
get Curve pointer from pointer
void update_curve(gpointer data)
update curve rendering
Variable declarations for the curve widget Functions for interactions with the curve widget.
void hide_curve(gpointer data)
hide curve
void save_image(gpointer cdata)
export curve window plot to image - creating the dialog
void write_curve(gpointer idata)
save curve data - creating the dialog
void edit_data(gpointer data)
create edit curve data dialog
Variable declarations for the curve data edition window.
int ** allocdint(int xal, int yal)
allocate an int ** pointer
gboolean * allocbool(int val)
allocate a gboolean * pointer
gboolean ** allocdbool(int xal, int yal)
allocate a gboolean ** pointer
Global variable declarations Global convenience function declarations Global data structure defin...
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
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
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.
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
void gtk_label_align(GtkWidget *lab, float ax, float ay)
set text alignment in a GtkLabel
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
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.
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
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
void show_the_widgets(GtkWidget *widg)
show GtkWidget
project * get_project_by_id(int p)
get project pointer using id number
void prep_extra_rid(tint *data)
look up extra data set(s) for curve
int curve_shortcut_by_group[]
G_MODULE_EXPORT void curve_menu_bar_action(GSimpleAction *action, GVariant *parameter, gpointer data)
curve menu action callback
DataLayout * curve_default_layout(project *pid, int rid, int cid)
prepare the default layout for a curve
GtkWidget * curve_popup_menu(gpointer data)
create curve popup menu
GMenu * create_add_remove_section(GSimpleActionGroup *action_group, gchar *act, int num, tint *data)
create the add / remove curve submenus
G_MODULE_EXPORT void curve_edit_menu_action(GSimpleAction *action, GVariant *parameter, gpointer data)
curve menu edit action callback
GMenu * curve_close_section(gchar *str)
create the close menu item
GIcon * get_gicon_from_data(int format, const gchar *icon)
create a new icon using data
void autoscale(gpointer data)
autoscale callback
CurveExtra * init_extra(tint *id)
create extra data set
gchar * curve_group_names[]
gboolean was_not_added(ExtraSets *sets, int a, int b, int c)
test if already in the menu or not
G_MODULE_EXPORT void curve_add_remove_menu_action(GSimpleAction *action, GVariant *parameter, gpointer data)
curve menu add / remove action callback
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.
void curve_window_add_menu_bar(tint *data)
add menu bar to the curve window
shortcuts curve_shortcuts[]
GMenu * curve_menu_bar(GSimpleActionGroup *action_group, gchar *str, tint *data)
create the curve window menu bar
GMenu * create_curve_menu(gchar *str)
create the curve submenu
GMenu * autoscale_section(gchar *str)
create autoscale menu item
void add_extra(ExtraSets *sets, tint *id)
add set to the extra set(s)
void remove_extra(ExtraSets *sets, CurveExtra *ctmp)
remove data from extra set(s)
GMenu * edit_data_section(GSimpleActionGroup *action_group, gchar *str, tint *data)
create the edit data submenu
GMenu * curve_section(GSimpleActionGroup *action_group, gchar *act, ExtraSets *sets, gboolean add, int edit, int a, int b, tint *data)
create curve submenu
GMenu * create_data_menu(GSimpleActionGroup *action_group, int pop, gchar *str, tint *data)
create the save data submenu
int curve_group_by_section[]
GMenu * create_curve_submenu(GSimpleActionGroup *action_group, gchar *act, tint *data, gboolean add, int edit)
create curve add / remove submenus
void action_to_plot(gpointer data)
add to plot, or, remove curve from plot
GMenu * curve_help_menu(gchar *str)
create the help menu item
gchar * curve_section_names[]