]> granicus.if.org Git - graphviz/commitdiff
Smyrna:Alpha and picking works together.
authorarif <devnull@localhost>
Wed, 11 Aug 2010 21:44:17 +0000 (21:44 +0000)
committerarif <devnull@localhost>
Wed, 11 Aug 2010 21:44:17 +0000 (21:44 +0000)
Full screen tune up

14 files changed:
cmd/smyrna/draw.c
cmd/smyrna/glexpose.c
cmd/smyrna/gltemplate.c
cmd/smyrna/glutrender.c
cmd/smyrna/glutrender.h
cmd/smyrna/gui/appmouse.c
cmd/smyrna/gui/glcompui.c
cmd/smyrna/gui/topviewsettings.c
cmd/smyrna/hotkeymap.c
cmd/smyrna/main.c
cmd/smyrna/smyrna.vcproj.RESEARCH.arif.user
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topviewfuncs.c
cmd/smyrna/viewport.c

index bb546e2aa7531ee2e1dd4221c14db961500b9ca5..4b273cd593d04f9a9716b1979de4af4e30d2fde5 100755 (executable)
@@ -966,7 +966,6 @@ void draw_selpoly(glCompPoly* selPoly)
     int i;
 /*    glColor4f(view->gridColor.R, view->gridColor.G, view->gridColor.B,
                  view->gridColor.A);*/
-    glDisable(GL_DEPTH_TEST);
     glColor4f(1,0,0,1);
     glBegin(GL_LINE_STRIP);
     for (i = 0;i <  selPoly->cnt ; i++)
@@ -981,9 +980,6 @@ void draw_selpoly(glCompPoly* selPoly)
        glVertex3f(view->mouse.GLpos.x,view->mouse.GLpos.y,0);
        glEnd();
     }
-    glEnable(GL_DEPTH_TEST);
-
-
 }
 
 #ifdef UNUSED
index 77ec5ab2f39914db13e9f025c6ddfede0567c397..8f1f1c0b5fa0cc867fe5479dd22ff02768d81403 100644 (file)
@@ -13,7 +13,6 @@
 *        Information and Software Systems Research        *
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
-
 #include "glexpose.h"
 #include "draw.h"
 #include "topviewfuncs.h"
 #include "hotkeymap.h"
 #include "polytess.h"
 
