18#include <glade/glade.h>
51 return GLUT_BITMAP_9_BY_15;
54 return GLUT_BITMAP_8_BY_13;
57 return GLUT_BITMAP_TIMES_ROMAN_10;
60 return GLUT_BITMAP_HELVETICA_10;
63 return GLUT_BITMAP_HELVETICA_12;
66 return GLUT_BITMAP_HELVETICA_18;
69 return GLUT_BITMAP_TIMES_ROMAN_10;
83 if (!buf || *buf ==
'\0')
192 FILE *input_file =
NULL;
193 FILE *input_file2 =
NULL;
199 "default attributes template graph file \"%s\" not found\n",
208 "could not load default attributes template graph file \"%s\"\n",
214 input_file2 = fopen(
path,
"rb");
216 fprintf(stderr,
"default attributes template graph file \"%s\" not found\n",
smyrnaPath(
"attr_widgets.dot"));
221 fclose (input_file2);
223 fprintf(stderr,
"could not load default attribute widgets graph file \"%s\"\n",
smyrnaPath(
"attr_widgets.dot"));
296 vi->
timer = g_timer_new();
297 vi->
timer2 = g_timer_new();
298 vi->
timer3 = g_timer_new();
300 g_timer_stop(vi->
timer);
339 if (!(input_file = fopen(filename,
"r"))) {
340 g_print(
"Cannot open %s\n", filename);
346 g_print(
"Cannot read graph in %s\n", filename);
353 g_print(
"There is no position info in graph %s in %s\n",
agnameof(g), filename);
473 g_print(
"there is no file name to save! Programmer error\n");
476 if (output_file ==
NULL) {
477 g_print(
"Cannot create file \n");
482 fclose (output_file);
484 g_print(
"%s successfully saved \n",
fileName);
517 GtkWidget *dialog = gtk_file_chooser_dialog_new(
"Save File",
519 GTK_FILE_CHOOSER_ACTION_SAVE,
523 GTK_RESPONSE_ACCEPT,
NULL);
524 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER
526 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
528 gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
532 gtk_widget_destroy(dialog);
536 gtk_widget_destroy(dialog);
548static float interpol(
float minv,
float maxv,
float minc,
float maxc,
float x)
550 return (x - minv) * (maxc - minc) / (maxv - minv) + minc;
557 float percl = l / maxl;
562 if (percl < sc->
s[ind].perc)
567 sc->
s[ind - 1].
c.
R, sc->
s[ind].
c.
R, percl);
570 sc->
s[ind - 1].
c.
G, sc->
s[ind].
c.
G, percl);
573 sc->
s[ind - 1].
c.
B, sc->
s[ind].
c.
B, percl);
577 if (percl < sc->
s[ind].perc)
580 c->
R = sc->
s[ind].
c.
R;
581 c->
G = sc->
s[ind].
c.
G;
582 c->
B = sc->
s[ind].
c.
B;
598 av_perc = 1.0 / (float) (colorcnt-1);
599 for (
size_t ind = 0; ind < colorcnt; ind++) {
605 sc->
s[ind].
perc = (float)ind * av_perc;
616 "#C8CBED",
"#9297D3",
"#0000FF",
"#2C2E41"
619 "#EBBE29",
"#D58C4A",
"#74AE09",
"#893C49"
622 "#E0061E",
"#F0F143",
"#95192B",
"#EB712F"
625 "#1E6A10",
"#2ABE0E",
"#AEDD39",
"#5EE88B"
627#define CSZ(x) (sizeof(x)/sizeof(char*))
638#define NUM_SCHEMES (sizeof(palette)/sizeof(colordata))
643 fprintf (stderr,
"colorschemaset: illegal themeid %d\n", themeid);
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 char * gv_strdup(const char *original)
static void * gv_calloc(size_t nmemb, size_t size)
static void * gv_alloc(size_t size)
void colorxlate(char *str, agxbuf *buf)
static NORETURN void graphviz_exit(int status)
glCompSet * glcreate_gl_topview_menu(void)
gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
Agsym_t * agattr(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up attributes of a graph
char * agget(void *obj, char *name)
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
int agwrite(Agraph_t *g, void *chan)
Return 0 on success, EOF on failure.
Agraph_t * agread(void *chan, Agdisc_t *disc)
constructs a new graph
char * agnameof(void *)
returns a string descriptor for the object.
void * agbindrec(void *obj, const char *name, unsigned int recsize, int move_to_front)
attaches a new record of the given size to the object
Agraph_t * graph(char *name)
void load_mouse_actions(ViewInfo *v)
char * fileName(ingraph_state *sp)
Return name of current file being processed.
char * smyrnaPath(char *suffix)
#define GG_labelattribute(g)
#define GG_nodelabelcolor(g)
#define GN_labelattribute(g)
#define GG_edgelabelcolor(g)
#define GE_labelattribute(g)
#define GG_elabelattribute(g)
platform abstraction for case-insensitive string functions
colorschemaset * colschms
GtkComboBox * graphComboBox
glCompColor nodelabelcolor
glCompColor edgelabelcolor
glCompColor selectedNodeColor
viewport_camera ** cameras
systemgraphs systemGraphs
size_t active_camera
<number of cameras
struct topview::@55 fisheyeParams
void initSmGraph(Agraph_t *g, topview *rv)
void load_settings_from_graph(void)
void update_graph_from_settings(Agraph_t *g)
static float interpol(float minv, float maxv, float minc, float maxc, float x)
static void clear_color_theme(colorschemaset *cs)
void set_viewport_settings_from_template(ViewInfo *vi, Agraph_t *g)
static char * deep_blue[]
static void set_color_theme_color(colorschemaset *sc, char **colorstr)
static gboolean gl_main_expose(gpointer data)
static char * rain_forest[]
void close_graph(ViewInfo *vi)
int save_graph_with_file_name(Agraph_t *graph, char *fileName)
void getcolorfromschema(colorschemaset *sc, float l, float maxl, glCompColor *c)
void switch_graph(int graphId)
static colordata palette[]
static void * get_glut_font(int ind)
static colorschemaset * create_color_theme(int themeid)
static Agraph_t * loadGraph(char *filename)
void init_viewport(ViewInfo *vi)
static void activate(int id)
static void get_data_dir(void)
static void update_graph_params(Agraph_t *graph)
char * get_attribute_value(char *attr, ViewInfo *vi, Agraph_t *g)
void updateRecord(Agraph_t *g)
int add_graph_to_viewport_from_file(char *fileName)
void refreshViewport(void)
int add_graph_to_viewport(Agraph_t *graph, char *id)
static void clear_viewport(ViewInfo *vi)
static void graphRecord(Agraph_t *g)