From dcfcfbbc8f6cb4170b8904fdd34ae0d1df99df2a Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 18 Jan 2005 06:22:03 +0000 Subject: [PATCH] %g->%.3g + use format also for 2d graphs --- Common/DefaultOptions.h | 4 ++-- Graphics/Graph2D.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index eea7163bd3..ade49a03a9 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -365,12 +365,12 @@ StringXString PostProcessingOptions_String[] = { StringXString ViewOptions_String[] = { { F|O, "AbscissaName" , opt_view_abscissa_name , "" , "Abscissa name for 2D graphs" }, - { F|O, "AbscissaFormat" , opt_view_abscissa_format , "%g" , + { F|O, "AbscissaFormat" , opt_view_abscissa_format , "%.3g" , "Abscissa number format for 2D graphs (in standard C form)" }, { F, "FileName" , opt_view_filename , "" , "Default post-processing view file name" }, - { F|O, "Format" , opt_view_format , "%g" , + { F|O, "Format" , opt_view_format , "%.3g" , "Number format (in standard C form)" }, { F|O, "GeneralizedRaiseX" , opt_view_gen_raise0 , "v0" , diff --git a/Graphics/Graph2D.cpp b/Graphics/Graph2D.cpp index 16358634be..9ee29889e4 100644 --- a/Graphics/Graph2D.cpp +++ b/Graphics/Graph2D.cpp @@ -1,4 +1,4 @@ -// $Id: Graph2D.cpp,v 1.44 2005-01-09 21:36:47 geuzaine Exp $ +// $Id: Graph2D.cpp,v 1.45 2005-01-18 06:22:03 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -199,8 +199,11 @@ static void Draw_Graph2D(Post_View * v, glColor4ubv((GLubyte *) & CTX.color.text); if(v->Type == DRAW_POST_2D_SPACE && ((v->ShowTime == 1 && List_Nbr(v->Time) > 1) || - (v->ShowTime == 2 && List_Nbr(v->Time) > 0))) - sprintf(label, "%s (%g)", v->Name, *(double *)List_Pointer(v->Time, v->TimeStep)); + (v->ShowTime == 2 && List_Nbr(v->Time) > 0))){ + char tmp[256]; + sprintf(tmp, v->Format, *(double *)List_Pointer(v->Time, v->TimeStep)); + sprintf(label, "%s (%s)", v->Name, tmp); + } else sprintf(label, "%s", v->Name); glRasterPos2d(xtop, ytop + font_h + tic); -- GitLab