-static void draw_cube()
+int texture[3];
+static int Status=0;                                                                   // Status Indicator
+
+void LoadGLTextures()                                                                  // Load Bitmaps And Convert To Textures
+{
+       int imageWidth,imageHeight;
+
+       unsigned char *data = glCompLoadPng ("c:/graphviz-ms/bin/Data/Crate.png", &imageWidth, &imageHeight);
+
+       if (!data)
+       {
+           printf ("Data/Crate.bmp could not be located\n");
+           exit(-1);
+       }
+       // Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
+       glGenTextures(3, &texture[0]);                                  // Create Three Textures
+
+               // Create Nearest Filtered Texture
+               glBindTexture(GL_TEXTURE_2D, texture[0]);
+               glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
+               glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
+               glTexImage2D(GL_TEXTURE_2D, 0, 3, imageWidth,imageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
+
+               // Create Linear Filtered Texture
+               glBindTexture(GL_TEXTURE_2D, texture[1]);
+               glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+               glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+               glTexImage2D(GL_TEXTURE_2D, 0, 3, imageWidth,imageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
+
+               // Create MipMapped Texture
+               glBindTexture(GL_TEXTURE_2D, texture[2]);
+               glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+               glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
+               gluBuild2DMipmaps(GL_TEXTURE_2D, 3, imageWidth,imageHeight, GL_RGBA, GL_UNSIGNED_BYTE,data);
+       Status=1;                                                                       // Set The Status To TRUE
+}
+
+
+
+void draw_cube_tex()
 {
 
+
+    glRotatef(45,1,1,1);
+    glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
+       glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);      // Really Nice Perspective Calculations
+    if(!Status)
+       LoadGLTextures();
+    if(!Status)
+       return;
+    glBindTexture(GL_TEXTURE_2D,texture[1]);
+       glBegin(GL_QUADS);
+               // Front Face
+               glColor4f(1, 1, 1,1);   // Color Blue
+
+               glNormal3f( 0.0f, 0.0f, 1.0f);
+               glTexCoord2f(0.0f, 0.0f); glVertex3f(-100.0f, -100.0f,  100.0f);
+               glTexCoord2f(1.0f, 0.0f); glVertex3f( 100.0f, -100.0f,  100.0f);
+               glTexCoord2f(1.0f, 1.0f); glVertex3f( 100.0f,  100.0f,  100.0f);
+               glTexCoord2f(0.0f, 1.0f); glVertex3f(-100.0f,  100.0f,  100.0f);
+               // Back Face
+               glNormal3f( 0.0f, 0.0f,-1.0f);
+               glTexCoord2f(1.0f, 0.0f); glVertex3f(-100.0f, -100.0f, -100.0f);
+               glTexCoord2f(1.0f, 1.0f); glVertex3f(-100.0f,  100.0f, -100.0f);
+               glTexCoord2f(0.0f, 1.0f); glVertex3f( 100.0f,  100.0f, -100.0f);
+               glTexCoord2f(0.0f, 0.0f); glVertex3f( 100.0f, -100.0f, -100.0f);
+               // Top Face
+               glNormal3f( 0.0f, 1.0f, 0.0f);
+               glTexCoord2f(0.0f, 1.0f); glVertex3f(-100.0f,  100.0f, -100.0f);
+               glTexCoord2f(0.0f, 0.0f); glVertex3f(-100.0f,  100.0f,  100.0f);
+               glTexCoord2f(1.0f, 0.0f); glVertex3f( 100.0f,  100.0f,  100.0f);
+               glTexCoord2f(1.0f, 1.0f); glVertex3f( 100.0f,  100.0f, -100.0f);
+               // Bottom Face
+               glNormal3f( 0.0f,-1.0f, 0.0f);
+               glTexCoord2f(1.0f, 1.0f); glVertex3f(-100.0f, -100.0f, -100.0f);
+               glTexCoord2f(0.0f, 1.0f); glVertex3f( 100.0f, -100.0f, -100.0f);
+               glTexCoord2f(0.0f, 0.0f); glVertex3f( 100.0f, -100.0f,  100.0f);
+               glTexCoord2f(1.0f, 0.0f); glVertex3f(-100.0f, -100.0f,  100.0f);
+               // Right face
+               glNormal3f( 1.0f, 0.0f, 0.0f);
+               glTexCoord2f(1.0f, 0.0f); glVertex3f( 100.0f, -100.0f, -100.0f);
+               glTexCoord2f(1.0f, 1.0f); glVertex3f( 100.0f,  100.0f, -100.0f);
+               glTexCoord2f(0.0f, 1.0f); glVertex3f( 100.0f,  100.0f,  100.0f);
+               glTexCoord2f(0.0f, 0.0f); glVertex3f( 100.0f, -100.0f,  100.0f);
+               // Left Face
+               glNormal3f(-1.0f, 0.0f, 0.0f);
+               glTexCoord2f(0.0f, 0.0f); glVertex3f(-100.0f, -100.0f, -100.0f);
+               glTexCoord2f(1.0f, 0.0f); glVertex3f(-100.0f, -100.0f,  100.0f);
+               glTexCoord2f(1.0f, 1.0f); glVertex3f(-100.0f,  100.0f,  100.0f);
+               glTexCoord2f(0.0f, 1.0f); glVertex3f(-100.0f,  100.0f, -100.0f);
+       glEnd();
+    glDisable(GL_TEXTURE_2D);              // Enable Texture Mapping
+
+
+
+}
+static void draw_cube()
+{
+    glRotatef(30,1,1,1);
     glBegin(GL_QUADS);         // Draw The Cube Using quads
-    glColor3f(0.0f, 100.0f, 0.0f);     // Color Blue
+    glColor4f(0.0f, 100.0f, 0.0f,0.5); // Color Blue
     glVertex3f(100.0f, 100.0f, -100.0f);       // Top Right Of The Quad (Top)
     glVertex3f(-100.0f, 100.0f, -100.0f);      // Top Left Of The Quad (Top)
     glVertex3f(-100.0f, 100.0f, 100.0f);       // Bottom Left Of The Quad (Top)
     glVertex3f(100.0f, 100.0f, 100.0f);        // Bottom Right Of The Quad (Top)
-    glColor3f(100.0f, 0.5f, 0.0f);     // Color Orange
+    glColor4f(100.0f, 0.5f, 0.0f,0.5); // Color Orange
     glVertex3f(100.0f, -100.0f, 100.0f);       // Top Right Of The Quad (Bottom)
     glVertex3f(-100.0f, -100.0f, 100.0f);      // Top Left Of The Quad (Bottom)
     glVertex3f(-100.0f, -100.0f, -100.0f);     // Bottom Left Of The Quad (Bottom)
     glVertex3f(100.0f, -100.0f, -100.0f);      // Bottom Right Of The Quad (Bottom)
-    glColor3f(100.0f, 0.0f, 0.0f);     // Color Red    
+    glColor4f(100.0f, 0.0f, 0.0f,0.5); // Color Red    
     glVertex3f(100.0f, 100.0f, 100.0f);        // Top Right Of The Quad (Front)
     glVertex3f(-100.0f, 100.0f, 100.0f);       // Top Left Of The Quad (Front)
     glVertex3f(-100.0f, -100.0f, 100.0f);      // Bottom Left Of The Quad (Front)
@@ -219,7 +314,6 @@ static int glexpose_drawgraph(ViewInfo * view)
 //              }
 //              else
 //                      drawGraph(view->g[view->activeGraph]);  //xdot based drawing functions
-       glCompSetDraw(view->widgets);
        return 1;
     }
     return 0;
@@ -259,7 +353,9 @@ int glexpose_main(ViewInfo * view)
     if (!glupdatecamera(view))
        return 0;
 
-//      draw_cube();
+//    glEnable(GL_DEPTH_TEST);
+//    draw_cube();
+//    draw_cube_tex();
 
 
     if (view->activeGraph >= 0) {
@@ -272,14 +368,17 @@ int glexpose_main(ViewInfo * view)
     else
        return 0;
 
+
+
     glexpose_grid(view);
     draw_fisheye_magnifier(view);
     draw_magnifier(view);
     drawBorders(view);
     glexpose_drawgraph(view);
-//      drawRotatingTools();
     drawRotatingAxis();
     draw_selpoly(&view->Topview->sel.selPoly);
+    glCompSetDraw(view->widgets);
+
 //              draw_stuff();
 //      test_color_pallete();
 //      drawtestpoly();
index df2818d5175e974959ce39e4b8fb7d7942372ba6..75d3fa1d7afd77ac1c970e141d50bfd8f8e454bf 100755 (executable)
@@ -174,10 +174,8 @@ static void realize(GtkWidget * widget, gpointer data)
 //  glEnable (GL_NORMALIZE);
     glEnable(GL_BLEND);
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-    glDepthFunc(GL_LESS);
-    glDisable(GL_DEPTH);
+//    glDepthFunc(GL_LESS);
 //  glEnable(GL_LINE_SMOOTH);
-
     gdk_gl_drawable_gl_end(gldrawable);
 
 
index 9b41bc04241c41f42e5644ee24a18f09335d221d..f51cca747a33b17897cd1d561e70117566227da3 100644 (file)
@@ -21,6 +21,7 @@
 #include "glexpose.h"
 
 
+
     /*call backs */
 
 static float begin_x = 0.0;
@@ -45,7 +46,7 @@ static glMouseButtonType getGlCompMouseType(int n)
 }
 
 
-void cb_glutreshape(int width, int height)
+void cb_reshape(int width, int height)
 {
     /* static int doonce=0; */
     int vPort[4];
@@ -73,15 +74,17 @@ void cb_glutreshape(int width, int height)
     }
 
     glMatrixMode(GL_MODELVIEW);
+    glLoadIdentity();
        /*** OpenGL END ***/
 
 }
