diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index d5a25c74f1bae18613fe45dd0fc81d3c85cec85d..cfb969b43cc1a913188b2690a1861625925f181d 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -316,6 +316,8 @@ 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" , + "Abscissa number format for 2D graphs (in standard C form)" }, { F, "FileName" , opt_view_filename , "" , "Default file name to assign to the post-processing view" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 5dc3836f2032519e6f09586a82288889597529db..ea84860f9030904faa50d42c95774782a78f6f19 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.86 2002-09-02 22:38:57 geuzaine Exp $ +// $Id: Options.cpp,v 1.87 2002-10-12 19:41:13 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -903,6 +903,17 @@ char * opt_view_abscissa_name(OPT_ARGS_STR){ #endif return v->AbscissaName; } +char * opt_view_abscissa_format(OPT_ARGS_STR){ + GET_VIEW(NULL) ; + if(action & GMSH_SET){ + strcpy(v->AbscissaFormat, val); + } +#ifdef _FLTK + if(WID && (action & GMSH_GUI) && (num == WID->view_number)) + WID->view_input[3]->value(v->AbscissaFormat); +#endif + return v->AbscissaFormat; +} char * opt_print_eps_font(OPT_ARGS_STR){ diff --git a/Common/Options.h b/Common/Options.h index 877bb04b863b1b9b7ba61fb1716a40d07099fcad..0403bec0f4820cf62228ab3dee92adbd9d05a8c6 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -180,6 +180,7 @@ char * opt_view_name(OPT_ARGS_STR); char * opt_view_format(OPT_ARGS_STR); char * opt_view_filename(OPT_ARGS_STR); char * opt_view_abscissa_name(OPT_ARGS_STR); +char * opt_view_abscissa_format(OPT_ARGS_STR); char * opt_print_eps_font(OPT_ARGS_STR); // NUMBERS diff --git a/Common/Views.cpp b/Common/Views.cpp index 3f624e6d2a48f53e9d9675e4f6762bcd274914aa..854124e45ee1bb22083ee291c4088548bb43ed01 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.78 2002-10-04 21:28:16 geuzaine Exp $ +// $Id: Views.cpp,v 1.79 2002-10-12 19:41:13 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -485,6 +485,7 @@ void CopyViewOptions(Post_View *src, Post_View *dest){ dest->Size[0] = src->Size[0]; dest->Size[1] = src->Size[1]; strcpy(dest->Format, src->Format); + strcpy(dest->AbscissaFormat, src->AbscissaFormat); strcpy(dest->AbscissaName, src->AbscissaName); dest->CustomMin = src->CustomMin; dest->CustomMax = src->CustomMax; diff --git a/Common/Views.h b/Common/Views.h index b82ff99326dd64b5dc007acdea245a5c3548d12d..0752e618e6ec819b109a1a206cf2c91ebf478cab 100644 --- a/Common/Views.h +++ b/Common/Views.h @@ -56,7 +56,7 @@ class Post_View{ // options int Type, Position[2], AutoPosition, Size[2],TensorType; - char Format[256]; + char Format[256], AbscissaFormat[256]; double CustomMin, CustomMax; double Offset[3], Raise[3], ArrowScale, Explode; int Visible, IntervalsType, NbIso, NbAbscissa, Light, SmoothNormals ; diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 14436c92c39cf24eb1833a5cace00b6516acb7c6..1da39cf60ff3cc76fa770139718bbe1dc659ab51 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.143 2002-10-04 21:14:17 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.144 2002-10-12 19:41:13 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -2470,6 +2470,9 @@ void view_options_ok_cb(CALLBACK_ARGS){ if(force || WID->view_input[2]->changed()) opt_view_abscissa_name(i, GMSH_SET, (char*)WID->view_input[2]->value()); + if(force || WID->view_input[3]->changed()) + opt_view_abscissa_format(i, GMSH_SET, (char*)WID->view_input[3]->value()); + // colorbar window if(force || (WID->view_colorbar_window->changed() && i!=(long int)data)){ diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index e1db3ce7f46da11b02c8989334f3f1ce476ca4a0..f648116bc34d52b8aeb647c3197e9a4dbb65f0b1 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.200 2002-10-12 18:20:25 geuzaine Exp $ +// $Id: GUI.cpp,v 1.201 2002-10-12 19:41:13 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -2378,12 +2378,16 @@ void GUI::create_view_options_window(int num){ view_input[2] = new Fl_Input(2*WB, 2*WB+1*BH, IW, BH, "Abscissa name"); view_input[2]->align(FL_ALIGN_RIGHT); view_input[2]->callback(set_changed_cb, 0); + + view_input[3] = new Fl_Input(2*WB, 2*WB+2*BH, IW, BH, "Abscissa format"); + view_input[3]->align(FL_ALIGN_RIGHT); + view_input[3]->callback(set_changed_cb, 0); - view_value[25] = new Fl_Value_Input(2*WB, 2*WB+ 2*BH, IW, BH, "Abscissa points"); + view_value[25] = new Fl_Value_Input(2*WB, 2*WB+ 3*BH, IW, BH, "Abscissa points"); view_value[25]->minimum(0.); view_value[25]->step(1); view_value[25]->maximum(256); - view_value[26] = new Fl_Value_Input(2*WB, 2*WB+ 3*BH, IW, BH, "Grid mode"); + view_value[26] = new Fl_Value_Input(2*WB, 2*WB+ 4*BH, IW, BH, "Grid mode"); view_value[26]->minimum(0.); view_value[26]->step(1); view_value[26]->maximum(3); @@ -2637,6 +2641,7 @@ void GUI::update_view_window(int num){ else view_2d->deactivate(); opt_view_abscissa_name(num, GMSH_GUI, NULL); + opt_view_abscissa_format(num, GMSH_GUI, NULL); opt_view_nb_abscissa(num, GMSH_GUI, 0); opt_view_grid(num, GMSH_GUI, 0); diff --git a/Graphics/Graph2D.cpp b/Graphics/Graph2D.cpp index af32758ce5a6772541e37f93d1084b6e19aa4fb3..99fb3dc4421580dce839673e08caa3cd3e8067d4 100644 --- a/Graphics/Graph2D.cpp +++ b/Graphics/Graph2D.cpp @@ -1,4 +1,4 @@ -// $Id: Graph2D.cpp,v 1.19 2002-05-20 18:28:26 geuzaine Exp $ +// $Id: Graph2D.cpp,v 1.20 2002-10-12 19:41:13 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -218,9 +218,9 @@ static void Draw_Graph2D(Post_View *v, nb = v->NbAbscissa; if(v->ShowScale){ - sprintf(label, v->Format, AbsMin); + sprintf(label, v->AbscissaFormat, AbsMin); double ww = gl_width(label); - sprintf(label, v->Format, AbsMax); + sprintf(label, v->AbscissaFormat, AbsMax); if(gl_width(label) > ww) ww = gl_width(label); if((nb-1)*(ww+2) > width) nb = (int)floor(width/(ww+2))+1; } @@ -259,9 +259,9 @@ static void Draw_Graph2D(Post_View *v, if(v->ShowScale){ glColor4ubv((GLubyte*)&CTX.color.text); if(nb==1) - sprintf(label, v->Format, AbsMin); + sprintf(label, v->AbscissaFormat, AbsMin); else - sprintf(label, v->Format, AbsMin+i*(AbsMax-AbsMin)/(double)(nb-1)); + sprintf(label, v->AbscissaFormat, AbsMin+i*(AbsMax-AbsMin)/(double)(nb-1)); glRasterPos2d(xtop+i*dx-gl_width(label)/2.,ybot-1.5*font_h); Draw_String(label); } @@ -359,9 +359,9 @@ void Draw_Graph2D(void){ dx = dy = 0.; if(v->ShowScale){ gl_font(FL_HELVETICA,CTX.gl_fontsize); - sprintf(label,v->Format,v->CustomMin); + sprintf(label,v->AbscissaFormat,v->CustomMin); if(gl_width(label)+tic > dx) dx = gl_width(label)+tic; - sprintf(label,v->Format,v->CustomMax); + sprintf(label,v->AbscissaFormat,v->CustomMax); if(gl_width(label)+tic > dx) dx = gl_width(label)+tic; dy = 1.5*gl_height(); //2 below and & above! }