[chronojump] encoderConfig shown prettier on treeviews



commit 0907bc41388c14fc403092d419de275abb911ecc
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Feb 26 11:14:11 2014 +0100

    encoderConfig shown prettier on treeviews

 src/encoder.cs     |   38 ++++++++++++++++++++++++++++++++++++--
 src/gui/encoder.cs |    4 ++--
 2 files changed, 38 insertions(+), 4 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index 0f4b61b..9733388 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -368,7 +368,7 @@ public class EncoderSQL
                return str;
        }
 
-       public string [] ToStringArray (int count, bool checkboxes, bool video) {
+       public string [] ToStringArray (int count, bool checkboxes, bool video, bool encoderConfigPretty) {
                int all = 9;
                if(checkboxes)
                        all ++;
@@ -387,7 +387,10 @@ public class EncoderSQL
                str[i++] = exerciseName;
                str[i++] = extraWeight;
 
-               str[i++] = encoderConfiguration.code.ToString();
+               if(encoderConfigPretty)
+                       str[i++] = encoderConfiguration.ToStringPretty();
+               else
+                       str[i++] = encoderConfiguration.code.ToString();
                
                str[i++] = ecconLong;
                str[i++] = GetDate(true);
@@ -852,5 +855,36 @@ public class EncoderConfiguration {
                        anglePush.ToString() + sep + angleWeight.ToString() + sep +
                        inertia.ToString() + sep + gearedDown.ToString();
        }
+
+       //just to show on a treeview    
+       public string ToStringPretty() {
+               string sep = "; ";
+
+               string str_d = "";
+               if(d != -1)
+                       str_d = sep + "d=" + d.ToString();
+
+               string str_D = "";
+               if(D != -1)
+                       str_D = sep + "D=" + D.ToString();
+
+               string str_anglePush = "";
+               if(anglePush != -1)
+                       str_anglePush = sep + "push angle=" + anglePush.ToString();
+
+               string str_angleWeight = "";
+               if(angleWeight != -1)
+                       str_angleWeight = sep + "weight angle=" + angleWeight.ToString();
+
+               string str_inertia = "";
+               if(inertia != -1)
+                       str_inertia = sep + "inertia=" + inertia.ToString();
+
+               string str_gearedDown = "";
+               if(gearedDown != 1)     //1 is the default
+                       str_gearedDown = sep + "geared down=" + gearedDown.ToString();
+
+               return code + str_d + str_D + str_anglePush + str_angleWeight + str_inertia + str_gearedDown;
+       }
        
 }
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 4e3735a..042352a 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -728,7 +728,7 @@ public partial class ChronoJumpWindow
                foreach(EncoderSQL es in data) {
                        checkboxes[count++] = es.status;
                        Log.WriteLine(checkboxes[count-1]);
-                       dataPrint.Add(es.ToStringArray(count,true,false));
+                       dataPrint.Add(es.ToStringArray(count,true,false,true));
                }
        
                string [] columnsString = {
@@ -1090,7 +1090,7 @@ public partial class ChronoJumpWindow
                ArrayList dataPrint = new ArrayList();
                int count = 1;
                foreach(EncoderSQL es in data) 
-                       dataPrint.Add(es.ToStringArray(count++,false,true));
+                       dataPrint.Add(es.ToStringArray(count++,false,true,true));
                
                string [] columnsString = {
                        Catalog.GetString("ID"),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]