-void cb_glutdisplay()
+void cb_display(void )
 {
+//    glClearColor(view->bgColor.R, view->bgColor.G, view->bgColor.B, view->bgColor.A);
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-    glClearColor(view->bgColor.R, view->bgColor.G, view->bgColor.B, view->bgColor.A);
     glLoadIdentity();
     glexpose_main(view);       //draw all stuff
+//    draw_cube_tex();
     glutSwapBuffers();
     if (view->initFile) {
        view->initFile = 0;
@@ -124,7 +127,7 @@ void cb_mouseclick(int button, int state,int x, int y)
        dx = 0.0;
        dy = 0.0;
     }
-    cb_glutdisplay();
+    cb_display();
 
 }
 void cb_mouseover(int x,int y)/*no mouse click only mouse pointer moving on context*/
@@ -138,7 +141,7 @@ void cb_mouseover(int x,int y)/*no mouse click only mouse pointer moving on cont
 
 
 }
-void cb_mouseover2(int X,int Y)/*mouse moving witha button clicked (dragging)*/
+void cb_drag(int X,int Y)/*mouse moving witha button clicked (dragging)*/
 {
 
     float x = (float) X;
@@ -161,63 +164,163 @@ void cb_mouseover2(int X,int Y)/*mouse moving witha button clicked (dragging)*/
        appmouse_middle_drag(view,x,y);
     begin_x = x;
     begin_y = y;
-    cb_glutdisplay();
+    cb_display();
+
+}
+void cb_mouseentry(int state)
+{
+    if(state==GLUT_LEFT)
+    {
+       //TODO when mouse leaves the scene (which might be impossible in full screen modes with one monitor     
+    }
+    else // GLUT_ENTERED
+    {
+       //TODO mouse is back in scene 
+    }
 
 }
