]> granicus.if.org Git - graphviz/commitdiff
smyrna improvements
authorarif <devnull@localhost>
Wed, 8 Apr 2009 18:55:08 +0000 (18:55 +0000)
committerarif <devnull@localhost>
Wed, 8 Apr 2009 18:55:08 +0000 (18:55 +0000)
12 files changed:
cmd/smyrna/draw.c
cmd/smyrna/glexpose.c
cmd/smyrna/gltemplate.c
cmd/smyrna/gui/callbacks.c
cmd/smyrna/gui/gui.c
cmd/smyrna/gui/topviewsettings.c
cmd/smyrna/smyrna.vcproj
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topfisheyeview.c
cmd/smyrna/topview.c
cmd/smyrna/viewport.c
cmd/smyrna/viewportcamera.c

index 9a3bf4c8c48e912e7309dd3788d8dfacc3f4cb49..7463b5b7d8d4b19e67975c4f290f03b449af9c7c 100755 (executable)
@@ -454,7 +454,7 @@ static void SetStyle(xdot_op * op, int param)
 static void SetFont(xdot_op * op, int param)
 {
        //activate the right font
-       view->fontset->activefont=add_font(view->fontset,op->u.font.name);//load or set active font
+       view->widgets->fontset->activefont=add_font(view->widgets->fontset,op->u.font.name);//load or set active font
        view->FontSize =  op->u.font.size;
 }
 
@@ -474,13 +474,13 @@ static void EmbedText(xdot_op * op, int param)
        x = (GLfloat) op->u.text.x;
     if (op->u.text.align == -1)
        x = (GLfloat) op->u.text.x + op->u.text.width;
-       view->fontset->fonts[view->fontset->activefont]->fontheight=view->FontSize;
+       view->widgets->fontset->fonts[view->widgets->fontset->activefont]->fontheight=view->FontSize;
     if (param == 0)
-       fontColor(view->fontset->fonts[view->fontset->activefont],view->penColor.R, view->penColor.G, view->penColor.B,1);
+       fontColor(view->widgets->fontset->fonts[view->widgets->fontset->activefont],view->penColor.R, view->penColor.G, view->penColor.B,1);
     if (param == 1)            //selected
-       fontColor(view->fontset->fonts[view->fontset->activefont],view->selectedNodeColor.R, view->selectedNodeColor.G,
+       fontColor(view->widgets->fontset->fonts[view->widgets->fontset->activefont],view->selectedNodeColor.R, view->selectedNodeColor.G,
                  view->selectedNodeColor.B,1);
-       glprintf(view->fontset->fonts[view->fontset->activefont], (x - dx), (GLfloat)op->u.text.y -  dy,
+       glprintf(view->widgets->fontset->fonts[view->widgets->fontset->activefont], (x - dx), (GLfloat)op->u.text.y -  dy,
                   (GLfloat)op->u.text.width, op->u.text.text);
 }
 
@@ -745,7 +745,7 @@ static void scanXdot(xdot * xDot, void *p)
                op->obj = p;
                if (op->op.kind==xd_font)
                {
-                       add_font(view->fontset,op->op.u.font.name);//load or set active font
+                       add_font(view->widgets->fontset,op->op.u.font.name);//load or set active font
                }
     }
 
index 4bccdb60c31908b7677edaf447a0b8db91ceaddc..90d294c0c35a959a714f8c38e285cfc9ce568f2f 100644 (file)
@@ -137,7 +137,7 @@ void drawtestpoly(void)
        glEnable(GL_TEXTURE_2D);
        glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 //     glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE , GL_DECAL);
-       glBindTexture(GL_TEXTURE_2D,view->fontset->fonts[view->fontset->activefont]->texId);
+       glBindTexture(GL_TEXTURE_2D,view->widgets->fontset->fonts[view->widgets->fontset->activefont]->texId);
        glColor3f(1,0,0);
        glBegin(GL_POLYGON);
                glTexCoord2f(0.0,0.0);glVertex3f(0.0,0.0,0.0);
@@ -190,12 +190,12 @@ int glexpose_drawgraph(ViewInfo * view)
 //                     glCompDrawBegin();
 //                     OtkUpdateCheck();
 //                     glCompDrawEnd();
