smyrna changes to pick opbjects in 3d space
authorarif <devnull@localhost>
Tue, 14 Jul 2009 21:14:51 +0000 (21:14 +0000)
committerarif <devnull@localhost>
Tue, 14 Jul 2009 21:14:51 +0000 (21:14 +0000)
22 files changed:
cmd/gvpr/gvpr.vcproj
cmd/gvpr/gvprmain.c
cmd/smyrna/draw.c
cmd/smyrna/gltemplate.c
cmd/smyrna/gui/beacon.c
cmd/smyrna/gui/beacon.h
cmd/smyrna/gvprpipe.c
cmd/smyrna/smyrna.vcproj
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topfisheyeview.c
cmd/smyrna/topview.c
graphviz.sln
lib/glcomp/glcompbutton.c
lib/glcomp/glcomplabel.c
lib/glcomp/glcomptext.c
lib/glcomp/glcomptext.h
lib/glcomp/glutils.c
lib/glcomp/glutils.h
lib/gvpr/Makefile.am
lib/gvpr/gvpr.c
plugin/gdiplus/gvplugin_gdiplus.cpp
plugin/gdiplus/gvplugin_gdiplus.vcproj

index df3562a470c342c3c9cf5298baaa6ac733e03791..d816cda611f593f1eebc50a08d1cc872f2c681de 100644 (file)
@@ -39,7 +39,7 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="&quot;$(SolutionDir)/windows/lib/ingraphs&quot;;&quot;$(SolutionDir)/lib/ingraphs&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;&quot;$(SolutionDir)/libltdl&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/agutil&quot;;&quot;$(SolutionDir)/windows/lib/cdt&quot;;&quot;$(SolutionDir)/&quot;;&quot;$(SolutionDir)/lib/graph&quot;;&quot;$(SolutionDir)/lib/vpsc&quot;;&quot;$(SolutionDir)/lib/vmalloc&quot;;&quot;$(SolutionDir)/lib/twopigen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/sfio&quot;;&quot;$(SolutionDir)/lib/sfpdpgen&quot;;&quot;$(SolutionDir)/lib/rbtree&quot;;&quot;$(SolutionDir)/lib/pathplan&quot;;&quot;$(SolutionDir)/lib/patchwork&quot;;&quot;$(SolutionDir)/lib/pack&quot;;&quot;$(SolutionDir)/lib/ortho&quot;;&quot;$(SolutionDir)/lib/inkpot&quot;;&quot;$(SolutionDir)/lib/gd&quot;;&quot;$(SolutionDir)/lib/filter&quot;;&quot;$(SolutionDir)/lib/fdpgen&quot;;&quot;$(SolutionDir)/lib/expr&quot;;&quot;$(SolutionDir)/lib/dotgen&quot;;&quot;$(SolutionDir)/lib/circogen&quot;;&quot;$(SolutionDir)/lib/ast&quot;;&quot;$(SolutionDir)/lib/agraph&quot;;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvc&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/cmd/gvpr&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;"
+                               AdditionalIncludeDirectories="&quot;$(SolutionDir)/windows/lib/ingraphs&quot;;&quot;$(SolutionDir)/lib/ingraphs&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;&quot;$(SolutionDir)/libltdl&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/agutil&quot;;&quot;$(SolutionDir)/windows/lib/cdt&quot;;&quot;$(SolutionDir)/&quot;;&quot;$(SolutionDir)/lib/graph&quot;;&quot;$(SolutionDir)/lib/vpsc&quot;;&quot;$(SolutionDir)/lib/vmalloc&quot;;&quot;$(SolutionDir)/lib/twopigen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/sfio&quot;;&quot;$(SolutionDir)/lib/sfpdpgen&quot;;&quot;$(SolutionDir)/lib/rbtree&quot;;&quot;$(SolutionDir)/lib/pathplan&quot;;&quot;$(SolutionDir)/lib/patchwork&quot;;&quot;$(SolutionDir)/lib/pack&quot;;&quot;$(SolutionDir)/lib/ortho&quot;;&quot;$(SolutionDir)/lib/inkpot&quot;;&quot;$(SolutionDir)/lib/gd&quot;;&quot;$(SolutionDir)/lib/filter&quot;;&quot;$(SolutionDir)/lib/fdpgen&quot;;&quot;$(SolutionDir)/lib/expr&quot;;&quot;$(SolutionDir)/lib/dotgen&quot;;&quot;$(SolutionDir)/lib/circogen&quot;;&quot;$(SolutionDir)/lib/ast&quot;;&quot;$(SolutionDir)/lib/agraph&quot;;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvc&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/cmd/gvpr&quot;;&quot;$(SolutionDir)/lib/gvpr&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;"
                                PreprocessorDefinitions="MSWIN32;WIN32;_DEBUG;_WINDOWS;HAVE_CONFIG_H;WIN32_DLL;GVDLL"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="3"
@@ -61,7 +61,7 @@
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="sfio.lib ast.lib expr.lib cdt.lib gvc.lib ingraphs.lib vmalloc.lib cgraph.lib shlwapi.lib"
+                               AdditionalDependencies="sfio.lib ast.lib expr.lib cdt.lib gvc.lib ingraphs.lib vmalloc.lib cgraph.lib shlwapi.lib gvprlib.lib"
                                OutputFile="c:/graphviz-ms/bin/$(ProjectName).exe"
                                LinkIncremental="2"
                                AdditionalLibraryDirectories="C:\gtk\lib;&quot;C:\graphviz-ms\bin&quot;"
                        />
                        <Tool
                                Name="VCCLCompilerTool"
-                               AdditionalIncludeDirectories="&quot;$(SolutionDir)/windows/lib/ingraphs&quot;;&quot;$(SolutionDir)/lib/ingraphs&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;&quot;$(SolutionDir)/libltdl&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/agutil&quot;;&quot;$(SolutionDir)/windows/lib/cdt&quot;;&quot;$(SolutionDir)/&quot;;&quot;$(SolutionDir)/lib/graph&quot;;&quot;$(SolutionDir)/lib/vpsc&quot;;&quot;$(SolutionDir)/lib/vmalloc&quot;;&quot;$(SolutionDir)/lib/twopigen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/sfio&quot;;&quot;$(SolutionDir)/lib/sfpdpgen&quot;;&quot;$(SolutionDir)/lib/rbtree&quot;;&quot;$(SolutionDir)/lib/pathplan&quot;;&quot;$(SolutionDir)/lib/patchwork&quot;;&quot;$(SolutionDir)/lib/pack&quot;;&quot;$(SolutionDir)/lib/ortho&quot;;&quot;$(SolutionDir)/lib/inkpot&quot;;&quot;$(SolutionDir)/lib/gd&quot;;&quot;$(SolutionDir)/lib/filter&quot;;&quot;$(SolutionDir)/lib/fdpgen&quot;;&quot;$(SolutionDir)/lib/expr&quot;;&quot;$(SolutionDir)/lib/dotgen&quot;;&quot;$(SolutionDir)/lib/circogen&quot;;&quot;$(SolutionDir)/lib/ast&quot;;&quot;$(SolutionDir)/lib/agraph&quot;;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvc&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/cmd/gvpr&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;"
+                               AdditionalIncludeDirectories="&quot;$(SolutionDir)/lib/gvpr&quot;;&quot;$(SolutionDir)/windows/lib/ingraphs&quot;;&quot;$(SolutionDir)/lib/ingraphs&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;&quot;$(SolutionDir)/libltdl&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/agutil&quot;;&quot;$(SolutionDir)/windows/lib/cdt&quot;;&quot;$(SolutionDir)/&quot;;&quot;$(SolutionDir)/lib/graph&quot;;&quot;$(SolutionDir)/lib/vpsc&quot;;&quot;$(SolutionDir)/lib/vmalloc&quot;;&quot;$(SolutionDir)/lib/twopigen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/sfio&quot;;&quot;$(SolutionDir)/lib/sfpdpgen&quot;;&quot;$(SolutionDir)/lib/rbtree&quot;;&quot;$(SolutionDir)/lib/pathplan&quot;;&quot;$(SolutionDir)/lib/patchwork&quot;;&quot;$(SolutionDir)/lib/pack&quot;;&quot;$(SolutionDir)/lib/ortho&quot;;&quot;$(SolutionDir)/lib/inkpot&quot;;&quot;$(SolutionDir)/lib/gd&quot;;&quot;$(SolutionDir)/lib/filter&quot;;&quot;$(SolutionDir)/lib/fdpgen&quot;;&quot;$(SolutionDir)/lib/expr&quot;;&quot;$(SolutionDir)/lib/dotgen&quot;;&quot;$(SolutionDir)/lib/circogen&quot;;&quot;$(SolutionDir)/lib/ast&quot;;&quot;$(SolutionDir)/lib/agraph&quot;;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvc&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/cmd/gvpr&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;HAVE_CONFIG_H;WIN32_DLL;GVDLL"
                                RuntimeLibrary="2"
                                UsePrecompiledHeader="0"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="cgraph.lib sfio.lib ast.lib expr.lib cdt.lib gvc.lib ingraphs.lib vmalloc.lib shlwapi.lib"
