From 06941fafb7f4d4c4931b49751ca2f439990f916f Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 5 Sep 2016 21:56:12 +0000
Subject: [PATCH] step data in addition to multi-step data

---
 Common/DefaultOptions.h |  4 ++--
 Common/Options.cpp      |  2 +-
 Fltk/optionWindow.cpp   |  1 +
 Graphics/drawScales.cpp | 18 +++++++++---------
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index def30ad324..2c8fee3ba8 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -1610,8 +1610,8 @@ StringXNumber ViewOptions_Number[] = {
   { F|O, "ShowScale" , opt_view_show_scale , 1. ,
     "Show value scale?" },
   { F|O, "ShowTime" , opt_view_show_time , 3. ,
-    "Time display mode (0=none, 1=time series, 2=harmonic data, "
-    "3=automatic, 4=multi-step data, 5=real eigenvalues, 6=complex eigenvalues)" },
+    "Time display mode (0=none, 1=time series, 2=harmonic data, 3=automatic, "
+    "4=step data, 5=multi-step data, 6=real eigenvalues, 7=complex eigenvalues)" },
   { F|O, "SmoothNormals" , opt_view_smooth_normals , 0. ,
     "Smooth the normals?" },
   { F|O, "Stipple" , opt_view_use_stipple , 0. ,
diff --git a/Common/Options.cpp b/Common/Options.cpp
index fbaf830300..8596be5eec 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -8094,7 +8094,7 @@ double opt_view_show_time(OPT_ARGS_NUM)
   GET_VIEWo(0.);
   if(action & GMSH_SET) {
     opt->showTime = (int)val;
-    if(opt->showTime < 0 || opt->showTime > 6)
+    if(opt->showTime < 0 || opt->showTime > 7)
       opt->showTime = 0;
   }
 #if defined(HAVE_FLTK)
diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp
index 63c697f436..094659acbe 100644
--- a/Fltk/optionWindow.cpp
+++ b/Fltk/optionWindow.cpp
@@ -3093,6 +3093,7 @@ optionWindow::optionWindow(int deltaFontSize)
         {"Time series", 0, 0, 0},
         {"Harmonic data", 0, 0, 0},
         {"Automatic", 0, 0, 0},
+        {"Step data", 0, 0, 0},
         {"Multi-step data", 0, 0, 0},
         {"Real eigenvalues", 0, 0, 0},
         {"Complex eigenvalues", 0, 0, 0},
diff --git a/Graphics/drawScales.cpp b/Graphics/drawScales.cpp
index 898f930ea5..72de3474d3 100644
--- a/Graphics/drawScales.cpp
+++ b/Graphics/drawScales.cpp
@@ -180,7 +180,7 @@ static void drawScaleLabel(drawContext *ctx, PView *p, double xmin, double ymin,
   if(choice == 3){ // automatic
     if(n == 1) choice = 0; // nothing
     else if(n == 2) choice = 2; // harmonic
-    else choice = 4; // multi-step data
+    else choice = 5; // multi-step data
   }
   switch(choice){
   case 1: // time series
@@ -198,18 +198,18 @@ static void drawScaleLabel(drawContext *ctx, PView *p, double xmin, double ymin,
   case 3: // automatic
     // never here
     break;
-  case 4: // multi-step data
-    if(n == 1)
-      sprintf(label, "%s - step %d", data->getName().c_str(), opt->timeStep);
-    else
-      sprintf(label, "%s - step %d in [0,%d]", data->getName().c_str(),
-              opt->timeStep, data->getNumTimeSteps() - 1);
+  case 4: // step data
+    sprintf(label, "%s - step %d", data->getName().c_str(), opt->timeStep);
+    break;
+  case 5: // multi-step data
+    sprintf(label, "%s - step %d in [0,%d]", data->getName().c_str(),
+            opt->timeStep, data->getNumTimeSteps() - 1);
     break;
-  case 5: // real eigenvalues
+  case 6: // real eigenvalues
     sprintf(label, "%s - eigenvalue %s", data->getName().c_str(),
             time);
     break;
-  case 6: // complex eigenvalues
+  case 7: // complex eigenvalues
     sprintf(label, "%s - eigenvalue %s (%s part)", data->getName().c_str(),
             time, ((opt->timeStep - n0) % 2) ? "imaginary" : "real");
     break;
-- 
GitLab