Debian Codegraph @

cmd/smyrna/gui/callbacks.c

raw
1 /*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11 #define _CRT_SECURE_NO_DEPRECATE 1
12 #include "config.h"
13 #include <gtk/gtk.h>
14 #include "callbacks.h"
15 #include "viewport.h"
16 #include "selectionfuncs.h"
17
18 //Menu Items
19
20 void save_as_graph_clicked(GtkWidget *widget, void *user_data) {
21 (void)widget;
22 (void)user_data;
23
24 GtkWidget *dialog;
25 dialog = gtk_file_chooser_dialog_new("Save File",
26 NULL,
27 GTK_FILE_CHOOSER_ACTION_SAVE,
28 GTK_STOCK_CANCEL,
29 GTK_RESPONSE_CANCEL,
30 GTK_STOCK_SAVE,
31 GTK_RESPONSE_ACCEPT, NULL);
32 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER
33 (dialog), TRUE);
34
35 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
36 char *filename;
37 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
38 save_graph_with_file_name(view->g[view->activeGraph], filename);
39 g_free(filename);
40 }
41 gtk_widget_destroy(dialog);
42 }
43
44 void remove_graph_clicked(GtkWidget *widget, void *user_data) {
45 (void)widget;
46 (void)user_data;
47
48 g_print("remove graph button fired\n");
49 }
50
51 static void btn_clicked(GtkWidget * widget, gvk_layout layout)
52 {
53 (void)widget;
54 (void)layout;
55 }
56
57 void btn_dot_clicked(GtkWidget *widget, void *user_data) {
58 (void)user_data;
59
60 btn_clicked(widget, GVK_DOT);
61 }
62
63 void btn_neato_clicked(GtkWidget *widget, void *user_data) {
64 (void)user_data;
65
66 btn_clicked(widget, GVK_NEATO);
67 }
68
69 void btn_twopi_clicked(GtkWidget *widget, void *user_data) {
70 (void)user_data;
71
72 btn_clicked(widget, GVK_TWOPI);
73 }
74
75 void btn_circo_clicked(GtkWidget *widget, void *user_data) {
76 (void)user_data;
77
78 btn_clicked(widget, GVK_CIRCO);
79 }
80
81 void btn_fdp_clicked(GtkWidget *widget, void *user_data) {
82 (void)user_data;
83
84 btn_clicked(widget, GVK_FDP);
85 }
86
87 /*console output widgets*/
88 _BB void on_clearconsolebtn_clicked(GtkWidget *widget, void *user_data) {
89 (void)widget;
90 (void)user_data;
91
92 gtk_text_buffer_set_text(gtk_text_view_get_buffer
93 ((GtkTextView *)
94 glade_xml_get_widget(xml, "mainconsole")),
95 "", 0);
96 }
97
98 _BB void on_hideconsolebtn_clicked(GtkWidget *widget, void *user_data) {
99 (void)widget;
100 (void)user_data;
101
102 gtk_widget_hide(glade_xml_get_widget(xml, "vbox13"));
103 }
104
105 _BB void on_consoledecbtn_clicked(GtkWidget *widget, void *user_data) {
106 (void)widget;
107 (void)user_data;
108
109 int w, h;
110 gtk_widget_get_size_request((GtkWidget*)
111 glade_xml_get_widget(xml,
112 "scrolledwindow7"),
113 &w, &h);
114 w -= 5;
115 gtk_widget_set_size_request(((GtkWidget*)
116 glade_xml_get_widget(xml,
117 "scrolledwindow7")),
118 w, 0);
119 }
120
121 _BB void on_consoleincbtn_clicked(GtkWidget *widget, void *user_data) {
122 (void)widget;
123 (void)user_data;
124
125 int w, h;
126 gtk_widget_get_size_request((GtkWidget*)
127 glade_xml_get_widget(xml,
128 "scrolledwindow7"),
129 &w, &h);
130 w += 5;
131 gtk_widget_set_size_request(((GtkWidget*)
132 glade_xml_get_widget(xml,
133 "scrolledwindow7")),
134 w, 0);
135 }