Commit 88e79e7f authored by Xavier de Blas's avatar Xavier de Blas

Encoder capture end at n inactivity seconds can be false

parent b6a36e8c
......@@ -1627,20 +1627,7 @@ It starts before and arrives there with some speed.</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label62">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">End at n inactivity seconds</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox21">
<widget class="GtkHBox" id="hbox_encoder_capture_inactivity_time">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
......@@ -1713,6 +1700,21 @@ It starts before and arrives there with some speed.</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_encoder_capture_inactivity_end_time">
<property name="label" translatable="yes">End at n inactivity seconds</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="clicked" handler="on_check_encoder_capture_inactivity_end_time_clicked" swapped="no"/>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"/>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
......
......@@ -85,7 +85,7 @@ public abstract class EncoderCapture
//this will be used to stop encoder automatically
protected int consecutiveZeros;
protected int consecutiveZerosMax;
protected bool automaticallyEndByTime;
//specific of some subclasses
protected bool lastDirectionStoredIsUp;
protected bool capturingFirstPhase;
......@@ -204,6 +204,7 @@ public abstract class EncoderCapture
//or to save this set and wait for the next on cont mode
consecutiveZeros = -1;
consecutiveZerosMax = timeEnd * 1000;
automaticallyEndByTime = (timeEnd >= 0);
initSpecific();
......@@ -389,6 +390,7 @@ public abstract class EncoderCapture
* 1500 is conversion to milliseconds and * 1.5 to have enough time to move after clusters res
*/
if(
automaticallyEndByTime &&
(
(Ecca.curvesAccepted > 0 && consecutiveZeros >= consecutiveZerosMax) ||
(! cont && Ecca.curvesAccepted == 0 && consecutiveZeros >= (2* consecutiveZerosMax))
......
......@@ -97,6 +97,8 @@ public class PreferencesWindow
//encoder capture tab
[Widget] Gtk.SpinButton spin_encoder_capture_time;
[Widget] Gtk.CheckButton check_encoder_capture_inactivity_end_time;
[Widget] Gtk.HBox hbox_encoder_capture_inactivity_time;
[Widget] Gtk.SpinButton spin_encoder_capture_inactivity_end_time;
[Widget] Gtk.Image image_encoder_gravitatory;
[Widget] Gtk.Image image_encoder_inertial;
......@@ -403,8 +405,19 @@ public class PreferencesWindow
//encoder capture -->
PreferencesWindowBox.spin_encoder_capture_time.Value = preferences.encoderCaptureTime;
PreferencesWindowBox.spin_encoder_capture_inactivity_end_time.Value = preferences.encoderCaptureInactivityEndTime;
if(preferences.encoderCaptureInactivityEndTime < 0) {
PreferencesWindowBox.check_encoder_capture_inactivity_end_time.Active = false;
PreferencesWindowBox.hbox_encoder_capture_inactivity_time.Sensitive = false;
PreferencesWindowBox.spin_encoder_capture_inactivity_end_time.Value = 3;
} else {
PreferencesWindowBox.check_encoder_capture_inactivity_end_time.Active = true;
PreferencesWindowBox.hbox_encoder_capture_inactivity_time.Sensitive = true;
PreferencesWindowBox.spin_encoder_capture_inactivity_end_time.Value = preferences.encoderCaptureInactivityEndTime;
}
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_gravity.png");
PreferencesWindowBox.image_encoder_gravitatory.Pixbuf = pixbuf;
......@@ -514,6 +527,11 @@ public class PreferencesWindow
spin_encoder_capture_show_only_some_bars.Sensitive = true;
}
private void on_check_encoder_capture_inactivity_end_time_clicked (object o, EventArgs args)
{
hbox_encoder_capture_inactivity_time.Sensitive = check_encoder_capture_inactivity_end_time.Active;
}
//private void on_notebook_encoder_capture_gi_change_current_page (object o, Gtk.ChangeCurrentPageArgs args)
private void on_notebook_encoder_capture_gi_switch_page (object o, Gtk.SwitchPageArgs args)
{
......@@ -1300,11 +1318,16 @@ public class PreferencesWindow
preferences.encoderCaptureTime,
(int) PreferencesWindowBox.spin_encoder_capture_time.Value);
preferences.encoderCaptureInactivityEndTime = preferencesChange(
"encoderCaptureInactivityEndTime",
preferences.encoderCaptureInactivityEndTime,
(int) PreferencesWindowBox.spin_encoder_capture_inactivity_end_time.Value);
if(! PreferencesWindowBox.check_encoder_capture_inactivity_end_time.Active)
{
SqlitePreferences.Update("encoderCaptureInactivityEndTime", "-1", true);
preferences.encoderCaptureInactivityEndTime = -1;
} else {
preferences.encoderCaptureInactivityEndTime = preferencesChange(
"encoderCaptureInactivityEndTime",
preferences.encoderCaptureInactivityEndTime,
(int) PreferencesWindowBox.spin_encoder_capture_inactivity_end_time.Value);
}
preferences.encoderCaptureMinHeightGravitatory = preferencesChange(
"encoderCaptureMinHeightGravitatory",
......
......@@ -57,7 +57,7 @@ public class Preferences
//encoder capture
public int encoderCaptureTime;
public int encoderCaptureInactivityEndTime;
public int encoderCaptureInactivityEndTime; // -1 if not automatically end
public Constants.EncoderVariablesCapture encoderCaptureMainVariable;
public int encoderCaptureMinHeightGravitatory;
public int encoderCaptureMinHeightInertial;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment