From 03825ecd459e5ceac06565be88614888ac5d7acd Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 18 Jan 2005 05:31:04 +0000
Subject: [PATCH] set default number format to %g, and use it to display the
 time value, too

---
 Common/DefaultOptions.h |  4 ++--
 Graphics/Scale.cpp      | 16 +++++++++++-----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 751e0f7b64..eea7163bd3 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 , "%.3e" , 
+  { F|O, "AbscissaFormat" , opt_view_abscissa_format , "%g" , 
     "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 , "%.3e" , 
+  { F|O, "Format" , opt_view_format , "%g" , 
     "Number format (in standard C form)" },
 
   { F|O, "GeneralizedRaiseX" , opt_view_gen_raise0 , "v0" , 
diff --git a/Graphics/Scale.cpp b/Graphics/Scale.cpp
index 46b120fa1c..3e301f0cfd 100644
--- a/Graphics/Scale.cpp
+++ b/Graphics/Scale.cpp
@@ -1,4 +1,4 @@
-// $Id: Scale.cpp,v 1.55 2005-01-01 19:35:29 geuzaine Exp $
+// $Id: Scale.cpp,v 1.56 2005-01-18 05:31:04 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -268,8 +268,11 @@ void draw_scale(Post_View * v,
   // the label
 
   if((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);
 
@@ -378,8 +381,11 @@ void Draw_Scales(void)
 	width_prev = width;
 	sprintf(label, v->Format, -100*M_PI);
 	width = bar_size + tic + gl_width(label);
-	if(List_Nbr(v->Time) > 1 && v->ShowTime)
-	  sprintf(label, "%s (%g)", v->Name, *(double *)List_Pointer(v->Time, v->TimeStep));
+	if(List_Nbr(v->Time) > 1 && v->ShowTime){
+	  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);
 	if(gl_width(label) > width)
-- 
GitLab