#include "hotkeymap.h"
#include "polytess.h"
-#if 0
static void draw_cube()
{
glVertex3f(100.0f, -100.0f, -100.0f); // Bottom Right Of The Quad (Right)
glEnd();
}
-#endif
static void drawRotatingAxis(void)
{
if (!glupdatecamera(view))
return 0;
+ draw_cube();
+
+
if (view->activeGraph >= 0) {
if (!doonce) {
doonce = 1;
drawBorders(view);
glexpose_drawgraph(view);
// drawRotatingTools();
-// draw_cube();
drawRotatingAxis();
draw_selpoly(&view->Topview->sel.selPoly);
// draw_stuff();
int load_settings_from_graph(Agraph_t * g)
{
Agsym_t* sym=NULL;
- while ((sym = agnxtattr(view->systemGraphs.attrs_widgets,AGRAPH, sym)))
- {
- if(strncmp (sym->name,"color_button",strlen("color_button"))==0)
- set_color_button_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
- if(strncmp (sym->name,"check_box",strlen("check_box"))==0)
- set_checkbox_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
- if(strncmp (sym->name,"text_box",strlen("text_box"))==0)
- set_text_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
- if(strncmp (sym->name,"combobox",strlen("combobox"))==0)
- set_combobox_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
- if(strncmp (sym->name,"spin_button",strlen("spin_button"))==0)
- set_spinbtn_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
- if(strncmp (sym->name,"scale_button",strlen("scale_button"))==0)
- set_scalebtn_widget_to_attribute(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
-
- }
+ while ((sym = agnxtattr(view->systemGraphs.attrs_widgets,AGRAPH, sym)))
+ {
+ if(strncmp (sym->name,"color_button",strlen("color_button"))==0)
+ set_color_button_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
+ if(strncmp (sym->name,"check_box",strlen("check_box"))==0)
+ set_checkbox_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
+ if(strncmp (sym->name,"text_box",strlen("text_box"))==0)
+ set_text_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
+ if(strncmp (sym->name,"combobox",strlen("combobox"))==0)
+ set_combobox_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
+ if(strncmp (sym->name,"spin_button",strlen("spin_button"))==0)
+ set_spinbtn_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
+ if(strncmp (sym->name,"scale_button",strlen("scale_button"))==0)
+ set_scalebtn_widget_to_attribute(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name));
+ }
return 1;
+ /*P.S: if I can find a way too make gtk windows get along with glut window this might be possible*/
}
-/* graphRecord:
- * add graphRec to graph if necessary.
- * update fields of graphRec.
- * We assume the graph has attributes nodelabelattribute, edgelabelattribute,
- * nodelabelcolor and edgelabelcolor from template.dot.
- * We assume nodes have pos attributes.
- */
-static void
-graphRecord (Agraph_t* g)
-{
- agbindrec(g, "graphRec", sizeof(graphRec), 1);
-
- GG_nodelabelcolor(g) = agattr (g, AGRAPH, "nodelabelcolor", 0);
- GG_edgelabelcolor(g) = agattr (g, AGRAPH, "edgelabelcolor", 0);
-
- GN_pos(g) = agattr (g, AGNODE, "pos", 0);
- GN_size(g) = agattr (g, AGNODE, "size", 0);
- GN_visible(g) = agattr (g, AGNODE, "visible", 0);
- GN_selected(g) = agattr (g, AGNODE, "selected", 0);
- GN_labelattribute(g) = agattr (g, AGNODE, agget(g,"nodelabelattribute"), 0);
-
- GE_visible(g) = agattr (g, AGEDGE, "visible", 0);
- GE_selected(g) = agattr (g, AGEDGE, "selected", 0);
- GE_labelattribute(g) = agattr (g, AGEDGE, agget(g,"edgelabelattribute"), 0);
-}
-
-
int update_graph_from_settings(Agraph_t * g)
{
Agsym_t* sym=NULL;
if(strncmp (sym->name,"scale_button",strlen("scale_button"))==0)
get_scalebtn_widget_to_attribute(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name),g);
}
- graphRecord(g);
return 1;
}
#include "libintl.h"
#endif
#include <assert.h>
+#include "glutrender.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
{
unsigned int c;
- while ((c = getopt(argc, argv, ":K:txv?")) != -1) {
+ while ((c = getopt(argc, argv, ":K:txvf?")) != -1) {
switch (c) {
case 'v':
SmyrnaVerbose = 1;
view->dfltEngine = s2layout(optarg);
break;
#endif
+ case 'f':
+ view->guiMode=GUI_FULLSCREEN;
+ break;
+
case '?':
if (optopt == '?')
usage(0);
}
#endif
+void display()
+{
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glLoadIdentity();
+ glexpose_main(view);
+ glutSwapBuffers();
-int main(int argc, char *argv[])
+}
+static void glutMode()
+{
+ glutInitWindowSize(512,512);
+ glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+ glutCreateWindow("The glut hello world program");
+ glutDisplayFunc(display);
+
+ glutMainLoop(); // Infinite event loop
+}
+
+
+static void windowedMode(int argc, char *argv[])
{
GdkGLConfig *glconfig;
- char *initFileName;
/*combo box to show loaded graphs */
GtkComboBox *graphComboBox;
+ gtk_set_locale();
+ gtk_init(&argc, &argv);
+ if (!(smyrnaGlade))
+ smyrnaGlade = smyrnaPath("smyrna.glade");
+ xml = glade_xml_new(smyrnaGlade, NULL, NULL);
+
+ gladewidget = glade_xml_get_widget(xml, "frmMain");
+ gtk_widget_show(gladewidget);
+ g_signal_connect((gpointer) gladewidget, "destroy",
+ G_CALLBACK(mQuitSlot), NULL);
+ glade_xml_signal_autoconnect(xml);
+ gtk_gl_init(0, 0);
+ /* Configure OpenGL framebuffer. */
+ glconfig = configure_gl();
+// gladewidget = glade_xml_get_widget(xml, "vbox2");
+ gladewidget = glade_xml_get_widget(xml, "hbox11");
+
+ gtk_widget_hide(glade_xml_get_widget(xml, "vbox13"));
+ gtk_window_set_deletable ((GtkWindow*)glade_xml_get_widget(xml, "dlgSettings"),0);
+ gtk_window_set_deletable ((GtkWindow*)glade_xml_get_widget(xml, "frmTVNodes"),0);
+ create_window(glconfig, gladewidget);
+ change_cursor(GDK_TOP_LEFT_ARROW);
+
+#ifndef WIN32
+ glutInit(&argc, argv);
+#endif
+
+ gladewidget = glade_xml_get_widget(xml, "hbox13");
+ graphComboBox = (GtkComboBox *) gtk_combo_box_new_text();
+ gtk_box_pack_end((GtkBox*)gladewidget, (GtkWidget*)graphComboBox, 1, 1, 10);
+ gtk_widget_show((GtkWidget*)graphComboBox);
+ view->graphComboBox = graphComboBox;
+
+ if(view->guiMode==GUI_FULLSCREEN)
+ gtk_window_fullscreen(glade_xml_get_widget(xml, "frmMain"));
+ gtk_main();
+}
+
+
+
+
+int main(int argc, char *argv[])
+{
+ char *initFileName;
+
smyrnaDir = getenv("SMYRNA_PATH");
textdomain(GETTEXT_PACKAGE);
#endif
view = NEW(ViewInfo);
-
init_viewport(view);
- gtk_set_locale();
- gtk_init(&argc, &argv);
- initFileName = parseArgs(argc, argv, view);
- if (!(smyrnaGlade))
- smyrnaGlade = smyrnaPath("smyrna.glade");
- xml = glade_xml_new(smyrnaGlade, NULL, NULL);
-
- gladewidget = glade_xml_get_widget(xml, "frmMain");
- gtk_widget_show(gladewidget);
- g_signal_connect((gpointer) gladewidget, "destroy",
- G_CALLBACK(mQuitSlot), NULL);
- glade_xml_signal_autoconnect(xml);
- if (initFileName) {
- view->initFile = 1;
- view->initFileName = strdup(initFileName);
- }
- gtk_gl_init(0, 0);
- /* Configure OpenGL framebuffer. */
- glconfig = configure_gl();
-// gladewidget = glade_xml_get_widget(xml, "vbox2");
- gladewidget = glade_xml_get_widget(xml, "hbox11");
-
- gtk_widget_hide(glade_xml_get_widget(xml, "vbox13"));
- gtk_window_set_deletable ((GtkWindow*)glade_xml_get_widget(xml, "dlgSettings"),0);
- gtk_window_set_deletable ((GtkWindow*)glade_xml_get_widget(xml, "frmTVNodes"),0);
-
-
- create_window(glconfig, gladewidget);
-
- change_cursor(GDK_TOP_LEFT_ARROW);
-
+ view->initFileName = parseArgs(argc, argv, view);
+ if(view->initFileName)
+ view->initFile=1;
#ifndef WIN32
glutInit(&argc, argv);
#endif
-
- gladewidget = glade_xml_get_widget(xml, "hbox13");
- graphComboBox = (GtkComboBox *) gtk_combo_box_new_text();
- gtk_box_pack_end((GtkBox*)gladewidget, (GtkWidget*)graphComboBox, 1, 1, 10);
- gtk_widget_show((GtkWidget*)graphComboBox);
- view->graphComboBox = graphComboBox;
- gtk_main();
-
-
-
+ windowedMode(argc, argv);
+// view->guiMode=GUI_GLUT;
+ sm_glutinit(800,600,0);
#ifdef G_OS_WIN32
g_free(package_prefix);
g_free(package_data_dir);
RelativePath=".\gltemplate.c"
>
</File>
+ <File
+ RelativePath=".\glutrender.c"
+ >
+ </File>
<File
RelativePath=".\gui\gui.c"
>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="9.00"
- ShowAllFiles="false"
+ ShowAllFiles="true"
>
<Configurations>
<Configuration
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory="C:\graphviz-ms\bin"
- CommandArguments="c:\4elt.dot"
+ CommandArguments="-f c:\4elt.dot"
Attach="false"
DebuggerType="3"
Remote="1"
#define GE_selected(g) (GREC(g)->E_selected)
#define GG_edgelabelcolor(g) (GREC(g)->G_edgelabelcolor)
#define GE_labelattribute(g) (GREC(g)->E_labelattribute)
+#define GUI_WINDOWED 0
+#define GUI_FULLSCREEN 1
typedef struct _selection {
glCompPoly selPoly;
refresh_filter refresh;
int edgerendertype;
float nodeScale;
+ int guiMode;
} ViewInfo;
/*rotation steps*/
static colorschemaset *create_color_theme(int themeid);
static md5_byte_t *get_md5_key(Agraph_t * graph);
+
#define countof( array ) ( sizeof( array )/sizeof( array[0] ) )
ViewInfo *view;
("defaultfisheyemagnifierdistort", view, g));
view->drawnodes = atoi(get_attribute_value("drawnodes", view, g));
view->drawedges = atoi(get_attribute_value("drawedges", view, g));
+ view->drawnodes=1;
+ view->drawedges=1;
view->drawnodelabels=atoi(get_attribute_value("labelshownodes", view, g));
view->drawedgelabels=atoi(get_attribute_value("labelshowedges", view, g));
view->nodeScale=atof(get_attribute_value("nodesize", view, g))*.30;
view->refresh.visibility=1;
view->refresh.nodesize=1;
view->edgerendertype=0;
- /*add default camera */
- //create fontset
+ if(view->guiMode!=GUI_FULLSCREEN)
+ view->guiMode=GUI_WINDOWED;
}
return add_graph_to_viewport(graph, fileName);
}
+
+/* graphRecord:
+ * add graphRec to graph if necessary.
+ * update fields of graphRec.
+ * We assume the graph has attributes nodelabelattribute, edgelabelattribute,
+ * nodelabelcolor and edgelabelcolor from template.dot.
+ * We assume nodes have pos attributes.
+ */
+static void
+graphRecord (Agraph_t* g)
+{
+ agbindrec(g, "graphRec", sizeof(graphRec), 1);
+
+ GG_nodelabelcolor(g) = agattr (g, AGRAPH, "nodelabelcolor", 0);
+ GG_edgelabelcolor(g) = agattr (g, AGRAPH, "edgelabelcolor", 0);
+
+ GN_pos(g) = agattr (g, AGNODE, "pos", 0);
+ GN_size(g) = agattr (g, AGNODE, "size", 0);
+ GN_visible(g) = agattr (g, AGNODE, "visible", 0);
+ GN_selected(g) = agattr (g, AGNODE, "selected", 0);
+ GN_labelattribute(g) = agattr (g, AGNODE, agget(g,"nodelabelattribute"), 0);
+
+ GE_visible(g) = agattr (g, AGEDGE, "visible", 0);
+ GE_selected(g) = agattr (g, AGEDGE, "selected", 0);
+ GE_labelattribute(g) = agattr (g, AGEDGE, agget(g,"edgelabelattribute"), 0);
+}
+
+
+
void refreshViewport(int doClear)
{
Agraph_t *graph = view->g[view->activeGraph];
load_settings_from_graph(graph);
update_graph_from_settings(graph);
set_viewport_settings_from_template(view, graph);
+ graphRecord(graph);
initSmGraph(graph,view->Topview);
// update_topview(graph, view->Topview, 1);