]> granicus.if.org Git - graphviz/commitdiff
*** empty log message ***
authorarif <devnull@localhost>
Fri, 4 Apr 2008 20:21:36 +0000 (20:21 +0000)
committerarif <devnull@localhost>
Fri, 4 Apr 2008 20:21:36 +0000 (20:21 +0000)
cmd/smyrna/glexpose.c
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topview.c
cmd/smyrna/viewport.c
cmd/smyrna/viewport.h
cmd/smyrna/viewportcamera.c [new file with mode: 0644]
cmd/smyrna/viewportcamera.h [new file with mode: 0644]

index 7c09010ae53f98bf3a76d25dd1907ec54879142e..91e9a345365e39fa27e7c44bbdaf74f1b87bd980 100644 (file)
@@ -27,12 +27,14 @@ int glupdatecamera(ViewInfo * view)
 {
 
        glLoadIdentity();
-       gluLookAt(view->panx, view->pany, view->zoom * -1, view->panx,
-             view->pany, 0.0, 0.0, 1.0, 0.0);
-/*     gluLookAt(view->panx, view->pany, view->zoom * -1, 0,
-             0, 0.0, 0.0, 1.0, 0.0);
-*/
+       if (view->active_camera==-1)
+               gluLookAt(view->panx, view->pany, view->zoom * -1, view->panx,
+                       view->pany, 0.0, 0.0, 1.0, 0.0);
 
+       else
+               gluLookAt(view->cameras[view->active_camera]->x,view->cameras[view->active_camera]->y,view->cameras[view->active_camera]->z,
+               view->cameras[view->active_camera]->targetx,view->cameras[view->active_camera]->targety,view->cameras[view->active_camera]->targetz,
+                                         0.0, 1.0, 0.0);
        GetOGLPosRef(1, view->h - 5, &(view->clipX1), &(view->clipY1),
                 &(view->clipZ1));
     GetOGLPosRef(view->w - 1, 1, &(view->clipX2), &(view->clipY2),
index 22c0103198425eec34932453fb24e11170685873..518f735777a21761d443e90af3d6c7bccdb11c87 100644 (file)
@@ -142,10 +142,6 @@ typedef struct _viewport_camera{
        float targetz;
 
        cam_t type; //
-       float panx;
-       float pany;
-       float panz;
-       float zoom;
 } viewport_camera;
 
 
index a9ce437ff16c64c122c021075a03350591abc4d5..19b4781f8e4024d92e312a8f1b9fd45e90f2bab7 100755 (executable)
@@ -954,6 +954,16 @@ void menu_click_alpha_plus(void *p)
        view->zoom = (float) MAX_ZOOM;
 
 }
+void menu_click_3d_view(void *p)
+{
+    if ((view->zoom + ZOOM_STEP) < MAX_ZOOM)
+       view->zoom = view->zoom + ZOOM_STEP;
+    else
+       view->zoom = (float) MAX_ZOOM;
+
+}
+
+
 
 #ifdef _WIN32
 #define SMYRNA_ICON_PAN "c:/pan.raw"
@@ -1002,7 +1012,7 @@ glCompSet *glcreate_gl_topview_menu()
      */
 
     //small panel left bottom
-    p = glCompPanelNew(25, 25, 245, 40);
+    p = glCompPanelNew(25, 25, 325, 40);
     p->data = 0;
     glCompSetAddPanel(s, p);
 
@@ -1022,7 +1032,14 @@ glCompSet *glcreate_gl_topview_menu()
     glCompSetAddButton(s, b);
 
 
-    b = glCompButtonNew(165, 7, 75, 25, "HIDE", '\0', 0, 0);
+    b = glCompButtonNew(165, 7, 75, 25, "CAMERAS", '\0', 0, 0);
+    b->customptr = view;
+    b->panel = p;
+    b->groupid = 1;
+    b->callbackfunc = menu_click_3d_view;
+    glCompSetAddButton(s, b);
+
+    b = glCompButtonNew(245, 7, 75, 25, "HIDE", '\0', 0, 0);
     b->color.R = 1;
     b->customptr = view;
     b->panel = p;
@@ -1030,6 +1047,7 @@ glCompSet *glcreate_gl_topview_menu()
     b->callbackfunc = menu_click_hide;
     glCompSetAddButton(s, b);
 
+
     //control panel
     p = glCompPanelNew(25, 75, 165, 200);
     p->data = 1;               //control panel
index 0bea6456977126dc2e255f8abf394d0340a8ef48..3adbcd5184ba00396182720ee1495e2939e29457 100755 (executable)
@@ -339,6 +339,10 @@ void init_viewport(ViewInfo * view)
     view->Selection.Anti = 0;
     view->Topview = malloc(sizeof(topview));
     view->Topview->topviewmenu = '\0';
+       view->cameras='\0';;
+       view->camera_count=0;
+       view->active_camera=-1;
+
     set_viewport_settings_from_template(view, view->default_attributes);
 }
 
