34static char*
ID =
"ID";
74 if ((outputfile = fopen(filename,
"w"))) {
75 ret =
agwrite(subg, outputfile);
78 fprintf (stderr,
"Could not open %s for writing\n", filename);
103 agxset(v, visible_attr, bf);
125 dialog = gtk_file_chooser_dialog_new(
"Save File",
127 GTK_FILE_CHOOSER_ACTION_SAVE,
131 GTK_RESPONSE_ACCEPT,
NULL);
132 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER
134 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
136 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
140 gtk_widget_destroy(dialog);
144 gtk_widget_destroy(dialog);
152 GtkTreeViewColumn *column;
153 GtkCellRendererText *renderer;
156 renderer = (GtkCellRendererText *) gtk_cell_renderer_text_new();
157 ((GtkCellRenderer *) renderer)->mode = GTK_CELL_RENDERER_MODE_EDITABLE;
158 renderer->editable = editable;
162 renderer->foreground = c;
165 gtk_tree_view_column_new_with_attributes(Title,
167 renderer,
"text", asso,
170 gtk_tree_view_append_column(GTK_TREE_VIEW(
tree), column);
171 gtk_tree_view_column_set_resizable(column, 1);
178 GtkTreeViewColumn *column;
179 GtkCellRendererToggle *renderer;
180 renderer = (GtkCellRendererToggle *) gtk_cell_renderer_toggle_new();
181 renderer->activatable = editable;
184 gtk_tree_view_column_new_with_attributes(Title,
186 renderer,
"active", asso,
188 gtk_tree_view_append_column(GTK_TREE_VIEW(
tree), column);
189 gtk_tree_view_column_set_resizable(column, 1);
203 gtk_tree_store_append(
grid->store, &iter,
NULL);
205 for (
id = 0;
id <
grid->count;
id++) {
207 if (strcmp(cp->
name,
ID) == 0)
continue;
216 g_value_init(&value, cp->
type);
217 switch (
grid->columns[
id].type) {
220 if ((strcmp(bf,
"1") == 0) || (strcmp(bf,
"true") == 0)
221 || (strcmp(bf,
"True") == 0))
222 g_value_set_boolean(&value, 1);
224 g_value_set_boolean(&value, 0);
227 g_value_set_boolean(&value, 1);
231 g_value_set_static_string(&value, bf);
234 gtk_tree_store_set_value(
grid->store, &iter,
id, &value);
235 g_value_unset(&value);
243 if ((ncolumns == 0) || (types ==
NULL))
246 gtk_tree_store_clear(
store);
247 g_object_unref(
store);
250 store = gtk_tree_store_newv(ncolumns, types);
274 GtkTreeViewColumn *column;
279 while ((column = gtk_tree_view_get_column(
tree, 0)))
280 gtk_tree_view_remove_column(
tree, column);
281 store = (GtkTreeStore *) gtk_tree_view_get_model(
tree);
283 tree = (GtkTreeView *) gtk_tree_view_new();
284 gtk_widget_show((GtkWidget *)
tree);
286 gtk_container_add((GtkContainer *)
287 glade_xml_get_widget(
xml,
"scrolledwindow9"),
293 for (
id = 0;
id < g->
count;
id++)
297 gtk_tree_view_set_model(
tree, (GtkTreeModel *)
store);
299 for (
id = 0;
id < g->
count;
id++)
309 assert(g->
count >= 0);
320 for (
id = 0;
id < g->
count;
id++) {
365 static GtkTreeView *
tree;
367 char *buf =
agget(g,
"datacolumns");
Memory allocation wrappers that exit on failure.
static void * gv_recalloc(void *ptr, size_t old_nmemb, size_t new_nmemb, size_t size)
static void * gv_calloc(size_t nmemb, size_t size)
static void * gv_alloc(size_t size)
Agsym_t * agattr(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up attributes of a graph
int agxset(void *obj, Agsym_t *sym, const char *value)
char * agget(void *obj, char *name)
Agedge_t * agsubedge(Agraph_t *g, Agedge_t *e, int createflag)
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
int agwrite(Agraph_t *g, void *chan)
Return 0 on success, EOF on failure.
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Agnode_t * agfstnode(Agraph_t *g)
Agnode_t * agsubnode(Agraph_t *g, Agnode_t *n, int createflag)
char * agnameof(void *)
returns a string descriptor for the object.
Agraph_t * agsubg(Agraph_t *g, char *name, int cflag)
int agdelsubg(Agraph_t *g, Agraph_t *sub)
textitem scanner parser str
static int store(segment_t *seg, int first, pointf *pts)
a non-owning string reference
state for an in-progress string tokenization
Non-owning string references.
static bool strview_str_eq(strview_t a, const char *b)
compare a string reference to a string for equality
static char * strview_str(strview_t source)
make a heap-allocated string from this string view
static strview_t strview(const char *referent, char terminator)
create a string reference
static strview_t tok_get(const tok_t *t)
get the current token
static tok_t tok(const char *input, const char *separators)
begin tokenization of a new string
static bool tok_end(const tok_t *t)
is this tokenizer exhausted?
static void tok_next(tok_t *t)
advance to the next token in the string being scanned
void updateSmGraph(Agraph_t *g, topview *t)
static int create_save_subgraph_from_filter(char *filename, int withEdges)
static void create_column(gridCol *c, GtkTreeView *tree, int id)
static grid_t * update_columns(grid_t *g, char *str)
static void create_text_column(char *Title, GtkTreeView *tree, int asso, bool editable)
int tv_save_as(int withEdges)
static grid_t * initGrid(void)
static void clearGrid(grid_t *g)
static void add_column(grid_t *g, strview_t name, bool editable, GType g_type)
static GtkTreeStore * update_tree_store(GtkTreeStore *store, int ncolumns, GType *types)
static GtkTreeView * update_tree(GtkTreeView *tree, grid_t *g)
void setup_tree(Agraph_t *g)
static void create_toggle_column(char *Title, GtkTreeView *tree, int asso, bool editable)
static void populate_data(Agraph_t *g, grid_t *grid)
static void induceEdges(Agraph_t *g, Agraph_t *sg)
static void set_visibility(Agraph_t *g, int visibility)
VIS_API void visibility(vconfig_t *)