From a5e4d07503ecd15416e386f32b68ccf741e8965b Mon Sep 17 00:00:00 2001 From: arif Date: Tue, 26 May 2009 17:00:08 +0000 Subject: [PATCH] -gvpr button activated -gvpr broken pipes issue fixed few gvpr windows related bugs fixed(iddefs for mingw and vs) --- cmd/smyrna/glmotion.c | 113 +++++++++++++++++------------------------- cmd/smyrna/topview.c | 12 +---- 2 files changed, 47 insertions(+), 78 deletions(-) diff --git a/cmd/smyrna/glmotion.c b/cmd/smyrna/glmotion.c index 020b999e5..d5326cc38 100644 --- a/cmd/smyrna/glmotion.c +++ b/cmd/smyrna/glmotion.c @@ -9,7 +9,8 @@ gboolean redraw = FALSE; -int glmotion_main(ViewInfo * v,GdkEventMotion * event,GtkWidget * widget) + +void glmotion_main(ViewInfo * v,GdkEventMotion * event,GtkWidget * widget) { redraw = FALSE; @@ -55,90 +56,73 @@ int glmotion_main(ViewInfo * v,GdkEventMotion * event,GtkWidget * widget) gdk_window_invalidate_rect(widget->window, &widget->allocation, FALSE); - return 1; } -int glmotion_zoom(ViewInfo * v) +void glmotion_zoom_inc(int zoomin) { + float inc_value; + inc_value=(float)(view->Topview->fitin_zoom * MAX_ZOOM*-1-view->Topview->fitin_zoom *MIN_ZOOM*-1)/ZOOM_STEPS; + if (zoomin) /*zooming in , zoom value should be decreased*/ + graph_zoom(view->zoom-view->zoom*0.25 ); + else + graph_zoom(view->zoom+view->zoom*0.25); /*zoom out*/ + glexpose(); +} +/*real zoom in out is done here, all other functions send this one what they desired, it is not guranteed,*/ +void graph_zoom(float real_zoom) +{ + float old_zoom; + if (view->active_camera == -1) + old_zoom = view->zoom; + else + old_zoom = view->cameras[view->active_camera]->r; -/* if (view->active_camera == -1) { - old_zoom = view->zoom; - real_zoom = view->zoom + dx / 10 * (view->zoom * -1 / 20); - } - else - { - old_zoom = view->cameras[view->active_camera]->r; - real_zoom = - (view->cameras[view->active_camera]->r + - dx / 10 * (view->cameras[view->active_camera]->r / 20)) * - -1; - } - - if (real_zoom > MAX_ZOOM) - real_zoom = (float) MAX_ZOOM; - if (real_zoom < MIN_ZOOM) - real_zoom = (float) MIN_ZOOM; - - if (view->active_camera == -1) - view->zoom = real_zoom; - else { - view->cameras[view->active_camera]->r = real_zoom * -1; - - } - view->panx = old_zoom * view->panx / real_zoom; - view->pany = old_zoom * view->pany / real_zoom; - - x = ((float) 100.0 - (float) 1.0) * (view->zoom - - (float) MIN_ZOOM) / - ((float) MAX_ZOOM - (float) MIN_ZOOM) + (float) 1.0; - sprintf(buf, "%i", (int) x); - glCompLabelSetText((glCompLabel *) view->Topview->customptr, buf); - redraw = TRUE;*/ - + if (real_zoom < view->Topview->fitin_zoom * MAX_ZOOM) + real_zoom = (float) view->Topview->fitin_zoom * MAX_ZOOM; + if (real_zoom > view->Topview->fitin_zoom *MIN_ZOOM) + real_zoom = (float) view->Topview->fitin_zoom *MIN_ZOOM; + if(view->active_camera==-1) + view->zoom = real_zoom; + else + view->cameras[view->active_camera]->r=real_zoom*-1; + /*adjust pan values*/ + view->panx = old_zoom * view->panx / real_zoom; + view->pany = old_zoom * view->pany / real_zoom; + /*set label to new zoom value */ +#if 0 + xx = ((float) 100.0 - (float) 1.0) * (v->zoom - + (float) MIN_ZOOM) / ((float) MAX_ZOOM - (float) MIN_ZOOM) + (float) 1.0; + sprintf(buf, "%i", (int) xx); +#endif +/* if (v->Topview->customptr) + glCompLabelSetText((glCompLabel *) v->Topview->customptr, buf);*/ +} +void glmotion_zoom(ViewInfo * v) +{ char buf[256]; - float real_zoom,old_zoom,xx; + float real_zoom,xx; if (view->active_camera == -1) { - old_zoom = view->zoom; real_zoom = view->zoom + view->mouse.dx / 10 * (view->zoom * -1 / 20); } else { - old_zoom = view->cameras[view->active_camera]->r; real_zoom = (view->cameras[view->active_camera]->r + view->mouse.dx / 10 * (view->cameras[view->active_camera]->r / 20)) * -1; } + graph_zoom(real_zoom); - if (real_zoom > MAX_ZOOM) - real_zoom = (float) MAX_ZOOM; - if (real_zoom < MIN_ZOOM) - real_zoom = (float) MIN_ZOOM; - if(v->active_camera==-1) - v->zoom = real_zoom; - else - v->cameras[v->active_camera]->r=real_zoom*-1; - /*adjust pan values*/ - view->panx = old_zoom * view->panx / real_zoom; - view->pany = old_zoom * view->pany / real_zoom; - - /*set label to new zoom value */ - xx = ((float) 100.0 - (float) 1.0) * (v->zoom - - (float) MIN_ZOOM) / ((float) MAX_ZOOM - (float) MIN_ZOOM) + (float) 1.0; - sprintf(buf, "%i", (int) xx); -/* if (v->Topview->customptr) - glCompLabelSetText((glCompLabel *) v->Topview->customptr, buf);*/ - return 1; } -int glmotion_pan(ViewInfo * v) +void glmotion_pan(ViewInfo * v) { float gldx,gldy; if(v->active_camera ==-1) @@ -159,9 +143,8 @@ int glmotion_pan(ViewInfo * v) } redraw = TRUE; - return 1; } -int glmotion_adjust_pan(ViewInfo* v,float panx,float pany) +void glmotion_adjust_pan(ViewInfo* v,float panx,float pany) { float gldx,gldy; if(v->active_camera ==-1) @@ -182,11 +165,9 @@ int glmotion_adjust_pan(ViewInfo* v,float panx,float pany) } redraw = TRUE; - return 1; - } -int glmotion_rotate(ViewInfo * v) +void glmotion_rotate(ViewInfo * v) { if(v->mouse.rotate_axis==MOUSE_ROTATE_XY) { @@ -206,6 +187,4 @@ int glmotion_rotate(ViewInfo * v) v->cameras[v->active_camera]->anglez-=v->mouse.dx/7; v->cameras[v->active_camera]->anglez-=v->mouse.dy/7; } - - return 1; } diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index f86596ecd..2af907f48 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -338,7 +338,7 @@ void preparetopview(Agraph_t * g, topview * t) } -static float set_gl_dot_size(topview * t) +float set_gl_dot_size(topview * t) { static float sizevc; if (view->active_camera==-1) @@ -363,7 +363,6 @@ static int begintopviewnodes(Agraph_t* g) { case 0: glPointSize((GLfloat)set_gl_dot_size(view->Topview)); -// glPointSize((GLfloat)0.00); glEnable(GL_POINT_SMOOTH); glBegin(GL_POINTS); break; @@ -1373,19 +1372,10 @@ static void menu_click_fisheye_magnifier(void *p) static void menu_click_zoom_minus(void *p) { - if ((view->zoom - (float)ZOOM_STEP) > (float)MIN_ZOOM) - view->zoom = view->zoom - (float)ZOOM_STEP; - else - view->zoom = (float)MIN_ZOOM; } static void menu_click_zoom_plus(void *p) { - if ((view->zoom + (float)ZOOM_STEP) < (float)MAX_ZOOM) - view->zoom = view->zoom + (float)ZOOM_STEP; - else - view->zoom = (float) MAX_ZOOM; - } #ifdef UNUSED -- 2.40.0