[chronojump] DB 1.77 Preferences.ForceSensorGraphsLineWidth



commit 19c90ced6667e90ef531a8f80ee1a6fd8177f5ce
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Oct 28 12:20:31 2019 +0100

    DB 1.77 Preferences.ForceSensorGraphsLineWidth

 glade/preferences_win.glade   | 61 +++++++++++++++++++++++++++++++++++++++++--
 src/gui/chronojump.cs         |  4 +++
 src/gui/forceSensor.cs        |  2 +-
 src/gui/forceSensorAnalyze.cs |  2 +-
 src/gui/preferences.cs        |  8 ++++++
 src/preferences.cs            |  1 +
 src/sqlite/main.cs            | 11 +++++++-
 src/sqlite/preferences.cs     | 16 +++++++-----
 8 files changed, 94 insertions(+), 11 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index a3b494d0..fcc9c7db 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -3308,8 +3308,8 @@ Other</property>
               <widget class="GtkVBox" id="vbox18">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">8</property>
-                <property name="spacing">10</property>
+                <property name="border_width">16</property>
+                <property name="spacing">20</property>
                 <child>
                   <widget class="GtkFrame" id="frame10">
                     <property name="visible">True</property>
@@ -3482,6 +3482,63 @@ Other</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
+                <child>
+                  <widget class="GtkHBox" id="hbox_force_sensor_width_in_seconds1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <widget class="GtkLabel" id="label_force_sensor_graphs_line_width">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Graphs line width</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkSpinButton" id="spin_force_sensor_graphs_line_width">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">●</property>
+                        <property name="invisible_char_set">True</property>
+                        <property name="primary_icon_activatable">False</property>
+                        <property name="secondary_icon_activatable">False</property>
+                        <property name="primary_icon_sensitive">True</property>
+                        <property name="secondary_icon_sensitive">True</property>
+                        <property name="adjustment">2 1 10 1 10 0</property>
+                        <property name="climb_rate">1</property>
+                        <property name="numeric">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label22">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label">px</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
               </widget>
               <packing>
                 <property name="position">6</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 1b96a494..d864254e 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3036,6 +3036,10 @@ public partial class ChronoJumpWindow
                catch {
                        LogB.Information("catched at on_preferences_accepted ()");
                }
+
+               //forceSensor (pen has already been defined)
+               pen_black_force_capture.SetLineAttributes (preferences.forceSensorGraphsLineWidth, 
Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
+               pen_black_force_ai.SetLineAttributes (preferences.forceSensorGraphsLineWidth, 
Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
        }
 
 
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index e5a6f04e..8eeeb84f 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -187,7 +187,7 @@ public partial class ChronoJumpWindow
                pen_black_force_capture.Foreground = UtilGtk.BLACK;
                //pen_black_force_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast, 
Gdk.JoinStyle.Miter);
                //this makes the lines less spiky:
-               pen_black_force_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, 
Gdk.JoinStyle.Round);
+               pen_black_force_capture.SetLineAttributes (preferences.forceSensorGraphsLineWidth, 
Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
 
                pen_red_force_capture = new Gdk.GC(force_capture_drawingarea.GdkWindow);
                pen_red_force_capture.Foreground = UtilGtk.RED_PLOTS;
diff --git a/src/gui/forceSensorAnalyze.cs b/src/gui/forceSensorAnalyze.cs
index 478db47b..39fcf71c 100644
--- a/src/gui/forceSensorAnalyze.cs
+++ b/src/gui/forceSensorAnalyze.cs
@@ -645,7 +645,7 @@ public partial class ChronoJumpWindow
                //pen_black_force_ai.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast, 
Gdk.JoinStyle.Miter);
                //this makes the lines less spiky:
                //pen_black_force_ai.SetLineAttributes (1, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, 
Gdk.JoinStyle.Round);
-               pen_black_force_ai.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, 
Gdk.JoinStyle.Round);
+               pen_black_force_ai.SetLineAttributes (preferences.forceSensorGraphsLineWidth, 
Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
 
                pen_blue_force_ai.SetLineAttributes (1, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, 
Gdk.JoinStyle.Round);
                pen_red_force_ai.SetLineAttributes (1, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, 
Gdk.JoinStyle.Round);
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 6500d417..a9e1dd23 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -147,6 +147,7 @@ public class PreferencesWindow
        [Widget] Gtk.SpinButton spin_force_sensor_capture_width_graph_seconds;
        [Widget] Gtk.RadioButton radio_force_sensor_capture_zoom_out;
        [Widget] Gtk.RadioButton radio_force_sensor_capture_scroll;
+       [Widget] Gtk.SpinButton spin_force_sensor_graphs_line_width;
 
        //multimedia tab
        [Widget] Gtk.CheckButton checkbutton_volume;
@@ -597,6 +598,8 @@ public class PreferencesWindow
                else
                        PreferencesWindowBox.radio_force_sensor_capture_zoom_out.Active = true;
 
+               PreferencesWindowBox.spin_force_sensor_graphs_line_width.Value = 
preferences.forceSensorGraphsLineWidth;
+
                //language -->
                if(preferences.language == "")
                        PreferencesWindowBox.radio_language_detected.Active = true;
@@ -1941,6 +1944,11 @@ public class PreferencesWindow
                                preferences.forceSensorCaptureScroll,
                                radio_force_sensor_capture_scroll.Active);
 