+void cb_keyboard(unsigned char key,int x, int y)
+{
+    if (key==27)    /*ESC*/
+       exit (1);
+    if(key=='3')
+       switch2D3D(NULL, 0, 0,glMouseLeftButton);
+    if(key=='c')
+        menu_click_center(NULL, 0, 0,glMouseLeftButton);
+
+    if(key=='+')
+        menu_click_zoom_plus(NULL, 0, 0,glMouseLeftButton);
+    if(key=='-')
+        menu_click_zoom_minus(NULL, 0, 0,glMouseLeftButton);
+    if(key=='p')
+        menu_click_pan(NULL, 0, 0,glMouseLeftButton);
+    
+
+    appmouse_key_press(view,key);
+}
+void cb_keyboard_up(unsigned char key,int x, int y)
+{
+    appmouse_key_release(view,key);;
+}
 
 
-void sm_glutinit(int w,int h,int full)
+void cb_special_key(int key, int x, int y)
 {
-    glutInitWindowSize(512,512);
- glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH|GLUT_RGBA|GLUT_ALPHA|GLUT_STENCIL);
+    if(key==GLUT_KEY_F1)
+    {
+       printf("Currently help is not available\n");
+    }
+    appmouse_key_press(view,key);
 
+}
+void cb_special_key_up(int key, int x, int y)
+{
+    if(key==GLUT_KEY_F1)
+    {
+       printf("Currently help is not available\n");
+    }
+    appmouse_key_release(view,key);
 
-//    glutInitDisplayMode ( GLUT_RGBA | GLUT_DOUBLE);
-    glutCreateWindow("The glut hello world program");
-    glutDisplayFunc(cb_glutdisplay);
-    glutReshapeFunc(cb_glutreshape);
+}
+
+static int cb_game_mode(char* optArg)
+{
+    
+    glutGameModeString(optArg);
+    if (glutGameModeGet(GLUT_GAME_MODE_POSSIBLE)) 
+    {
+       glutEnterGameMode();
+       return 1;
+
+    }
+    else 
+    {
+       printf("smyrna cannot initialize requested screen resolution and rate!\n");
+       exit(-1);
+
+    }
+
+}
+static int cb_windowed_mode(int w,int h)
+{
+  glutInitWindowSize(w, h);
+  glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_ACCUM | GLUT_DOUBLE);
+  glutCreateWindow("smyrna");
+  return 1;
+    
+}
+
+int cb_glutinit(int x,int y,int w,int h, int bits,int s_rate,int fullscreen,int* argcp, char *argv[],char* optArg)
+{
+    /*
+    x,y:window position , unless in full screen mode
+    w,h: width and height of the window in pixels
+    bits: display color bit count
+    s_rate: for full screen mode this value represents refresh rate in hertz
+    fullscreen: if it will be a fullscreen window,
+    argcp argv: main function's parameters, required for glutinit
+    */
+
+
+
+    glutInit(argcp,argv); //this is required by some OS.
+
+//    glutInitDisplayMode( GLUT_ALPHA | GLUT_DOUBLE | GLUT_RGBA);
+       glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
+       // The Type Of Depth Testing To Do
+/*     glEnable(GL_BLEND);
+       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+       glShadeModel(GL_SMOOTH);*/
+        glDisable(GL_DEPTH);
+       glClearDepth(1.0f);             // Depth Buffer Setup
+       glEnable(GL_DEPTH_TEST);                                                        // Enables Depth Testing
+       glDepthFunc(GL_LEQUAL);                                                         // The Type Of Depth Testing To 
+       glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);      // Really Nice Perspective Calculations
+
+
+    if (fullscreen)
+       cb_game_mode(optArg);
+    else    //well, use gtk then
+    {  
+       cb_windowed_mode(w,h);
+
+    }
+
+    /*register callbacks here*/
+    glutDisplayFunc(cb_display);
+    glutReshapeFunc(cb_reshape);
+    glutKeyboardFunc(cb_keyboard);
+    glutKeyboardUpFunc( cb_keyboard_up);
     glutMouseFunc(cb_mouseclick);
