Load saved muway and set to muways soft threshold.
[mussa.git] / qui / MussaWindow.cpp
index 242781606d1daf5ca55884b81ee0e9f2f51ac223..80d855d438089c4ead1c6ccf595190c9e801c79f 100644 (file)
@@ -115,7 +115,18 @@ void MussaWindow::setAnalysis(MussaRef new_analysis)
   if (new_analysis != 0) {
     // only switch mussas if we loaded without error
     clear();
+    //std::cout << "analysis soft: " << analysis->get_soft_threshold()
+    //          << " new analysis soft: " << new_analysis->get_soft_threshold()
+    //          << "\n";
     analysis.swap(new_analysis);
+    //std::cout << "after swap soft thres: " << analysis->get_soft_threshold()
+    //          << "\n";
+    threshold->disconnect(this);
+    threshold->reset(analysis->get_threshold(),
+                     analysis->get_window(),
+                     analysis->get_soft_threshold());
+    connect(threshold, SIGNAL(thresholdChanged(int)),
+          this, SLOT(setSoftThreshold(int)));
     updateTitle();
     updateAnalysis();
   }
@@ -631,14 +642,21 @@ void MussaWindow::newMussaWindow()
 
 void MussaWindow::setSoftThreshold(int value)
 {
+  //std::cout << "Soft: " << analysis->get_soft_threshold()
+  //          << " Value: " << value << "\n";
   if (analysis->get_soft_threshold() != value) {
     threshold->setEnabled( false );
+    //std::cout << "Updating!!!!\n";
     analysis->set_soft_threshold(value);
     analysis->nway();
     updateLinks();
     update();
     threshold->setEnabled( true );
   }
+  //else
+  //{
+  //  std::cout << "NOT Updating!!!!\n";
+  //}
 }
 
 void MussaWindow::showMussaToolbar()
@@ -733,6 +751,7 @@ void MussaWindow::updateAnalysis()
   // but it's possible for us to not have had a chance to set out sequences
   // yet.
   threshold->setRange(analysis->get_threshold(),analysis->get_window());
+  threshold->setBasepairThreshold(analysis->get_soft_threshold());
   updateLinks();
   browser->zoomOut();
   zoom->setValue(browser->zoom());