73 gchar * section_names[sections], gchar * group_names[
groups],
shortcuts shortcs[]);
86 {
"Autoscale",
"Autoscale", GDK_KEY_a,
"<Ctrl>a" },
87 {
"Edit curve",
"Edit curve", GDK_KEY_e,
"<Ctrl>e" },
88 {
"Close curve",
"Close curve", GDK_KEY_c,
"<Ctrl>c" },
89 {
"Export data",
"Export data", GDK_KEY_s,
"<Ctrl>s" },
90 {
"Save image",
"Save image", GDK_KEY_i,
"<Ctrl>i" }
118 ctmp ->
id.a =
id ->
a;
119 ctmp ->
id.b =
id ->
b;
120 ctmp ->
id.c =
id ->
c;
122 ctmp ->
layout -> datacolor.red = 0.0;
123 ctmp ->
layout -> datacolor.green = 0.0;
124 ctmp ->
layout -> datacolor.blue = 0.0;
138 if (sets -> extras == 0)
141 sets -> last = sets -> first;
146 sets -> last -> next -> prev = sets -> last;
147 sets -> last = sets -> last -> next;
162 if (sets -> extras == 1)
165 sets -> first = NULL;
170 if (ctmp -> prev == NULL)
172 sets -> first = ctmp -> next;
174 sets -> first -> prev = NULL;
176 else if (ctmp -> next == NULL)
179 g_free (ctmp -> next);
185 ctmp -> prev -> next = ctmp -> next;
186 ctmp -> next -> prev = ctmp -> prev;
207 if (this_proj -> curves[data ->
b][data ->
c] -> extrac -> extras > 0)
209 CurveExtra * ctmp = this_proj -> curves[data ->
b][data ->
c] -> extrac -> first;
210 for (i=0; i<this_proj -> curves[data ->
b][data ->
c] -> extrac -> extras; i++)
212 extrarid[ctmp ->
id.a][ctmp ->
id.b] ++;
213 if (ctmp -> next != NULL) ctmp = ctmp -> next;
229 gboolean remove = FALSE;
234 for (i=0; i<this_proj -> curves[
activer][
activec] -> extrac -> extras; i++)
236 if (ctmp ->
id.
a ==
id ->
a && ctmp ->
id.
b ==
id ->
b && ctmp ->
id.
c ==
id ->
c)
241 if (ctmp -> next != NULL) ctmp = ctmp -> next;
299 gchar * name = g_strdup_printf (
"%s", g_action_get_name(G_ACTION(
action)));
300 if (g_strcmp0 (name,
"save.data") == 0)
304 else if (g_strcmp0 (name,
"close.curve") == 0)
308 else if (g_strcmp0 (name,
"edit.curve") == 0)
312 else if (g_strcmp0 (name,
"save.image") == 0)
316 else if (g_strcmp0 (name,
"autoscale.curve") == 0)
320 else if (g_strcmp0 (name,
"shortcuts.curve") == 0)
343 for (i=0; i<sets -> extras; i++)
345 if (ctmp ->
id.
a ==
a && ctmp ->
id.
b ==
b)
349 if (ctmp ->
id.
c ==
c)
return FALSE;
352 if (ctmp -> next != NULL) ctmp = ctmp -> next;
373 GMenu * menu = g_menu_new ();
374 gchar * str_a, * str_b, * str_c;
375 gchar *
text[2] = {
"curve.action",
"edit.data"};
378 for (i=0; i<this_proj -> numc[
b]; i++)
380 if (this_proj -> curves[
b][i] -> ndata > 0)
382 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))
384 str_a = g_strdup_printf (
"%s", this_proj -> curves[
b][i] -> name);
385 str_b = g_strdup_printf (
"%s.%d-%d-%d",
text[edit],
a,
b, i);
386 str_c = g_strdup_printf (
"%s.%s", act, str_b);
387 append_menu_item (menu, (
const gchar *)str_a, (
const gchar *)str_c, NULL, NULL,
IMG_NONE, NULL, FALSE, FALSE, FALSE, NULL);
419 GMenu * menu = g_menu_new ();
426 create_menu[i][data ->
b] = FALSE;
427 create_proj[i] = FALSE;
429 if (data ->
b ==
GR || data ->
b ==
GK)
432 k = (data ->
b ==
GR) ?
GK :
GR;
434 else if (data ->
b ==
SQ || data ->
b ==
SK)
437 k = (data ->
b ==
SQ) ?
SK :
SQ;
440 if (((add &&
extrarid[i][data ->
b] < this_proj -> numc[data ->
b])
441 || (! add &&
extrarid[i][data ->
b] > 0)) && this_proj -> visok[data ->
b])
443 create_menu[i][data ->
b] = TRUE;
444 create_proj[i] = TRUE;
447 if (j && this_proj -> visok[k])
449 create_menu[i][k] = FALSE;
450 if (this_proj -> curves[k][0] -> ndata > 0)
452 if ((add &&
extrarid[i][k] < this_proj -> numc[k])
455 create_menu[i][k] = TRUE;
456 create_proj[i] = TRUE;
463 create_menu[data ->
a][data ->
b] = TRUE;
464 create_proj[data ->
a] = TRUE;
472 smenu = g_menu_new ();
478 g_free (create_proj);
479 g_free (create_menu);
494 GMenu * menu = g_menu_new ();
495 gchar * act = g_strdup_printf (
"%s.edit.curve", str);
496 append_menu_item (menu,
"Edit Curve", (
const gchar *)act,
"<CTRL>E", NULL,
IMG_STOCK,
PAGE_SETUP, FALSE, FALSE, FALSE, NULL);
498 act = g_strdup_printf (
"%s.save.image", str);
499 append_menu_item (menu,
"Export Image", (
const gchar *)act,
"<CTRL>I", NULL,
IMG_FILE,
PACKAGE_IMG, FALSE, FALSE, FALSE, NULL);
515 GMenu * menu = g_menu_new ();
516 GMenuItem * item = g_menu_item_new (
"Edit Data", NULL);
517 gchar * str_edit = g_strdup_printf (
"%s-win-edit", str);
518 g_menu_item_set_attribute (item,
"custom",
"s", str_edit, NULL);
522 g_menu_item_set_icon (item, gicon);
523 g_object_unref (gicon);
525 g_menu_item_set_submenu (item, (GMenuModel *)
create_curve_submenu (action_group, str, data, FALSE, 1));
526 g_menu_append_item (menu, item);
527 g_object_unref (item);
540 GMenu * menu = g_menu_new ();
541 gchar * act = g_strdup_printf (
"%s.close.curve", str);
542 append_menu_item (menu,
"Close", (
const gchar *)act,
"<CTRL>C", NULL,
IMG_STOCK,
FCLOSE, FALSE, FALSE, FALSE, NULL);
556 GMenu * menu = g_menu_new ();
557 gchar * act = g_strdup_printf (
"%s.shortcuts.curve", str);
558 append_menu_item (menu,
"Shortcuts", (
const gchar *)act, NULL, NULL,
IMG_NONE, NULL, FALSE, FALSE, FALSE, NULL);
575 GMenu * menu = g_menu_new ();
576 g_menu_append_section (menu, NULL, (GMenuModel*)
edit_data_section(action_group, str, data));
577 gchar * act = g_strdup_printf (
"%s.save.data", str);
578 append_menu_item (menu,
"Save Data", (
const gchar *)act,
"<CTRL>S", NULL,
IMG_STOCK,
FSAVEAS, FALSE, FALSE, FALSE, NULL);
596 GMenu * menu = g_menu_new ();
615 this_proj -> curves[data ->
b][data ->
c] -> pos =
destroy_this_widget (this_proj -> curves[data ->
b][data ->
c] -> pos);
616 this_proj -> curves[data ->
b][data ->
c] -> pos = gtk_label_new (
" ");
617 this_proj -> curves[data ->
b][data ->
c] -> curve_hbox =
destroy_this_widget (this_proj -> curves[data ->
b][data ->
c] -> curve_hbox);
618 this_proj -> curves[data ->
b][data ->
c] -> curve_hbox =
create_hbox (0);
619 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);
620 gchar * str = g_strdup_printf (
"c-%d", this_proj -> curves[data ->
b][data ->
c] -> action_id);
622 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));
624 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));
627 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, this_proj -> curves[data ->
b][data ->
c] -> curve_hbox, menu, TRUE, TRUE, 0);
629 add_box_child_end (this_proj -> curves[data ->
b][data ->
c] -> curve_hbox, this_proj -> curves[data ->
b][data ->
c] -> pos, FALSE, FALSE, 0);
645 GMenu * menu = g_menu_new ();
646 GMenuItem * item = g_menu_item_new (
"Add Data Set", NULL);
649 g_menu_item_set_icon (item, gicon);
650 g_object_unref (gicon);
653 if (this_proj -> curves[data ->
b][data ->
c] -> extrac -> extras < num)
655 g_menu_item_set_submenu (item, (GMenuModel *)
create_curve_submenu (action_group, act, data, TRUE, 0));
659 g_menu_item_set_attribute (item,
"action",
"s",
"None", NULL);
661 g_menu_append_item (menu, item);
662 g_object_unref (item);
664 item = g_menu_item_new (
"Remove Data Set", NULL);
667 g_menu_item_set_icon (item, gicon);
668 g_object_unref (gicon);
670 if (this_proj -> curves[data ->
b][data ->
c] -> extrac -> extras > 0)
672 g_menu_item_set_submenu (item, (GMenuModel *)
create_curve_submenu (action_group, act, data, FALSE, 0));
676 g_menu_item_set_attribute (item,
"action",
"s",
"None", NULL);
678 g_menu_append_item (menu, item);
679 g_object_unref (item);
692 GMenu * menu = g_menu_new ();
693 gchar * act = g_strdup_printf (
"%s.autoscale.curve", str);
694 append_menu_item (menu,
"Autoscale", (
const gchar *)act,
"<CTRL>A", NULL,
IMG_STOCK,
FITBEST, FALSE, FALSE, FALSE, NULL);
708 GtkWidget * curve_pop_menu;
711 GSimpleActionGroup * curve_popup_actions = g_simple_action_group_new ();
712 GSimpleAction * curve_popup_action[6];
713 curve_popup_action[0] = g_simple_action_new (
"save.data", NULL);
714 curve_popup_action[1] = g_simple_action_new (
"close.curve", NULL);
715 curve_popup_action[2] = g_simple_action_new (
"edit.curve", NULL);
716 curve_popup_action[3] = g_simple_action_new (
"save.image", NULL);
717 curve_popup_action[4] = g_simple_action_new (
"autoscale.curve", NULL);
718 curve_popup_action[5] = g_simple_action_new (
"shortcuts.curve", NULL);
721 g_action_map_add_action (G_ACTION_MAP(curve_popup_actions), G_ACTION(curve_popup_action[i]));
722 g_signal_connect (curve_popup_action[i],
"activate", G_CALLBACK(
curve_menu_bar_action), cstate ->
id);
725 gchar * str = g_strdup_printf (
"mc-%d",
get_project_by_id(cstate ->
id ->
a) -> curves[cstate ->
id ->
b][cstate ->
id ->
c] -> action_id);
726 GMenu * menu = g_menu_new ();
727 g_menu_append_section (menu, NULL, (GMenuModel *)
create_data_menu(curve_popup_actions, 1, str, cstate ->
id));
733 if (cstate ->
id ->
b ==
GR || cstate ->
id ->
b ==
GK)
737 else if (cstate ->
id ->
b ==
SQ || cstate ->
id ->
b ==
SK)
745 g_menu_append_section (menu, NULL, (GMenuModel *)
curve_help_menu(str));
748 curve_pop_menu = gtk_popover_menu_new_from_model_full ((GMenuModel *)menu, GTK_POPOVER_MENU_NESTED);
749 gtk_widget_set_parent (curve_pop_menu,
get_project_by_id(cstate ->
id ->
a) -> curves[cstate ->
id ->
b][cstate ->
id ->
c] -> window);
750 gtk_widget_set_size_request (curve_pop_menu, -1, 305);
752 curve_pop_menu = gtk_menu_new_from_model ((GMenuModel *)menu);
755 gtk_widget_insert_action_group (curve_pop_menu, str, G_ACTION_GROUP(curve_popup_actions));
757 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.
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.
char * graph_name[NGRAPHS]
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
GMenu * curve_menu_bar(project *this_proj, GSimpleActionGroup *action_group, gchar *str, tint *data)
create the curve window menu bar
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 * 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[]