100 ctmp ->
id.a =
id ->
a;
101 ctmp ->
id.b =
id ->
b;
102 ctmp ->
id.c =
id ->
c;
104 ctmp ->
layout -> datacolor.red = 0.0;
105 ctmp ->
layout -> datacolor.green = 0.0;
106 ctmp ->
layout -> datacolor.blue = 0.0;
120 if (sets -> extras == 0)
123 sets -> last = sets -> first;
128 sets -> last -> next -> prev = sets -> last;
129 sets -> last = sets -> last -> next;
144 if (sets -> extras == 1)
147 sets -> first = NULL;
152 if (ctmp -> prev == NULL)
154 sets -> first = ctmp -> next;
156 sets -> first -> prev = NULL;
158 else if (ctmp -> next == NULL)
161 g_free (ctmp -> next);
167 ctmp -> prev -> next = ctmp -> next;
168 ctmp -> next -> prev = ctmp -> prev;
189 if (this_proj -> curves[data ->
b][data ->
c] -> extrac -> extras > 0)
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++)
194 extrarid[ctmp ->
id.a][ctmp ->
id.b] ++;
195 if (ctmp -> next != NULL) ctmp = ctmp -> next;
211 gboolean remove = FALSE;
216 for (i=0; i<this_proj -> curves[
activer][
activec] -> extrac -> extras; i++)
218 if (ctmp ->
id.
a ==
id ->
a && ctmp ->
id.
b ==
id ->
b && ctmp ->
id.
c ==
id ->
c)
223 if (ctmp -> next != NULL) ctmp = ctmp -> next;
281 gchar * name = g_strdup_printf (
"%s", g_action_get_name(G_ACTION(
action)));
282 if (g_strcmp0 (name,
"save.data") == 0)
286 else if (g_strcmp0 (name,
"close.curve") == 0)
290 else if (g_strcmp0 (name,
"edit.curve") == 0)
294 else if (g_strcmp0 (name,
"save.image") == 0)
298 else if (g_strcmp0 (name,
"autoscale.curve") == 0)
318 for (i=0; i<sets -> extras; i++)
320 if (ctmp ->
id.
a ==
a && ctmp ->
id.
b ==
b)
324 if (ctmp ->
id.
c ==
c)
return FALSE;
327 if (ctmp -> next != NULL) ctmp = ctmp -> next;
348 GMenu * menu = g_menu_new ();
349 gchar * str_a, * str_b, * str_c;
350 gchar *
text[2] = {
"curve.action",
"edit.data"};
353 for (i=0; i<this_proj -> numc[
b]; i++)
355 if (this_proj -> curves[
b][i] -> ndata > 0)
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))
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);
394 GMenu * menu = g_menu_new ();
401 create_menu[i][data ->
b] = FALSE;
402 create_proj[i] = FALSE;
404 if (data ->
b ==
GR || data ->
b ==
GK)
407 k = (data ->
b ==
GR) ?
GK :
GR;
409 else if (data ->
b ==
SQ || data ->
b ==
SK)
412 k = (data ->
b ==
SQ) ?
SK :
SQ;
415 if (((add &&
extrarid[i][data ->
b] < this_proj -> numc[data ->
b])
416 || (! add &&
extrarid[i][data ->
b] > 0)) && this_proj -> visok[data ->
b])
418 create_menu[i][data ->
b] = TRUE;
419 create_proj[i] = TRUE;
422 if (j && this_proj -> visok[k])
424 create_menu[i][k] = FALSE;
425 if (this_proj -> curves[k][0] -> ndata > 0)
427 if ((add &&
extrarid[i][k] < this_proj -> numc[k])
430 create_menu[i][k] = TRUE;
431 create_proj[i] = TRUE;
438 create_menu[data ->
a][data ->
b] = TRUE;
439 create_proj[data ->
a] = TRUE;
447 smenu = g_menu_new ();
453 g_free (create_proj);
454 g_free (create_menu);
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);
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);
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);
497 g_menu_item_set_icon (item, gicon);
498 g_object_unref (gicon);
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);
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);
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);
555 GMenu * menu = g_menu_new ();
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);
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));
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));
585 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, this_proj -> curves[data ->
b][data ->
c] -> curve_hbox, menu, TRUE, TRUE, 0);
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);
603 GMenu * menu = g_menu_new ();
604 GMenuItem * item = g_menu_item_new (
"Add Data Set", NULL);
607 g_menu_item_set_icon (item, gicon);
608 g_object_unref (gicon);
611 if (this_proj -> curves[data ->
b][data ->
c] -> extrac -> extras < num)
613 g_menu_item_set_submenu (item, (GMenuModel *)
create_curve_submenu (action_group, act, data, TRUE, 0));
617 g_menu_item_set_attribute (item,
"action",
"s",
"None", NULL);
619 g_menu_append_item (menu, item);
620 g_object_unref (item);
622 item = g_menu_item_new (
"Remove Data Set", NULL);
625 g_menu_item_set_icon (item, gicon);
626 g_object_unref (gicon);
628 if (this_proj -> curves[data ->
b][data ->
c] -> extrac -> extras > 0)
630 g_menu_item_set_submenu (item, (GMenuModel *)
create_curve_submenu (action_group, act, data, FALSE, 0));
634 g_menu_item_set_attribute (item,
"action",
"s",
"None", NULL);
636 g_menu_append_item (menu, item);
637 g_object_unref (item);
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);
666 GtkWidget * curve_pop_menu;
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);
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);
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));
690 if (cstate ->
id ->
b ==
GR || cstate ->
id ->
b ==
GK)
694 else if (cstate ->
id ->
b ==
SQ || cstate ->
id ->
b ==
SK)
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);
708 curve_pop_menu = gtk_menu_new_from_model ((GMenuModel *)menu);
711 gtk_widget_insert_action_group (curve_pop_menu, str, G_ACTION_GROUP(curve_popup_actions));
713 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
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)
void autoscale(gpointer data)
autoscale callback
CurveExtra * init_extra(tint *id)
create extra data set
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
void curve_window_add_menu_bar(tint *data)
add menu bar to the curve window
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
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