-    glutMotionFunc(cb_mouseover2);
-    glutFullScreen();
-
-    glClearColor(view->bgColor.R, view->bgColor.G, view->bgColor.B, view->bgColor.A);  //background color
-    glClearDepth(1.0);
-    glClear(GL_COLOR_BUFFER_BIT);
-
-
-    glFrontFace(GL_CW);
-// glEnable (GL_LIGHTING);
-// glEnable (GL_LIGHT0);
-//  glEnable (GL_AUTO_NORMAL);
-//  glEnable (GL_NORMALIZE);
-    glEnable(GL_BLEND);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-    glDepthFunc(GL_LESS);
-    glDisable(GL_DEPTH);
-//  glEnable(GL_LINE_SMOOTH);
-
-
-
-/*    *   7.1 glutDisplayFunc
-    * 7.2 glutOverlayDisplayFunc
-    * 7.3 glutReshapeFunc
-    * 7.4 glutKeyboardFunc
-    * 7.5 glutMouseFunc
-    * 7.6 glutMotionFunc, glutPassiveMotionFunc
-    * 7.7 glutVisibilityFunc
-    * 7.8 glutEntryFunc
-    * 7.9 glutSpecialFunc
-    * 7.10 glutSpaceballMotionFunc
-    * 7.11 glutSpaceballRotateFunc
-    * 7.12 glutSpaceballButtonFunc
-    * 7.13 glutButtonBoxFunc
-    * 7.14 glutDialsFunc
-    * 7.15 glutTabletMotionFunc
-    * 7.16 glutTabletButtonFunc
-    * 7.17 glutMenuStatusFunc
-    * 7.18 glutIdleFunc
-    * 7.19 glutTimerFunc 
- */
-    glutMainLoop(); // Infinite event loop
+    glutMotionFunc(cb_drag);
+    glutPassiveMotionFunc(cb_mouseover);
+    glutVisibilityFunc(NULL);
+    glutEntryFunc(cb_mouseentry);//if mouse pointer left or entered the scene
+    glutSpecialFunc(cb_special_key);
+    glutSpecialUpFunc(cb_special_key_up);
+
+    //Attach extra call backs if needed in the future
+/*  glutOverlayDisplayFunc
+    glutSpaceballMotionFunc
+    glutSpaceballRotateFunc
+    glutSpaceballButtonFunc
+    glutButtonBoxFunc
+    glutDialsFunc
+    glutTabletMotionFunc
+    glutTabletButtonFunc
+    glutMenuStatusFunc
+    glutIdleFunc
+    glutTimerFunc 
+*/
+
+
+    //pass control to glut
+    cb_reshape(w,h);
+    glutMainLoop ();
+
+
+    return 0; //we should never reach here
+
 }
 
+
index 7fce19745f1f7c0f9e6786d2017eeec7708ac704..7e74e742fa94a15ce34bed1b4c7eeb19f5ff3760 100644 (file)
@@ -6,7 +6,7 @@
 extern "C" {
 #endif
 
-    void sm_glutinit(int w,int h,int full);
+    int cb_glutinit(int x,int y,int w,int h, int bits,int s_rate,int fullscreen,int* argcp, char *argv[],char* optArg);
 
 #ifdef __cplusplus
 }                              /* end extern "C" */