+                               AdditionalDependencies="cgraph.lib sfio.lib ast.lib expr.lib cdt.lib gvc.lib ingraphs.lib vmalloc.lib shlwapi.lib gvprlib.lib"
                                OutputFile="c:/graphviz-ms/bin/$(ProjectName).exe"
                                LinkIncremental="2"
                                AdditionalLibraryDirectories="C:\graphviz-ms\bin;C:\gtk\lib"
                        Filter="h;hpp;hxx;hm;inl;inc;xsd"
                        UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
                        >
-                       <File
-                               RelativePath=".\actions.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\compile.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\gprstate.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\parse.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\queue.h"
-                               >
-                       </File>
                </Filter>
                <Filter
                        Name="Resource Files"
                        UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
                        >
                        <File
-                               RelativePath=".\actions.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\compile.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\gprstate.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\gvpr.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\parse.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\queue.c"
+                               RelativePath=".\gvprmain.c"
                                >
                        </File>
                </Filter>
index 3c09f7aabe591a0af1e6c9dcdb4a4e917f33116f..4c434099156eb057450e01ed7b049f4d906a78fb 100644 (file)
@@ -31,6 +31,9 @@
 #else
 #include "compat_unistd.h"
 #endif
+
+
+
 #include "gvpr.h"
 
 #ifdef DEBUG
index aeeced1ea17892f1e1e0596024137c716aa40f3c..8e5e230b6cbcc5dc82d70785d4b727d4366e055c 100755 (executable)
@@ -480,7 +480,7 @@ static void EmbedText(xdot_op * op, int param)
     if (param == 1)            //selected
        fontColor(view->widgets->fontset->fonts[view->widgets->fontset->activefont],view->selectedNodeColor.R, view->selectedNodeColor.G,
                  view->selectedNodeColor.B,1);
-       glprintf(view->widgets->fontset->fonts[view->widgets->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)0,
                   (GLfloat)op->u.text.width, op->u.text.text);
 }
 