-                       glCompSetDraw(view->Topview->topviewmenu);
 //                     OtkDrawAll_scene( 0);
 
                }
                else
                        drawGraph(view->g[view->activeGraph]);  //xdot based drawing functions
+               glCompSetDraw(view->widgets);
                return 1;
     }
        return 0;
index f60491f700260196f63f6d70de79cec093f65752..521038bc0fca4b2dfb2eabf334d0dce8233f46ab 100755 (executable)
@@ -138,7 +138,6 @@ static void realize(GtkWidget * widget, gpointer data)
     smyrna_font = smyrnaPath("arial.tga");
 #endif
 
-       add_font(view->fontset,"Times 14");//wired in default font
        /*** OpenGL BEGIN ***/
     if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
        return;
@@ -262,7 +261,7 @@ static gboolean button_press_event(GtkWidget * widget,
 {
     if (view->graphCount)
        {
-               if (glCompSetClick(view->Topview->topviewmenu, (int) event->x, (int) event->y))
+               if (glCompSetClick(view->widgets, (int) event->x, (int) event->y))
            expose_event(view->drawing_area, NULL, NULL);
     }
 
@@ -313,7 +312,7 @@ static gboolean button_release_event(GtkWidget * widget,
        if (event->button == 1) //left click release
     {
                if (glCompSetRelease
-           (view->Topview->topviewmenu, (int) event->x_root,
+           (view->widgets, (int) event->x_root,
             (int) event->y_root))              {
                         expose_event(view->drawing_area, NULL, NULL);  }
        view->mouse.mouse_down = 0;
@@ -582,7 +581,6 @@ void create_window(GdkGLConfig * glconfig, GtkWidget * vbox)
      */
 
     gdk_gl_query_version(&major, &minor);
-    g_print("\nOpenGL extension version - %d.%d\n", major, minor);
 
     /* Try double-buffered visual */
 
index c87ca5f0b974731ba60bcb9ce4d450810336f3f3..69b4f8ad996102e6a40f8cdf399731d5194739ef 100755 (executable)
@@ -162,7 +162,7 @@ void graph_select_change(GtkWidget * widget, gpointer user_data)
 
 
     if (!view->SignalBlock) {
-       active_graph = gtk_combo_box_get_active((GtkComboBox *) widget);
+       active_graph = gtk_combo_box_get_active((GtkComboBox*) widget);
 
        if (active_graph > -1) {
            view->activeGraph = active_graph;
index a2959c21a2f9c4934a27807c696c2ea2b69238dc..ac9aada6f014341d9b1e91801cc5a3702683531b 100755 (executable)
@@ -303,7 +303,7 @@ int update_graph_properties(Agraph_t * graph)       //updates graph from gui
 
 
     //check if the engine has been changed, if so do new layout
-    if (GD_Engine(graph) != gtk_combo_box_get_active((GtkComboBox *)
+/*    if (GD_Engine(graph) != gtk_combo_box_get_active((GtkComboBox *)
                                 glade_xml_get_widget(xml, "cbLayout"))) {
        Dlg =
            (GtkMessageDialog *) gtk_message_dialog_new(NULL,
@@ -319,7 +319,7 @@ int update_graph_properties(Agraph_t * graph)       //updates graph from gui
                                                     (xml, "cbLayout")),
                            0);
        gtk_object_destroy((GtkObject *) Dlg);
-    }
+    }*/
     return 1;
 }
 
index a35566bc997c5615fd85068760ed94824ac4f0c6..915f525bf2474314fad03a0109555b46966996fc 100644 (file)
@@ -237,9 +237,9 @@ int load_settings_from_graph(Agraph_t * g)
     set_color_button_widget("topologicaltopviewcoarsestcolor",
                                         "settingsColorBtn9");
 
-    set_color_button_widget("topologicaltopviewfinestcolor",
+    set_color_button_widget("topologicalfisheyefinestcolor",
                            "settingsColorBtn10");
-    set_color_button_widget("topologicaltopviewcoarsestcolor   ",
+    set_color_button_widget("topologicalfisheyecoarsestcolor",
                            "settingsColorBtn11");
 
 
index 55512a789eed8fb3efcaa74814292da60e677fca..b5ddae26cb51982f8781da4e57d4a21bf4835dff 100644 (file)
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="mspng.lib gtk-win32-2.0.lib asprintf.lib atk-1.0.lib bz2.lib cairo.lib charset.lib croco-0.6.lib expat.lib expatw.lib glade-2.0.lib fontconfig.lib freetype.lib gdk_pixbuf-2.0.lib gdkglext-win32-1.0.lib gdk-win32-2.0.lib glib-2.0.lib gmodule-2.0.lib gobject-2.0.lib gsf-1.lib gsf-win32-1.lib gthread-2.0.lib gtkglext-win32-1.0.lib iconv.lib intl.lib jpeg.lib libexpat.lib libexpatw.lib pango-1.0.lib pangocairo-1.0.lib pangoft2-1.0.lib pangowin32-1.0.lib popt.lib rsvg-2.lib tiff.lib xml2.lib libgdkglext-win32-1.0.dll.a libgtkglext-win32-1.0.dll.a glu32.lib opengl32.lib ltdl.lib hs_regex.lib zdll.lib gladeui-1.lib glcomp.lib cgraph.lib gvc.lib xdot.lib topfish.lib ingraphs.lib neatogen.lib gts.lib $(NOINHERIT)"
+                               AdditionalDependencies="mspng.lib gtk-win32-2.0.lib asprintf.lib atk-1.0.lib bz2.lib cairo.lib charset.lib croco-0.6.lib expat.lib expatw.lib glade-2.0.lib fontconfig.lib freetype.lib gdk_pixbuf-2.0.lib gdkglext-win32-1.0.lib gdk-win32-2.0.lib glib-2.0.lib gmodule-2.0.lib gobject-2.0.lib gsf-1.lib gsf-win32-1.lib gthread-2.0.lib gtkglext-win32-1.0.lib iconv.lib intl.lib jpeg.lib libexpat.lib libexpatw.lib pango-1.0.lib pangocairo-1.0.lib pangoft2-1.0.lib pangowin32-1.0.lib popt.lib rsvg-2.lib tiff.lib xml2.lib libgdkglext-win32-1.0.dll.a libgtkglext-win32-1.0.dll.a glu32.lib opengl32.lib ltdl.lib regex_win32.lib zdll.lib gladeui-1.lib glcomp.lib cgraph.lib gvc.lib xdot.lib topfish.lib ingraphs.lib neatogen.lib gts.lib $(NOINHERIT)"
                                OutputFile="c:/graphviz-ms/bin/$(ProjectName).exe"
                                LinkIncremental="2"
                                AdditionalLibraryDirectories="C:\glade_setup\lib;&quot;C:\graphviz-ms\bin&quot;;C:\gtk\lib;C:\GnuWin32\lib;&quot;C:\Projects\graphviz2\lib\zlib-1.2.3\lib&quot;;C:\Projects\cairo_build\lib;C:\Projects\ATT\GTK\GTKTest2\lib;C:\GtkGLExt\1.0\lib;C:\GTK\2.0\bin;C:\GTK\2.0\lib"
index 605999febc20f7bc31ff4dc7e62caa05079b519a..868d5d57cead9d9b01b80b4c8201034423aefbb4 100644 (file)
@@ -178,7 +178,6 @@ typedef struct {
     int Nodecount;
     int Edgecount;
     int limits[4];
-    glCompSet *topviewmenu;    //for novice user open gl menu
     topviewdata *TopviewData;
     void *customptr;
     Hierarchy *h;
@@ -499,7 +498,8 @@ typedef struct _ViewInfo
        gvk_layout dfltEngine;
        GtkTextBuffer* consoleText;
        float FontSizeConst;
-       fontset_t* fontset;
+    glCompSet *widgets;        //for novice user open gl menu
+
 } ViewInfo;
 
 extern ViewInfo *view;
index 2808f5ccce376e54fbdd477413bd3d7cffdc3353..cf5783b8287aeebd851b1b3998d900c450d34dc4 100644 (file)
@@ -421,13 +421,11 @@ void drawtopfishnodelabels(topview* t)
                                if((v==t->fs->foci_nodes[0]) &&(focusnodes))
                                {
                                        glColor4f((float)0, (float)0, (float)1, (float)1);
-                                       view->fontset->fonts[view->fontset->activefont]->fontheight=fs;
                                        glprintfglut(GLUT_BITMAP_HELVETICA_18,gg[v].physical_x_coord,gg[v].physical_y_coord,buf);
                                }
                                else if (finenodes)
                                {
                                        glColor4f(0, 0, 0, 1);
-                                       view->fontset->fonts[view->fontset->activefont]->fontheight=fs;
                                        glprintfglut(GLUT_BITMAP_HELVETICA_10,gg[v].physical_x_coord,gg[v].physical_y_coord,buf);
                                }
                        }
index 0c18463209c342175036cdc1150a6c79483e6b0b..c8acf2657275227d3a360c778f42fbf6252fac44 100755 (executable)
@@ -42,7 +42,7 @@ static float dy = 0.0;
 static float dz = 0.0;
 
    /* Forward declarations */
-static glCompSet *glcreate_gl_topview_menu(void);
+glCompSet *glcreate_gl_topview_menu(void);
 static void set_boundaries(topview * t);
 static void set_topview_options(void);
 static int draw_topview_label(topview_node * v, float zdepth);
@@ -61,8 +61,6 @@ void cleartopview(topview * t)
     free(t->Nodes);
     /*clear edges */
     free(t->Edges);
-    /*clear gl menu */
-    glCompSetClear(t->topviewmenu);
     free(t);
 }
 
@@ -109,8 +107,6 @@ void preparetopview(Agraph_t * g, topview * t)
 
     t->Nodes = N_GNEW(agnnodes(g), topview_node);
 
-    printf("# of edges :%i\n", agnnodes(g));
-    printf("# of edges :%i\n", agnedges(g));
 
     /* malloc topviewdata */
     t->TopviewData = NEW(topviewdata);
@@ -239,15 +235,18 @@ void preparetopview(Agraph_t * g, topview * t)
                }
                ind++;
     }
-    t->Nodecount = ind;
+       view->widgets =glcreate_gl_topview_menu();
+//     view->widgets->fontset = fontset_init();
+//     add_font(view->widgets->fontset,"Times 14");//wired in default font
+
+       t->Nodecount = ind;
     t->Edgecount = ind2;
     view->fmg.fisheye_distortion_fac = 5;      //need to be hooked to a widget
     set_boundaries(t);
     set_update_required(t);
-    t->topviewmenu = glcreate_gl_topview_menu();
        //set componenet set's  font with already loaded default font.This will be inherited by all components added to this set as default
     attach_camera_widget(view);
-    load_host_buttons(t, g, t->topviewmenu);
+    load_host_buttons(t, g, view->widgets);
     t->h = '\0';
     if (view->dfltViewType == VT_TOPFISH)
        t->is_top_fisheye = 1;
@@ -256,6 +255,8 @@ void preparetopview(Agraph_t * g, topview * t)
 
     t->picked_node_count = 0;
     t->picked_nodes = '\0';
+
+
 }
 /*
        this function calculates and sets node size(opengl dots, they are squares not a dots
@@ -649,7 +650,7 @@ static int draw_node_hint_boxes(void)
                          (GLfloat) fs,agnameof(view->Topview->picked_nodes[ind]->Node)
                          )
                          ;
-               view->fontset->fonts[view->fontset->activefont]->fontheight=fs;
+               view->widgets->fontset->fonts[view->widgets->fontset->activefont]->fontheight=fs;
        /*blue font color*/
 //     fontwidth=GetOGLDistance(glutBitmapLength(GLUT_BITMAP_HELVETICA_12,agnameof(view->Topview->picked_nodes[ind]->Node)));
        glColor4f(0, 0, 1, 1);
@@ -1419,15 +1420,18 @@ static char *smyrna_icon_zoomminus;
 static char *smyrna_icon_fisheye;
 static char *smyrna_icon_rotate;
 
-static glCompSet *glcreate_gl_topview_menu(void)
+glCompSet *glcreate_gl_topview_menu(void)
 {
 
     glCompSet *s = glCompSetNew();
     glCompPanel *p;
     glCompButton *b;
     glCompLabel *l;
+       s->fontset=fontset_init();
+       /*add a glut font*/
+       add_glut_font(s->fontset,GLUT_BITMAP_HELVETICA_12);     
+       s->fontset->activefont=0;
 
-    copy_font(s->font,view->fontset->fonts[view->fontset->activefont]);
        /* GtkRequisition requisition; *//* What??*/
     if (!smyrna_icon_pan) {
 #ifdef _WIN32
index 92a0c96c78222dbef661dade2b6ccbdb6a0869e1..db396a483be7e4dda39119f6d6e8f3a9901c755c 100755 (executable)
@@ -84,56 +84,6 @@ set_viewport_settings_from_template(ViewInfo * view, Agraph_t * g)
 {
     gvcolor_t cl;
     char *buf;
-#if 0
-    graph[antialiasing = 1,
-         bgcolor = "#ffffff",
-         bordercolor = "#38eb29",
-         bordercoloralpha = "1",
-         bordervisible = "1",
-         defaultfontname = "1",
-         defaultfontsize = "52",
-         gridcolor = "#6033d8",
-         gridcoloralpha = "1",
-         gridvisible = "1",
-         highlightededgecolor = "#c41b50",
-         highlightededgecoloralpha = "1",
-         highlightednodecolor = "#d1cd24",
-         highlightednodecoloralpha = "1",
-         defaultlinewidth = "1"
-         nodesizewithdegree = "1",
-         randomizeedgecolors = "1",
-         randomizenodecolors = "1",
-         selectededgecolor = "#ffc0cb",
-         selectededgecoloralpha = "1",
-         selectednodecolor = "#8ce61d",
-         selectednodecoloralpha = "1",
-         gridcoloralpha = "1",
-         defaultmagnifierwidth = "300",
-         defaultmagnifierheight = "200",
-         defaultmagnifierkts = "5",
-         defaultfisheyemagnifierradius = "250"
-         defaultfisheyemagnifierdistort = "5",
-         usermode = "1",
-         topologicalfisheyefinenodes = "50",
-         topologicalfisheyecoarseningfactor = "2.5",
-         topologicalfisheyedistortionfactor = "1",
-         topologicalfisheyedist2limit = "1",
-         topologicalfisheyeanimate = "1",
-         topologicalfisheyelabelfinenodes = "1",
-         topologicalfisheyecolornodes = "1",
-         topologicalfisheyecoloredges = "1",
-         topologicalfisheyelabelfocus = "1",
-         topologicalfisheyefinestcolor = "red",
-         topologicalfisheyecoarsestcolor = "green",
-         drawnodes="1",
-         drawedges="1"]
-       ;
-
-         
-
-
-    border color
-#endif
      colorxlate(get_attribute_value("bordercolor", view, g), &cl,
                RGBA_DOUBLE);
     view->borderColor.R = (float) cl.u.RGBA[0];
@@ -391,7 +341,6 @@ void init_viewport(ViewInfo * view)
        view->frame_length=1;
        /*add a call back to the main()*/
        g_timeout_add_full((gint)G_PRIORITY_DEFAULT,(guint)100,gl_main_expose,NULL,NULL);
-       view->Topview->topviewmenu = '\0';
        view->cameras='\0';;
        view->camera_count=0;
        view->active_camera=-1;
@@ -401,7 +350,6 @@ void init_viewport(ViewInfo * view)
     view->dfltEngine = GVK_NONE;
 
        //create fontset
-    view->fontset = fontset_init();
 }
 
 
@@ -831,8 +779,9 @@ int add_graph_to_viewport_from_file(char *fileName)
        view->g[view->graphCount - 1] = graph;
        view->activeGraph = view->graphCount - 1;
        //GUI update , graph combo box on top-right should be updated
-       load_settings_from_graph(view->default_attributes);
+       load_settings_from_graph(view->g[view->activeGraph]);
        update_graph_from_settings(view->g[view->activeGraph]);
+    set_viewport_settings_from_template(view, view->g[view->activeGraph]);
        refreshControls(view);
        return 1;
     } else
index c5e1a45c6ef98af6f3f33a333c58d98ef6c59f7f..a1e24ec4aaddefd708185f108b42c2ce8815b794 100644 (file)
@@ -169,7 +169,7 @@ void attach_camera_widget(ViewInfo * view)
     char buf[256];
     glCompPanel *p;
     glCompButton *b;
-    glCompSet *s = view->Topview->topviewmenu;
+       glCompSet *s = view->widgets;
     int p_height;
     /*first we need to get rid of the old menu */
     for (ind = 0; ind < s->panelcount; ind++) {