@@ -1248,52 +1252,3 @@ int setGdkColor(GdkColor * c, char *color) {
 void glexpose() {
     expose_event(view->drawing_area, NULL, NULL);
 }
-
-
-
-
-
-static viewport_camera* new_viewport_camera(ViewInfo * view)
-{
-       viewport_camera* c=malloc(sizeof(viewport_camera));
-       return c;
-}
-
-viewport_camera* add_camera_to_viewport(ViewInfo * view)
-{
-       view->cameras= RALLOC(view->camera_count,view->cameras,viewport_camera*);
-       view->cameras[view->camera_count]=new_viewport_camera(view);
-       view->camera_count++;
-       return view->cameras[view->camera_count-1];
-}
-int delete_camera_from_viewport(ViewInfo * view,viewport_camera* c)
-{
-    int ind = 0;
-    int found = 0;
-    for (ind; ind < view->camera_count - 1; ind++)
-       {
-               if ((view->cameras[ind] == c) && found == 0)
-                   found = 1;
-               if (found == 1)
-                       view->cameras[ind] =view->cameras[ind + 1];
-    }
-    if (found)
-       {
-               free(c);
-               view->camera_count--;
-               view->cameras =
-                       realloc(view->cameras, sizeof(viewport_camera*) * view->camera_count);
-               return 1;
-    }
-    return 0;
-}
-int activate_viewport_camera (ViewInfo * view,int cam_index)
-{
-       if (cam_index < view);
-
-
-
-}
-
-
-
index 62b1abb7c8e6754dc7e3f2ff44f83165549b19b1..e7bda76ff921ba59afe5627daab3ea041c334421 100755 (executable)
@@ -37,9 +37,6 @@ void move_node(void *n, float dx, float dy);
 void glexpose();
 void move_nodes(Agraph_t * g);
 
-viewport_camera* add_camera_to_viewport(ViewInfo * view);
-int delete_camera_from_viewport(ViewInfo * view,viewport_camera* c);
-int activate_viewport_camera (ViewInfo * view,int cam_index);
 
  /* helper functions */
 extern int setGdkColor(GdkColor * c, char *color);
diff --git a/cmd/smyrna/viewportcamera.c b/cmd/smyrna/viewportcamera.c
new file mode 100644 (file)
index 0000000..8e0711c
--- /dev/null
@@ -0,0 +1,63 @@
+#include "viewportcamera.h"
+static viewport_camera* new_viewport_camera(ViewInfo * view)
+{
+       viewport_camera* c=malloc(sizeof(viewport_camera));
+       return c;
+}
+
+viewport_camera* add_camera_to_viewport(ViewInfo * view)
+{
+       view->cameras=(viewport_camera**)realloc(view->cameras,sizeof(viewport_camera *)*view->camera_count);
+
+       view->cameras[view->camera_count]=new_viewport_camera(view);
+       view->camera_count++;
+       return view->cameras[view->camera_count-1];
+}
+int delete_camera_from_viewport(ViewInfo * view,viewport_camera* c)
+{
+    int ind = 0;
+    int found = 0;
+    for (ind; ind < view->camera_count - 1; ind++)
+       {
+               if ((view->cameras[ind] == c) && found == 0)
+                   found = 1;
+               if (found == 1)
+                       view->cameras[ind] =view->cameras[ind + 1];
+    }
+    if (found)
+       {
+               free(c);
+               view->camera_count--;
+               view->cameras =
+                       realloc(view->cameras, sizeof(viewport_camera*) * view->camera_count);
+               return 1;
+    }
+    return 0;
+}
+int activate_viewport_camera (ViewInfo * view,int cam_index)
+{
+       if (cam_index < view)
+       {
+               view->active_camera=cam_index;
+               return refresh_viewport_camera(view);
+       }
+       else
+               return 0;
+}
+int refresh_viewport_camera (ViewInfo * view)
+{
+       if(view->active_camera >=0)
+       {
+               
+/*             view->panx=view->cameras[view->active_camera]->panx;
+               view->pany=view->cameras[view->active_camera]->pany;
+               view->panz=view->cameras[view->active_camera]->panz;
+               view->zoom=view->cameras[view->active_camera]->zoom;*/
+               return 1;
+       }
+       else
+               return 0;
+
+
+
+}
diff --git a/cmd/smyrna/viewportcamera.h b/cmd/smyrna/viewportcamera.h
new file mode 100644 (file)
index 0000000..0d3136b
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef VIEWPORTCAMERA_H
+#define VIEWPORTCAMERA_H
+#include "smyrnadefs.h"
+viewport_camera* add_camera_to_viewport(ViewInfo * view);
+int delete_camera_from_viewport(ViewInfo * view,viewport_camera* c);
+int activate_viewport_camera (ViewInfo * view,int cam_index);
+int refresh_viewport_camera (ViewInfo * view);
+
+#endif
\ No newline at end of file