diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 3ab611ab2c7d307093d54be2a2e7028efa6b8094..d4cb3f2a917a27ece50068e188161575e4012b57 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.428 2005-03-13 05:32:43 geuzaine Exp $ +// $Id: GUI.cpp,v 1.429 2005-03-13 09:10:34 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -2616,12 +2616,12 @@ void GUI::create_option_window() view_butt[7]->callback(activate_cb, (void*)"view_axes_auto_2d"); view_value[20] = new Fl_Value_Input(L + width / 2, 2 * WB + 9 * BH, IW / 2, BH); - view_value[20]->minimum(0); + view_value[20]->minimum(-1024); view_value[20]->maximum(1024); view_value[20]->step(1); view_value[21] = new Fl_Value_Input(L + width / 2 + IW / 2, 2 * WB + 9 * BH, IW / 2, BH, "Position"); view_value[21]->align(FL_ALIGN_RIGHT); - view_value[21]->minimum(0); + view_value[21]->minimum(-1024); view_value[21]->maximum(1024); view_value[21]->step(1); diff --git a/Graphics/Draw.h b/Graphics/Draw.h index 6115aa5bb90d1ba5e43b8fe7bdffece612c23cc7..5b6790c953a70716ff382ae75320219d99426d5e 100644 --- a/Graphics/Draw.h +++ b/Graphics/Draw.h @@ -66,7 +66,7 @@ void Draw_Post(void); void Draw_Graph2D(void); void Draw_Text2D(void); void Draw_Text2D3D(int dim, int timestep, int nb, List_T *td, List_T *tc); -void FixText2DCoordinates(double *x, double *y); +int Fix2DCoordinates(double *x, double *y); void Draw_OnScreenMessages(void); void Draw_Scales(void); void Draw_Disk(double size, double rint, double x, double y, double z, int light); diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp index f3c1cf5a4b0a75ec15e53f4a6a5093922f5823d4..f752bf16f41e566d4d2bb0bb087ed89650c37fbb 100644 --- a/Graphics/Entity.cpp +++ b/Graphics/Entity.cpp @@ -1,4 +1,4 @@ -// $Id: Entity.cpp,v 1.60 2005-03-13 05:32:44 geuzaine Exp $ +// $Id: Entity.cpp,v 1.61 2005-03-13 09:10:35 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -505,27 +505,19 @@ void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin, void Draw_SmallAxes() { - double l, o, xx, xy, yx, yy, zx, zy, cx, cy; - - l = CTX.small_axes_size; - o = 2; - - if(CTX.small_axes_pos[0] > 0) - cx = CTX.viewport[0] + CTX.small_axes_pos[0]; - else - cx = CTX.viewport[2] + CTX.small_axes_pos[0]; - - if(CTX.small_axes_pos[1] > 0) - cy = CTX.viewport[3] - CTX.small_axes_pos[1]; - else - cy = CTX.viewport[1] - CTX.small_axes_pos[1]; - - xx = l * CTX.rot[0]; - xy = l * CTX.rot[1]; - yx = l * CTX.rot[4]; - yy = l * CTX.rot[5]; - zx = l * CTX.rot[8]; - zy = l * CTX.rot[9]; + double l = CTX.small_axes_size; + double o = 2; + + double cx = CTX.small_axes_pos[0]; + double cy = CTX.small_axes_pos[1]; + Fix2DCoordinates(&cx, &cy); + + double xx = l * CTX.rot[0]; + double xy = l * CTX.rot[1]; + double yx = l * CTX.rot[4]; + double yy = l * CTX.rot[5]; + double zx = l * CTX.rot[8]; + double zy = l * CTX.rot[9]; glLineWidth(CTX.line_width); gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor); diff --git a/Graphics/Graph2D.cpp b/Graphics/Graph2D.cpp index 6aedb1c2d455220e8ef202fc216faa395cceb9fa..0e75828840d725775e0e5361f6d189f9159cd794 100644 --- a/Graphics/Graph2D.cpp +++ b/Graphics/Graph2D.cpp @@ -1,4 +1,4 @@ -// $Id: Graph2D.cpp,v 1.49 2005-03-12 20:17:41 geuzaine Exp $ +// $Id: Graph2D.cpp,v 1.50 2005-03-13 09:10:35 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -92,15 +92,13 @@ static void addval(Post_View * v, double Abs, double Val, } -static void Draw_Graph2D(Post_View * v, double xx, double yy, +static void Draw_Graph2D(Post_View * v, double xtop, double ytop, double width, double height, double tic) { char label[1024]; float font_h, font_a; int i, i_inc, i_max, j, j_inc, j_max, k, nb; double dx, dy, dv; - double xtop = xx; - double ytop = CTX.viewport[3] - yy; double ybot = ytop - height; double Abs, Val, ValMin = 0., ValMax = 0., AbsMin, AbsMax; double p1[3], p2[3]; @@ -385,7 +383,12 @@ void Draw_Graph2D(void) Post_View *v = *(Post_View **) List_Pointer(todraw, i); if(!v->AutoPosition) { - Draw_Graph2D(v, v->Position[0], v->Position[1], v->Size[0], v->Size[1], tic); + double x = v->Position[0], y = v->Position[1]; + int center = Fix2DCoordinates(&x, &y); + Draw_Graph2D(v, + x - (center & 1 ? v->Size[0]/2. : 0), + y + (center & 2 ? v->Size[1]/2. : 0), + v->Size[0], v->Size[1], tic); } else{ double winw = CTX.viewport[2] - CTX.viewport[0]; @@ -396,7 +399,7 @@ void Draw_Graph2D(void) double h = frach * winh - ysep; double xmin = CTX.viewport[0] + (1-fracw)/2. * winw; double ymin = CTX.viewport[1] + (1-frach)/2. * winh; - Draw_Graph2D(v, xmin + 0.95*xsep, ymin + 0.4*ysep, w, h, tic); + Draw_Graph2D(v, xmin + 0.95*xsep, CTX.viewport[3] - (ymin + 0.4*ysep), w, h, tic); } else if(List_Nbr(todraw) == 2){ double fracw = 0.75, frach = 0.85; @@ -405,7 +408,7 @@ void Draw_Graph2D(void) double xmin = CTX.viewport[0] + (1-fracw)/2. * winw; double ymin = CTX.viewport[1] + (1-frach)/3. * winh; if(num == 1) ymin += (h + ysep + (1-frach)/3. * winh); - Draw_Graph2D(v, xmin + 0.95*xsep, ymin + 0.4*ysep, w, h, tic); + Draw_Graph2D(v, xmin + 0.95*xsep, CTX.viewport[3] - (ymin + 0.4*ysep), w, h, tic); num++; } else{ @@ -416,7 +419,7 @@ void Draw_Graph2D(void) if(num == 1 || num == 3) xmin += (w + xsep + (1-fracw)/3. * winw); double ymin = CTX.viewport[1] + (1-frach)/3. * winh; if(num == 2 || num == 3) ymin += (h + ysep + (1-frach)/3. * winh); - Draw_Graph2D(v, xmin + 0.95*xsep, ymin + 0.4*ysep, w, h, tic); + Draw_Graph2D(v, xmin + 0.95*xsep, CTX.viewport[3] - (ymin + 0.4*ysep), w, h, tic); num++; } } @@ -425,8 +428,10 @@ void Draw_Graph2D(void) // Text strings -void FixText2DCoordinates(double *x, double *y) +int Fix2DCoordinates(double *x, double *y) { + int ret = (*x > 99999 && *y > 99999) ? 3 : (*y > 99999) ? 2 : (*x > 99999) ? 1 : 0; + if(*x < 0) // measure from right border *x = CTX.viewport[2] + *x; else if(*x > 99999) // by convention, x-centered @@ -438,6 +443,7 @@ void FixText2DCoordinates(double *x, double *y) *y = CTX.viewport[3]/2.; else *y = CTX.viewport[3] - *y; + return ret; } // Parser format: T2(x,y,style){"str","str",...}; @@ -481,7 +487,7 @@ void Draw_Text2D3D(int dim, int timestep, int nb, List_T * td, List_T * tc) x = d1[0]; y = d1[1]; z = 0.; - FixText2DCoordinates(&x, &y); + Fix2DCoordinates(&x, &y); style = d1[2]; index = (int)d1[3]; if(d2) diff --git a/Graphics/Scale.cpp b/Graphics/Scale.cpp index 1d204df435058d82f52185d2642a401c6208df9e..0e1f5d1853a174131e1c371a911643a69f4b2235 100644 --- a/Graphics/Scale.cpp +++ b/Graphics/Scale.cpp @@ -1,4 +1,4 @@ -// $Id: Scale.cpp,v 1.59 2005-03-12 07:52:56 geuzaine Exp $ +// $Id: Scale.cpp,v 1.60 2005-03-13 09:10:35 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -328,11 +328,12 @@ void Draw_Scales(void) Post_View *v = *(Post_View **) List_Pointer(todraw, i); if(!v->AutoPosition) { + double x = v->Position[0], y = v->Position[1]; + int center = Fix2DCoordinates(&x, &y); draw_scale(v, - v->Position[0], - CTX.viewport[3] - v->Size[1] - v->Position[1], - v->Size[0], v->Size[1], - tic, CTX.post.horizontal_scales); + x - ((center & 1) ? v->Size[0]/2. : 0.), + y - v->Size[1] + ((center & 2) ? v->Size[1]/2. : 0.), + v->Size[0], v->Size[1], tic, CTX.post.horizontal_scales); } else{ if(CTX.post.horizontal_scales){ diff --git a/Plugin/Annotate.cpp b/Plugin/Annotate.cpp index 66ed436d70f0179c216bb8312c0051de63a0ff69..a6dd6ef85dcbc928216754e88cb79563c0db85bf 100644 --- a/Plugin/Annotate.cpp +++ b/Plugin/Annotate.cpp @@ -1,4 +1,4 @@ -// $Id: Annotate.cpp,v 1.10 2005-03-11 17:25:07 geuzaine Exp $ +// $Id: Annotate.cpp,v 1.11 2005-03-13 09:10:35 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -103,7 +103,7 @@ void GMSH_AnnotatePlugin::draw() (double)CTX.viewport[1], (double)CTX.viewport[3], -1., 1.); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - FixText2DCoordinates(&X, &Y); + Fix2DCoordinates(&X, &Y); glRasterPos2d(X, Y); Draw_String(AnnotateOptions_String[0].def, style); // draw 10-pixel marker