+               preferences.forceSensorGraphsLineWidth = preferencesChange(
+                               SqlitePreferences.ForceSensorGraphsLineWidth,
+                               preferences.forceSensorGraphsLineWidth,
+                               Convert.ToInt32(spin_force_sensor_graphs_line_width.Value));
+
                //multimedia ----
                if( preferences.volumeOn != PreferencesWindowBox.checkbutton_volume.Active ) {
                        SqlitePreferences.Update("volumeOn", 
PreferencesWindowBox.checkbutton_volume.Active.ToString(), true);
diff --git a/src/preferences.cs b/src/preferences.cs
index 53f28592..faa0eda4 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -91,6 +91,7 @@ public class Preferences
 
        public int forceSensorCaptureWidthSeconds;
        public bool forceSensorCaptureScroll;
+       public int forceSensorGraphsLineWidth;
 
        //advanced tab
        public bool askDeletion;
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 21b2b75d..7543c7f5 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -129,7 +129,7 @@ class Sqlite
        /*
         * Important, change this if there's any update to database
         */
-       static string lastChronojumpDatabaseVersion = "1.76";
+       static string lastChronojumpDatabaseVersion = "1.77";
 
        public Sqlite() {
        }
@@ -2531,6 +2531,14 @@ class Sqlite
 
                                currentVersion = updateVersion("1.76");
                        }
+                       if(currentVersion == "1.76")
+                       {
+                               LogB.SQL("Inserted into preferences: forceSensorGraphsLineWidth");
+
+                               SqlitePreferences.Insert (SqlitePreferences.ForceSensorGraphsLineWidth, "2");
+
+                               currentVersion = updateVersion("1.77");
+                       }
 
 
                        // --- add more updates here
@@ -2725,6 +2733,7 @@ class Sqlite
                SqliteJson.createTableUploadExhibitionTestTemp ();
 
                //changes [from - to - desc]
+               //1.76 - 1.77 Converted DB to 1.77 Inserted into preferences: forceSensorGraphsLineWidth
                //1.75 - 1.76 Converted DB to 1.76 ALTER TABLE " + Constants.ForceSensorTable + " ADD COLUMN 
(stiffness float, stiffnessString string)
                //1.74 - 1.75 Converted DB to 1.75 Created table ForceSensorElasticBand
                //1.73 - 1.74 Converted DB to 1.74 ALTER TABLE Constants.ForceSensorExerciseTable ADD COLUMN 
forceResultant, elastic
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index e8abcc1e..97bda6e5 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -40,12 +40,6 @@ class SqlitePreferences : Sqlite
        public const string EncoderMassGravitatory = "encoderMassGravitatory";
        public const string EncoderWeightsInertial = "encoderWeightsInertial";
 
-       public const string ForceSensorTareDateTimeStr = "forceSensorTareDateTime";
-       public const string ForceSensorTareStr = "forceSensorTare";
-       public const string ForceSensorCalibrationDateTimeStr = "forceSensorCalibrationDateTime";
-       public const string ForceSensorCalibrationWeightStr = "forceSensorCalibrationWeight";
-       public const string ForceSensorCalibrationFactorStr = "forceSensorCalibrationFactor";
-
        public const string EncoderRhythmActiveStr = "encoderRhythmActive";
        public const string EncoderRhythmRepsOrPhasesStr = "encoderRhythmRepsOrPhases";
        public const string EncoderRhythmRepSecondsStr = "encoderRhythmRepSeconds";
@@ -59,6 +53,13 @@ class SqlitePreferences : Sqlite
        //forceSensor
        public const string ForceSensorCaptureWidthSeconds = "forceSensorCaptureWidthSeconds";
        public const string ForceSensorCaptureScroll = "forceSensorCaptureScroll";
+       public const string ForceSensorGraphsLineWidth = "forceSensorGraphsLineWidth";
+
+       public const string ForceSensorTareDateTimeStr = "forceSensorTareDateTime";
+       public const string ForceSensorTareStr = "forceSensorTare";
+       public const string ForceSensorCalibrationDateTimeStr = "forceSensorCalibrationDateTime";
+       public const string ForceSensorCalibrationWeightStr = "forceSensorCalibrationWeight";
+       public const string ForceSensorCalibrationFactorStr = "forceSensorCalibrationFactor";
 
        protected internal static new void createTable()
        {
@@ -184,6 +185,7 @@ class SqlitePreferences : Sqlite
                                //forceSensor
                                Insert (ForceSensorCaptureWidthSeconds, "10", dbcmdTr);
                                Insert (ForceSensorCaptureScroll, "True"); //scroll. not zoom out
+                               Insert (ForceSensorGraphsLineWidth, "2");
 
                                //multimedia
                                Insert ("videoDevice", "", dbcmdTr); //first
@@ -453,6 +455,8 @@ class SqlitePreferences : Sqlite
                                preferences.forceSensorCaptureWidthSeconds = 
Convert.ToInt32(reader[1].ToString());
                        else if(reader[0].ToString() == ForceSensorCaptureScroll)
                                preferences.forceSensorCaptureScroll = reader[1].ToString() == "True";
+                       else if(reader[0].ToString() == ForceSensorGraphsLineWidth)
+                               preferences.forceSensorGraphsLineWidth = 
Convert.ToInt32(reader[1].ToString());
 
                        //force sensor tare
                        else if(reader[0].ToString() == ForceSensorTareDateTimeStr)


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