@@ -177,6 +177,11 @@ class SessionSettings {
177177 private int loadMarkerWindow;
178178 private int loadMarkerVertScale;
179179
180+ // Focus Widget
181+ private int loadFocusMetric;
182+ private int loadFocusThreshold;
183+ private int loadFocusWindow;
184+
180185 // Primary JSON objects for saving and loading data
181186 private JSONObject saveSettingsJSONData;
182187 private JSONObject loadSettingsJSONData;
@@ -195,6 +200,7 @@ class SessionSettings {
195200 private final String kJSONKeyEmg = " emg" ;
196201 private final String kJSONKeyEmgJoystick = " emgJoystick" ;
197202 private final String kJSONKeyMarker = " marker" ;
203+ private final String kJSONKeyFocus = " focus" ;
198204
199205 // used only in this class to count the number of channels being used while saving/loading, this gets updated in updateGlobalChannelCount whenever the number of channels being used changes
200206 int sessionSettingsChannelCount;
@@ -451,6 +457,13 @@ class SessionSettings {
451457 saveMarkerSettings. setInt(" markerVertScale" , w_marker. getMarkerVertScale(). getIndex());
452458 saveSettingsJSONData. setJSONObject(kJSONKeyMarker, saveMarkerSettings);
453459
460+ // /////////////////////////////////////////////Setup new JSON object to save Marker Widget Settings
461+ JSONObject saveFocusSettings = new JSONObject ();
462+ saveFocusSettings. setInt(" focusMetric" , w_focus. getFocusMetric(). getIndex());
463+ saveFocusSettings. setInt(" focusThreshold" , w_focus. getFocusThreshold(). getIndex());
464+ saveFocusSettings. setInt(" focusWindow" , w_focus. getFocusWindow(). getIndex());
465+ saveSettingsJSONData. setJSONObject(kJSONKeyFocus, saveFocusSettings);
466+
454467 // /////////////////////////////////////////////Setup new JSON object to save Widgets Active in respective Containers
455468 JSONObject saveWidgetSettings = new JSONObject ();
456469
@@ -608,6 +621,12 @@ class SessionSettings {
608621 loadMarkerWindow = loadMarkerSettings. getInt(" markerWindow" );
609622 loadMarkerVertScale = loadMarkerSettings. getInt(" markerVertScale" );
610623
624+ // Get Focus widget settings
625+ JSONObject loadFocusSettings = loadSettingsJSONData. getJSONObject(kJSONKeyFocus);
626+ loadFocusMetric = loadFocusSettings. getInt(" focusMetric" );
627+ loadFocusThreshold = loadFocusSettings. getInt(" focusThreshold" );
628+ loadFocusWindow = loadFocusSettings. getInt(" focusWindow" );
629+
611630 // get the Widget/Container settings
612631 JSONObject loadWidgetSettings = loadSettingsJSONData. getJSONObject(kJSONKeyWidget);
613632 // Apply Layout directly before loading and applying widgets to containers
@@ -814,6 +833,14 @@ class SessionSettings {
814833 w_marker. setMarkerVertScale(loadMarkerVertScale);
815834 w_marker. cp5_widget. getController(" markerVertScaleDropdown" ). getCaptionLabel(). setText(w_marker. getMarkerVertScale(). getString());
816835
836+ // //////////////////////////Apply Focus Widget settings
837+ w_focus. setMetric(loadFocusMetric);
838+ w_focus. cp5_widget. getController(" focusMetricDropdown" ). getCaptionLabel(). setText(w_focus. getFocusMetric(). getString());
839+ w_focus. setThreshold(loadFocusThreshold);
840+ w_focus. cp5_widget. getController(" focusThresholdDropdown" ). getCaptionLabel(). setText(w_focus. getFocusThreshold(). getString());
841+ w_focus. setFocusHorizScale(loadFocusWindow);
842+ w_focus. cp5_widget. getController(" focusWindowDropdown" ). getCaptionLabel(). setText(w_focus. getFocusWindow(). getString());
843+
817844 // //////////////////////////////////////////////////////////
818845 // Apply more loaded widget settings above this line //
819846
0 commit comments