@@ -942,6 +942,7 @@ int draw_node_hintbox_gl_line(GLfloat x,GLfloat y,GLfloat z,GLfloat fs,char* tex
 int draw_node_hintbox(GLfloat x,GLfloat y,GLfloat z,GLfloat fs,char* text)
 {
        
+
        glColor3f(1,1,0);
                draw_node_hintbox_gl_polygon(x,y,z,fs,text);
        glColor3f(0,0,1);
index 89a7801fc597dcd3679ec9d0efa222dfc0c5dfc2..e0567f7e487c5a68acbfd2c076e0a9051226f2fd 100755 (executable)
@@ -326,63 +326,61 @@ static gboolean button_release_event(GtkWidget * widget,
 
        if (event->button == 1) //left click release
     {
-               if (glCompSetRelease
-           (view->widgets, (int) event->x_root,
-            (int) event->y_root))              {
-                        expose_event(view->drawing_area, NULL, NULL);  }
-       view->mouse.mouse_down = 0;
-       if ((view->mouse.mouse_mode == MM_RECTANGULAR_SELECT)
-           || (view->mouse.mouse_mode == MM_RECTANGULAR_X_SELECT)) {
-           if (view->GLx <= view->GLx2)
-               view->Selection.X = view->GLx;
-           else
-               view->Selection.X = view->GLx2;
-           if (view->GLy <= view->GLy2)
-               view->Selection.Y = view->GLy;
-           else
-               view->Selection.Y = view->GLy2;
-           view->Selection.W = view->GLx2 - view->GLx;
-           if (view->Selection.W < 0)
-               view->Selection.W = view->Selection.W * -1;
-           view->Selection.H = view->GLy2 - view->GLy;
-           if (view->Selection.H < 0)
-               view->Selection.H = view->Selection.H * -1;
-           if (view->mouse.mouse_mode == 4)
-               view->Selection.Type = 1;
-           else
-               view->Selection.Type = 2;
-           view->Selection.Active = 1;
-           expose_event(view->drawing_area, NULL, NULL);
-       }
+               if (glCompSetRelease(view->widgets, (int) event->x_root,(int) event->y_root))           
+               {
+                        expose_event(view->drawing_area, NULL, NULL);  
+               }
+               view->mouse.mouse_down = 0;
+               if ((view->mouse.mouse_mode == MM_RECTANGULAR_SELECT)
+                       || (view->mouse.mouse_mode == MM_RECTANGULAR_X_SELECT)) 
+               {
+                       if (view->GLx <= view->GLx2)
+                               view->Selection.X = view->GLx;
+                       else
+                               view->Selection.X = view->GLx2;
+                       if (view->GLy <= view->GLy2)
+                               view->Selection.Y = view->GLy;
+                       else
+                               view->Selection.Y = view->GLy2;
+                       view->Selection.W = view->GLx2 - view->GLx;
+                       if (view->Selection.W < 0)
+                               view->Selection.W = view->Selection.W * -1;
+                       view->Selection.H = view->GLy2 - view->GLy;
+                       if (view->Selection.H < 0)
+                               view->Selection.H = view->Selection.H * -1;
+                       if (view->mouse.mouse_mode == 4)
+                               view->Selection.Type = 1;
+                       else
+                               view->Selection.Type = 2;
+                       view->Selection.Active = 1;
+                       expose_event(view->drawing_area, NULL, NULL);
+               }
 
-       if (view->mouse.mouse_mode == MM_MOVE) {
-               move_TVnodes();
-       }
+               if (view->mouse.mouse_mode == MM_MOVE)
+                       move_TVnodes();
 
-       if ((view->mouse.mouse_mode == MM_FISHEYE_MAGNIFIER) || (view->mouse.mouse_mode == MM_MAGNIFIER))       //fisheye mag mouse release, stop distortion
-       {
-           originate_distorded_coordinates(view->Topview);
-           expose_event(view->drawing_area, NULL, NULL);
-       }
-       if (view->mouse.mouse_mode==MM_PAN)
+               if ((view->mouse.mouse_mode == MM_FISHEYE_MAGNIFIER) || (view->mouse.mouse_mode == MM_MAGNIFIER))       //fisheye mag mouse release, stop distortion
                {
+                       originate_distorded_coordinates(view->Topview);
                        expose_event(view->drawing_area, NULL, NULL);
-
                }
-
+               if (view->mouse.mouse_mode==MM_PAN)
+                       expose_event(view->drawing_area, NULL, NULL);
        }
     if (event->button == 3)    //right click
        {
+               to3D(view->mouse.mouse_X,view->mouse.mouse_Y, &view->mouse.GLX, &view->mouse.GLY,&view->mouse.GLZ);
+               pick_node_from_coords(view->mouse.GLX,view->mouse.GLY,view->mouse.GLZ);
 
                if (view->activeGraph >= 0)
                {
                        if(view->Topview->is_top_fisheye)
                        {
-                               GetFixedOGLPoslocal((int) event->x, (int) event->y,view->GLDepth, &(view->GLx2),&(view->GLy2), &(view->GLz2));
+                               GetFixedOGLPoslocal((int) event->x, (int) event->y, &(view->GLx2),&(view->GLy2), &(view->GLz2));
                                changetopfishfocus(view->Topview, &view->GLx2, &view->GLy2, 0,1);
-                               expose_event(view->drawing_area, NULL, NULL);
                        }
                }
+               expose_event(view->drawing_area, NULL, NULL);
        }
 
     dx = 0.0;
index 47afe930c4f17217457cdd3c63288dedf13d793f..f3e797196b0e69cc8e9404b04d23cc10a8e9c7a7 100644 (file)
 #include "selection.h"
 #include "gltemplate.h"
 #include "toolboxcallbacks.h"
+typedef struct tagXYZ
+{
+    float X, Y, Z;
+}
+XYZ;
+void pick_node_from_coords(float x,float y,float z)
+{
+       topview_node* n;
+       topview_node* sn;       /*selected node , closest node*/
+       topview_edge* e;
+       topview_edge* se;/*selected edge , closest one*/
+       GLfloat closest_dif = 1000;
+       GLfloat closest_dif2 = 1000;
+       static char buf[512];
+       float a, b,c;
+       int ind;
+       sn=(topview_node*)0;
+       se=(topview_edge*)0;
+
+       for (ind = 0; ind < view->Topview->Nodecount; ind++) 
+       {
+               n = &view->Topview->Nodes[ind];
+               a = ABS(n->distorted_x - view->mouse.GLX);
+               b = ABS(n->distorted_y - view->mouse.GLY);
+               c = ABS(n->distorted_z - view->mouse.GLZ);
+               a = (float) pow((a * a + b * b+ c*c), (float) 0.5);
+               if (a < closest_dif)
+               {
+                       sn=n;
+                       closest_dif=a;
+               }
+       }
+
+       for (ind = 0; ind < view->Topview->Edgecount; ind++) 
+       {
+               XYZ p1,p2,p3;
+               e = &view->Topview->Edges[ind];
+
+               p1.X=e->Node1->distorted_x;
+               p1.Y=e->Node1->distorted_y;
+               p1.Z=e->Node1->distorted_z;
+
+               p2.X=e->Node2->distorted_x;
+               p2.Y=e->Node2->distorted_y;
+               p2.Z=e->Node2->distorted_z;
+
+               p3.X=view->mouse.GLX;
+               p3.Y=view->mouse.GLY;
+               p3.Z=view->mouse.GLZ;
+               if(DistancePointLine( &p3, &p1, &p2, &a))
+               {
+                       if (a < closest_dif2 )
+                       {
+                               se=e;
+                               closest_dif2=a;
+                       }
+               }
+       }
+
+       if (closest_dif < closest_dif2 * 10)
+       {
+               if (sn)
+               {
+                       if (!is_node_picked(sn)) 
+                               add_to_pick_list(sn);
+                       else
+                               remove_from_pick_list(sn);
+               }
+       }
+       else
+       {
+               if (se)
+               {
+                       if (!is_edge_picked(se)) 
+                               add_edge_to_pick_list(se);
+                       else
+                               remove_edge_from_pick_list(se);
+               }
+       }
+
+}
 
-int pick_node(topview_node * n)
+
+
+
+
+
+
+/*int pick_node(topview_node * n)
 {
     static int closest_dif = 3;
        static char buf[512];
        float a, b;
-    a = ABS(n->distorted_x - view->GLx);
-    b = ABS(n->distorted_y - view->GLy);
+       a = ABS(n->distorted_x - view->mouse.GLX);
+    b = ABS(n->distorted_y - view->mouse.GLY);
     a = (float) pow((a * a + b * b), (float) 0.5);
     if (a < closest_dif) {
        if (!is_node_picked(n)) {
@@ -22,8 +109,6 @@ int pick_node(topview_node * n)
            return 0;
        } else {
            if (remove_from_pick_list(n)) {
-//             printf("node has been unpicked ,name:%s\n",
-//                    agnameof(n->Node));
                return 1;
            }
            return 0;
@@ -31,7 +116,7 @@ int pick_node(topview_node * n)
     }
     return 0;
 
-}
+}*/
 
 int is_node_picked(topview_node * n)
 {
@@ -48,7 +133,8 @@ int remove_from_pick_list(topview_node * n)
 {
     int ind = 0;
     int found = 0;
-    for (; ind < view->Topview->picked_node_count; ind++) {
+       printf("removed\n");
+       for (; ind < view->Topview->picked_node_count; ind++) {
        if ((view->Topview->picked_nodes[ind] == n) && (!found))
            found = 1;
        if ((found) && (ind < (view->Topview->picked_node_count - 1))) {
@@ -70,40 +156,149 @@ int remove_from_pick_list(topview_node * n)
 int add_to_pick_list(topview_node * n)
 {
     view->Topview->picked_node_count++;
-    view->Topview->picked_nodes =
-       realloc(view->Topview->picked_nodes,
-               sizeof(topview_node *) * view->Topview->picked_node_count);
+    view->Topview->picked_nodes =realloc(view->Topview->picked_nodes,sizeof(topview_node *) * view->Topview->picked_node_count);
     view->Topview->picked_nodes[view->Topview->picked_node_count - 1] = n;
+       printf("picked count:%d\n",view->Topview->picked_node_count);
     return 1;
+}
 
+int is_edge_picked(topview_edge * e)
+{
+    int ind = 0;
+    int found = 0;
+    for (; ind < view->Topview->picked_edge_count; ind++) {
+       if ((view->Topview->picked_edges[ind] == e) && (!found))
+           return 1;
+    }
+    return 0;
 }
 
+int remove_edge_from_pick_list(topview_edge * e)
+{
+    int ind = 0;
+    int found = 0;
+       printf("removed\n");
+       for (; ind < view->Topview->picked_edge_count; ind++) 
+       {
+               if ((view->Topview->picked_edges[ind] == e) && (!found))
+                       found = 1;
+               if ((found) && (ind < (view->Topview->picked_edge_count - 1))) 
+               {
+                       view->Topview->picked_edges[ind] = view->Topview->picked_edges[ind + 1];
+               }
+    }
+    if (found) 
+       {
+               view->Topview->picked_edge_count--;
+               view->Topview->picked_edges =realloc(view->Topview->picked_edges,sizeof(topview_edge *) *view->Topview->picked_edge_count);
+               return 1;
+    }
+    return 0;
+}
+
+int add_edge_to_pick_list(topview_edge * e)
+{
+    view->Topview->picked_edge_count++;
+    view->Topview->picked_edges =realloc(view->Topview->picked_edges,sizeof(topview_edge *) * view->Topview->picked_edge_count);
+    view->Topview->picked_edges[view->Topview->picked_edge_count - 1] = e;
+       printf("picked edge count:%d\n",view->Topview->picked_edge_count);
+    return 1;
+}
+
+
+
+
 
 
 
 int draw_node_hint_boxes(void)
 {
     int ind;
-    /* int fs = 12; */
-    for (ind = 0; ind < view->Topview->picked_node_count; ind++) 
+    float fs = GetOGLDistance(12);
+    char* lbl;
+    topview_node* n;
+    topview_edge* e;
+    double dx, dy, dz;
+       char buf[512];
+
+    view->widgets->fontset->fonts[view->widgets->fontset->activefont]->fontheight=fs;
+
+
+       for (ind = 0; ind < view->Topview->picked_node_count; ind++) 
+       {
+               n = view->Topview->picked_nodes[ind];
+               lbl = agnameof(n->Node);
+               dx = n->distorted_x;
+               dy = n->distorted_y;
+               dz = n->distorted_z;
+
+
+               /*blue font color*/
+               glColor4f(0, 0, 1, 1);
+               glprintfglut (GLUT_BITMAP_HELVETICA_12, dx,dy,dz,"[");
+               glprintfglut (GLUT_BITMAP_HELVETICA_12, dx,(dy+fs+fs/(GLfloat)5.0),dz,lbl);
+    }
+       glLineWidth(5);
+       glColor4f(0, 1, 0, 0.5);
+       glBegin(GL_LINES);
+       for (ind = 0; ind < view->Topview->picked_edge_count; ind++) 
        {
-               draw_node_hintbox(view->Topview->picked_nodes[ind]->distorted_x,
-                         view->Topview->picked_nodes[ind]->distorted_y,
-                                       view->Topview->picked_nodes[ind]->distorted_z+(float)0.001,
-                                       (GLfloat) view->FontSizeConst,
-                                    agnameof(view->Topview->picked_nodes[ind]->Node));
-/*     fontSize(fs);
-       fontColorA(0, 0, 1, 1);
-       glprintf((int)
-                      (view->Topview->picked_nodes[ind]->distorted_x -
-                       fs / 3 + 1 - fs),
-                      (int) (view->Topview->picked_nodes[ind]->
-                             distorted_y + fs + 1),
-                      agnameof(view->Topview->picked_nodes[ind]->Node),
-                      fs *
-                      strlen(agnameof
-                             (view->Topview->picked_nodes[ind]->Node)) /
-                      2);*/
+               float x1,x2,x3,y1,y2,y3,z1,z2,z3l;
+               e = view->Topview->picked_edges[ind];
+                       x1=e->Node1->distorted_x;
+                       x2=e->Node2->distorted_x;
+                       y1=e->Node1->distorted_y;
+                       y2=e->Node2->distorted_y;
+                       z1=e->Node1->distorted_z;
+                       z2=e->Node2->distorted_z;
+
+               dx = (x1+x2)/2.0;
+               dy = (y1+y2)/2.0;
+               dz = (z1+z2)/2.0;
+
+
+               glVertex3f(x1,y1,z1);
+               glVertex3f(x2,y2,z2);
+
+
+               /*blue font color*/
+               glprintfglut (GLUT_BITMAP_HELVETICA_12, dx,dy,dz,"[");
+               glprintfglut (GLUT_BITMAP_HELVETICA_12, dx,(dy+fs+fs/(GLfloat)5.0),dz,lbl);
     }
+       glEnd();
+       glLineWidth(0);
+
+       for (ind = 0; ind < view->Topview->picked_edge_count; ind++) 
+       {
+               buf[0]=(char*)0;
+               float x1,x2,x3,y1,y2,y3,z1,z2,z3l;
+               glColor4f(0, 1, 0, 0.5);
+               e = view->Topview->picked_edges[ind];
+                       x1=e->Node1->distorted_x;
+                       x2=e->Node2->distorted_x;
+                       y1=e->Node1->distorted_y;
+                       y2=e->Node2->distorted_y;
+                       z1=e->Node1->distorted_z;
+                       z2=e->Node2->distorted_z;
+
+                       strcat(buf,agnameof(e->Node1->Node));
+               strcat(buf," - ");
+               strcat(buf,agnameof(e->Node2->Node));
+
+               dx = (x1+x2)/2.0;
+               dy = (y1+y2)/2.0;
+               dz = (z1+z2)/2.0;
+
+
+
+               glColor4f(0, 0, 1, 1);
+
+               /*blue font color*/
+               glprintfglut (GLUT_BITMAP_HELVETICA_12, dx,dy,dz,"|");
+               glprintfglut (GLUT_BITMAP_HELVETICA_12, dx,(dy+fs+fs/(GLfloat)5.0),dz,buf);
+    }
+
+
     return 1;
 }
+
index b5eaa8404f53c3ae2bc740b3d4175818817149bf..7ddf05ae7748e983a5427e04d88a95b49b81978a 100644 (file)
@@ -6,6 +6,5 @@ int pick_node(topview_node * n);
 int is_node_picked(topview_node * n);
 int remove_from_pick_list(topview_node * n);
 int add_to_pick_list(topview_node * n);
-int draw_node_hint_boxes(void);
 
 #endif
index 3030eeb5153ae80edcfbcd595322599f8dbede21..c7105b7aaea861fbc3a1bfdd6405a14be50b56d7 100644 (file)
@@ -20,8 +20,9 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <glade/glade.h>
-#include <viewport.h> 
-#include <gltemplate.h> 
+
+//#include <viewport.h> 
+//#include <gltemplate.h> 
 
 #include <gvpr.h>
 
index 72ea120b6a64e5dbd004ce3eae653e6b7ea2d964..ada34581b655e964f8121ef6f8f3047c524a0088 100644 (file)
@@ -40,7 +40,7 @@
                                Name="VCCLCompilerTool"
                                AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
                                Optimization="0"
-                               AdditionalIncludeDirectories="&quot;$(SolutionDir)/lib/gvc&quot;;&quot;C:\gtk\include\libglade-2.0&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/topfish&quot;;&quot;C:\gtk\lib\gtkglext-1.0\include&quot;;&quot;C:\gtk\include\gtkglext-1.0\&quot;;C:\gtk\include\cairo;&quot;C:\gtk\include\atk-1.0&quot;;&quot;C:\gtk\lib\gtk-2.0\include\cairo&quot;;&quot;C:\gtk\lib\gtk-2.0\include&quot;;&quot;C:\gtk\include\gtk-2.0\&quot;;&quot;$(SolutionDir)/cmd/smyrna/gui&quot;;&quot;$(SolutionDir)/cmd/smyrna&quot;;&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)/lib/glcomp&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvpr&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;;&quot;$(SolutionDir)/lib/glut/glut-3.7.6-bin&quot;;&quot;$(SolutionDir)/lib/xdot&quot;"
+                               AdditionalIncludeDirectories="&quot;$(SolutionDir)/lib/expr&quot;;&quot;$(SolutionDir)/lib/vmalloc&quot;;&quot;$(SolutionDir)/lib/ast&quot;;&quot;$(SolutionDir)/lib/sfio&quot;;&quot;$(SolutionDir)/lib/gvc&quot;;&quot;C:\gtk\include\libglade-2.0&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/topfish&quot;;&quot;C:\gtk\lib\gtkglext-1.0\include&quot;;&quot;C:\gtk\include\gtkglext-1.0\&quot;;C:\gtk\include\cairo;&quot;C:\gtk\include\atk-1.0&quot;;&quot;C:\gtk\lib\gtk-2.0\include\cairo&quot;;&quot;C:\gtk\lib\gtk-2.0\include&quot;;&quot;C:\gtk\include\gtk-2.0\&quot;;&quot;$(SolutionDir)/cmd/smyrna/gui&quot;;&quot;$(SolutionDir)/cmd/smyrna&quot;;&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)/lib/glcomp&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvpr&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;;&quot;$(SolutionDir)/lib/glut/glut-3.7.6-bin&quot;;&quot;$(SolutionDir)/lib/xdot&quot;"
                                PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_TRIANGLE;HAVE_CONFIG_H;HAVE_GTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32_DLL"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="3"
                        />
                        <Tool
                                Name="VCCLCompilerTool"
-                               AdditionalIncludeDirectories="&quot;$(SolutionDir)/lib/gvc&quot;;&quot;C:\gtk\include\libglade-2.0&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/topfish&quot;;&quot;C:\gtk\lib\gtkglext-1.0\include&quot;;&quot;C:\gtk\include\gtkglext-1.0\&quot;;C:\gtk\include\cairo;&quot;C:\gtk\include\atk-1.0&quot;;&quot;C:\gtk\lib\gtk-2.0\include\cairo&quot;;&quot;C:\gtk\lib\gtk-2.0\include&quot;;&quot;C:\gtk\include\gtk-2.0\&quot;;&quot;$(SolutionDir)/cmd/smyrna/gui&quot;;&quot;$(SolutionDir)/cmd/smyrna&quot;;&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)/lib/glcomp&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvpr&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;;&quot;$(SolutionDir)/lib/glut/glut-3.7.6-bin&quot;;&quot;$(SolutionDir)/lib/xdot&quot;"
+                               AdditionalIncludeDirectories="&quot;$(SolutionDir)/lib/expr&quot;;&quot;$(SolutionDir)/lib/vmalloc&quot;;&quot;$(SolutionDir)/lib/ast&quot;;&quot;$(SolutionDir)/lib/sfio&quot;;&quot;$(SolutionDir)/lib/gvc&quot;;&quot;C:\gtk\include\libglade-2.0&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/topfish&quot;;&quot;C:\gtk\lib\gtkglext-1.0\include&quot;;&quot;C:\gtk\include\gtkglext-1.0\&quot;;C:\gtk\include\cairo;&quot;C:\gtk\include\atk-1.0&quot;;&quot;C:\gtk\lib\gtk-2.0\include\cairo&quot;;&quot;C:\gtk\lib\gtk-2.0\include&quot;;&quot;C:\gtk\include\gtk-2.0\&quot;;&quot;$(SolutionDir)/cmd/smyrna/gui&quot;;&quot;$(SolutionDir)/cmd/smyrna&quot;;&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)/lib/glcomp&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvpr&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;;&quot;$(SolutionDir)/lib/glut/glut-3.7.6-bin&quot;;&quot;$(SolutionDir)/lib/xdot&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
                                RuntimeLibrary="2"
                                UsePrecompiledHeader="0"
                        <File
                                RelativePath=".\gvprpipe.c"
                                >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               GeneratePreprocessedFile="0"
+                                       />
+                               </FileConfiguration>
                        </File>
                        <File
                                RelativePath=".\hier.c"
index 4af4923174576c9e0825cf8b9c747229f35e660b..d7246346126bb74dc0ab0dfc68db1e65a5b3ee04 100644 (file)
@@ -17,7 +17,9 @@
 #define SMYRNADEFS_H
 
 #ifdef WIN32
+#ifndef NO_WIN_HEADER
 #include "windows.h"
+#endif
 //#include "gltexfont.h"
 //#define       SMYRNA_GLADE "C:/Projects/graphviz2/share/gui/smyrna.glade"
 #define        SMYRNA_ATTRS "c:/graphviz-ms/graphviz2/share/gui/attrs.txt"
@@ -318,6 +320,9 @@ typedef struct {
        int animate;
        topview_node** picked_nodes;
        int picked_node_count;
+       topview_edge** picked_edges;
+       int picked_edge_count;
+
        graph_data Graphdata;
        int maxnodedegree;
        float maxedgelen;
@@ -346,7 +351,10 @@ typedef struct _mouse_attr {
        float begin_x;
        float begin_y;
        float dx;
-       float dy;
+       float dy;       
+       float GLX;/*opengl coordiantes for right click*/
+       float GLY;
+       float GLZ;
        mouse_rotate_axis rotate_axis;  
        clicked_mouse_button button;
 } mouse_attr;
index e5c1c2af810011e0fd0abcc1a87a0674988d41fe..4551124c11c09bf4beff5233c3ca0595c0d83d2e 100644 (file)
@@ -424,12 +424,12 @@ void drawtopfishnodelabels(topview* t)
                                if((v==t->fs->foci_nodes[0]) &&(focusnodes))
                                {
                                        glColor4f((float)0, (float)0, (float)1, (float)1);
-                                       glprintfglut(GLUT_BITMAP_HELVETICA_18,gg[v].physical_x_coord,gg[v].physical_y_coord,buf);
+                                       glprintfglut(GLUT_BITMAP_HELVETICA_18,gg[v].physical_x_coord,gg[v].physical_y_coord,0,buf);
                                }
                                else if (finenodes)
                                {
                                        glColor4f(0, 0, 0, 1);
-                                       glprintfglut(GLUT_BITMAP_HELVETICA_10,gg[v].physical_x_coord,gg[v].physical_y_coord,buf);
+                                       glprintfglut(GLUT_BITMAP_HELVETICA_10,gg[v].physical_x_coord,gg[v].physical_y_coord,0,buf);
                                }
                        }
 
index 039e0fcd2530ab8a47d12a9271b7afbd4607717a..07ca467347bc0fd9e53231ecb8770540bcff4186 100755 (executable)
@@ -57,7 +57,6 @@ static int select_topview_node(topview_node * n);
 static int update_topview_node_from_cgraph(topview_node * Node);
 #endif
 static int get_color_from_edge(topview_edge * e);
-static int draw_node_hint_boxes(void);
 static int pick_node(topview_node * n);
 
 #ifdef UNUSED
@@ -394,6 +393,8 @@ void preparetopview(Agraph_t * g, topview * t)
        /*reset picked nodes*/
        t->picked_node_count = 0;
     t->picked_nodes = '\0';
+       t->picked_edge_count = 0;
+    t->picked_edges = '\0';
 
 }
 
@@ -464,8 +465,10 @@ static void enddrawcycle(Agraph_t* g)
     }
     if (view->Selection.single_selected_node)  
        {
-               if (view->mouse.button== rightmousebutton)      //right click pick mode
-                       pick_node(view->Selection.single_selected_node);
+       if (view->mouse.button== rightmousebutton)
+               //right click pick mode
+               ;
+       /*              pick_node(view->Selection.single_selected_node);*/
        else 
        {       //left click single select mode
            if (view->Selection.single_selected_node->data.Selected == 0) 
@@ -512,8 +515,7 @@ static int drawtopviewnodes(Agraph_t * g)
     float ddx, ddy, ddz;
     int ind = 0;
     float dotsize = set_gl_dot_size(view->Topview);            //sets the size of the gl points
-
-    set_topview_options();
+       set_topview_options();
     begintopviewnodes(g, dotsize);
     view->visiblenodecount=0;
     for (ind = 0; ind < view->Topview->Nodecount; ind++) {
@@ -528,25 +530,24 @@ static int drawtopviewnodes(Agraph_t * g)
            if(!view->drawnodes || !node_visible(v))
                continue;
 
-           select_topview_node(v);
+           /*check for each node if it needs to be selected or picked*/
+               select_topview_node(v);
                //UPDATE view->Topview data from cgraph
                /* if (v->update_required) */
                    /* update_topview_node_from_cgraph(v); */
-           if (v->data.Selected == 1) {
-               glColor4f(view->selectedNodeColor.R,
-                     view->selectedNodeColor.G,
-                     view->selectedNodeColor.B,
-                     view->selectedNodeColor.A); 
-               ddx = dx;
-               ddy = dy;
-               ddz = dz;
+           if (v->data.Selected == 1) 
+               {
+                       glColor4f(view->selectedNodeColor.R, view->selectedNodeColor.G, view->selectedNodeColor.B, view->selectedNodeColor.A); 
+                       ddx = dx;
+                       ddy = dy;
+                       ddz = dz;
            } 
-           else {  //get the color from node
-               glColor4f(v->Color.R, v->Color.G, v->Color.B,
-                               v->node_alpha*view->defaultnodealpha);
-               ddx = 0;
-               ddy = 0;
-               ddz = 0;
+           else 
+               {  //get the color from node
+                       glColor4f(v->Color.R, v->Color.G, v->Color.B,v->node_alpha*view->defaultnodealpha);
+                       ddx = 0;
+                       ddy = 0;
+                       ddz = 0;
            }
 
            if (v->distorted_x != v->x)
@@ -641,7 +642,9 @@ static int drawtopviewlabels(Agraph_t * g)
        topview_node *v;
        float f;
 
-       if ((view->visiblenodecount >view->labelnumberofnodes) || (!view->labelshownodes) ||(!view->drawnodes))
+       if (
+               ((view->visiblenodecount >view->labelnumberofnodes) && (view->active_camera == -1))
+               || (!view->labelshownodes) ||(!view->drawnodes))
                return 0;
        if (view->Topview->maxnodedegree > 15)
                f=15;
@@ -652,8 +655,11 @@ static int drawtopviewlabels(Agraph_t * g)
                
                v = &view->Topview->Nodes[ind];
 
-               if( ((float)view->visiblenodecount   > view->labelnumberofnodes * v->degree /  f) && view->labelwithdegree)
-                       continue;
+               if (view->active_camera == -1)
+               {
+                       if( ((float)view->visiblenodecount   > view->labelnumberofnodes * v->degree /  f) && view->labelwithdegree)
+                               continue;
+               }
                if (!node_visible(v))
                    continue;
            draw_topview_label(v, 1);
@@ -711,56 +717,9 @@ void drawTopViewGraph(Agraph_t * g)
     }
 }
 
-static int is_node_picked(topview_node * n)
-{
-    int ind = 0;
-    int found = 0;
-    for (; ind < view->Topview->picked_node_count; ind++) {
-       if ((view->Topview->picked_nodes[ind] == n) && (!found))
-           return 1;
-    }
-    return 0;
-}
 
-static int remove_from_pick_list(topview_node * n)
-{
-    int ind = 0;
-    int found = 0;
-       view->mouse.button=-1;  //reset button click to avoid extra selection and pick chekcs
-       for (; ind < view->Topview->picked_node_count; ind++) {
-       if ((view->Topview->picked_nodes[ind] == n) && (!found))
-           found = 1;
-       if ((found) && (ind < (view->Topview->picked_node_count - 1))) {
-           view->Topview->picked_nodes[ind] =
-               view->Topview->picked_nodes[ind + 1];
-       }
-    }
-    if (found) {
-       view->Topview->picked_node_count--;
-       view->Topview->picked_nodes =
-           realloc(view->Topview->picked_nodes,
-                   sizeof(topview_node *) *
-                   view->Topview->picked_node_count);
-       return 1;
-    }
-    return 0;
-}
-
-static int add_to_pick_list(topview_node * n)
-{
-    view->Topview->picked_node_count++;
-    view->Topview->picked_nodes =
-       realloc(view->Topview->picked_nodes,
-               sizeof(topview_node *) * view->Topview->picked_node_count);
-    view->Topview->picked_nodes[view->Topview->picked_node_count - 1] = n;
-       view->mouse.button=-1;  //reset button click to avoid extra selection and pick chekcs
-
-    return 1;
-
-}
 
-static int pick_node(topview_node * n)
+/*static int pick_node(topview_node * n)
 {
        if (!is_node_picked(n)) 
        {
@@ -780,51 +739,28 @@ static int pick_node(topview_node * n)
        }
     return 0;
 
-}
+}*/
 
-static int draw_node_hint_boxes(void)
-{
-    int ind;
-    float fs = GetOGLDistance(12);
-    char* lbl;
-    topview_node* n;
-    double dx, dy, dz;
-
-    view->widgets->fontset->fonts[view->widgets->fontset->activefont]->fontheight=fs;
-    for (ind = 0; ind < view->Topview->picked_node_count; ind++) {
-       n = view->Topview->picked_nodes[ind];
-       lbl = agnameof(n->Node);
-       dx = n->distorted_x;
-       dy = n->distorted_y;
-       dz = n->distorted_z;
-
-       draw_node_hintbox(dx, dy, dz, (GLfloat) fs, lbl);
-
-       /*blue font color*/
-       glColor4f(0, 0, 1, 1);
-       glprintfglut (GLUT_BITMAP_HELVETICA_12, dx,(dy+fs+fs/(GLfloat)5.0),lbl);
-    }
-    return 1;
-}
 
 
 static int select_topview_node(topview_node * n)
 {
-/*    if (!view->Selection.Active) {
+    if (!view->Selection.Active) {
        //implement hint box here
-               if (view->mouse.button== rightmousebutton)
+/*             if (view->mouse.button== rightmousebutton)
                {
                        if (pick_node(n))
                                view->mouse.button = -1;
                }
-               return 0;
-    }*/
+               return 0;*/
+    }
        if (
                (( view->Selection.Type == 0) && (view->Selection.Active))
                || 
                (view->mouse.button== rightmousebutton))        //single selection or right click (picking)
        {
                float dist=(float)DIST2(view->Selection.X-n->distorted_x, view->Selection.Y-n->distorted_y);
+
                if ((view->Selection.node_distance==-1) ||(dist < view->Selection.node_distance))
                {
                                view->Selection.node_distance=dist;
@@ -1001,10 +937,11 @@ static int draw_topview_label(topview_node * v, float zdepth)
     float ddx = 0;
     float ddy = 0;
        char* buf;
-       if ((v->distorted_x / view->zoom * -1 > view->clipX1)
+       char bf[256];
+       if (((v->distorted_x / view->zoom * -1 > view->clipX1)
        && (v->distorted_x / view->zoom * -1 < view->clipX2)
        && (v->distorted_y / view->zoom * -1 > view->clipY1)
-       && (v->distorted_y / view->zoom * -1 < view->clipY2)) 
+       && (v->distorted_y / view->zoom * -1 < view->clipY2)) || (view->active_camera >=0))
        {
                if (v->data.Selected == 1) 
                {
@@ -1014,7 +951,7 @@ static int draw_topview_label(topview_node * v, float zdepth)
                glColor4f(view->nodelabelcolor.R,view->nodelabelcolor.G,view->nodelabelcolor.B,view->nodelabelcolor.A);
                buf=agget(agraphof(v->Node),"nodelabelattribute");
                if (buf)
-                       glprintfglut(view->glutfont,(v->distorted_x - ddx),(v->distorted_y - ddy),
+                       glprintfglut(view->glutfont,(v->distorted_x - ddx),(v->distorted_y - ddy),v->distorted_z,
                           agget(v->Node,buf));
                return 1;
     } else
@@ -1026,11 +963,13 @@ static int draw_topview_edge_label(topview_edge * e, float zdepth)
     float ddx = 0;
     float ddy = 0;
        char* buf;
-       float x1,y1,x2,y2,x,y;
+       float x1,y1,z1,x2,y2,z2,x,y,z;
        x1=e->Node1->distorted_x;
        y1=e->Node1->distorted_y;
        x2=e->Node2->distorted_x;
        y2=e->Node2->distorted_y;
+       z1=e->Node1->distorted_z;
+       z2=e->Node2->distorted_z;
 
 
        if ((x1 / view->zoom * -1 > view->clipX1)
@@ -1041,6 +980,7 @@ static int draw_topview_edge_label(topview_edge * e, float zdepth)
 
                x=(x2-x1)/2.00 + x1;
                y=(y2-y1)/2.00 + y1;
+               z=(z2-z1)/2.00 + z1;
                if (e->data.Selected==1)
                {
                    ddx = dx;
@@ -1049,7 +989,7 @@ static int draw_topview_edge_label(topview_edge * e, float zdepth)
                glColor4f(view->edgelabelcolor.R,view->edgelabelcolor.G,view->edgelabelcolor.B,view->edgelabelcolor.A);
                buf=agget(agraphof(e->Edge),"edgelabelattribute");
                if (buf)
-                       glprintfglut(view->glutfont,x - ddx,y - ddy,agget(e->Edge,buf));
+                       glprintfglut(view->glutfont,x - ddx,y - ddy,z,agget(e->Edge,buf));
                return 1;
     } else
                return 0;
index 925556ead4a3bb6aa76d1648b62ee9d7177a42df..d0d1cecdd4100a88a31c0e653aac17c99079952b 100644 (file)
@@ -7,6 +7,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Pathplan", "lib\pathplan\Pa
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdt", "lib\cdt\cdt.vcproj", "{83CF0498-7884-49D3-8B3C-263C5AF5FE1B}"
+       ProjectSection(ProjectDependencies) = postProject
+               {0DEA7FAC-4190-4B39-BEF0-1C055758FED3} = {0DEA7FAC-4190-4B39-BEF0-1C055758FED3}
+       EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gvc", "lib\gvc.vcproj", "{15229511-9F6C-48A5-9194-660CA6492563}"
        ProjectSection(ProjectDependencies) = postProject
@@ -72,6 +75,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dot", "cmd\dot\dot.vcproj",
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gvplugin_neato_layout", "plugin\neato_layout\gvplugin_neato_layout.vcproj", "{92EA9398-9244-4DAA-8E7D-2F6BEC338CAB}"
        ProjectSection(ProjectDependencies) = postProject
+               {443EB1A7-C634-4292-9F2D-C752BB2BF40F} = {443EB1A7-C634-4292-9F2D-C752BB2BF40F}
                {AE706502-3203-4815-BF50-4D73BF96BA58} = {AE706502-3203-4815-BF50-4D73BF96BA58}
                {15229511-9F6C-48A5-9194-660CA6492563} = {15229511-9F6C-48A5-9194-660CA6492563}
                {C5CEB09E-79AF-4091-ACCF-D28EC3D7D90F} = {C5CEB09E-79AF-4091-ACCF-D28EC3D7D90F}
index b6d096f284ffe48cc3ae053e02b0799061bdb929..38f73b88608b957f665a8f7de2ac0a905f16b10a 100644 (file)
@@ -202,7 +202,7 @@ int glCompDrawButton(glCompButton * p)
             p->fontsize) / (GLfloat) 2.0 + p->pos.y + p->thickness;
 
                
-       glprintf(p->font, fontx,fonty, fontwidth,p->caption);
+       glprintf(p->font, fontx,fonty, p->bevel,fontwidth,p->caption);
        }
     //put glyph
     else 
index a48c528fbcc529b83d1b9ec4740bd517fef32516..99585d89537ca527fab6122937585042e1de2963 100644 (file)
@@ -78,9 +78,7 @@ int glCompDrawLabel(glCompLabel * p)
        p->font->fontheight=p->size;
        fontColor(p->font,p->color.R, p->color.G, p->color.B, p->color.A);
 
-       glprintf(p->font, p->pos.x,  p->pos.y,
-                       (p->size * p->fontsizefactor *
-                             strlen(p->text)), p->text);
+       glprintf(p->font, p->pos.x,  p->pos.y,p->panel->bevel,(p->size * p->fontsizefactor *strlen(p->text)), p->text);
        if (p->panel) {
            p->pos.x = p->pos.x - p->panel->pos.x;
            p->pos.y = p->pos.y - p->panel->pos.y;
index f06f162a50e2774e24029475611aeee1e9344530..c9690b288150dfd084aed42fda1bbb3a99c2d1f4 100644 (file)
@@ -77,15 +77,9 @@ void restore_gl_vars(glCompText* f)
                glDisable (GL_TEXTURE_2D);
        glMatrixMode (f->glcache.matrix);
 }
-void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, char *bf)
+void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,char *bf)
 {
-       glRasterPos3f(xpos,ypos,1);
-         print_bitmap_string(font,bf); 
-}
-
-void glprintfglutz (void* font, GLfloat xpos, GLfloat ypos, GLfloat zpos, char *bf)
-{
-       glRasterPos3f(xpos,ypos,zpos+0.01);
+       glRasterPos3f(xpos,ypos,zpos+0.001);
          print_bitmap_string(font,bf); 
 }
 
@@ -112,10 +106,7 @@ glPrintf (glCompText* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,
                return;
        if (font->isglut)
        {
-               if (usez)
-                       glprintfglutz (font->glutfont, xpos,ypos,zpos,bf);
-               else
-                       glprintfglut (font->glutfont, xpos,ypos,bf);
+               glprintfglut (font->glutfont, xpos,ypos,zpos,bf);
                return;
        }
 
@@ -171,9 +162,10 @@ glPrintf (glCompText* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,
 }
 
 void 
-glprintf (glCompText* font, GLfloat xpos, GLfloat ypos, GLfloat width, char *bf)
+glprintf (glCompText* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,GLfloat width, char *bf)
+
 {
-       glPrintf (font, xpos, ypos, 0, width, bf, 0);
+       glPrintf (font, xpos, ypos, zpos, width, bf, 0);
 }
 
 void 
index 1243563e0dc1380a974e748f7415e961add50d1f..31002cf416ef8a559a64c429c9545d9882f0270c 100644 (file)
@@ -33,10 +33,9 @@ extern void free_font_set(fontset_t* fontset);
 extern void copy_font(glCompText* targetfont,const glCompText* sourcefont);
 extern glCompText* add_font(fontset_t* fontset,char* fontdesc);
 extern glCompText* add_glut_font(fontset_t* fontset,void* glutfont);
-extern void glprintf (glCompText*, GLfloat , GLfloat , GLfloat, char*);
-extern void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, char *bf);
-extern void glprintfz (glCompText*, GLfloat , GLfloat , GLfloat, GLfloat, char*);
-extern void glprintfglutz (void* font, GLfloat xpos, GLfloat ypos, GLfloat, char *bf);
+extern void glprintf (glCompText*, GLfloat , GLfloat , GLfloat ,GLfloat, char*);
+
+extern void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,char *bf);
 
 extern glCompText* font_init(void);
 extern void fontColor (glCompText* font,float r, float g, float b,float a);
index e4c3d4cd2104b6778db924c34373632db897127d..6686ec7158f2a221bbbe16c1c567eafb8e76f3fa 100644 (file)
@@ -38,7 +38,6 @@ int GetFixedOGLPos(int x, int y, float kts, GLfloat * X, GLfloat * Y,
        glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
     glGetDoublev(GL_PROJECTION_MATRIX, projection);
     glGetIntegerv(GL_VIEWPORT, viewport);
-
     gluProject(-100.0, -100.0, 1.00, modelview, projection, viewport, &wwinX,
               &wwinY, &wwinZ);
 
@@ -90,6 +89,8 @@ int GetOGLPosRef(int x, int y, float *X, float *Y, float *Z)
     *Y = (float) posY;
     *Z = (float) posZ;
 //    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+//     printf("==>(%d,%d,%d) -> (%f,%f,%f)\n",x,y,wwinZ,*X,*Y,*Z);
+
 
        return 1;
 
@@ -144,7 +145,60 @@ float GetOGLDistance(int l)
        return ((float) (posXX - posX));
 
 }
-int GetFixedOGLPoslocal(int x, int y, float kts, GLfloat * X, GLfloat * Y,
+/*
+       functions def: returns opengl coordinates of firt hit object by using screen coordinates
+       x,y; 2D screen coordiantes (usually received from mouse events
+       X,Y,Z; pointers to coordinates values to be calculated
+       return value: no return value
+
+
+*/
+
+void to3D(int x, int y, GLfloat *X, GLfloat *Y,GLfloat *Z)
+{
+       int const WIDTH = 40;
+
+    GLint viewport[4];
+    GLdouble modelview[16];
+    GLdouble projection[16];
+    GLfloat winX, winY;
+       GLfloat winZ[1600];
+    GLdouble posX, posY, posZ;
+       int idx;
+       static float comp;
+       glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
+    glGetDoublev(GL_PROJECTION_MATRIX, projection);
+    glGetIntegerv(GL_VIEWPORT, viewport);
+
+       winX = (float) x;
+    winY = (float) viewport[3] - (float) y;
+
+       glReadPixels(x-WIDTH/2.0, (int)winY-WIDTH/2.0, WIDTH, WIDTH, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ);
+       comp=-9999999;
+       for (idx=0;idx < WIDTH* WIDTH ; idx ++)
+       {
+               if ((winZ[idx] > comp) && (winZ[idx] < 1))
+                               comp = winZ[idx];
+               printf ("%f\n",winZ[idx]);
+       }
+       gluUnProject(winX,winY, comp,modelview, projection, viewport, &posX,
+              &posY, &posZ);
+
+       *X = (GLfloat) posX;
+    *Y = (GLfloat) posY;
+    *Z = (GLfloat) posZ;
+//     printf ("%f %f %f\n",*X,*Y,*Z);
+//    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+       return ;
+       
+       
+       
+       
+
+}
+
+
+int GetFixedOGLPoslocal(int x, int y, GLfloat * X, GLfloat * Y,
                   GLfloat * Z)
 {
     GLdouble wwinX;
@@ -161,6 +215,8 @@ int GetFixedOGLPoslocal(int x, int y, float kts, GLfloat * X, GLfloat * Y,
     glGetDoublev(GL_PROJECTION_MATRIX, projection);
     glGetIntegerv(GL_VIEWPORT, viewport);
 
+
+
        glColor4f((GLfloat)0,(GLfloat)0,(GLfloat)0,(GLfloat)0.001);
        glBegin(GL_POINTS);
     glVertex3f(10.00, 10.00, 0.00);
@@ -211,4 +267,159 @@ int glreversecamera(ViewInfo * view)
 }
 
 #endif
+#include <math.h>
+
+typedef struct {
+  double x, y, z;
+} point;
+
+
+typedef struct {
+  point u, v;
+} line;
+typedef struct {
+  point N;  /* normal */
+  double d;  /* offset */
+} plane;
+
+
+static point add (point p, point q)
+{
+    p.x += q.x;
+    p.y += q.y;
+    p.z += q.z;
+    return p;
+}
+
+static point sub (point p, point q)
+{
+    p.x -= q.x;
+    p.y -= q.y;
+    p.z -= q.z;
+    return p;
+}
+
+static double dot (point p, point q)
+{
+    return (p.x*p.x + p.y*p.y + p.z*p.z); }
+
+double len (point p)
+{
+    sqrt(dot(p,p));
+}
+
+point scale (double d, point p)
+{
+    p.x *= d;
+    p.y *= d;
+    p.z *= d;
+    return p;
+}
+
+point normalize (point p)
+{
+   double d = len (p);
+
+   return scale (1/d, p);
+}
+
+double dist (point p, point q)
+{
+    return (len (sub (p,q)));
+}
+
+point intersect (line l, plane J)
+{
+    double t = -(J.d + dot(l.u,J.N))/dot(l.v,J.N);
+    return (add(l.u, scale(t,l.v)));
+}
+
+/*
+ * Given a line l determined by two points a and b, and a 3rd point p:
+ */
+double point_to_line_dist (point a, point b, point p) {
+    line l;
+    plane J;
+    point q;
+
+    l.u = a;
+    l.v = normalize (sub (b, a));
+
+    J.N = l.v;
+    J.d = -dot(p, l.v);
+
+    q = intersect (l, J);
+
+    return (dist (p, q));
+}
+
+
+
+typedef struct tagXYZ
+{
+    float X, Y, Z;
+}
+XYZ;
+
+float Magnitude( XYZ *Point1, XYZ *Point2 )
+{
+    XYZ Vector;
+
+    Vector.X = Point2->X - Point1->X;
+    Vector.Y = Point2->Y - Point1->Y;
+    Vector.Z = Point2->Z - Point1->Z;
+
+    return (float)sqrt( Vector.X * Vector.X + Vector.Y * Vector.Y + Vector.Z * Vector.Z );
+}
+
+int DistancePointLine( XYZ *Point, XYZ *LineStart, XYZ *LineEnd, float *Distance )
+{
+    float LineMag;
+    float U;
+    XYZ Intersection;
+
+    LineMag = Magnitude( LineEnd, LineStart );
+
+    U = ( ( ( Point->X - LineStart->X ) * ( LineEnd->X - LineStart->X ) ) +
+    ( ( Point->Y - LineStart->Y ) * ( LineEnd->Y - LineStart->Y ) ) +
+    ( ( Point->Z - LineStart->Z ) * ( LineEnd->Z - LineStart->Z ) ) ) /
+    ( LineMag * LineMag );
+
+    if( U < 0.0f || U > 1.0f )
+        return 0;   // closest point does not fall within the line segment
+
+    Intersection.X = LineStart->X + U * ( LineEnd->X - LineStart->X );
+    Intersection.Y = LineStart->Y + U * ( LineEnd->Y - LineStart->Y );
+    Intersection.Z = LineStart->Z + U * ( LineEnd->Z - LineStart->Z );
+
+    *Distance = Magnitude( Point, &Intersection );
+
+    return 1;
+}
+
+/*void main( void )
+{
+    XYZ LineStart, LineEnd, Point;
+    float Distance;
+
+
+    LineStart.X =  50.0f; LineStart.Y =   80.0f; LineStart.Z =  300.0f;
+    LineEnd.X   =  50.0f; LineEnd.Y   = -800.0f; LineEnd.Z   = 1000.0f;
+    Point.X     =  20.0f; Point.Y     = 1000.0f; Point.Z     =  400.0f;
+
+    if( DistancePointLine( &Point, &LineStart, &LineEnd, &Distance ) )
+        printf( "closest point falls within line segment, distance = %f\n", Distance     );
+    else
+        printf( "closest point does not fall within line segment\n" );
+
+
+    LineStart.X =  0.0f; LineStart.Y =   0.0f; LineStart.Z =  50.0f;
+    LineEnd.X   =  0.0f; LineEnd.Y   =   0.0f; LineEnd.Z   = -50.0f;
+    Point.X     = 10.0f; Point.Y     =  50.0f; Point.Z     =  10.0f;
+
+    if( DistancePointLine( &Point, &LineStart, &LineEnd, &Distance ) )
+        printf( "closest point falls within line segment, distance = %f\n", Distance     );
+    else
+        printf( "closest point does not fall within line segment\n" );
+}*/
 
index b44612f09a774602a045c674ed1e4e18b78eb82d..4a2149617c36cc076d8a7c9d14c84cec89805247 100644 (file)
 #include <GL/glu.h>
 
 
+
+
+
 int GetFixedOGLPos(int x, int y, float kts, GLfloat * X, GLfloat * Y,
                   GLfloat * Z);
 int GetOGLPosRef(int x, int y, float *X, float *Y, float *Z);
 float GetOGLDistance(int l);
-int GetFixedOGLPoslocal(int x, int y, float kts, GLfloat * X, GLfloat * Y,
+int GetFixedOGLPoslocal(int x, int y, GLfloat * X, GLfloat * Y,
                   GLfloat * Z);
+void to3D(int x, int y, GLfloat * X, GLfloat * Y,GLfloat * Z);
 void linear_interplotate (float x1,float y1,float x3,float y3,float x2,float* y2);
-
 #endif
index 04e14b5df45bbecdf09d4d271f28a45bc590e6c7..01cf79a1fc5e09ab307b30b5a8b98392a618f27e 100644 (file)
@@ -47,6 +47,6 @@ mkdefs_SOURCES = mkdefs.c
 gdefs.h: $(top_srcdir)/lib/gvpr/gprdata mkdefs
        ./mkdefs gdefs.h < $(top_srcdir)/lib/gvpr/gprdata
 
-EXTRA_DIST = $(man_MANS) $(pdf_DATA) Makefile.old gprdata mkdefs.c gdefs.h trie.c
+EXTRA_DIST = $(man_MANS) $(pdf_DATA) Makefile.old gprdata mkdefs.c gdefs.h trie.c gvprlib.vcproj
 
 DISTCLEANFILES = $(pdf_DATA) gdefs.h mkdefs
index 38cc017bf060eaafdb52439bdd532da1747af0b1..01ed4be5534eedd3c80cddf02af7a63131c10f7c 100644 (file)
@@ -43,6 +43,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <setjmp.h>
+#include "getopt.h"
 
 #define DFLT_GPRPATH    "."
 
index a36aec144de9dcf918938dee0879625b8e52b713..b7347d03ae3b3e77c2631ed5ae3fdb8f66bd6921 100755 (executable)
@@ -67,6 +67,9 @@ const Gdiplus::StringFormat* GetGenericTypographic()
 void SaveBitmapToStream(Bitmap &bitmap, IStream *stream, int format)
 {
        /* search the encoders for one that matches our device id, then save the bitmap there */
+       GdiplusStartupInput gdiplusStartupInput;
+       ULONG_PTR gdiplusToken;
+       GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
        UINT encoderNum;
        UINT encoderSize;
        GetImageEncodersSize(&encoderNum, &encoderSize);
index 0ac08750aa6570e6c65a0b21a2af13b3742df645..2bf7d9139555deaa3f2ffbd5d7d2a7a1cae29bd9 100644 (file)
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="libpng.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 pathplan.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 cdt.lib graph.lib gvc.lib circogen.lib neatogen.lib fdpgen.lib patchwork.lib sparse.lib twopigen.lib gd.lib gts.lib Ole32.lib user32.lib gdi32.lib gdiplus.lib $(NOINHERIT)"
+                               OutputFile="c:/graphviz-ms/bin/$(ProjectName).dll"
                                LinkIncremental="2"
                                AdditionalLibraryDirectories="C:\graphviz-ms\bin;C:\gtk\lib"
                                ModuleDefinitionFile="gvplugin_gdiplus.def"