index 6474f6d50cc8b7f7ae2036edba0c48989a94eff2..d3ddf849f05a9133726a1635010d7358a29ccd55 100644 (file)
@@ -34,8 +34,10 @@ static void apply_actions(ViewInfo* v,int x,int y)
 {
     int a;
     gdouble seconds;
-
-    switch ((a=get_mode(v))) {
+    a=get_mode(v);
+    if((a==MM_PAN) && (view->guiMode==GUI_FULLSCREEN) &&((v->active_camera >= 0)))
+       a=MM_ROTATE;    
+    switch (a) {
     case MM_ROTATE :
        seconds = g_timer_elapsed(view->timer3, NULL);
        if (seconds > 0.1) {
index 4ca368b4acd9bcdce262e16251348d05949148ad..28ba7b1ba1b435c7041b791c4224ef38cf0af973 100644 (file)
@@ -42,7 +42,7 @@ static glCompImage *img3D;
 static glCompButton *panBtn;
 
 
-static void menu_click_pan(glCompObj *obj, GLfloat x, GLfloat y,
+void menu_click_pan(glCompObj *obj, GLfloat x, GLfloat y,
                           glMouseButtonType t)
 {
         deselect_all(view->g[view->activeGraph]);
@@ -57,13 +57,13 @@ static void menu_click_zoom(void *obj, GLfloat x, GLfloat y,
 #endif
 
 
-static void menu_click_zoom_minus(glCompObj *obj, GLfloat x, GLfloat y,
+void menu_click_zoom_minus(glCompObj *obj, GLfloat x, GLfloat y,
                                  glMouseButtonType t)
 {
     glmotion_zoom_inc(0);
 }
 
-static void menu_click_zoom_plus(glCompObj *obj, GLfloat x, GLfloat y,
+void menu_click_zoom_plus(glCompObj *obj, GLfloat x, GLfloat y,
                                 glMouseButtonType t)
 {
     glmotion_zoom_inc(1);
@@ -97,7 +97,7 @@ static void menu_switch_to_fisheye(glCompObj *obj, GLfloat x, GLfloat y,
 
 
 
-static void menu_click_center(glCompObj *obj, GLfloat x, GLfloat y,
+void menu_click_center(glCompObj *obj, GLfloat x, GLfloat y,
                              glMouseButtonType t)
 {
     if (view->active_camera == -1) {   /*2D mode */
@@ -110,7 +110,7 @@ static void menu_click_center(glCompObj *obj, GLfloat x, GLfloat y,
 
     }
 }
-static void switch2D3D(glCompObj *obj, GLfloat x, GLfloat y,
+void switch2D3D(glCompObj *obj, GLfloat x, GLfloat y,
                       glMouseButtonType t)
 {
     if (t == glMouseLeftButton) {
index 906bc06fa41a5b8e769ea172a8ce7f3a9618b9f8..c3eda39f102b95189f7cc6b987bf909416052528 100644 (file)
@@ -56,6 +56,10 @@ void on_settingsCancelBtn_clicked(GtkWidget * widget, gpointer user_data)
 {
     gtk_widget_hide(glade_xml_get_widget(xml, "dlgSettings"));
 }
+void copy_attr(Agraph_t* destG,char* attr,Agraph_t* g)
+{
+    agattr(g,AGRAPH,attr,agget(destG,attr));
+}
 
 
 static int set_color_button_widget(char *attribute, char *widget_name)
@@ -67,7 +71,10 @@ static int set_color_button_widget(char *attribute, char *widget_name)
     attribute=attribute +13;
     buf = agget(view->g[view->activeGraph], attribute);
     if ((!buf) || (strcmp(buf, "") == 0))
+    {
        buf = agget(view->systemGraphs.def_attrs, attribute);
+       copy_attr(view->systemGraphs.def_attrs, attribute,view->g[view->activeGraph]);
+    }
     if (buf) {
        colorxlate(buf, &cl, RGBA_DOUBLE);
        color.red = (int) (cl.u.RGBA[0] * 65535.0);
@@ -119,7 +126,11 @@ static int set_text_widget(char *attribute, char *widget_name)
 
     buf = agget(view->g[view->activeGraph], attribute);
     if ((!buf) || (strcmp(buf, "") == 0))
+    {
        buf = agget(view->systemGraphs.def_attrs, attribute);
+       copy_attr(view->systemGraphs.def_attrs, attribute,view->g[view->activeGraph]);
+    }
+
     if (buf) {
        gtk_entry_set_text((GtkEntry *)
                           glade_xml_get_widget(xml, widget_name), buf);
@@ -136,7 +147,12 @@ static int set_checkbox_widget(char *attribute, char *widget_name)
 
     buf = agget(view->g[view->activeGraph], attribute);
     if ((!buf) || (strcmp(buf, "") == 0))
+    {
        buf = agget(view->systemGraphs.def_attrs, attribute);
+       copy_attr(view->systemGraphs.def_attrs, attribute,view->g[view->activeGraph]);
+    }
+
+
     if (buf) {
        value = atoi(buf);
        gtk_toggle_button_set_active((GtkToggleButton *)
@@ -163,7 +179,7 @@ static int get_checkbox_widget_to_attribute(char *attribute,
                                                                    widget_name));
     sprintf(buf, "%d", value);
     agattr(g, AGRAPH, attribute, buf);
-    return 1;
+   return 1;
 }
 
 static int set_spinbtn_widget(char *attribute, char *widget_name)
@@ -174,7 +190,10 @@ static int set_spinbtn_widget(char *attribute, char *widget_name)
 
     buf = agget(view->g[view->activeGraph], attribute);
     if ((!buf) || (strcmp(buf, "") == 0))
+    {
        buf = agget(view->systemGraphs.def_attrs, attribute);
+       copy_attr(view->systemGraphs.def_attrs, attribute,view->g[view->activeGraph]);
+    }
     if (buf) {
        value = (float) atof(buf);
        gtk_spin_button_set_value((GtkSpinButton *)
@@ -225,7 +244,11 @@ static int set_scalebtn_widget_to_attribute(char *attribute,
     buf = agget(view->g[view->activeGraph], attribute);
 
     if ((!buf) || (strcmp(buf, "") == 0))
+    {
        buf = agget(view->systemGraphs.def_attrs, attribute);
+       copy_attr(view->systemGraphs.def_attrs, attribute,view->g[view->activeGraph]);
+
+    }
     if (buf) {
        value = (float) atof(buf);
        gtk_range_set_value((GtkRange *)
@@ -242,7 +265,10 @@ static int set_combobox_widget(char *attribute, char *widget_name)
     attribute=attribute +9;
     buf = agget(view->g[view->activeGraph], attribute);
     if ((!buf) || (strcmp(buf, "") == 0))
+    {
        buf = agget(view->systemGraphs.def_attrs, attribute);
+       copy_attr(view->systemGraphs.def_attrs, attribute,view->g[view->activeGraph]);
+    }
     if (buf) {
        value = (int) atoi(buf);
        gtk_combo_box_set_active((GtkComboBox *)
@@ -292,9 +318,9 @@ int load_settings_from_graph(Agraph_t * g)
                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*/
 }
 
 int update_graph_from_settings(Agraph_t * g)
index 1b19296343dd7bed312ecf975b93f8f457ab9703..8e401dbe2c6553db2666034f2e58739d6662dcbd 100644 (file)
@@ -53,17 +53,35 @@ int static get_mouse_mode(const char *s)
 
 int static get_button(const char *s)
 {
-
-    if (strcmp(s, "B_LSHIFT") == 0)
-       return B_LSHIFT;
-    if (strcmp(s, "B_RSHIFT") == 0)
-       return B_RSHIFT;
-    if (strcmp(s, "B_LCTRL") == 0)
-       return B_LCTRL;
-    if (strcmp(s, "B_RCTRL") == 0)
-       return B_RCTRL;
-    if (strcmp(s, "0") == 0)
-       return 0;
+    if(view->guiMode != GUI_FULLSCREEN)
+    {
+       if (strcmp(s, "B_LSHIFT") == 0)
+           return B_LSHIFT;
+       if (strcmp(s, "B_RSHIFT") == 0)
+           return B_RSHIFT;
+       if (strcmp(s, "B_LCTRL") == 0)
+           return B_LCTRL;
+       if (strcmp(s, "B_RCTRL") == 0)
+           return B_RCTRL;
+       if (strcmp(s, "0") == 0)
+           return 0;
+    }
+    else
+    {
+               int mod = glutGetModifiers();
+               if (mod == GLUT_ACTIVE_ALT)
+
+       if (strcmp(s, "B_LSHIFT") == 0)
+           return GLUT_ACTIVE_SHIFT;
+       if (strcmp(s, "B_RSHIFT") == 0)
+           return GLUT_ACTIVE_SHIFT;
+       if (strcmp(s, "B_LCTRL") == 0)
+           return GLUT_ACTIVE_CTRL;
+       if (strcmp(s, "B_RCTRL") == 0)
+           return GLUT_ACTIVE_CTRL;
+       if (strcmp(s, "0") == 0)
+           return 0;
+    }
     return 0;
 
 }
index fd460336a70b0aacbbb0f06b96da43920715cc9e..5e316eea18ac249d25333fdcef79bb510cc8d808 100755 (executable)
@@ -56,6 +56,7 @@ gchar *package_locale_dir;
 static char *smyrnaDir;                /* path to directory containin smyrna data files */
 char *smyrnaGlade;
 unsigned char SmyrnaVerbose;
+int width,height;/*glut window size*/
 
 
 /* smyrnaPath:
@@ -103,7 +104,7 @@ static char *parseArgs(int argc, char *argv[], ViewInfo * view)
 {
     unsigned int c;
 
-    while ((c = getopt(argc, argv, ":K:txvf?")) != -1) {
+    while ((c = getopt(argc, argv, ":Kf:txv?")) != -1) {
        switch (c) {
        case 'v':
            SmyrnaVerbose = 1;
@@ -121,6 +122,7 @@ static char *parseArgs(int argc, char *argv[], ViewInfo * view)
 #endif
        case 'f':
            view->guiMode=GUI_FULLSCREEN;
+           view->optArg=strdup(optarg);
            break;
 
        case '?':
@@ -210,9 +212,8 @@ static void windowedMode(int argc, char *argv[])
     gtk_widget_show((GtkWidget*)graphComboBox);
     view->graphComboBox = graphComboBox;
 
-    if(view->guiMode==GUI_FULLSCREEN)
-       gtk_window_fullscreen(glade_xml_get_widget(xml, "frmMain"));
-    gtk_main();
+    if(view->guiMode!=GUI_FULLSCREEN)
+       gtk_main();
 }
 
 
@@ -259,9 +260,11 @@ int main(int argc, char *argv[])
 #ifndef WIN32
     glutInit(&argc, argv);
 #endif
-    windowedMode(argc, argv);
-//    view->guiMode=GUI_GLUT;
-       sm_glutinit(800,600,0);
+
+    if(view->guiMode==GUI_FULLSCREEN)
+       cb_glutinit(0,0,800,600,32,75,1,&argc,argv,view->optArg);
+    else
+       windowedMode(argc, argv);
 #ifdef G_OS_WIN32
     g_free(package_prefix);
     g_free(package_data_dir);
index f97efcafa5ad8eab6748997ffff826b2b0b419d0..13f4c52f5782d96e875f472e3957670d1a6c81b2 100644 (file)
@@ -11,7 +11,7 @@
                        <DebugSettings
                                Command="$(TargetPath)"
                                WorkingDirectory="C:\graphviz-ms\bin"
-                               CommandArguments="-f c:/4elt.dot"
+                               CommandArguments="c:/4elt.dot "
                                Attach="false"
                                DebuggerType="3"
                                Remote="1"
index 147c6a7a2c357ddd5691825df4e5b237746cab4d..9f71227b2897cea3af3c962c8a614f7ca99c0681 100644 (file)
@@ -722,6 +722,7 @@ typedef struct
        int edgerendertype;
        float nodeScale;
        int guiMode;
+       char* optArg;
 
     } ViewInfo;
 /*rotation steps*/
index a1f1910d0829885a209c1aaf3498fa4fd5138218..dbdb74a732d9cf0c939604f8e713978c7298123b 100644 (file)
@@ -534,7 +534,7 @@ static void renderEdges(Agraph_t * g)
                continue;
            if(ED_selected(e))
                continue;
-           glColor4f(c.R,c.G,c.B,c.A);    
+           glColor4f(c.R,c.G,c.B,1);      
            if(!pos_attr_e)
            {
                posT=getPointFromStr(agxget(agtail(e), pos_attr));
@@ -736,20 +736,22 @@ void updateSmGraph(Agraph_t * g,topview* t)
     t->avgedgelength = totalELength / t->Edgecount;
 //    t->init_node_size=init_node_size(g, t);
     view->Topview=t;
-    cacheNodes(g,t);
+
+
+    /*render nodes once to get set some attributes set,THIS IS A HACK, FIX IT*/
+    renderNodes(g);
     cacheEdges(g,t);
-    cacheSelectedNodes(g,t);
     cacheSelectedEdges(g,t);
-    cacheNodeLabels(g,t);
+    cacheNodes(g,t);
+    cacheSelectedNodes(g,t);
     cacheEdgeLabels(g,t);
+    cacheNodeLabels(g,t);
 }
 void initSmGraph(Agraph_t * g,topview* rv)
 {
     rv->maxnodedegree = 1;
 
         
-    /*create glcomp menu system */
-    view->widgets = glcreate_gl_topview_menu();
 
     /*create attribute list*/
     rv->attributes=load_attr_list(view->g[view->activeGraph]);
@@ -774,9 +776,28 @@ void initSmGraph(Agraph_t * g,topview* rv)
 
 void renderSmGraph(Agraph_t * g,topview* t)
 {
+    /*
+       we like to have blending affect where node and edge  overlap
+       to achive this depth test should be turned off.
+    */
 
     glEnable(GL_POINT_SMOOTH);
+    glEnable(GL_DEPTH_TEST);
+    glDepthFunc (GL_ALWAYS);
+    glEnable(GL_DEPTH);
+//    glDepthMask(0);
 
+    if(view->drawedges)
+    {
+       glCallList(t->cache.edge_id);
+        glCallList(t->cache.seledge_id);
+        if(view->drawedgelabels)
+       {
+           if(view->zoom*-1 <  t->fitin_zoom /(float)view->labelnumberofnodes*-1) 
+                   glCallList(t->cache.edgelabel_id);
+
+       }
+    }
     if(view->drawnodes)
     {
        glPointSize(view->nodeScale*t->fitin_zoom/view->zoom);
@@ -789,17 +810,6 @@ void renderSmGraph(Agraph_t * g,topview* t)
        }
     }
 
-    if(view->drawedges)
-    {
-       glCallList(t->cache.edge_id);
-        glCallList(t->cache.seledge_id);
-        if(view->drawedgelabels)
-       {
-           if(view->zoom*-1 <  t->fitin_zoom /(float)view->labelnumberofnodes*-1) 
-                   glCallList(t->cache.edgelabel_id);
-
-       }
-    }
 }
 
 void freeSmGraph(Agraph_t * g,topview* t)
index fe5e1801c2a889a6c108ce670b84129af9aadcba..ba949c3ba5ccafc5d165c83440c0cb0b2182a20b 100755 (executable)
@@ -293,8 +293,6 @@ void set_viewport_settings_from_template(ViewInfo * view, Agraph_t * g)
             ("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;
@@ -519,6 +517,10 @@ void init_viewport(ViewInfo * view)
     view->edgerendertype=0;
     if(view->guiMode!=GUI_FULLSCREEN)
        view->guiMode=GUI_WINDOWED;
+
+    /*create glcomp menu system */
+    view->widgets = glcreate_gl_topview_menu();
+
 }
 
 
@@ -679,7 +681,9 @@ void refreshViewport(int doClear)
     view->refresh.selection=1;
     view->refresh.visibility=1;
     load_settings_from_graph(graph);
-    update_graph_from_settings(graph);
+
+    if(view->guiMode!=GUI_FULLSCREEN)
+       update_graph_from_settings(graph);
     set_viewport_settings_from_template(view, graph);
     graphRecord(graph);
     initSmGraph(graph,view->Topview);