Load saved muway and set to muways soft threshold.
[mussa.git] / qui / ThresholdWidget.cpp
index 5c856968139fca01ded6f1d6dbf2985c3bc03c1e..20fdbebaac9bf02bfc9fced140b1b87002b852d7 100644 (file)
@@ -10,6 +10,7 @@
 ThresholdWidget::ThresholdWidget(QWidget *parent, int min, int max) 
   : QWidget(parent),
     layout(0),
+    cur_bp_threshold(0),
     basepair_spinner(0),
     window_size_label(0),
     percent_label(0)
@@ -43,8 +44,11 @@ void ThresholdWidget::setupWidgets()
 void ThresholdWidget::setRange(int min, int max)
 {
   basepair_spinner->setRange(min, max);
-  cur_bp_threshold = min;
-  basepair_spinner->setValue(min);
+  if (cur_bp_threshold < min || cur_bp_threshold > max)
+  {
+    cur_bp_threshold = min;
+    basepair_spinner->setValue(min);
+  }
 
   QString num;
   num.setNum(max);
@@ -100,3 +104,14 @@ int ThresholdWidget::threshold() const
 {
   return cur_bp_threshold;
 }
+
+void ThresholdWidget::reset(int min, int max, int threshold)
+{
+  
+  cur_bp_threshold = threshold;
+  cur_percent_threshold = (int)(roundl(ratio() * 100));
+  setRange(min, max);
+  basepair_spinner->setValue(threshold);
+  updatePercentThreshold();
+  
+}