Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
callbacks.c
Go to the documentation of this file.
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
20void 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));
39 g_free(filename);
40 }
41 gtk_widget_destroy(dialog);
42}
43
44void 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
51static void btn_clicked(GtkWidget * widget, gvk_layout layout)
52{
53 (void)widget;
54 (void)layout;
55}
56
57void btn_dot_clicked(GtkWidget *widget, void *user_data) {
58 (void)user_data;
59
60 btn_clicked(widget, GVK_DOT);
61}
62
63void btn_neato_clicked(GtkWidget *widget, void *user_data) {
64 (void)user_data;
65
66 btn_clicked(widget, GVK_NEATO);
67}
68
69void btn_twopi_clicked(GtkWidget *widget, void *user_data) {
70 (void)user_data;
71
72 btn_clicked(widget, GVK_TWOPI);
73}
74
75void btn_circo_clicked(GtkWidget *widget, void *user_data) {
76 (void)user_data;
77
78 btn_clicked(widget, GVK_CIRCO);
79}
80
81void 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}
void btn_fdp_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:81
_BB void on_hideconsolebtn_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:98
void btn_circo_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:75
_BB void on_consoleincbtn_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:121
void btn_dot_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:57
void remove_graph_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:44
void save_as_graph_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:20
_BB void on_consoledecbtn_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:105
void btn_neato_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:63
static void btn_clicked(GtkWidget *widget, gvk_layout layout)
Definition callbacks.c:51
_BB void on_clearconsolebtn_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:88
void btn_twopi_clicked(GtkWidget *widget, void *user_data)
Definition callbacks.c:69
#define _BB
Definition callbacks.h:20
node NULL
Definition grammar.y:163
GladeXML * xml
Definition gui.c:22
static int layout(graph_t *g, layout_info *infop)
Definition layout.c:811
ViewInfo * view
Definition viewport.c:37
gvk_layout
Definition smyrnadefs.h:104
@ GVK_DOT
Definition smyrnadefs.h:105
@ GVK_NEATO
Definition smyrnadefs.h:106
@ GVK_CIRCO
Definition smyrnadefs.h:108
@ GVK_FDP
Definition smyrnadefs.h:109
@ GVK_TWOPI
Definition smyrnadefs.h:107
Agraph_t ** g
Definition smyrnadefs.h:296
int activeGraph
Definition smyrnadefs.h:300
int save_graph_with_file_name(Agraph_t *graph, char *fileName)
Definition viewport.c:460