[chronojump] Preferences stuff refactored
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Preferences stuff refactored
- Date: Thu, 21 Aug 2014 18:53:05 +0000 (UTC)
commit c5badd71a545a1bd16804f693e0a1b56e580d5b7
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Aug 21 20:52:16 2014 +0200
Preferences stuff refactored
chronojump_server/Makefile.am | 1 +
glade/chronojump.glade | 2 +-
src/Makefile.am | 1 +
src/gui/chronojump.cs | 466 +++++++++++------------------------------
src/gui/encoder.cs | 64 +++----
src/gui/eventExecute.cs | 70 +++---
src/gui/preferences.cs | 265 ++++++++++++++---------
src/gui/stats.cs | 10 +-
src/preferences.cs | 140 ++++++++++++
src/sqlite/preferences.cs | 85 ++++++++
src/treeViewEvent.cs | 4 +-
src/treeViewJump.cs | 141 +++++-------
12 files changed, 639 insertions(+), 610 deletions(-)
---
diff --git a/chronojump_server/Makefile.am b/chronojump_server/Makefile.am
index 9a58d96..aedbf43 100644
--- a/chronojump_server/Makefile.am
+++ b/chronojump_server/Makefile.am
@@ -15,6 +15,7 @@ SOURCES = \
../src/run.cs\
../src/person.cs\
../src/personSession.cs\
+ ../src/preferences.cs\
../src/pulse.cs\
../src/reactionTime.cs\
../src/session.cs\
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index ba98a93..163e016 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -29065,7 +29065,7 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
</widget>
</child>
</widget>
- <widget class="GtkWindow" id="preferences">
+ <widget class="GtkWindow" id="preferences_win">
<property name="height_request">450</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index 6b69462..0be9be5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -132,6 +132,7 @@ SOURCES = \
multiChronopicType.cs\
session.cs\
exportSession.cs\
+ preferences.cs\
treeViewEvent.cs\
treeViewPerson.cs\
treeViewJump.cs\
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 58c4dc0..ac12a7e 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -315,8 +315,6 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_encoder_signal_delete;
Random rand;
- bool volumeOn;
- bool videoOn;
//persons
private TreeStore treeview_persons_store;
@@ -345,24 +343,7 @@ public partial class ChronoJumpWindow
private TreeStore treeview_multi_chronopic_store;
private TreeViewMultiChronopic myTreeViewMultiChronopic;
-
-
- //preferences variables
- private static int prefsDigitsNumber;
- private static bool showHeight;
- private static bool showPower;
- private static bool showInitialSpeed;
- private static bool showAngle;
- private static bool showQIndex;
- private static bool showDjIndex;
- private static bool askDeletion;
- private static bool weightPercentPreferred;
- private static bool heightPreferred;
- private static bool metersSecondsPreferred;
- private static string CSVExportDecimalSeparator; //"COMMA" or "POINT"
- private static bool RGraphsTranslate;
- private static bool useHeightsOnJumpIndexes;
- private static Constants.EncoderAutoSaveCurve encoderAutoSaveCurve;
+ private Preferences preferences;
private static Person currentPerson;
private static Session currentSession;
@@ -395,6 +376,7 @@ public partial class ChronoJumpWindow
private static Report report;
//windows needed
+ PreferencesWindow preferencesWin;
//LanguageWindow languageWin;
SessionAddEditWindow sessionAddEditWin;
//SessionEditWindow sessionEditWin;
@@ -817,170 +799,72 @@ public partial class ChronoJumpWindow
private void loadPreferences ()
{
- Log.WriteLine (string.Format(Catalog.GetString("Chronojump database version file: {0}"),
- SqlitePreferences.Select("databaseVersion") ));
-
- //chronopicPort = SqlitePreferences.Select("chronopicPort");
-
- prefsDigitsNumber = Convert.ToInt32 ( SqlitePreferences.Select("digitsNumber") );
-
- checkbutton_allow_finish_rj_after_time.Active = (
SqlitePreferences.Select("allowFinishRjAfterTime") == "True" );
-
- if ( SqlitePreferences.Select("showHeight") == "True" )
- showHeight = true;
- else
- showHeight = false;
-
- if ( SqlitePreferences.Select("showPower") == "True" )
- showPower = true;
- else
- showPower = false;
-
- if ( SqlitePreferences.Select("showInitialSpeed") == "True" )
- showInitialSpeed = true;
- else
- showInitialSpeed = false;
-
- if ( SqlitePreferences.Select("showAngle") == "True" )
- showAngle = true;
- else
- showAngle = false;
-
-
- //only one of showQIndex or showDjIndex can be true. Also none of them
- if ( SqlitePreferences.Select("showQIndex") == "True" )
- showQIndex = true;
- else
- showQIndex = false;
-
-
- if ( SqlitePreferences.Select("showDjIndex") == "True" )
- showDjIndex = true;
- else
- showDjIndex = false;
-
+ preferences = Preferences.LoadAllFromSqlite();
+ Log.WriteLine (string.Format(Catalog.GetString("Chronojump database version file: {0}"),
+ preferences.databaseVersion));
- if ( SqlitePreferences.Select("simulated") == "True" ) {
- // simulated = true;
- //menuitem_simulated.Active = true;
-
- // cpRunning = false;
- } else {
- // simulated = false;
-
- // cpRunning = true;
- }
-
- if ( SqlitePreferences.Select("askDeletion") == "True" )
- askDeletion = true;
- else
- askDeletion = false;
-
-
- if ( SqlitePreferences.Select("weightStatsPercent") == "True" )
- weightPercentPreferred = true;
- else
- weightPercentPreferred = false;
-
-
- if ( SqlitePreferences.Select("heightPreferred") == "True" )
- heightPreferred = true;
- else
- heightPreferred = false;
-
+ checkbutton_allow_finish_rj_after_time.Active = preferences.allowFinishRjAfterTime;
- if ( SqlitePreferences.Select("metersSecondsPreferred") == "True" )
- metersSecondsPreferred = true;
- else
- metersSecondsPreferred = false;
- //---- volume ----
- if ( SqlitePreferences.Select("volumeOn") == "True" )
- volumeOn = true;
- else
- volumeOn = false;
-
UtilGtk.ColorsCheckOnlyPrelight(checkbutton_volume);
UtilGtk.ColorsCheckOnlyPrelight(checkbutton_volume_encoder);
//don't raise the signal
checkbutton_volume.Clicked -= new EventHandler(on_checkbutton_volume_clicked);
- checkbutton_volume.Active = volumeOn;
+ checkbutton_volume.Active = preferences.volumeOn;
checkbutton_volume.Clicked += new EventHandler(on_checkbutton_volume_clicked);
//don't raise the signal
checkbutton_volume_encoder.Clicked -= new EventHandler(on_checkbutton_volume_encoder_clicked);
- checkbutton_volume_encoder.Active = volumeOn;
+ checkbutton_volume_encoder.Active = preferences.volumeOn;
checkbutton_volume_encoder.Clicked += new EventHandler(on_checkbutton_volume_encoder_clicked);
- changeVolumeButtons(volumeOn);
+ changeVolumeButtons(preferences.volumeOn);
//---- video ----
- if ( SqlitePreferences.Select("videoOn") == "True" )
- videoOn = true;
- else
- videoOn = false;
UtilGtk.ColorsCheckOnlyPrelight(checkbutton_video);
UtilGtk.ColorsCheckOnlyPrelight(checkbutton_video_encoder);
//don't raise the signal
checkbutton_video.Clicked -= new EventHandler(on_checkbutton_video_clicked);
- checkbutton_video.Active = videoOn;
+ checkbutton_video.Active = preferences.videoOn;
checkbutton_video.Clicked += new EventHandler(on_checkbutton_video_clicked);
//don't raise the signal
checkbutton_video_encoder.Clicked -= new EventHandler(on_checkbutton_video_encoder_clicked);
- checkbutton_video_encoder.Active = videoOn;
+ checkbutton_video_encoder.Active = preferences.videoOn;
checkbutton_video_encoder.Clicked += new EventHandler(on_checkbutton_video_encoder_clicked);
- changeVideoButtons(videoOn);
+ changeVideoButtons(preferences.videoOn);
//load preferences, update radios, but not update database
update_sqlite_at_runs_speed_radios = false;
- if ( SqlitePreferences.Select("runSpeedStartArrival") == "True" )
+ if (preferences.runSpeedStartArrival)
radio_runs_speed_start_arrival.Active = true;
else
radio_runs_speed_start_leaving.Active = true;
- if ( SqlitePreferences.Select("runISpeedStartArrival") == "True" )
+ if (preferences.runISpeedStartArrival)
radio_runs_i_speed_start_arrival.Active = true;
else
radio_runs_i_speed_start_leaving.Active = true;
update_sqlite_at_runs_speed_radios = true;
- encoderPropulsive = SqlitePreferences.Select("encoderPropulsive") == "True";
- encoderSmoothCon = Convert.ToDouble ( Util.ChangeDecimalSeparator (
- SqlitePreferences.Select("encoderSmoothCon") ) );
-
- CSVExportDecimalSeparator = SqlitePreferences.Select("CSVExportDecimalSeparator");
-
- RGraphsTranslate = SqlitePreferences.Select("RGraphsTranslate") == "True";
-
- useHeightsOnJumpIndexes = SqlitePreferences.Select("useHeightsOnJumpIndexes") == "True";
-
- string temp = SqlitePreferences.Select("encoderAutoSaveCurve");
- if(temp == Constants.EncoderAutoSaveCurve.BESTMEANPOWER.ToString())
- encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.BESTMEANPOWER;
- else if(temp == Constants.EncoderAutoSaveCurve.ALL.ToString())
- encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.ALL;
- else
- encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.NONE;
//change language works on windows. On Linux let's change the locale
//if(UtilAll.IsWindows())
// languageChange();
//pass to report
- report.PrefsDigitsNumber = prefsDigitsNumber;
- report.HeightPreferred = heightPreferred;
- report.WeightStatsPercent = weightPercentPreferred;
+ report.PrefsDigitsNumber = preferences.digitsNumber;
+ report.HeightPreferred = preferences.heightPreferred;
+ report.WeightStatsPercent = preferences.weightStatsPercent;
+ report.GraphTranslate = preferences.RGraphsTranslate;
+ report.UseHeightsOnJumpIndexes = preferences.useHeightsOnJumpIndexes;
report.Progversion = progVersion;
- report.GraphTranslate = RGraphsTranslate;
- report.UseHeightsOnJumpIndexes = useHeightsOnJumpIndexes;
-
Log.WriteLine ( Catalog.GetString ("Preferences loaded") );
}
@@ -1265,7 +1149,7 @@ public partial class ChronoJumpWindow
if(connectedAndCanI(Constants.ServerActionQuery)) {
ChronojumpServer myServer = new ChronojumpServer();
QueryServerWindow.Show(
- prefsDigitsNumber,
+ preferences.digitsNumber,
myServer.SelectEvaluators(true)
);
}
@@ -1510,7 +1394,7 @@ public partial class ChronoJumpWindow
private void createTreeView_jumps (Gtk.TreeView tv) {
//myTreeViewJumps is a TreeViewJumps instance
- myTreeViewJumps = new TreeViewJumps( tv, showHeight, showPower, showInitialSpeed, showAngle,
showQIndex, showDjIndex, prefsDigitsNumber, weightPercentPreferred, metersSecondsPreferred,
TreeViewEvent.ExpandStates.MINIMIZED);
+ myTreeViewJumps = new TreeViewJumps(tv, preferences, TreeViewEvent.ExpandStates.MINIMIZED);
//the glade cursor_changed does not work on mono 1.2.5 windows
tv.CursorChanged += on_treeview_jumps_cursor_changed;
@@ -1536,7 +1420,7 @@ public partial class ChronoJumpWindow
private void treeview_jumps_storeReset() {
myTreeViewJumps.RemoveColumns();
- myTreeViewJumps = new TreeViewJumps( treeview_jumps, showHeight, showPower, showInitialSpeed,
showAngle, showQIndex, showDjIndex, prefsDigitsNumber, weightPercentPreferred, metersSecondsPreferred,
myTreeViewJumps.ExpandState );
+ myTreeViewJumps = new TreeViewJumps(treeview_jumps, preferences, myTreeViewJumps.ExpandState);
}
private void on_treeview_jumps_cursor_changed (object o, EventArgs args) {
@@ -1588,7 +1472,7 @@ public partial class ChronoJumpWindow
*/
private void createTreeView_jumps_rj (Gtk.TreeView tv) {
- myTreeViewJumpsRj = new TreeViewJumpsRj( tv, showHeight, showInitialSpeed, showQIndex,
showDjIndex, prefsDigitsNumber, weightPercentPreferred, metersSecondsPreferred,
TreeViewEvent.ExpandStates.MINIMIZED );
+ myTreeViewJumpsRj = new TreeViewJumpsRj (tv, preferences,
TreeViewEvent.ExpandStates.MINIMIZED);
//the glade cursor_changed does not work on mono 1.2.5 windows
tv.CursorChanged += on_treeview_jumps_rj_cursor_changed;
@@ -1616,7 +1500,7 @@ public partial class ChronoJumpWindow
private void treeview_jumps_rj_storeReset() {
myTreeViewJumpsRj.RemoveColumns();
- myTreeViewJumpsRj = new TreeViewJumpsRj( treeview_jumps_rj, showHeight, showInitialSpeed,
showQIndex, showDjIndex, prefsDigitsNumber, weightPercentPreferred, metersSecondsPreferred,
myTreeViewJumpsRj.ExpandState );
+ myTreeViewJumpsRj = new TreeViewJumpsRj (treeview_jumps_rj, preferences,
myTreeViewJumpsRj.ExpandState);
}
private void on_treeview_jumps_rj_cursor_changed (object o, EventArgs args) {
@@ -1675,7 +1559,7 @@ public partial class ChronoJumpWindow
private void createTreeView_runs (Gtk.TreeView tv) {
//myTreeViewRuns is a TreeViewRuns instance
- myTreeViewRuns = new TreeViewRuns( tv, prefsDigitsNumber, metersSecondsPreferred,
TreeViewEvent.ExpandStates.MINIMIZED );
+ myTreeViewRuns = new TreeViewRuns (tv, preferences.digitsNumber,
preferences.metersSecondsPreferred, TreeViewEvent.ExpandStates.MINIMIZED );
//the glade cursor_changed does not work on mono 1.2.5 windows
tv.CursorChanged += on_treeview_runs_cursor_changed;
@@ -1699,7 +1583,7 @@ public partial class ChronoJumpWindow
private void treeview_runs_storeReset() {
myTreeViewRuns.RemoveColumns();
- myTreeViewRuns = new TreeViewRuns( treeview_runs, prefsDigitsNumber, metersSecondsPreferred,
myTreeViewRuns.ExpandState );
+ myTreeViewRuns = new TreeViewRuns(treeview_runs, preferences.digitsNumber,
preferences.metersSecondsPreferred, myTreeViewRuns.ExpandState);
}
private void on_treeview_runs_cursor_changed (object o, EventArgs args) {
@@ -1751,7 +1635,7 @@ public partial class ChronoJumpWindow
private void createTreeView_runs_interval (Gtk.TreeView tv) {
//myTreeViewRunsInterval is a TreeViewRunsInterval instance
- myTreeViewRunsInterval = new TreeViewRunsInterval( tv, prefsDigitsNumber,
metersSecondsPreferred, TreeViewEvent.ExpandStates.MINIMIZED );
+ myTreeViewRunsInterval = new TreeViewRunsInterval (tv, preferences.digitsNumber,
preferences.metersSecondsPreferred, TreeViewEvent.ExpandStates.MINIMIZED);
//the glade cursor_changed does not work on mono 1.2.5 windows
tv.CursorChanged += on_treeview_runs_interval_cursor_changed;
@@ -1776,8 +1660,8 @@ public partial class ChronoJumpWindow
private void treeview_runs_interval_storeReset() {
myTreeViewRunsInterval.RemoveColumns();
- myTreeViewRunsInterval = new TreeViewRunsInterval( treeview_runs_interval,
- prefsDigitsNumber, metersSecondsPreferred, myTreeViewRunsInterval.ExpandState
);
+ myTreeViewRunsInterval = new TreeViewRunsInterval (treeview_runs_interval,
+ preferences.digitsNumber, preferences.metersSecondsPreferred,
myTreeViewRunsInterval.ExpandState);
}
private void on_treeview_runs_interval_cursor_changed (object o, EventArgs args) {
@@ -1836,7 +1720,7 @@ public partial class ChronoJumpWindow
private void createTreeView_reaction_times (Gtk.TreeView tv) {
//myTreeViewReactionTimes is a TreeViewReactionTimes instance
- myTreeViewReactionTimes = new TreeViewReactionTimes( tv, prefsDigitsNumber,
TreeViewEvent.ExpandStates.MINIMIZED );
+ myTreeViewReactionTimes = new TreeViewReactionTimes( tv, preferences.digitsNumber,
TreeViewEvent.ExpandStates.MINIMIZED);
//the glade cursor_changed does not work on mono 1.2.5 windows
tv.CursorChanged += on_treeview_reaction_times_cursor_changed;
@@ -1860,7 +1744,7 @@ public partial class ChronoJumpWindow
private void treeview_reaction_times_storeReset() {
myTreeViewReactionTimes.RemoveColumns();
- myTreeViewReactionTimes = new TreeViewReactionTimes( treeview_reaction_times,
prefsDigitsNumber, myTreeViewReactionTimes.ExpandState );
+ myTreeViewReactionTimes = new TreeViewReactionTimes( treeview_reaction_times,
preferences.digitsNumber, myTreeViewReactionTimes.ExpandState );
}
private void on_treeview_reaction_times_cursor_changed (object o, EventArgs args) {
@@ -1912,7 +1796,7 @@ public partial class ChronoJumpWindow
private void createTreeView_pulses (Gtk.TreeView tv) {
//myTreeViewPulses is a TreeViewPulses instance
- myTreeViewPulses = new TreeViewPulses( tv, prefsDigitsNumber,
TreeViewEvent.ExpandStates.MINIMIZED );
+ myTreeViewPulses = new TreeViewPulses( tv, preferences.digitsNumber,
TreeViewEvent.ExpandStates.MINIMIZED );
//the glade cursor_changed does not work on mono 1.2.5 windows
tv.CursorChanged += on_treeview_pulses_cursor_changed;
@@ -1937,7 +1821,7 @@ public partial class ChronoJumpWindow
private void treeview_pulses_storeReset() {
myTreeViewPulses.RemoveColumns();
- myTreeViewPulses = new TreeViewPulses( treeview_pulses, prefsDigitsNumber,
myTreeViewPulses.ExpandState );
+ myTreeViewPulses = new TreeViewPulses( treeview_pulses, preferences.digitsNumber,
myTreeViewPulses.ExpandState );
}
private void on_treeview_pulses_cursor_changed (object o, EventArgs args) {
@@ -1997,10 +1881,10 @@ public partial class ChronoJumpWindow
private void createTreeView_multi_chronopic (Gtk.TreeView tv) {
//myTreeViewMultiChronopic is a TreeViewMultiChronopic instance
if(definedSession)
- myTreeViewMultiChronopic = new TreeViewMultiChronopic( tv, prefsDigitsNumber,
+ myTreeViewMultiChronopic = new TreeViewMultiChronopic( tv, preferences.digitsNumber,
TreeViewEvent.ExpandStates.MINIMIZED,
SqliteMultiChronopic.MaxCPs(currentSession.UniqueID) );
else
- myTreeViewMultiChronopic = new TreeViewMultiChronopic( tv, prefsDigitsNumber,
+ myTreeViewMultiChronopic = new TreeViewMultiChronopic( tv, preferences.digitsNumber,
TreeViewEvent.ExpandStates.MINIMIZED, 2);
//the glade cursor_changed does not work on mono 1.2.5 windows
@@ -2027,10 +1911,10 @@ public partial class ChronoJumpWindow
private void treeview_multi_chronopic_storeReset() {
myTreeViewMultiChronopic.RemoveColumns();
if(definedSession)
- myTreeViewMultiChronopic = new TreeViewMultiChronopic( treeview_multi_chronopic,
prefsDigitsNumber,
+ myTreeViewMultiChronopic = new TreeViewMultiChronopic( treeview_multi_chronopic,
preferences.digitsNumber,
myTreeViewMultiChronopic.ExpandState,
SqliteMultiChronopic.MaxCPs(currentSession.UniqueID) );
else
- myTreeViewMultiChronopic = new TreeViewMultiChronopic( treeview_multi_chronopic,
prefsDigitsNumber,
+ myTreeViewMultiChronopic = new TreeViewMultiChronopic( treeview_multi_chronopic,
preferences.digitsNumber,
myTreeViewMultiChronopic.ExpandState, 2);
}
@@ -2596,7 +2480,7 @@ public partial class ChronoJumpWindow
}
private void on_export_session_accepted(object o, EventArgs args) {
- new ExportSessionCSV(currentSession, app1, prefsDigitsNumber);
+ new ExportSessionCSV(currentSession, app1, preferences.digitsNumber);
}
@@ -2607,7 +2491,7 @@ public partial class ChronoJumpWindow
private void on_recuperate_person_clicked (object o, EventArgs args) {
Log.WriteLine("recuperate person");
- personRecuperateWin = PersonRecuperateWindow.Show(app1, currentSession, prefsDigitsNumber,
checkbutton_video);
+ personRecuperateWin = PersonRecuperateWindow.Show(app1, currentSession,
preferences.digitsNumber, checkbutton_video);
personRecuperateWin.FakeButtonDone.Clicked += new EventHandler(on_recuperate_person_accepted);
}
@@ -2654,7 +2538,7 @@ public partial class ChronoJumpWindow
private void on_person_add_single_activate (object o, EventArgs args) {
personAddModifyWin = PersonAddModifyWindow.Show(app1,
currentSession, new Person(-1),
- prefsDigitsNumber, checkbutton_video, false); //don't comes from recuperate
window
+ preferences.digitsNumber, checkbutton_video, false); //don't comes from
recuperate window
//-1 means we are adding a new person
//if we were modifying it will be it's uniqueID
@@ -2736,9 +2620,9 @@ public partial class ChronoJumpWindow
private void on_edit_current_person_clicked (object o, EventArgs args) {
Log.WriteLine("modify person");
- //personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession,
currentPerson.UniqueID, prefsDigitsNumber);
+ //personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession,
currentPerson.UniqueID, preferences.digitsNumber);
personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, currentPerson,
- prefsDigitsNumber, checkbutton_video, false); //don't comes from recuperate
window
+ preferences.digitsNumber, checkbutton_video, false); //don't comes from
recuperate window
personAddModifyWin.FakeButtonAccept.Clicked += new
EventHandler(on_edit_current_person_accepted);
}
@@ -2818,16 +2702,6 @@ public partial class ChronoJumpWindow
* --------------------------------------------------------
*/
- /*
- private void on_menuitem_view_stats_activate(object o, EventArgs args) {
- statsWin = StatsWindow.Show(app1, currentSession,
- prefsDigitsNumber, weightPercentPreferred, heightPreferred,
- report, reportWin);
- createdStatsWin = true;
- stats_win_initializeSession();
- }
- */
-
//edit
private void on_cut1_activate (object o, EventArgs args) {
}
@@ -2841,117 +2715,15 @@ public partial class ChronoJumpWindow
private void on_preferences_activate (object o, EventArgs args)
{
- string [] videoDevices = UtilVideo.GetVideoDevices();
-
- PreferencesWindow myWin = PreferencesWindow.Show(
- prefsDigitsNumber, showHeight, showPower, showInitialSpeed, showAngle,
showQIndex, showDjIndex,
- askDeletion, weightPercentPreferred, heightPreferred, metersSecondsPreferred,
- //System.Threading.Thread.CurrentThread.CurrentUICulture.ToString(),
- SqlitePreferences.Select("language"),
- encoderPropulsive, encoderSmoothCon,
- videoDevices, videoDeviceNum, SqlitePreferences.Select("encoder1RMMethod"),
- CSVExportDecimalSeparator, RGraphsTranslate, useHeightsOnJumpIndexes,
- encoderAutoSaveCurve
- );
- myWin.Button_accept.Clicked += new EventHandler(on_preferences_accepted);
- }
-
- private void on_preferences_accepted (object o, EventArgs args) {
- prefsDigitsNumber = Convert.ToInt32 ( SqlitePreferences.Select("digitsNumber") );
-
- //string myPort = SqlitePreferences.Select("chronopicPort");
-
- //chronopicPort cannot change while chronopic is running.
- //user change the port, and the clicks on radiobutton on platform menu
-
- //if(myPort != chronopicPort && cpRunning) {
- // string message = "";
- // bool success = chronopicInit (myPort, out message);
- //}
-
- //chronopicPort = myPort;
-
-
- if ( SqlitePreferences.Select("askDeletion") == "True" )
- askDeletion = true;
- else
- askDeletion = false;
+ preferencesWin = PreferencesWindow.Show(preferences);
-
- if ( SqlitePreferences.Select("weightStatsPercent") == "True" )
- weightPercentPreferred = true;
- else
- weightPercentPreferred = false;
-
-
- if ( SqlitePreferences.Select("showHeight") == "True" )
- showHeight = true;
- else
- showHeight = false;
-
- if ( SqlitePreferences.Select("showPower") == "True" )
- showPower = true;
- else
- showPower = false;
-
-
- if ( SqlitePreferences.Select("showInitialSpeed") == "True" )
- showInitialSpeed = true;
- else
- showInitialSpeed = false;
-
- if ( SqlitePreferences.Select("showAngle") == "True" )
- showAngle = true;
- else
- showAngle = false;
-
-
- //update showQIndex or showDjIndex
- if ( SqlitePreferences.Select("showQIndex") == "True" )
- showQIndex = true;
- else
- showQIndex = false;
-
-
- if ( SqlitePreferences.Select("showDjIndex") == "True" )
- showDjIndex = true;
- else
- showDjIndex = false;
-
-
- //update heightPreferred
- if ( SqlitePreferences.Select("heightPreferred") == "True" )
- heightPreferred = true;
- else
- heightPreferred = false;
-
-
- //update metersSecondsPreferred
- if ( SqlitePreferences.Select("metersSecondsPreferred") == "True" )
- metersSecondsPreferred = true;
- else
- metersSecondsPreferred = false;
-
- encoderPropulsive = SqlitePreferences.Select("encoderPropulsive") == "True";
- encoderSmoothCon = Convert.ToDouble ( Util.ChangeDecimalSeparator (
- SqlitePreferences.Select("encoderSmoothCon") ) );
-
- CSVExportDecimalSeparator = SqlitePreferences.Select("CSVExportDecimalSeparator");
-
- RGraphsTranslate = SqlitePreferences.Select("RGraphsTranslate") == "True";
-
- useHeightsOnJumpIndexes = SqlitePreferences.Select("useHeightsOnJumpIndexes") == "True";
-
- string temp = SqlitePreferences.Select("encoderAutoSaveCurve");
- if(temp == Constants.EncoderAutoSaveCurve.BESTMEANPOWER.ToString())
- encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.BESTMEANPOWER;
- else if(temp == Constants.EncoderAutoSaveCurve.ALL.ToString())
- encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.ALL;
- else
- encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.NONE;
+ preferencesWin.Button_accept.Clicked += new EventHandler(on_preferences_accepted);
+ }
+ private void on_preferences_accepted (object o, EventArgs args)
+ {
+ preferences = preferencesWin.GetPreferences;
- videoDeviceNum = Convert.ToInt32(SqlitePreferences.Select("videoDevice"));
if(checkbutton_video.Active) {
videoCapturePrepare(false); //if error, show message
}
@@ -2962,23 +2734,23 @@ public partial class ChronoJumpWindow
if(repetitiveConditionsWin != null)
- repetitiveConditionsWin.VolumeOn = volumeOn;
+ repetitiveConditionsWin.VolumeOn = preferences.volumeOn;
try {
if(createdStatsWin) {
- //statsWin.PrefsDigitsNumber = prefsDigitsNumber;
- //statsWin.WeightStatsPercent = weightPercentPreferred;
- //statsWin.HeightPreferred = heightPreferred;
+ //statsWin.PrefsDigitsNumber = preferences.digitsNumber;
+ //statsWin.WeightStatsPercent = preferences.weightStatsPercent;
+ //statsWin.HeightPreferred = preferences.heightPreferred;
stats_win_fillTreeView_stats(false, true);
}
//pass to report
- report.PrefsDigitsNumber = prefsDigitsNumber;
- report.HeightPreferred = heightPreferred;
- report.WeightStatsPercent = weightPercentPreferred;
- report.GraphTranslate = RGraphsTranslate;
- report.UseHeightsOnJumpIndexes = useHeightsOnJumpIndexes;
+ report.PrefsDigitsNumber = preferences.digitsNumber;
+ report.HeightPreferred = preferences.heightPreferred;
+ report.WeightStatsPercent = preferences.weightStatsPercent;
+ report.GraphTranslate = preferences.RGraphsTranslate;
+ report.UseHeightsOnJumpIndexes = preferences.useHeightsOnJumpIndexes;
createTreeView_jumps (treeview_jumps);
@@ -3205,36 +2977,36 @@ public partial class ChronoJumpWindow
private void on_checkbutton_video_clicked(object o, EventArgs args) {
if(checkbutton_video.Active) {
- videoOn = true;
+ preferences.videoOn = true;
SqlitePreferences.Update("videoOn", "True", false);
} else {
- videoOn = false;
+ preferences.videoOn = false;
SqlitePreferences.Update("videoOn", "False", false);
}
//change encoder checkbox but don't raise the signal
checkbutton_video_encoder.Clicked -= new EventHandler(on_checkbutton_video_encoder_clicked);
- checkbutton_video_encoder.Active = videoOn;
+ checkbutton_video_encoder.Active = preferences.videoOn;
checkbutton_video_encoder.Clicked += new EventHandler(on_checkbutton_video_encoder_clicked);
- changeVideoButtons(videoOn);
+ changeVideoButtons(preferences.videoOn);
videoCapturePrepare(true); //if error, show message
}
private void on_checkbutton_video_encoder_clicked(object o, EventArgs args) {
if(checkbutton_video_encoder.Active) {
- videoOn = true;
+ preferences.videoOn = true;
SqlitePreferences.Update("videoOn", "True", false);
} else {
- videoOn = false;
+ preferences.videoOn = false;
SqlitePreferences.Update("videoOn", "False", false);
}
//change contacts checkbox but don't raise the signal
checkbutton_video.Clicked -= new EventHandler(on_checkbutton_video_clicked);
- checkbutton_video.Active = videoOn;
+ checkbutton_video.Active = preferences.videoOn;
checkbutton_video.Clicked += new EventHandler(on_checkbutton_video_clicked);
- changeVideoButtons(videoOn);
+ changeVideoButtons(preferences.videoOn);
videoCapturePrepare(true); //if error, show message
}
@@ -3252,34 +3024,34 @@ public partial class ChronoJumpWindow
private void on_checkbutton_volume_clicked(object o, EventArgs args) {
if(checkbutton_volume.Active) {
- volumeOn = true;
+ preferences.volumeOn = true;
SqlitePreferences.Update("volumeOn", "True", false);
} else {
- volumeOn = false;
+ preferences.volumeOn = false;
SqlitePreferences.Update("volumeOn", "False", false);
}
//change encoder checkbox but don't raise the signal
checkbutton_volume_encoder.Clicked -= new EventHandler(on_checkbutton_volume_encoder_clicked);
- checkbutton_volume_encoder.Active = volumeOn;
+ checkbutton_volume_encoder.Active = preferences.volumeOn;
checkbutton_volume_encoder.Clicked += new EventHandler(on_checkbutton_volume_encoder_clicked);
- changeVolumeButtons(volumeOn);
+ changeVolumeButtons(preferences.volumeOn);
}
private void on_checkbutton_volume_encoder_clicked(object o, EventArgs args) {
if(checkbutton_volume_encoder.Active) {
- volumeOn = true;
+ preferences.volumeOn = true;
SqlitePreferences.Update("volumeOn", "True", false);
} else {
- volumeOn = false;
+ preferences.volumeOn = false;
SqlitePreferences.Update("volumeOn", "False", false);
}
//change encoder checkbox but don't raise the signal
checkbutton_volume.Clicked -= new EventHandler(on_checkbutton_volume_clicked);
- checkbutton_volume.Active = volumeOn;
+ checkbutton_volume.Active = preferences.volumeOn;
checkbutton_volume.Clicked += new EventHandler(on_checkbutton_volume_clicked);
- changeVolumeButtons(volumeOn);
+ changeVolumeButtons(preferences.volumeOn);
}
/*
* cancel and finish
@@ -3699,7 +3471,7 @@ Console.WriteLine("X");
currentEventExecute = new JumpExecute(currentPerson.UniqueID, currentPerson.Name,
currentSession.UniqueID, currentJumpType.Name, myFall, jumpWeight,
- chronopicWin.CP, event_execute_label_message, app1, prefsDigitsNumber,
volumeOn,
+ chronopicWin.CP, event_execute_label_message, app1, preferences.digitsNumber,
preferences.volumeOn,
progressbarLimit, egd, description);
@@ -3752,13 +3524,13 @@ Log.WriteLine("DDD 1");
}
//move video file if exists
- if(videoOn)
+ if(preferences.videoOn)
if (! Util.CopyTempVideo(currentSession.UniqueID, Constants.TestTypes.JUMP,
currentJump.UniqueID))
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, video cannot be stored."));
myTreeViewJumps.PersonWeight = currentPersonSession.Weight;
- if(weightPercentPreferred)
+ if(preferences.weightStatsPercent)
myTreeViewJumps.Add(currentPerson.Name, currentJump);
else {
Jump myJump = new Jump();
@@ -3881,8 +3653,8 @@ Log.WriteLine("DDD 2");
currentEventExecute = new JumpRjExecute(currentPerson.UniqueID, currentPerson.Name,
currentSession.UniqueID, currentJumpRjType.Name, myFall, jumpWeight,
progressbarLimit, currentJumpRjType.JumpsLimited,
- chronopicWin.CP, event_execute_label_message, app1, prefsDigitsNumber,
- checkbutton_allow_finish_rj_after_time.Active, volumeOn,
+ chronopicWin.CP, event_execute_label_message, app1, preferences.digitsNumber,
+ checkbutton_allow_finish_rj_after_time.Active, preferences.volumeOn,
repetitiveConditionsWin, progressbarLimit, egd
);
@@ -3915,7 +3687,7 @@ Log.WriteLine("DDD 2");
currentJumpRj = (JumpRj) currentEventExecute.EventDone;
//move video file if exists
- if(videoOn)
+ if(preferences.videoOn)
if(! Util.CopyTempVideo(currentSession.UniqueID, Constants.TestTypes.JUMP_RJ,
currentJumpRj.UniqueID))
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, video cannot be stored."));
@@ -3930,7 +3702,7 @@ Log.WriteLine("DDD 2");
}
}
- if(weightPercentPreferred)
+ if(preferences.weightStatsPercent)
myTreeViewJumpsRj.Add(currentPerson.Name, currentJumpRj);
else {
JumpRj myJump = new JumpRj();
@@ -4044,7 +3816,7 @@ Log.WriteLine("DDD 2");
currentPerson.UniqueID, currentSession.UniqueID,
currentRunType.Name, myDistance,
chronopicWin.CP, event_execute_label_message, app1,
- prefsDigitsNumber, metersSecondsPreferred, volumeOn,
+ preferences.digitsNumber, preferences.metersSecondsPreferred,
preferences.volumeOn,
progressbarLimit, egd,
checkbutton_runs_prevent_double_contact.Active,
(int) spinbutton_runs_prevent_double_contact.Value,
@@ -4076,11 +3848,11 @@ Log.WriteLine("DDD 2");
currentRun = (Run) currentEventExecute.EventDone;
//move video file if exists
- if(videoOn)
+ if(preferences.videoOn)
if(! Util.CopyTempVideo(currentSession.UniqueID, Constants.TestTypes.RUN,
currentRun.UniqueID))
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, video cannot be stored."));
- currentRun.MetersSecondsPreferred = metersSecondsPreferred;
+ currentRun.MetersSecondsPreferred = preferences.metersSecondsPreferred;
myTreeViewRuns.Add(currentPerson.Name, currentRun);
@@ -4174,7 +3946,7 @@ Log.WriteLine("DDD 2");
currentPerson.UniqueID, currentSession.UniqueID, currentRunIntervalType.Name,
distanceInterval, progressbarLimit, currentRunIntervalType.TracksLimited,
chronopicWin.CP, event_execute_label_message, app1,
- prefsDigitsNumber, metersSecondsPreferred, volumeOn, repetitiveConditionsWin,
+ preferences.digitsNumber, preferences.metersSecondsPreferred,
preferences.volumeOn, repetitiveConditionsWin,
progressbarLimit, egd,
checkbutton_runs_i_prevent_double_contact.Active,
(int) spinbutton_runs_i_prevent_double_contact.Value,
@@ -4209,11 +3981,11 @@ Log.WriteLine("DDD 2");
currentRunInterval = (RunInterval) currentEventExecute.EventDone;
//move video file if exists
- if(videoOn)
+ if(preferences.videoOn)
if(! Util.CopyTempVideo(currentSession.UniqueID, Constants.TestTypes.RUN_I,
currentRunInterval.UniqueID))
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, video cannot be stored."));
- currentRunInterval.MetersSecondsPreferred = metersSecondsPreferred;
+ currentRunInterval.MetersSecondsPreferred = preferences.metersSecondsPreferred;
//if user clicked in finish earlier
if(currentEventExecute.Finish) {
@@ -4298,7 +4070,7 @@ Log.WriteLine("DDD 2");
currentEventExecute = new ReactionTimeExecute(currentPerson.UniqueID, currentPerson.Name,
currentSession.UniqueID,
- chronopicWin.CP, event_execute_label_message, app1, prefsDigitsNumber,
volumeOn,
+ chronopicWin.CP, event_execute_label_message, app1, preferences.digitsNumber,
preferences.volumeOn,
progressbarLimit, egd
);
@@ -4328,7 +4100,7 @@ Log.WriteLine("DDD 2");
currentReactionTime = (ReactionTime) currentEventExecute.EventDone;
//move video file if exists
- if(videoOn)
+ if(preferences.videoOn)
if(! Util.CopyTempVideo(currentSession.UniqueID, Constants.TestTypes.RT,
currentReactionTime.UniqueID))
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, video cannot be stored."));
@@ -4413,7 +4185,7 @@ Log.WriteLine("DDD 2");
currentEventExecute = new PulseExecute(currentPerson.UniqueID, currentPerson.Name,
currentSession.UniqueID, currentPulseType.Name, pulseStep, totalPulses,
chronopicWin.CP, event_execute_label_message,
- app1, prefsDigitsNumber, volumeOn, egd
+ app1, preferences.digitsNumber, preferences.volumeOn, egd
);
if(!chronopicWin.Connected)
@@ -4455,7 +4227,7 @@ Log.WriteLine("DDD 2");
currentPulse = (Pulse) currentEventExecute.EventDone;
//move video file if exists
- if(videoOn)
+ if(preferences.videoOn)
if(! Util.CopyTempVideo(currentSession.UniqueID, Constants.TestTypes.PULSE,
currentPulse.UniqueID))
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, video cannot be stored."));
@@ -4497,7 +4269,7 @@ Log.WriteLine("DDD 2");
cpd.Add(a);
}
- chronopicWin = ChronopicWindow.Create(cpd, Util.GetDefaultPort(), recreate, volumeOn);
+ chronopicWin = ChronopicWindow.Create(cpd, Util.GetDefaultPort(), recreate,
preferences.volumeOn);
//chronopicWin.FakeButtonCancelled.Clicked += new EventHandler(on_chronopic_window_cancelled);
if(notebook_sup.CurrentPage == 0)
@@ -4507,13 +4279,13 @@ Log.WriteLine("DDD 2");
}
private void on_chronopic_contacts_clicked (object o, EventArgs args) {
- chronopicWin = ChronopicWindow.View("contacts", volumeOn);
+ chronopicWin = ChronopicWindow.View("contacts", preferences.volumeOn);
//chronopicWin.FakeWindowReload.Clicked += new EventHandler(chronopicWindowReload);
chronopicWin.FakeWindowDone.Clicked += new
EventHandler(on_chronopic_window_contacts_connected_or_done);
}
private void on_chronopic_encoder_clicked (object o, EventArgs args) {
- chronopicWin = ChronopicWindow.View("encoder", volumeOn);
+ chronopicWin = ChronopicWindow.View("encoder", preferences.volumeOn);
//chronopicWin.FakeWindowReload.Clicked += new EventHandler(chronopicWindowReload);
chronopicWin.FakeWindowDone.Clicked += new
EventHandler(on_chronopic_window_encoder_connected_or_done);
}
@@ -4537,7 +4309,7 @@ Log.WriteLine("DDD 2");
//createChronopicWindow(true);
//show it
- chronopicWin = ChronopicWindow.View(volumeOn);
+ chronopicWin = ChronopicWindow.View(preferences.volumeOn);
}
*/
@@ -4721,7 +4493,7 @@ Console.WriteLine("V");
currentMultiChronopic = (MultiChronopic) currentEventExecute.EventDone;
Console.WriteLine("W");
//move video file if exists
- if(videoOn)
+ if(preferences.videoOn)
if(! Util.CopyTempVideo(currentSession.UniqueID,
Constants.TestTypes.MULTICHRONOPIC,
currentMultiChronopic.UniqueID))
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, video cannot be stored."));
@@ -4769,7 +4541,7 @@ Console.WriteLine("X");
else
PrepareJumpReactiveGraph(
Util.GetLast(currentJumpRj.TvString),
Util.GetLast(currentJumpRj.TcString),
- currentJumpRj.TvString,
currentJumpRj.TcString, volumeOn, repetitiveConditionsWin);
+ currentJumpRj.TvString,
currentJumpRj.TcString, preferences.volumeOn, repetitiveConditionsWin);
break;
case EventType.Types.RUN:
if(lastRunIsSimple)
@@ -4789,7 +4561,7 @@ Console.WriteLine("X");
currentRunInterval.IntervalTimesString,
distanceTotal,
runType.DistancesString,
- volumeOn, repetitiveConditionsWin);
+ preferences.volumeOn,
repetitiveConditionsWin);
}
break;
case EventType.Types.PULSE:
@@ -4842,7 +4614,7 @@ Console.WriteLine("X");
eventOldPerson = myJump.PersonID;
//4.- edit this jump
- editJumpWin = EditJumpWindow.Show(app1, myJump, weightPercentPreferred,
prefsDigitsNumber);
+ editJumpWin = EditJumpWindow.Show(app1, myJump, preferences.weightStatsPercent,
preferences.digitsNumber);
editJumpWin.Button_accept.Clicked += new EventHandler(on_edit_selected_jump_accepted);
}
}
@@ -4858,7 +4630,7 @@ Console.WriteLine("X");
eventOldPerson = myJump.PersonID;
//4.- edit this jump
- editJumpRjWin = EditJumpRjWindow.Show(app1, myJump, weightPercentPreferred,
prefsDigitsNumber);
+ editJumpRjWin = EditJumpRjWindow.Show(app1, myJump, preferences.weightStatsPercent,
preferences.digitsNumber);
editJumpRjWin.Button_accept.Clicked += new
EventHandler(on_edit_selected_jump_rj_accepted);
}
}
@@ -4870,7 +4642,7 @@ Console.WriteLine("X");
//if person changed, fill treeview again, if not, only update it's line
if(eventOldPerson == myJump.PersonID) {
- if(! weightPercentPreferred) {
+ if(! preferences.weightStatsPercent) {
double personWeight = SqlitePersonSession.SelectAttribute(
false, myJump.PersonID, currentSession.UniqueID,
Constants.Weight);
myJump.Weight = Util.WeightFromPercentToKg(myJump.Weight, personWeight);
@@ -4893,7 +4665,7 @@ Console.WriteLine("X");
//if person changed, fill treeview again, if not, only update it's line
if(eventOldPerson == myJump.PersonID) {
- if(! weightPercentPreferred) {
+ if(! preferences.weightStatsPercent) {
double personWeight = SqlitePersonSession.SelectAttribute(
false, myJump.PersonID, currentSession.UniqueID,
Constants.Weight);
myJump.Weight = Util.WeightFromPercentToKg(myJump.Weight, personWeight);
@@ -4917,11 +4689,11 @@ Console.WriteLine("X");
if (myTreeViewRuns.EventSelectedID > 0) {
//3.- obtain the data of the selected run
Run myRun = SqliteRun.SelectRunData( myTreeViewRuns.EventSelectedID, false );
- myRun.MetersSecondsPreferred = metersSecondsPreferred;
+ myRun.MetersSecondsPreferred = preferences.metersSecondsPreferred;
eventOldPerson = myRun.PersonID;
//4.- edit this run
- editRunWin = EditRunWindow.Show(app1, myRun, prefsDigitsNumber,
metersSecondsPreferred);
+ editRunWin = EditRunWindow.Show(app1, myRun, preferences.digitsNumber,
preferences.metersSecondsPreferred);
editRunWin.Button_accept.Clicked += new EventHandler(on_edit_selected_run_accepted);
}
}
@@ -4937,7 +4709,7 @@ Console.WriteLine("X");
eventOldPerson = myRun.PersonID;
//4.- edit this run
- editRunIntervalWin = EditRunIntervalWindow.Show(app1, myRun, prefsDigitsNumber,
metersSecondsPreferred);
+ editRunIntervalWin = EditRunIntervalWindow.Show(app1, myRun,
preferences.digitsNumber, preferences.metersSecondsPreferred);
editRunIntervalWin.Button_accept.Clicked += new
EventHandler(on_edit_selected_run_interval_accepted);
}
}
@@ -4987,7 +4759,7 @@ Console.WriteLine("X");
eventOldPerson = myRT.PersonID;
//4.- edit this event
- editReactionTimeWin = EditReactionTimeWindow.Show(app1, myRT, prefsDigitsNumber);
+ editReactionTimeWin = EditReactionTimeWindow.Show(app1, myRT,
preferences.digitsNumber);
editReactionTimeWin.Button_accept.Clicked += new
EventHandler(on_edit_selected_reaction_time_accepted);
}
}
@@ -5017,7 +4789,7 @@ Console.WriteLine("X");
eventOldPerson = myPulse.PersonID;
//4.- edit this event
- editPulseWin = EditPulseWindow.Show(app1, myPulse, prefsDigitsNumber);
+ editPulseWin = EditPulseWindow.Show(app1, myPulse, preferences.digitsNumber);
editPulseWin.Button_accept.Clicked += new
EventHandler(on_edit_selected_pulse_accepted);
}
}
@@ -5047,7 +4819,7 @@ Console.WriteLine("X");
eventOldPerson = mc.PersonID;
//4.- edit this jump
- editMultiChronopicWin = EditMultiChronopicWindow.Show(app1, mc, prefsDigitsNumber);
+ editMultiChronopicWin = EditMultiChronopicWindow.Show(app1, mc,
preferences.digitsNumber);
editMultiChronopicWin.Button_accept.Clicked += new
EventHandler(on_edit_selected_multi_chronopic_accepted);
}
}
@@ -5243,7 +5015,7 @@ Console.WriteLine("X");
Log.WriteLine(myTreeViewJumps.EventSelectedID.ToString());
if (myTreeViewJumps.EventSelectedID > 0) {
//3.- display confirmwindow of deletion
- if (askDeletion) {
+ if (preferences.askDeletion) {
confirmWinJumpRun = ConfirmWindowJumpRun.Show(Catalog.GetString("Do you want
to delete this jump?"), "");
confirmWinJumpRun.Button_accept.Clicked += new
EventHandler(on_delete_selected_jump_accepted);
} else {
@@ -5259,7 +5031,7 @@ Console.WriteLine("X");
//2.- check that this line is a jump and not a person (check also if it's not a individual
RJ, the pass the parent RJ)
if (myTreeViewJumpsRj.EventSelectedID > 0) {
//3.- display confirmwindow of deletion
- if (askDeletion) {
+ if (preferences.askDeletion) {
confirmWinJumpRun = ConfirmWindowJumpRun.Show( Catalog.GetString("Do you want
to delete this jump?"),
Catalog.GetString("Attention: Deleting a Reactive subjump
will delete the whole jump"));
confirmWinJumpRun.Button_accept.Clicked += new
EventHandler(on_delete_selected_jump_rj_accepted);
@@ -5331,7 +5103,7 @@ Console.WriteLine("X");
//2.- check that this line is a jump and not a person
if (myTreeViewRuns.EventSelectedID > 0) {
//3.- display confirmwindow of deletion
- if (askDeletion) {
+ if (preferences.askDeletion) {
confirmWinJumpRun = ConfirmWindowJumpRun.Show(Catalog.GetString("Do you want
to delete this run?"), "");
confirmWinJumpRun.Button_accept.Clicked += new
EventHandler(on_delete_selected_run_accepted);
} else {
@@ -5348,7 +5120,7 @@ Console.WriteLine("X");
//2.- check that this line is a run and not a person (check also if it's a subrun, pass the
parent run)
if (myTreeViewRunsInterval.EventSelectedID > 0) {
//3.- display confirmwindow of deletion
- if (askDeletion) {
+ if (preferences.askDeletion) {
confirmWinJumpRun = ConfirmWindowJumpRun.Show( Catalog.GetString("Do you want
to delete this run?"),
Catalog.GetString("Attention: Deleting a Intervallic subrun
will delete the whole run"));
confirmWinJumpRun.Button_accept.Clicked += new
EventHandler(on_delete_selected_run_interval_accepted);
@@ -5411,7 +5183,7 @@ Console.WriteLine("X");
Log.WriteLine(myTreeViewReactionTimes.EventSelectedID.ToString());
if (myTreeViewReactionTimes.EventSelectedID > 0) {
//3.- display confirmwindow of deletion
- if (askDeletion) {
+ if (preferences.askDeletion) {
confirmWinJumpRun = ConfirmWindowJumpRun.Show("Do you want to delete this
test?", "");
confirmWinJumpRun.Button_accept.Clicked += new
EventHandler(on_delete_selected_reaction_time_accepted);
} else {
@@ -5448,7 +5220,7 @@ Console.WriteLine("X");
Log.WriteLine(myTreeViewPulses.EventSelectedID.ToString());
if (myTreeViewPulses.EventSelectedID > 0) {
//3.- display confirmwindow of deletion
- if (askDeletion) {
+ if (preferences.askDeletion) {
confirmWinJumpRun = ConfirmWindowJumpRun.Show("Do you want to delete this
test?", "");
confirmWinJumpRun.Button_accept.Clicked += new
EventHandler(on_delete_selected_pulse_accepted);
} else {
@@ -5483,7 +5255,7 @@ Console.WriteLine("X");
//2.- check that this line is a test and not a person (check also if it's not a individual
mc, then pass the parent mc)
if (myTreeViewMultiChronopic.EventSelectedID > 0) {
//3.- display confirmwindow of deletion
- if (askDeletion) {
+ if (preferences.askDeletion) {
confirmWinJumpRun = ConfirmWindowJumpRun.Show( Catalog.GetString("Do you want
to delete this test?"), "");
confirmWinJumpRun.Button_accept.Clicked += new
EventHandler(on_delete_selected_multi_chronopic_accepted);
} else {
@@ -5683,7 +5455,7 @@ Console.WriteLine("X");
JumpRj myJump = SqliteJumpRj.SelectJumpData( "jumpRj",
myTreeViewJumpsRj.EventSelectedID, false );
//4.- edit this jump
- repairJumpRjWin = RepairJumpRjWindow.Show(app1, myJump, prefsDigitsNumber);
+ repairJumpRjWin = RepairJumpRjWindow.Show(app1, myJump, preferences.digitsNumber);
repairJumpRjWin.Button_accept.Clicked += new
EventHandler(on_repair_selected_jump_rj_accepted);
}
}
@@ -5710,7 +5482,7 @@ Console.WriteLine("X");
RunInterval myRun = SqliteRunInterval.SelectRunData( Constants.RunIntervalTable,
myTreeViewRunsInterval.EventSelectedID, false );
//4.- edit this run
- repairRunIntervalWin = RepairRunIntervalWindow.Show(app1, myRun, prefsDigitsNumber);
+ repairRunIntervalWin = RepairRunIntervalWindow.Show(app1, myRun,
preferences.digitsNumber);
repairRunIntervalWin.Button_accept.Clicked += new
EventHandler(on_repair_selected_run_interval_accepted);
}
}
@@ -5737,7 +5509,7 @@ Console.WriteLine("X");
Pulse myPulse = SqlitePulse.SelectPulseData( myTreeViewPulses.EventSelectedID, false
);
//4.- edit this pulse
- repairPulseWin = RepairPulseWindow.Show(app1, myPulse, prefsDigitsNumber);
+ repairPulseWin = RepairPulseWindow.Show(app1, myPulse, preferences.digitsNumber);
repairPulseWin.Button_accept.Clicked += new
EventHandler(on_repair_selected_pulse_accepted);
}
}
@@ -5953,11 +5725,11 @@ Console.WriteLine("X");
}
private void on_button_rj_bells_clicked(object o, EventArgs args) {
- repetitiveConditionsWin.View(Constants.BellModes.JUMPS, volumeOn);
+ repetitiveConditionsWin.View(Constants.BellModes.JUMPS, preferences.volumeOn);
}
private void on_button_time_bells_clicked(object o, EventArgs args) {
- repetitiveConditionsWin.View(Constants.BellModes.RUNS, volumeOn);
+ repetitiveConditionsWin.View(Constants.BellModes.RUNS, preferences.volumeOn);
}
private void on_repetitive_conditions_closed(object o, EventArgs args) {
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index b250e04..e156d53 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -188,12 +188,6 @@ public partial class ChronoJumpWindow
private static bool encoderProcessProblems;
private static bool encoderProcessFinish;
- //smooth preferences on Sqlite since 1.3.7
- bool encoderPropulsive;
- double encoderSmoothCon;
-
- //bool capturingRotaryInertial;
-
EncoderCaptureOptionsWindow encoderCaptureOptionsWin;
EncoderConfigurationWindow encoder_configuration_win;
@@ -337,7 +331,7 @@ public partial class ChronoJumpWindow
}
void on_button_encoder_capture_options_clicked (object o, EventArgs args) {
- encoderCaptureOptionsWin.View(repetitiveConditionsWin, volumeOn);
+ encoderCaptureOptionsWin.View(repetitiveConditionsWin, preferences.volumeOn);
}
private void on_encoder_capture_options_closed(object o, EventArgs args) {
@@ -346,7 +340,7 @@ public partial class ChronoJumpWindow
}
private void on_button_encoder_bells_clicked(object o, EventArgs args) {
- repetitiveConditionsWin.View(Constants.BellModes.ENCODER, volumeOn);
+ repetitiveConditionsWin.View(Constants.BellModes.ENCODER, preferences.volumeOn);
}
private bool encoderCheckPort() {
@@ -669,7 +663,7 @@ public partial class ChronoJumpWindow
private string getEncoderAnalysisOptions(bool captureOrAnalyze) {
string analysisOptions = "-";
- if(encoderPropulsive)
+ if(preferences.encoderPropulsive)
analysisOptions = "p";
return analysisOptions;
@@ -718,14 +712,12 @@ public partial class ChronoJumpWindow
"none", //analysisVariables (not needed in create
curves). Cannot be blank
analysisOptions,
encoderConfigurationCurrent,
- Util.ConvertToPoint(encoderSmoothCon), //R decimal: '.'
+ Util.ConvertToPoint(preferences.encoderSmoothCon), //R decimal: '.'
0, //curve is not used here
image_encoder_width, image_encoder_height,
- CSVExportDecimalSeparator
+ preferences.CSVExportDecimalSeparator
);
- //capturingRotaryInertial = false;
-
EncoderStruct es = new EncoderStruct(
UtilEncoder.GetEncoderDataTempFileName(),
UtilEncoder.GetEncoderGraphTempFileName(),
@@ -740,7 +732,7 @@ public partial class ChronoJumpWindow
"-(" + Util.ConvertToPoint(findMass(Constants.MassType.DISPLACED)) + "Kg)",
es,
false, //do not use neuromuscularProfile script
- RGraphsTranslate
+ preferences.RGraphsTranslate
);
if(result)
@@ -930,7 +922,7 @@ public partial class ChronoJumpWindow
}
protected void on_encoder_show_curves_row_delete_pre (object o, EventArgs args) {
- if(askDeletion) {
+ if(preferences.askDeletion) {
ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString(
"Are you sure you want to delete this repetition?"), "", "");
confirmWin.Button_accept.Clicked += new
EventHandler(on_encoder_show_curves_row_delete);
@@ -1330,7 +1322,7 @@ public partial class ChronoJumpWindow
}
protected void on_encoder_load_signal_row_delete_pre (object o, EventArgs args) {
- if(askDeletion) {
+ if(preferences.askDeletion) {
ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString(
"Are you sure you want to delete this set?"),
Catalog.GetString("Saved repetitions related to this set will also be deleted."), "");
confirmWin.Button_accept.Clicked += new
EventHandler(on_encoder_load_signal_row_delete);
@@ -1415,11 +1407,11 @@ public partial class ChronoJumpWindow
"none", //analysisVariables (not
needed in create curves). Cannot be blank
analysisOptions,
encoderConfigurationCurrent,
- Util.ConvertToPoint(encoderSmoothCon), //R decimal: '.'
+ Util.ConvertToPoint(preferences.encoderSmoothCon), //R decimal: '.'
-1,
image_encoder_width,
image_encoder_height,
- CSVExportDecimalSeparator
+ preferences.CSVExportDecimalSeparator
);
string dataFileName = UtilEncoder.GetEncoderDataTempFileName();
@@ -1438,7 +1430,7 @@ public partial class ChronoJumpWindow
"-(" + displacedMass + "Kg)",
encoderStruct,
false, //do not use neuromuscularProfile script
- RGraphsTranslate
+ preferences.RGraphsTranslate
);
//encoder_pulsebar_capture.Text = string.Format(Catalog.GetString(
@@ -1563,7 +1555,7 @@ public partial class ChronoJumpWindow
void on_button_encoder_delete_signal_clicked (object o, EventArgs args)
{
- if(askDeletion) {
+ if(preferences.askDeletion) {
ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString(
"Are you sure you want to delete this set?"),
Catalog.GetString("Saved repetitions related to this set will also be deleted."), "");
confirmWin.Button_accept.Clicked += new
EventHandler(on_button_encoder_delete_signal_accepted);
@@ -1773,7 +1765,7 @@ public partial class ChronoJumpWindow
button_video_play_this_test_encoder.Sensitive = false;
//copy video
- if(videoOn) {
+ if(preferences.videoOn) {
if(Util.CopyTempVideo(currentSession.UniqueID,
Constants.TestTypes.ENCODER,
Convert.ToInt32(encoderSignalUniqueID))) {
@@ -2290,11 +2282,11 @@ public partial class ChronoJumpWindow
analysisVariables,
analysisOptions,
encoderConfigurationCurrent,
- Util.ConvertToPoint(encoderSmoothCon), //R decimal:
'.'
+ Util.ConvertToPoint(preferences.encoderSmoothCon), //R decimal:
'.'
myCurveNum,
image_encoder_width,
image_encoder_height,
- CSVExportDecimalSeparator
+ preferences.CSVExportDecimalSeparator
);
@@ -2407,11 +2399,11 @@ public partial class ChronoJumpWindow
analysisVariables,
analysisOptions,
encoderConfigurationCurrent,
- Util.ConvertToPoint(encoderSmoothCon), //R decimal:
'.'
+ Util.ConvertToPoint(preferences.encoderSmoothCon), //R decimal:
'.'
Convert.ToInt32(UtilGtk.ComboGetActive(combo_encoder_analyze_curve_num_combo)),
image_encoder_width,
image_encoder_height,
- CSVExportDecimalSeparator
+ preferences.CSVExportDecimalSeparator
);
dataFileName = UtilEncoder.GetEncoderDataTempFileName();
@@ -2442,7 +2434,7 @@ public partial class ChronoJumpWindow
UtilEncoder.RunEncoderGraphNoRDotNet(titleStr, encoderStruct,
encoderAnalysis == "neuromuscularProfile",
- RGraphsTranslate);
+ preferences.RGraphsTranslate);
}
private void on_check_encoder_analyze_signal_or_curves_toggled (object obj, EventArgs args) {
@@ -3750,7 +3742,7 @@ public partial class ChronoJumpWindow
//propulsive stuff
int propulsiveEnd = curveToRreduced.Length;
rengine.Evaluate("g <- 9.81");
- if(encoderPropulsive) {
+ if(preferences.encoderPropulsive) {
//check if propulsive phase ends
Log.WriteLine("accel$y");
//rengine.Evaluate("print(accel$y)");
@@ -3963,14 +3955,14 @@ public partial class ChronoJumpWindow
if(mainVariableHigher != -1 && d >= mainVariableHigher) {
my_pen = pen_green_encoder_capture;
//play sound if value is high, volumeOn == true, is last value, capturing
- if(volumeOn && count == data.Count -1 && capturing)
- Util.PlaySound(Constants.SoundTypes.GOOD, volumeOn);
+ if(preferences.volumeOn && count == data.Count -1 && capturing)
+ Util.PlaySound(Constants.SoundTypes.GOOD, preferences.volumeOn);
}
else if(mainVariableLower != -1 && d <= mainVariableLower) {
my_pen = pen_red_encoder_capture;
//play sound if value is low, volumeOn == true, is last value, capturing
- if(volumeOn && count == data.Count -1 && capturing)
- Util.PlaySound(Constants.SoundTypes.BAD, volumeOn);
+ if(preferences.volumeOn && count == data.Count -1 && capturing)
+ Util.PlaySound(Constants.SoundTypes.BAD, preferences.volumeOn);
}
else
my_pen = pen_azul_encoder_capture;
@@ -4601,14 +4593,14 @@ public partial class ChronoJumpWindow
bool needToAutoSaveCurve = false;
if(
encoderSignalUniqueID == "-1" && //if we just
captured
- (encoderAutoSaveCurve ==
Constants.EncoderAutoSaveCurve.ALL ||
- encoderAutoSaveCurve ==
Constants.EncoderAutoSaveCurve.BESTMEANPOWER) )
+ (preferences.encoderAutoSaveCurve ==
Constants.EncoderAutoSaveCurve.ALL ||
+ preferences.encoderAutoSaveCurve ==
Constants.EncoderAutoSaveCurve.BESTMEANPOWER) )
needToAutoSaveCurve = true;
encoder_pulsebar_capture.Text = encoderSaveSignalOrCurve("signal",
0); //this updates encoderSignalUniqueID
if(needToAutoSaveCurve)
- encoderCaptureSaveCurvesAllNoneBest(encoderAutoSaveCurve);
+
encoderCaptureSaveCurvesAllNoneBest(preferences.encoderAutoSaveCurve);
} else
encoder_pulsebar_capture.Text = "";
@@ -4780,7 +4772,7 @@ public partial class ChronoJumpWindow
private void encoderStartVideoRecord() {
Log.WriteLine("Starting video");
checkbutton_video_encoder.Sensitive = false;
- if(videoOn) {
+ if(preferences.videoOn) {
capturer.ClickRec();
label_video_feedback_encoder.Text = "Rec.";
}
@@ -4790,7 +4782,7 @@ public partial class ChronoJumpWindow
private void encoderStopVideoRecord() {
Log.WriteLine("Stopping video");
checkbutton_video_encoder.Sensitive = true;
- if(videoOn) {
+ if(preferences.videoOn) {
label_video_feedback_encoder.Text = "";
capturer.ClickStop();
videoCapturePrepare(false); //if error, show message
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index f08810d..38746c2 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -278,7 +278,7 @@ public partial class ChronoJumpWindow
eventHasEnded = false;
checkbutton_video.Sensitive = false;
- if(videoOn) {
+ if(preferences.videoOn) {
capturer.ClickRec();
//label_video_feedback.Text = Catalog.GetString("Recording");
label_video_feedback.Text = "Rec.";
@@ -1002,52 +1002,52 @@ Log.WriteLine("Preparing reactive A");
double tcNow, double tcPerson, double tcSession)
{
if(tcNow > 0) {
- event_execute_label_jump_simple_tc_now.Text = "<b>" +
Util.TrimDecimals(tcNow.ToString(), prefsDigitsNumber) + "</b>";
+ event_execute_label_jump_simple_tc_now.Text = "<b>" +
Util.TrimDecimals(tcNow.ToString(), preferences.digitsNumber) + "</b>";
event_execute_label_jump_simple_tc_now.UseMarkup = true;
- event_execute_label_jump_simple_tc_person.Text =
Util.TrimDecimals(tcPerson.ToString(), prefsDigitsNumber);
- event_execute_label_jump_simple_tc_session.Text =
Util.TrimDecimals(tcSession.ToString(), prefsDigitsNumber);
+ event_execute_label_jump_simple_tc_person.Text =
Util.TrimDecimals(tcPerson.ToString(), preferences.digitsNumber);
+ event_execute_label_jump_simple_tc_session.Text =
Util.TrimDecimals(tcSession.ToString(), preferences.digitsNumber);
} else {
event_execute_label_jump_simple_tc_now.Text = "";
event_execute_label_jump_simple_tc_person.Text = "";
event_execute_label_jump_simple_tc_session.Text = "";
}
- event_execute_label_jump_simple_tf_now.Text = "<b>" + Util.TrimDecimals(tvNow.ToString(),
prefsDigitsNumber) + "</b>";
+ event_execute_label_jump_simple_tf_now.Text = "<b>" + Util.TrimDecimals(tvNow.ToString(),
preferences.digitsNumber) + "</b>";
event_execute_label_jump_simple_tf_now.UseMarkup = true;
- event_execute_label_jump_simple_tf_person.Text = Util.TrimDecimals(tvPerson.ToString(),
prefsDigitsNumber);
- event_execute_label_jump_simple_tf_session.Text = Util.TrimDecimals(tvSession.ToString(),
prefsDigitsNumber);
+ event_execute_label_jump_simple_tf_person.Text = Util.TrimDecimals(tvPerson.ToString(),
preferences.digitsNumber);
+ event_execute_label_jump_simple_tf_session.Text = Util.TrimDecimals(tvSession.ToString(),
preferences.digitsNumber);
//current height is calculated from tvNow
//heightPerson and heightSession is calculated for every jump, then done the AVG, then send
here
event_execute_label_jump_simple_height_now.Text = "<b>" + Util.TrimDecimals(
- Util.GetHeightInCentimeters(tvNow.ToString()) , prefsDigitsNumber) + "</b>";
+ Util.GetHeightInCentimeters(tvNow.ToString()) , preferences.digitsNumber) +
"</b>";
event_execute_label_jump_simple_height_now.UseMarkup = true;
- event_execute_label_jump_simple_height_person.Text =
Util.TrimDecimals(heightPerson.ToString(), prefsDigitsNumber);
- event_execute_label_jump_simple_height_session.Text =
Util.TrimDecimals(heightSession.ToString(), prefsDigitsNumber);
+ event_execute_label_jump_simple_height_person.Text =
Util.TrimDecimals(heightPerson.ToString(), preferences.digitsNumber);
+ event_execute_label_jump_simple_height_session.Text =
Util.TrimDecimals(heightSession.ToString(), preferences.digitsNumber);
}
private void printLabelsRunSimple (double timeNow, double timePerson, double timeSession, double
speedNow, double speedPerson, double speedSession) {
- event_execute_label_run_simple_time_now.Text = "<b>" + Util.TrimDecimals(timeNow.ToString(),
prefsDigitsNumber) + "</b>";
+ event_execute_label_run_simple_time_now.Text = "<b>" + Util.TrimDecimals(timeNow.ToString(),
preferences.digitsNumber) + "</b>";
event_execute_label_run_simple_time_now.UseMarkup = true;
- event_execute_label_run_simple_time_person.Text = Util.TrimDecimals(timePerson.ToString(),
prefsDigitsNumber);
- event_execute_label_run_simple_time_session.Text = Util.TrimDecimals(timeSession.ToString(),
prefsDigitsNumber);
+ event_execute_label_run_simple_time_person.Text = Util.TrimDecimals(timePerson.ToString(),
preferences.digitsNumber);
+ event_execute_label_run_simple_time_session.Text = Util.TrimDecimals(timeSession.ToString(),
preferences.digitsNumber);
- event_execute_label_run_simple_speed_now.Text = "<b>" +
Util.TrimDecimals(speedNow.ToString(), prefsDigitsNumber) + "</b>";
+ event_execute_label_run_simple_speed_now.Text = "<b>" +
Util.TrimDecimals(speedNow.ToString(), preferences.digitsNumber) + "</b>";
event_execute_label_run_simple_speed_now.UseMarkup = true;
- event_execute_label_run_simple_speed_person.Text = Util.TrimDecimals(speedPerson.ToString(),
prefsDigitsNumber);
- event_execute_label_run_simple_speed_session.Text =
Util.TrimDecimals(speedSession.ToString(), prefsDigitsNumber);
+ event_execute_label_run_simple_speed_person.Text = Util.TrimDecimals(speedPerson.ToString(),
preferences.digitsNumber);
+ event_execute_label_run_simple_speed_session.Text =
Util.TrimDecimals(speedSession.ToString(), preferences.digitsNumber);
}
private void printLabelsReactionTime (double timeNow, double timePerson, double timeSession) {
- event_execute_label_reaction_time_now.Text = "<b>" + Util.TrimDecimals(timeNow.ToString(),
prefsDigitsNumber) + "</b>";
+ event_execute_label_reaction_time_now.Text = "<b>" + Util.TrimDecimals(timeNow.ToString(),
preferences.digitsNumber) + "</b>";
event_execute_label_reaction_time_now.UseMarkup = true;
- event_execute_label_reaction_time_person.Text = Util.TrimDecimals(timePerson.ToString(),
prefsDigitsNumber);
- event_execute_label_reaction_time_session.Text = Util.TrimDecimals(timeSession.ToString(),
prefsDigitsNumber);
+ event_execute_label_reaction_time_person.Text = Util.TrimDecimals(timePerson.ToString(),
preferences.digitsNumber);
+ event_execute_label_reaction_time_session.Text = Util.TrimDecimals(timeSession.ToString(),
preferences.digitsNumber);
}
//used on simple tests
@@ -1374,22 +1374,22 @@ Log.WriteLine("Preparing reactive A");
* these Log.writeLines are useful to don't "get the thread dead"
* without them , sometimes drawingarea is not painted
*/
- event_execute_label_jump_reactive_tc_now.Text = "<b>" + Util.TrimDecimals(lastTc.ToString(),
prefsDigitsNumber) + "</b>";
+ event_execute_label_jump_reactive_tc_now.Text = "<b>" + Util.TrimDecimals(lastTc.ToString(),
preferences.digitsNumber) + "</b>";
event_execute_label_jump_reactive_tc_now.UseMarkup = true;
- event_execute_label_jump_reactive_tc_avg.Text = Util.TrimDecimals(avgTC.ToString(),
prefsDigitsNumber);
+ event_execute_label_jump_reactive_tc_avg.Text = Util.TrimDecimals(avgTC.ToString(),
preferences.digitsNumber);
- event_execute_label_jump_reactive_tf_now.Text = "<b>" + Util.TrimDecimals(lastTv.ToString(),
prefsDigitsNumber) + "</b>";
+ event_execute_label_jump_reactive_tf_now.Text = "<b>" + Util.TrimDecimals(lastTv.ToString(),
preferences.digitsNumber) + "</b>";
event_execute_label_jump_reactive_tf_now.UseMarkup = true;
- event_execute_label_jump_reactive_tf_avg.Text = Util.TrimDecimals(avgTV.ToString(),
prefsDigitsNumber);
+ event_execute_label_jump_reactive_tf_avg.Text = Util.TrimDecimals(avgTV.ToString(),
preferences.digitsNumber);
if(lastTc > 0) {
- event_execute_label_jump_reactive_tf_tc_now.Text = "<b>" +
Util.TrimDecimals((lastTv/lastTc).ToString(), prefsDigitsNumber) + "</b>";
+ event_execute_label_jump_reactive_tf_tc_now.Text = "<b>" +
Util.TrimDecimals((lastTv/lastTc).ToString(), preferences.digitsNumber) + "</b>";
event_execute_label_jump_reactive_tf_tc_now.UseMarkup = true;
} else
event_execute_label_jump_reactive_tf_tc_now.Text = "0";
if(avgTC > 0)
- event_execute_label_jump_reactive_tf_tc_avg.Text =
Util.TrimDecimals((avgTV/avgTC).ToString(), prefsDigitsNumber);
+ event_execute_label_jump_reactive_tf_tc_avg.Text =
Util.TrimDecimals((avgTV/avgTC).ToString(), preferences.digitsNumber);
else
event_execute_label_jump_reactive_tf_tc_avg.Text = "0";
}
@@ -1501,15 +1501,15 @@ Log.WriteLine("Preparing reactive A");
plotSimulatedMessageIfNeededAtCenter(ancho, alto);
}
- event_execute_label_run_interval_time_now.Text = "<b>" +
Util.TrimDecimals(lastTime.ToString(), prefsDigitsNumber) + "</b>";
+ event_execute_label_run_interval_time_now.Text = "<b>" +
Util.TrimDecimals(lastTime.ToString(), preferences.digitsNumber) + "</b>";
event_execute_label_run_interval_time_now.UseMarkup = true;
- event_execute_label_run_interval_time_avg.Text = Util.TrimDecimals(avgTime.ToString(),
prefsDigitsNumber);
+ event_execute_label_run_interval_time_avg.Text = Util.TrimDecimals(avgTime.ToString(),
preferences.digitsNumber);
- event_execute_label_run_interval_speed_now.Text = "<b>" + Util.TrimDecimals((distance /
lastTime).ToString(), prefsDigitsNumber) + "</b>";
+ event_execute_label_run_interval_speed_now.Text = "<b>" + Util.TrimDecimals((distance /
lastTime).ToString(), preferences.digitsNumber) + "</b>";
event_execute_label_run_interval_speed_now.UseMarkup = true;
- event_execute_label_run_interval_speed_avg.Text = Util.TrimDecimals((distanceTotal /
Util.GetTotalTime(timesString)).ToString(), prefsDigitsNumber);
+ event_execute_label_run_interval_speed_avg.Text = Util.TrimDecimals((distanceTotal /
Util.GetTotalTime(timesString)).ToString(), preferences.digitsNumber);
}
private void paintPulse (Gtk.DrawingArea drawingarea, double lastTime, string timesString, double
avgTime, int pulses,
@@ -1564,10 +1564,10 @@ Log.WriteLine("Preparing reactive A");
plotSimulatedMessageIfNeededAtCenter(ancho, alto);
}
- event_execute_label_pulse_now.Text = "<b>" + Util.TrimDecimals(lastTime.ToString(),
prefsDigitsNumber) + "</b>";
+ event_execute_label_pulse_now.Text = "<b>" + Util.TrimDecimals(lastTime.ToString(),
preferences.digitsNumber) + "</b>";
event_execute_label_pulse_now.UseMarkup = true;
- event_execute_label_pulse_avg.Text = Util.TrimDecimals(avgTime.ToString(), prefsDigitsNumber);
+ event_execute_label_pulse_avg.Text = Util.TrimDecimals(avgTime.ToString(),
preferences.digitsNumber);
}
double multiChronopicGetX(int ancho, double time, double timeOld, double timeTotal) {
@@ -1842,14 +1842,14 @@ Log.WriteLine("Preparing reactive A");
currentEventExecute.PrepareEventGraphJumpReactiveObject.lastTc,
currentEventExecute.PrepareEventGraphJumpReactiveObject.tvString,
currentEventExecute.PrepareEventGraphJumpReactiveObject.tcString,
- volumeOn, repetitiveConditionsWin);
+ preferences.volumeOn, repetitiveConditionsWin);
}
break;
case EventType.Types.RUN:
if(thisRunIsSimple)
PrepareRunSimpleGraph(currentEventExecute.PrepareEventGraphRunSimpleObject);
else {
- bool volumeOnHere = volumeOn;
+ bool volumeOnHere = preferences.volumeOn;
//do not play good or bad sounds at RSA because we need to hear the
GO sound
if(currentRunIntervalType.IsRSA)
volumeOnHere = false;
@@ -1895,7 +1895,7 @@ Log.WriteLine("Preparing reactive A");
eventHasEnded = true;
checkbutton_video.Sensitive = true;
- if(videoOn) {
+ if(preferences.videoOn) {
label_video_feedback.Text = "";
capturer.ClickStop();
videoCapturePrepare(false); //if error, show message
@@ -2021,7 +2021,7 @@ Log.WriteLine("Preparing reactive A");
hideButtons();
checkbutton_video.Sensitive = true;
- if(videoOn) {
+ if(preferences.videoOn) {
//it will be recorded on temp, but chronojump will move it to chronojump/multimedia
folders
label_video_feedback.Text = "";
capturer.ClickStop();
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index ce9205c..77c7e3c 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -32,7 +32,7 @@ using System.Threading;
public class PreferencesWindow {
- [Widget] Gtk.Window preferences;
+ [Widget] Gtk.Window preferences_win;
[Widget] Gtk.Label label_database;
[Widget] Gtk.Label label_database_temp;
@@ -107,6 +107,7 @@ public class PreferencesWindow {
static PreferencesWindow PreferencesWindowBox;
+ private Preferences preferences; //stored to update SQL if anything changed
private Thread thread;
//language when window is called. If changes, then change data in sql and show
@@ -116,11 +117,11 @@ public class PreferencesWindow {
PreferencesWindow () {
Glade.XML gladeXML;
- gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "preferences",
"chronojump");
+ gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade",
"preferences_win", "chronojump");
gladeXML.Autoconnect(this);
//put an icon to window
- UtilGtk.IconWindow(preferences);
+ UtilGtk.IconWindow(preferences_win);
label_database.Visible = false;
label_database_temp.Visible = false;
@@ -130,36 +131,32 @@ public class PreferencesWindow {
label_database_temp.Text = Util.GetDatabaseTempDir() + System.IO.Path.DirectorySeparatorChar
+ "chronojump.db";
}
- static public PreferencesWindow Show (int digitsNumber, bool showHeight, bool showPower,
- bool showInitialSpeed, bool showAngle, bool showQIndex, bool showDjIndex,
- bool askDeletion, bool weightStatsPercent, bool heightPreferred, bool
metersSecondsPreferred,
- string language, bool encoderPropulsive, double encoderSmoothCon,
- string [] videoDevices, int videoDeviceNum, string encoder1RMMethod,
- string CSVExportDecimalSeparator, bool RGraphsTranslate, bool useHeightsOnJumpIndexes,
- Constants.EncoderAutoSaveCurve encoderAutoSaveCurve
- )
+ static public PreferencesWindow Show (Preferences preferences)
{
if (PreferencesWindowBox == null) {
PreferencesWindowBox = new PreferencesWindow ();
}
+ PreferencesWindowBox.preferences = preferences;
+
//PreferencesWindowBox.languageIni = language;
//if(UtilAll.IsWindows())
// PreferencesWindowBox.createComboLanguage(language);
//else
PreferencesWindowBox.hideLanguageStuff();
- PreferencesWindowBox.createComboCamera(videoDevices, videoDeviceNum);
+ PreferencesWindowBox.createComboCamera(UtilVideo.GetVideoDevices(),
preferences.videoDeviceNum);
string [] decs = {"1", "2", "3"};
- PreferencesWindowBox.combo_decimals.Active = UtilGtk.ComboMakeActive(decs,
digitsNumber.ToString());
+ PreferencesWindowBox.combo_decimals.Active = UtilGtk.ComboMakeActive(
+ decs, preferences.digitsNumber.ToString());
- if(showHeight)
+ if(preferences.showHeight)
PreferencesWindowBox.checkbutton_height.Active = true;
else
PreferencesWindowBox.checkbutton_height.Active = false;
- if(showPower) {
+ if(preferences.showPower) {
PreferencesWindowBox.checkbutton_power.Active = true;
PreferencesWindowBox.button_help_power.Sensitive = true;
} else {
@@ -167,20 +164,20 @@ public class PreferencesWindow {
PreferencesWindowBox.button_help_power.Sensitive = false;
}
- if(showInitialSpeed)
+ if(preferences.showInitialSpeed)
PreferencesWindowBox.checkbutton_initial_speed.Active = true;
else
PreferencesWindowBox.checkbutton_initial_speed.Active = false;
- if(showAngle)
+ if(preferences.showAngle)
PreferencesWindowBox.checkbutton_angle.Active = true;
else
PreferencesWindowBox.checkbutton_angle.Active = false;
- if(showQIndex || showDjIndex) {
+ if(preferences.showQIndex || preferences.showDjIndex) {
PreferencesWindowBox.checkbutton_show_tv_tc_index.Active = true;
- if(showQIndex) {
+ if(preferences.showQIndex) {
PreferencesWindowBox.radiobutton_show_q_index.Active = true;
PreferencesWindowBox.radiobutton_show_dj_index.Active = false;
} else {
@@ -193,87 +190,71 @@ public class PreferencesWindow {
PreferencesWindowBox.hbox_indexes.Hide();
}
- if(askDeletion)
+ if(preferences.askDeletion)
PreferencesWindowBox.checkbutton_ask_deletion.Active = true;
else
PreferencesWindowBox.checkbutton_ask_deletion.Active = false;
- if(weightStatsPercent)
+ if(preferences.weightStatsPercent)
PreferencesWindowBox.radio_weight_percent.Active = true;
else
PreferencesWindowBox.radio_weight_kg.Active = true;
- if(heightPreferred)
+ if(preferences.heightPreferred)
PreferencesWindowBox.radio_elevation_height.Active = true;
else
PreferencesWindowBox.radio_elevation_tf.Active = true;
- if(metersSecondsPreferred)
+ if(preferences.metersSecondsPreferred)
PreferencesWindowBox.radio_speed_ms.Active = true;
else
PreferencesWindowBox.radio_speed_km.Active = true;
- if(CSVExportDecimalSeparator == "COMMA")
+ if(preferences.CSVExportDecimalSeparator == "COMMA")
PreferencesWindowBox.radio_export_latin.Active = true;
else
PreferencesWindowBox.radio_export_non_latin.Active = true;
//encoder
- PreferencesWindowBox.checkbutton_encoder_propulsive.Active = encoderPropulsive;
- PreferencesWindowBox.spin_encoder_smooth_con.Value = encoderSmoothCon;
+ PreferencesWindowBox.checkbutton_encoder_propulsive.Active = preferences.encoderPropulsive;
+ PreferencesWindowBox.spin_encoder_smooth_con.Value = preferences.encoderSmoothCon;
- if(encoder1RMMethod == Constants.Encoder1RMMethod.NONWEIGHTED.ToString())
+ if(preferences.encoder1RMMethod == Constants.Encoder1RMMethod.NONWEIGHTED)
PreferencesWindowBox.radio_encoder_1RM_nonweighted.Active = true;
- else if(encoder1RMMethod == Constants.Encoder1RMMethod.WEIGHTED.ToString())
+ else if(preferences.encoder1RMMethod == Constants.Encoder1RMMethod.WEIGHTED)
PreferencesWindowBox.radio_encoder_1RM_weighted.Active = true;
- else if(encoder1RMMethod == Constants.Encoder1RMMethod.WEIGHTED2.ToString())
+ else if(preferences.encoder1RMMethod == Constants.Encoder1RMMethod.WEIGHTED2)
PreferencesWindowBox.radio_encoder_1RM_weighted2.Active = true;
- else //(encoder1RMMethod == Constants.Encoder1RMMethod.WEIGHTED3.ToString())
+ else //(preferences.encoder1RMMethod == Constants.Encoder1RMMethod.WEIGHTED3)
PreferencesWindowBox.radio_encoder_1RM_weighted3.Active = true;
- /*
- switch(encoder1RMMethod) {
- case Constants.Encoder1RMMethod.NONWEIGHTED.ToString():
- PreferencesWindowBox.radio_encoder_1RM_nonweighted.Active = true;
- break;
- case Constants.Encoder1RMMethod.WEIGHTED.ToString():
- PreferencesWindowBox.radio_encoder_1RM_weighted.Active = true;
- break;
- case Constants.Encoder1RMMethod.WEIGHTED2.ToString():
- PreferencesWindowBox.radio_encoder_1RM_weighted2.Active = true;
- break;
- case Constants.Encoder1RMMethod.WEIGHTED3.ToString():
- PreferencesWindowBox.radio_encoder_1RM_weighted3.Active = true;
- break;
- }
- */
//done here and not in glade to be shown with the decimal point of user language
PreferencesWindowBox.label_encoder_con.Text = (0.7).ToString();
- if(RGraphsTranslate)
+ if(preferences.RGraphsTranslate)
PreferencesWindowBox.radio_graphs_translate.Active = true;
else
PreferencesWindowBox.radio_graphs_no_translate.Active = true;
- if(useHeightsOnJumpIndexes)
+ if(preferences.useHeightsOnJumpIndexes)
PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active = true;
else
PreferencesWindowBox.radio_do_not_use_heights_on_jump_indexes.Active = true;
- if(encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.BESTMEANPOWER)
+ if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.BESTMEANPOWER)
PreferencesWindowBox.radio_encoder_auto_save_curve_bestmeanpower.Active = true;
- else if(encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.ALL)
+ else if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.ALL)
PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active = true;
else
PreferencesWindowBox.radio_encoder_auto_save_curve_none.Active = true;
- PreferencesWindowBox.preferences.Show ();
+ PreferencesWindowBox.preferences_win.Show ();
return PreferencesWindowBox;
}
@@ -360,7 +341,7 @@ public class PreferencesWindow {
void on_button_cancel_clicked (object o, EventArgs args)
{
- PreferencesWindowBox.preferences.Hide();
+ PreferencesWindowBox.preferences_win.Hide();
PreferencesWindowBox = null;
}
@@ -370,7 +351,7 @@ public class PreferencesWindow {
if (thread != null && thread.IsAlive)
args.RetVal = true;
else {
- PreferencesWindowBox.preferences.Hide();
+ PreferencesWindowBox.preferences_win.Hide();
PreferencesWindowBox = null;
}
}
@@ -446,7 +427,7 @@ public class PreferencesWindow {
fileDB = label_database_temp.Text;
fc = new Gtk.FileChooserDialog(Catalog.GetString("Copy database to:"),
- preferences,
+ preferences_win,
FileChooserAction.SelectFolder,
Catalog.GetString("Cancel"),ResponseType.Cancel,
Catalog.GetString("Copy"),ResponseType.Accept
@@ -579,86 +560,159 @@ public class PreferencesWindow {
}
+ //change stuff in Sqlite and in preferences object that will be retrieved by GetPreferences
void on_button_accept_clicked (object o, EventArgs args)
{
Sqlite.Open();
- SqlitePreferences.Update("digitsNumber", UtilGtk.ComboGetActive(combo_decimals), true);
- SqlitePreferences.Update("showHeight",
PreferencesWindowBox.checkbutton_height.Active.ToString(), true);
- SqlitePreferences.Update("showPower",
PreferencesWindowBox.checkbutton_power.Active.ToString(), true);
- SqlitePreferences.Update("showInitialSpeed",
PreferencesWindowBox.checkbutton_initial_speed.Active.ToString(), true);
- SqlitePreferences.Update("showAngle",
PreferencesWindowBox.checkbutton_angle.Active.ToString(), true);
+ if( preferences.digitsNumber != Convert.ToInt32(UtilGtk.ComboGetActive(combo_decimals)) ) {
+ SqlitePreferences.Update("digitsNumber", UtilGtk.ComboGetActive(combo_decimals),
true);
+ preferences.digitsNumber = Convert.ToInt32(UtilGtk.ComboGetActive(combo_decimals));
+ }
+
+
+ if( preferences.showHeight != PreferencesWindowBox.checkbutton_height.Active ) {
+ SqlitePreferences.Update("showHeight",
PreferencesWindowBox.checkbutton_height.Active.ToString(), true);
+ preferences.showHeight = PreferencesWindowBox.checkbutton_height.Active;
+ }
+
+ if( preferences.showPower != PreferencesWindowBox.checkbutton_power.Active ) {
+ SqlitePreferences.Update("showPower",
PreferencesWindowBox.checkbutton_power.Active.ToString(), true);
+ preferences.showPower = PreferencesWindowBox.checkbutton_power.Active;
+ }
+
+ if( preferences.showInitialSpeed != PreferencesWindowBox.checkbutton_initial_speed.Active ) {
+ SqlitePreferences.Update("showInitialSpeed",
PreferencesWindowBox.checkbutton_initial_speed.Active.ToString(), true);
+ preferences.showInitialSpeed = PreferencesWindowBox.checkbutton_initial_speed.Active;
+ }
+
+ if( preferences.showAngle != PreferencesWindowBox.checkbutton_angle.Active ) {
+ SqlitePreferences.Update("showAngle",
PreferencesWindowBox.checkbutton_angle.Active.ToString(), true);
+ preferences.showAngle = PreferencesWindowBox.checkbutton_angle.Active;
+ }
if(PreferencesWindowBox.checkbutton_show_tv_tc_index.Active) {
SqlitePreferences.Update("showQIndex",
PreferencesWindowBox.radiobutton_show_q_index.Active.ToString(), true);
SqlitePreferences.Update("showDjIndex",
PreferencesWindowBox.radiobutton_show_dj_index.Active.ToString(), true);
+ preferences.showQIndex = PreferencesWindowBox.radiobutton_show_q_index.Active;
+ preferences.showDjIndex = PreferencesWindowBox.radiobutton_show_dj_index.Active;
} else {
SqlitePreferences.Update("showQIndex", "False", true);
SqlitePreferences.Update("showDjIndex", "False", true);
+ preferences.showQIndex = false;
+ preferences.showDjIndex = false;
}
- SqlitePreferences.Update("askDeletion",
PreferencesWindowBox.checkbutton_ask_deletion.Active.ToString(), true);
- SqlitePreferences.Update("weightStatsPercent",
PreferencesWindowBox.radio_weight_percent.Active.ToString(), true);
- SqlitePreferences.Update("heightPreferred",
PreferencesWindowBox.radio_elevation_height.Active.ToString(), true);
- SqlitePreferences.Update("metersSecondsPreferred",
PreferencesWindowBox.radio_speed_ms.Active.ToString(), true);
-
- SqlitePreferences.Update("encoderPropulsive",
- PreferencesWindowBox.checkbutton_encoder_propulsive.Active.ToString(), true);
- SqlitePreferences.Update("encoderSmoothCon", Util.ConvertToPoint(
- (double) PreferencesWindowBox.spin_encoder_smooth_con.Value), true);
- SqlitePreferences.Update("videoDevice", UtilGtk.ComboGetActivePos(combo_camera).ToString(),
true);
+ if( preferences.askDeletion != PreferencesWindowBox.checkbutton_ask_deletion.Active ) {
+ SqlitePreferences.Update("askDeletion",
PreferencesWindowBox.checkbutton_ask_deletion.Active.ToString(), true);
+ preferences.askDeletion = PreferencesWindowBox.checkbutton_ask_deletion.Active;
+ }
+
+ if( preferences.weightStatsPercent != PreferencesWindowBox.radio_weight_percent.Active ) {
+ SqlitePreferences.Update("weightStatsPercent",
PreferencesWindowBox.radio_weight_percent.Active.ToString(), true);
+ preferences.weightStatsPercent = PreferencesWindowBox.radio_weight_percent.Active;
+ }
+
+ if( preferences.heightPreferred != PreferencesWindowBox.radio_elevation_height.Active ) {
+ SqlitePreferences.Update("heightPreferred",
PreferencesWindowBox.radio_elevation_height.Active.ToString(), true);
+ preferences.heightPreferred = PreferencesWindowBox.radio_elevation_height.Active;
+ }
+
+ if( preferences.metersSecondsPreferred != PreferencesWindowBox.radio_speed_ms.Active ) {
+ SqlitePreferences.Update("metersSecondsPreferred",
PreferencesWindowBox.radio_speed_ms.Active.ToString(), true);
+ preferences.metersSecondsPreferred = PreferencesWindowBox.radio_speed_ms.Active;
+ }
+
- if(PreferencesWindowBox.radio_export_latin.Active)
- SqlitePreferences.Update("CSVExportDecimalSeparator","COMMA", true);
- else
- SqlitePreferences.Update("CSVExportDecimalSeparator","POINT", true);
- SqlitePreferences.Update("RGraphsTranslate",
- PreferencesWindowBox.radio_graphs_translate.Active.ToString(), true);
+ if( preferences.encoderPropulsive !=
PreferencesWindowBox.checkbutton_encoder_propulsive.Active ) {
+ SqlitePreferences.Update("encoderPropulsive",
+
PreferencesWindowBox.checkbutton_encoder_propulsive.Active.ToString(), true);
+ preferences.encoderPropulsive =
PreferencesWindowBox.checkbutton_encoder_propulsive.Active;
+ }
+
+ if( preferences.encoderSmoothCon != (double)
PreferencesWindowBox.spin_encoder_smooth_con.Value ) {
+ SqlitePreferences.Update("encoderSmoothCon", Util.ConvertToPoint(
+ (double) PreferencesWindowBox.spin_encoder_smooth_con.Value),
true);
+ preferences.encoderSmoothCon = (double)
PreferencesWindowBox.spin_encoder_smooth_con.Value;
+ }
- SqlitePreferences.Update("useHeightsOnJumpIndexes",
- PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active.ToString(),
true);
+ if( preferences.videoDeviceNum != UtilGtk.ComboGetActivePos(combo_camera) ) {
+ SqlitePreferences.Update("videoDevice",
UtilGtk.ComboGetActivePos(combo_camera).ToString(), true);
+ preferences.videoDeviceNum = UtilGtk.ComboGetActivePos(combo_camera);
+ }
- if(PreferencesWindowBox.radio_encoder_auto_save_curve_bestmeanpower.Active)
+
+ if(PreferencesWindowBox.radio_export_latin.Active) {
+ SqlitePreferences.Update("CSVExportDecimalSeparator","COMMA", true);
+ preferences.CSVExportDecimalSeparator = "COMMA";
+ }
+ else {
+ SqlitePreferences.Update("CSVExportDecimalSeparator","POINT", true);
+ preferences.CSVExportDecimalSeparator = "POINT";
+ }
+
+
+ if( preferences.RGraphsTranslate != PreferencesWindowBox.radio_graphs_translate.Active ) {
+ SqlitePreferences.Update("RGraphsTranslate",
+ PreferencesWindowBox.radio_graphs_translate.Active.ToString(), true);
+ preferences.RGraphsTranslate = PreferencesWindowBox.radio_graphs_translate.Active;
+ }
+
+ if( preferences.useHeightsOnJumpIndexes !=
PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active ) {
+ SqlitePreferences.Update("useHeightsOnJumpIndexes",
+
PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active.ToString(), true);
+ preferences.useHeightsOnJumpIndexes =
PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active;
+ }
+
+ if(PreferencesWindowBox.radio_encoder_auto_save_curve_bestmeanpower.Active) {
SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.BESTMEANPOWER.ToString(), true);
- else if(PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active)
+ preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.BESTMEANPOWER;
+ }
+ else if(PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active) {
SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.ALL.ToString(), true);
- else
+ preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.ALL;
+ }
+ else {
SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.NONE.ToString(), true);
-
- string encoder1RMMethod = "";
+ preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.NONE;
+ }
+
+ Constants.Encoder1RMMethod encoder1RMMethod;
if(PreferencesWindowBox.radio_encoder_1RM_nonweighted.Active)
- encoder1RMMethod = Constants.Encoder1RMMethod.NONWEIGHTED.ToString();
+ encoder1RMMethod = Constants.Encoder1RMMethod.NONWEIGHTED;
else if(PreferencesWindowBox.radio_encoder_1RM_weighted.Active)
- encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED.ToString();
+ encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED;
else if(PreferencesWindowBox.radio_encoder_1RM_weighted2.Active)
- encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED2.ToString();
+ encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED2;
else // (PreferencesWindowBox.radio_encoder_1RM_weighted3.Active)
- encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED3.ToString();
- SqlitePreferences.Update("encoder1RMMethod", encoder1RMMethod, true);
-
+ encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED3;
+
+ SqlitePreferences.Update("encoder1RMMethod", encoder1RMMethod.ToString(), true);
+ preferences.encoder1RMMethod = encoder1RMMethod;
+
Sqlite.Close();
-
+
/*
- if(UtilAll.IsWindows()) {
- //if language has changed
- if(UtilGtk.ComboGetActive(PreferencesWindowBox.combo_language) != languageIni) {
- string myLanguage = SqlitePreferences.Select("language");
- if ( myLanguage != null && myLanguage != "" && myLanguage != "0") {
- //if language exists in sqlite preferences update it
- SqlitePreferences.Update("language",
Util.GetLanguageCodeFromName(UtilGtk.ComboGetActive(PreferencesWindowBox.combo_language)));
- } else {
- //else: create it
- SqlitePreferences.Insert("language",
Util.GetLanguageCodeFromName(UtilGtk.ComboGetActive(PreferencesWindowBox.combo_language)));
- }
+ if(UtilAll.IsWindows()) {
+ //if language has changed
+ if(UtilGtk.ComboGetActive(PreferencesWindowBox.combo_language) != languageIni) {
+ string myLanguage = SqlitePreferences.Select("language");
+ if ( myLanguage != null && myLanguage != "" && myLanguage != "0") {
+ //if language exists in sqlite preferences update it
+ SqlitePreferences.Update("language",
Util.GetLanguageCodeFromName(UtilGtk.ComboGetActive(PreferencesWindowBox.combo_language)));
+ } else {
+ //else: create it
+ SqlitePreferences.Insert("language",
Util.GetLanguageCodeFromName(UtilGtk.ComboGetActive(PreferencesWindowBox.combo_language)));
+ }
- new DialogMessage(Catalog.GetString("Restart Chronojump to operate completely
on your language."), true);
- }
+ new DialogMessage(Catalog.GetString("Restart Chronojump to operate completely on your
language."), true);
+ }
}
*/
- PreferencesWindowBox.preferences.Hide();
+ PreferencesWindowBox.preferences_win.Hide();
PreferencesWindowBox = null;
}
@@ -668,4 +722,9 @@ public class PreferencesWindow {
get { return button_accept; }
}
+ public Preferences GetPreferences
+ {
+ get { return preferences; }
+ }
+
}
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index d47cc08..1c34c7d 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -859,19 +859,19 @@ public partial class ChronoJumpWindow {
statisticApplyTo,
treeview_stats,
sendSelectedSessions,
- prefsDigitsNumber,
+ preferences.digitsNumber,
checkbutton_stats_sex.Active,
statsJumpsType,
limit,
- heightPreferred,
- weightPercentPreferred,
+ preferences.heightPreferred,
+ preferences.weightStatsPercent,
markedRows,
evolution_mark_consecutives,
graphROptions,
graph,
toReport, //always false in this class
- RGraphsTranslate,
- useHeightsOnJumpIndexes
+ preferences.RGraphsTranslate,
+ preferences.useHeightsOnJumpIndexes
);
//if we just made a graph, store is not made,
diff --git a/src/preferences.cs b/src/preferences.cs
new file mode 100644
index 0000000..d14694d
--- /dev/null
+++ b/src/preferences.cs
@@ -0,0 +1,140 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * ChronoJump is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2004-2014 Xavier de Blas <xaviblas gmail com>
+ */
+
+using System;
+using System.Data;
+
+public class Preferences
+{
+ /*
+ * these are sent to preferences window
+ */
+
+ public int digitsNumber;
+ public bool showHeight;
+ public bool showPower;
+ public bool showInitialSpeed;
+ public bool showAngle;
+ public bool showQIndex;
+ public bool showDjIndex;
+ public bool askDeletion;
+ public bool weightStatsPercent; //AKA weightPercentPreferred
+ public bool heightPreferred;
+ public bool metersSecondsPreferred;
+ public bool encoderPropulsive;
+ public double encoderSmoothCon;
+ public int videoDeviceNum; //AKA videoDevice
+ public Constants.Encoder1RMMethod encoder1RMMethod;
+ public string CSVExportDecimalSeparator;
+ public bool RGraphsTranslate;
+ public bool useHeightsOnJumpIndexes;
+ public Constants.EncoderAutoSaveCurve encoderAutoSaveCurve;
+
+ /*
+ * these are NOT sent to preferences window
+ */
+
+ public bool allowFinishRjAfterTime;
+ public bool volumeOn;
+ public bool videoOn;
+ public int evaluatorServerID;
+ public string versionAvailable;
+ public bool runSpeedStartArrival;
+ public bool runISpeedStartArrival;
+ public string machineID;
+ public Constants.MultimediaStorage multimediaStorage;
+ public string databaseVersion;
+
+ /*
+ * these are unused on SqlitePreferences.SelectAll
+ */
+
+ //public string chronopicPort;
+ //public bool simulated;
+ //public string language;
+ //public double encoderSmoothEccCon; //unused
+ //public double inertialmomentum; //unused
+
+
+
+ public Preferences() {
+ }
+
+ public static Preferences LoadAllFromSqlite() {
+ return SqlitePreferences.SelectAll();
+ }
+
+
+ /*
+ public Preferences(
+ string databaseVersion, string chronopicPort, int digitsNumber,
+ bool showHeight, bool showPower, bool showInitialSpeed, bool showAngle,
+ bool showQIndex, bool showDjIndex,
+ bool simulated bool weightStatsPercent, bool askDeletion,
+ bool heightPreferred, bool metersSecondsPreferred,
+ string language, bool allowFinishRjAfterTime,
+ bool volumeOn, bool videoOn, bool evaluatorServerID,
+ string versionAvailable, bool runSpeedStartArrival, bool runISpeedStartArrival,
+ string machineID, Constants.MultimediaStorage multimediaStorage,
+ bool encoderPropulsive, double encoderSmoothCon,
+ int videoDeviceNum, Constants.Encoder1RMMethod encoder1RMMethod,
+ string CSVExportDecimalSeparator, bool RGraphsTranslate,
+ bool useHeightsOnJumpIndexes, Constants.EncoderAutoSaveCurve encoderAutoSaveCurve
+ )
+ {
+ this.databaseVersion = databaseVersion;
+ this.chronopicPort = chronopicPort;
+ this.digitsNumber = digitsNumber;
+ this.showHeight = showHeight;
+ this.showPower = showPower;
+ this.showInitialSpeed = showInitialSpeed;
+ this.showAngle = showAngle;
+ this.showQIndex = showQIndex;
+ this.showDjIndex = showDjIndex;
+ this.simulated = simulated;
+ this.weightStatsPercent =
+ this.askDeletion = askDeletion;
+ this.heightPreferred = heightPreferred;
+ this.metersSecondsPreferred = metersSeconsPreferred;
+ this.language = language;
+ this.allowFinishRjAfterTime = allowFinishRjAfterTime;
+ this.volumeOn = volumeOn;
+ this.videoOn = videoOn;
+ this.evaluatorServerID = evaluatorServerID;
+ this.versionAvailable = versionAvailable;
+ this.runSpeedStartArrival = runSpeedStartArrival;
+ this.runISpeedStartArrival = runISpeedStartArrival;
+ this.machineID = machineID;
+ this.multimediaStorage = multimediaStorage;
+ this.encoderPropulsive = encoderPropulsive;
+ this.encoderSmoothCon = encoderSmoothCon;
+ this.videoDeviceNum = videoDeviceNum;
+ this.encoder1RMMethod = encoder1RMMethod;
+ this.CSVExportDecimalSeparator = CSVExportDecimalSeparator;
+ this.RGraphsTranslate = RGraphsTranslate;
+ this.useHeightsOnJumpIndexes = useHeightsOnJumpIndexes;
+ this.encoderAutoSaveCurve = encoderAutoSaveCurve;
+ }
+ */
+
+ ~Preferences() {}
+
+}
+
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index d23e0fa..0cced83 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -130,5 +130,90 @@ class SqlitePreferences : Sqlite
return myReturn;
}
+
+ public static Preferences SelectAll ()
+ {
+ dbcon.Open();
+ dbcmd.CommandText = "SELECT * FROM " + Constants.PreferencesTable;
+ Log.WriteLine(dbcmd.CommandText.ToString());
+ dbcmd.ExecuteNonQuery();
+
+ SqliteDataReader reader;
+ reader = dbcmd.ExecuteReader();
+
+ Preferences preferences = new Preferences();
+
+ while(reader.Read()) {
+ //these are sent to preferences window
+ if(reader[0].ToString() == "digitsNumber")
+ preferences.digitsNumber = Convert.ToInt32(reader[1].ToString());
+ else if(reader[0].ToString() == "showHeight")
+ preferences.showHeight = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "showPower")
+ preferences.showPower = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "showInitialSpeed")
+ preferences.showInitialSpeed = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "showAngle")
+ preferences.showAngle = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "showQIndex")
+ preferences.showQIndex = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "showDjIndex")
+ preferences.showDjIndex = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "askDeletion")
+ preferences.askDeletion = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "weightStatsPercent")
+ preferences.weightStatsPercent = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "heightPreferred")
+ preferences.heightPreferred = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "metersSecondsPreferred")
+ preferences.metersSecondsPreferred = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "encoderPropulsive")
+ preferences.encoderPropulsive = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "encoderSmoothCon")
+ preferences.encoderSmoothCon = Convert.ToDouble(
+ Util.ChangeDecimalSeparator(reader[1].ToString()));
+ else if(reader[0].ToString() == "videoDevice")
+ preferences.videoDeviceNum = Convert.ToInt32(reader[1].ToString());
+ else if(reader[0].ToString() == "CSVExportDecimalSeparator")
+ preferences.CSVExportDecimalSeparator = reader[1].ToString();
+ else if(reader[0].ToString() == "RGraphsTranslate")
+ preferences.RGraphsTranslate = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "useHeightsOnJumpIndexes")
+ preferences.useHeightsOnJumpIndexes = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "encoderAutoSaveCurve")
+ preferences.encoderAutoSaveCurve = (Constants.EncoderAutoSaveCurve)
+ Enum.Parse(typeof(Constants.EncoderAutoSaveCurve),
reader[1].ToString());
+ else if(reader[0].ToString() == "encoder1RMMethod")
+ preferences.encoder1RMMethod = (Constants.Encoder1RMMethod)
+ Enum.Parse(typeof(Constants.Encoder1RMMethod), reader[1].ToString());
+ //these are NOT sent to preferences window
+ else if(reader[0].ToString() == "allowFinishRjAfterTime")
+ preferences.allowFinishRjAfterTime = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "volumeOn")
+ preferences.volumeOn = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "videoOn")
+ preferences.videoOn = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "evaluatorServerID")
+ preferences.evaluatorServerID = Convert.ToInt32(reader[1].ToString());
+ else if(reader[0].ToString() == "versionAvailable")
+ preferences.versionAvailable = reader[1].ToString();
+ else if(reader[0].ToString() == "runSpeedStartArrival")
+ preferences.runSpeedStartArrival = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "runISpeedStartArrival")
+ preferences.runISpeedStartArrival = reader[1].ToString() == "True";
+ else if(reader[0].ToString() == "machineID")
+ preferences.machineID = reader[1].ToString();
+ else if(reader[0].ToString() == "multimediaStorage")
+ preferences.multimediaStorage = (Constants.MultimediaStorage)
+ Enum.Parse(typeof(Constants.MultimediaStorage),
reader[1].ToString());
+ else if(reader[0].ToString() == "databaseVersion")
+ preferences.databaseVersion = reader[1].ToString();
+ }
+
+ reader.Close();
+ dbcon.Close();
+
+ return preferences;
+ }
}
diff --git a/src/treeViewEvent.cs b/src/treeViewEvent.cs
index a8975c8..f21c58b 100644
--- a/src/treeViewEvent.cs
+++ b/src/treeViewEvent.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2009 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2014 Xavier de Blas <xaviblas gmail com>
*/
using System;
@@ -29,6 +29,8 @@ public class TreeViewEvent
{
protected TreeStore store;
protected Gtk.TreeView treeview;
+
+ protected Preferences preferences;
protected int pDN; //prefsDigitsNumber;
protected bool treeviewHasTwoLevels;
diff --git a/src/treeViewJump.cs b/src/treeViewJump.cs
index 8f8913b..2fc58a6 100644
--- a/src/treeViewJump.cs
+++ b/src/treeViewJump.cs
@@ -27,13 +27,6 @@ using Mono.Unix;
public class TreeViewJumps : TreeViewEvent
{
- protected bool showHeight;
- protected bool showPower;
- protected bool showInitialSpeed;
- protected bool showAngle;
- protected bool showQIndex;
- protected bool showDjIndex;
-
protected string jumperName = Catalog.GetString("Jumper");
protected string weightName = Catalog.GetString("Extra weight");
protected string fallName = Catalog.GetString("Fall") + "\n(cm)";
@@ -46,8 +39,6 @@ public class TreeViewJumps : TreeViewEvent
protected string qIndexName = "Q Index" + "\n(%)";
protected string djIndexName = "Dj Index" + "\n(%)";
- protected bool metersSecondsPreferred;
-
//to calculate potency
protected double personWeight;
protected double weightInKg;
@@ -56,31 +47,20 @@ public class TreeViewJumps : TreeViewEvent
{
}
- public TreeViewJumps (Gtk.TreeView treeview,
- bool showHeight, bool showPower, bool showInitialSpeed, bool showAngle,
- bool showQIndex, bool showDjIndex, int newPrefsDigitsNumber,
- bool weightPercentPreferred, bool metersSecondsPreferred,
- ExpandStates expandState)
+ public TreeViewJumps (Gtk.TreeView treeview, Preferences preferences, ExpandStates expandState)
{
this.treeview = treeview;
- this.showHeight = showHeight;
- this.showPower = showPower;
- this.showInitialSpeed = showInitialSpeed;
- this.showAngle = showAngle;
- this.showQIndex = showQIndex;
- this.showDjIndex = showDjIndex;
- pDN = newPrefsDigitsNumber;
- this.weightPercentPreferred = weightPercentPreferred;
- this.metersSecondsPreferred = metersSecondsPreferred;
+ this.preferences = preferences;
this.expandState = expandState;
-
-
+
+ this.pDN = preferences.digitsNumber; //pDN short and very used name
+
treeviewHasTwoLevels = false;
dataLineNamePosition = 0; //position of name in the data to be printed
dataLineTypePosition = 4; //position of type in the data to be printed
allEventsName = Constants.AllJumpsName;
- if(weightPercentPreferred)
+ if(preferences.weightStatsPercent)
weightName += "\n(%)";
else
weightName += "\n(Kg)";
@@ -101,15 +81,15 @@ public class TreeViewJumps : TreeViewEvent
protected override int getColsNum() {
int i = columnsString.Length;
- if (showHeight)
+ if (preferences.showHeight)
i ++;
- if (showPower)
+ if (preferences.showPower)
i ++;
- if (showInitialSpeed)
+ if (preferences.showInitialSpeed)
i ++;
- if (showAngle)
+ if (preferences.showAngle)
i ++;
- if (showQIndex || showDjIndex)
+ if (preferences.showQIndex || preferences.showDjIndex)
i ++;
return i +1; //+1 is for the uniqueID hidden col (last)
}
@@ -118,15 +98,15 @@ public class TreeViewJumps : TreeViewEvent
{
//check long of new array
int i = 6; //columnsStringPre + uniqueID (at last)
- if (showHeight)
+ if (preferences.showHeight)
i ++;
- if (showPower)
+ if (preferences.showPower)
i ++;
- if (showInitialSpeed)
+ if (preferences.showInitialSpeed)
i ++;
- if (showAngle)
+ if (preferences.showAngle)
i ++;
- if (showQIndex || showDjIndex)
+ if (preferences.showQIndex || preferences.showDjIndex)
i ++;
//create new array
@@ -134,7 +114,7 @@ public class TreeViewJumps : TreeViewEvent
Array.Copy(columnsStringPre, columnsString, 5); //copy columnsStringPre
- if(metersSecondsPreferred)
+ if(preferences.metersSecondsPreferred)
initialSpeedName += "\n(m/s)";
else
initialSpeedName += "\n(Km/h)";
@@ -142,17 +122,17 @@ public class TreeViewJumps : TreeViewEvent
//fill names
i = 5; //start at pos five end of columnsStringPre
- if (showHeight)
+ if (preferences.showHeight)
columnsString[i++] = heightName;
- if (showPower)
+ if (preferences.showPower)
columnsString[i++] = powerName;
- if (showInitialSpeed)
+ if (preferences.showInitialSpeed)
columnsString[i++] = initialSpeedName;
- if (showAngle)
+ if (preferences.showAngle)
columnsString[i++] = angleName;
- if (showQIndex)
+ if (preferences.showQIndex)
columnsString[i++] = qIndexName;
- if (showDjIndex)
+ if (preferences.showDjIndex)
columnsString[i++] = djIndexName;
columnsString[i++] = descriptionName;
@@ -178,7 +158,7 @@ public class TreeViewJumps : TreeViewEvent
personWeight);
//we create the jump with a weight of percent or kk
- if(weightPercentPreferred)
+ if(preferences.weightStatsPercent)
myJump.Weight = Convert.ToDouble(myStringOfData[8].ToString());
else
myJump.Weight = weightInKg;
@@ -205,12 +185,12 @@ public class TreeViewJumps : TreeViewEvent
myData[count++] = Util.TrimDecimals(newJump.Weight.ToString(), pDN);
myData[count++] = Util.TrimDecimals(newJump.Fall.ToString(), pDN);
- if (showHeight)
+ if (preferences.showHeight)
myData[count++] =
Util.TrimDecimals(Util.GetHeightInCentimeters(newJump.Tv.ToString()), pDN);
- if (showPower) {
+ if (preferences.showPower) {
//takeoff has no tv. power should not be calculated
//calculate jumps with tf
if(newJump.Tv > 0) {
@@ -228,13 +208,13 @@ public class TreeViewJumps : TreeViewEvent
} else
myData[count++] = "0";
}
- if (showInitialSpeed)
- myData[count++] = Util.TrimDecimals(Util.GetInitialSpeed(newJump.Tv.ToString(),
metersSecondsPreferred), pDN);
- if (showAngle)
+ if (preferences.showInitialSpeed)
+ myData[count++] = Util.TrimDecimals(Util.GetInitialSpeed(newJump.Tv.ToString(),
preferences.metersSecondsPreferred), pDN);
+ if (preferences.showAngle)
myData[count++] = Util.TrimDecimals(newJump.Angle.ToString(), pDN);
- if(showQIndex)
+ if (preferences.showQIndex)
myData[count++] = Util.TrimDecimals(Util.GetQIndex(newJump.Tv,
newJump.Tc).ToString(), pDN);
- if(showDjIndex)
+ if (preferences.showDjIndex)
myData[count++] = Util.TrimDecimals(Util.GetDjIndex(newJump.Tv,
newJump.Tc).ToString(), pDN);
myData[count++] = newJump.Description;
@@ -254,24 +234,20 @@ public class TreeViewJumps : TreeViewEvent
public class TreeViewJumpsRj : TreeViewJumps
{
- public TreeViewJumpsRj (Gtk.TreeView treeview, bool showHeight, bool showInitialSpeed, bool
showQIndex, bool showDjIndex, int newPrefsDigitsNumber, bool weightPercentPreferred, bool
metersSecondsPreferred, ExpandStates expandState)
+ public TreeViewJumpsRj (Gtk.TreeView treeview, Preferences preferences, ExpandStates expandState)
{
this.treeview = treeview;
- this.showHeight = showHeight;
- this.showInitialSpeed = showInitialSpeed;
- this.showQIndex = showQIndex;
- this.showDjIndex = showDjIndex;
- pDN = newPrefsDigitsNumber;
- this.weightPercentPreferred = weightPercentPreferred;
- this.metersSecondsPreferred = metersSecondsPreferred;
+ this.preferences = preferences;
this.expandState = expandState;
-
+
+ this.pDN = preferences.digitsNumber; //pDN short and very used name
+
treeviewHasTwoLevels = true;
dataLineNamePosition = 0; //position of name in the data to be printed
dataLineTypePosition = 4; //position of type in the data to be printed
allEventsName = Constants.AllJumpsName;
- if(weightPercentPreferred)
+ if(preferences.weightStatsPercent)
weightName += "\n(%)";
else
weightName += "\n(Kg)";
@@ -297,7 +273,7 @@ public class TreeViewJumpsRj : TreeViewJumps
myJumpRj.Simulated = Convert.ToInt32(myStringOfData[18].ToString());
//we create the jump with a weight of percent or kk
- if(weightPercentPreferred)
+ if(preferences.weightStatsPercent)
myJumpRj.Weight = Convert.ToDouble(myStringOfData[8].ToString());
else
myJumpRj.Weight = Util.WeightFromPercentToKg(Convert.ToDouble(myStringOfData[8]),
Convert.ToDouble(myStringOfData[19]));
@@ -328,13 +304,13 @@ public class TreeViewJumpsRj : TreeViewJumps
myData[count++] = Util.TrimDecimals(newJumpRj.Weight.ToString(), pDN);
myData[count++] = Util.TrimDecimals(newJumpRj.Fall.ToString(), pDN);
- if (showHeight)
+ if (preferences.showHeight)
myData[count++] = "";
- if (showInitialSpeed)
+ if (preferences.showInitialSpeed)
myData[count++] = "";
- if(showQIndex)
+ if (preferences.showQIndex)
myData[count++] = "";
- if(showDjIndex)
+ if (preferences.showDjIndex)
myData[count++] = "";
myData[count++] = newJumpRj.Description;
@@ -368,15 +344,16 @@ public class TreeViewJumpsRj : TreeViewJumps
myData[count++] = Util.TrimDecimals( thisTv, pDN );
myData[count++] = "";
myData[count++] = "";
- if (showHeight)
+ if (preferences.showHeight)
myData[count++] = Util.TrimDecimals(Util.GetHeightInCentimeters(thisTv), pDN);
- if (showInitialSpeed)
- myData[count++] = Util.TrimDecimals(Util.GetInitialSpeed(thisTv,
metersSecondsPreferred), pDN);
- if(showQIndex)
+ if (preferences.showInitialSpeed)
+ myData[count++] = Util.TrimDecimals(Util.GetInitialSpeed(
+ thisTv, preferences.metersSecondsPreferred), pDN);
+ if (preferences.showQIndex)
myData[count++] = Util.TrimDecimals(
Util.GetQIndex(Convert.ToDouble(thisTv),
Convert.ToDouble(thisTc)).ToString(),
pDN);
- if(showDjIndex)
+ if (preferences.showDjIndex)
myData[count++] = Util.TrimDecimals(
Util.GetDjIndex(Convert.ToDouble(thisTv),
Convert.ToDouble(thisTc)).ToString(),
pDN);
@@ -399,11 +376,11 @@ public class TreeViewJumpsRj : TreeViewJumps
myData[count++] = Util.TrimDecimals(Util.GetTotalTime(newJumpRj.TvString).ToString(), pDN);
myData[count++] = ""; //weight
myData[count++] = ""; //fall
- if (showHeight)
+ if (preferences.showHeight)
myData[count++] = "";
- if (showInitialSpeed)
+ if (preferences.showInitialSpeed)
myData[count++] = "";
- if (showQIndex || showDjIndex)
+ if (preferences.showQIndex || preferences.showDjIndex)
myData[count++] = "";
myData[count++] = "";
@@ -441,20 +418,20 @@ public class TreeViewJumpsRj : TreeViewJumps
//this values are calculated using the AVG of the tcs or tvs, not as an avg of individual
values
- if (showHeight)
+ if (preferences.showHeight)
myData[count++] = Util.TrimDecimals(
Util.GetHeightInCentimeters(
tvAVGDouble.ToString())
, pDN);
- if (showInitialSpeed)
+ if (preferences.showInitialSpeed)
myData[count++] = Util.TrimDecimals(
Util.GetInitialSpeed(
- tvAVGDouble.ToString(), metersSecondsPreferred)
+ tvAVGDouble.ToString(), preferences.metersSecondsPreferred)
, pDN);
- if (showQIndex)
+ if (preferences.showQIndex)
myData[count++] = Util.TrimDecimals(
Util.GetQIndex(tvAVGDouble,tcAVGDouble).ToString(), pDN);
- else if (showDjIndex)
+ else if (preferences.showDjIndex)
myData[count++] = Util.TrimDecimals(
Util.GetDjIndex(tvAVGDouble,tcAVGDouble).ToString(), pDN);
@@ -498,11 +475,11 @@ public class TreeViewJumpsRj : TreeViewJumps
myData[count++] = ""; //weight
myData[count++] = ""; //fall
- if (showHeight)
+ if (preferences.showHeight)
myData[count++] = "";
- if (showInitialSpeed)
+ if (preferences.showInitialSpeed)
myData[count++] = "";
- if (showQIndex || showDjIndex)
+ if (preferences.showQIndex || preferences.showDjIndex)
myData[count++] = "";
myData[count++] = "";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]