The following commit has been merged in the master branch:
commit bf74b77edac4a3e346d920a7c7be3518d9128f6c
Author: Andrei Zavada <[email protected]>
Date:   Sun Apr 7 02:46:11 2013 +0300

    probe profile regeneration, make main window busy when it needs to happen

diff --git a/src/expdesign/profile.hh b/src/expdesign/profile.hh
index bb27606..0771e9d 100644
--- a/src/expdesign/profile.hh
+++ b/src/expdesign/profile.hh
@@ -36,6 +36,7 @@ class CProfile
                        create_timeline();
                }
        void create_timeline();
+       bool need_compute( const SProfileParamSet&);
 
        const SProfileParamSet& P() const
                                        { return *this; }
diff --git a/src/expdesign/recording.cc b/src/expdesign/recording.cc
index ea43687..3a17112 100644
--- a/src/expdesign/recording.cc
+++ b/src/expdesign/recording.cc
@@ -238,6 +238,16 @@ CProfile (CProfile&& rv)
 
 
 
+bool
+agh::CProfile::
+need_compute( const SProfileParamSet& P)
+{
+       for ( auto Mi = _mm_list.begin(); Mi != _mm_list.end(); ++Mi )
+               if ( (*Mi)->need_compute( P) )
+                       return true;
+       return false;
+}
+
 
 void
 agh::CProfile::
diff --git a/src/expdesign/recording.hh b/src/expdesign/recording.hh
index e416809..a0997d3 100644
--- a/src/expdesign/recording.hh
+++ b/src/expdesign/recording.hh
@@ -240,6 +240,21 @@ class CRecording {
                        }
                }
 
+       bool
+       need_compute( const SProfileParamSet& P)
+               {
+                       switch ( P.metric ) {
+                       case metrics::TType::psd:
+                               return psd_profile.need_compute();
+                       case metrics::TType::swu:
+                               return swu_profile.need_compute();
+                       case metrics::TType::mc:
+                               return mc_profile.need_compute();
+                       default:
+                               throw runtime_error ("What metric?");
+                       }
+               }
+
        metrics::psd::CProfile psd_profile;
        metrics::swu::CProfile swu_profile;
        metrics::mc::CProfile   mc_profile;
diff --git a/src/metrics/page-metrics-base.cc b/src/metrics/page-metrics-base.cc
index 5c5f165..d7aab1a 100644
--- a/src/metrics/page-metrics-base.cc
+++ b/src/metrics/page-metrics-base.cc
@@ -137,6 +137,26 @@ compute( const SPPack& req_params)
        return retval;
 }
 
+bool
+metrics::CProfile::
+need_compute( const SPPack& req_params)
+{
+       auto req_signature = _using_F().dirty_signature( _using_sig_no);
+       if ( have_data()
+            and req_signature == _signature_when_mirrored
+            and Pp.same_as(req_params) )
+               return false;
+
+       auto old_mirror = mirror_fname();
+       Pp.make_same( req_params);
+       _signature_when_mirrored = req_signature;
+       auto new_mirror = mirror_fname();
+
+       bool got_it = (mirror_back( new_mirror) == 0);
+
+       return not got_it;
+}
+
 
 
 int
diff --git a/src/metrics/page-metrics-base.hh b/src/metrics/page-metrics-base.hh
index 4598e9f..2a315d8 100644
--- a/src/metrics/page-metrics-base.hh
+++ b/src/metrics/page-metrics-base.hh
@@ -155,6 +155,12 @@ class CProfile {
                {
                        return compute( Pp);
                }
+       bool need_compute( const SPPack&);  // not const because it does 
mirror_back
+       bool need_compute()
+               {
+                       return need_compute( Pp);
+               }
+
 
     protected:
        virtual int go_compute() = 0;
diff --git a/src/ui/mw/mw_cb.cc b/src/ui/mw/mw_cb.cc
index 142861e..80c97ca 100644
--- a/src/ui/mw/mw_cb.cc
+++ b/src/ui/mw/mw_cb.cc
@@ -124,12 +124,20 @@ eMsmtProfileType_changed_cb( GtkComboBox* b, gpointer 
userdata)
            break;
        }
 
-//     aghui::SBusyBlock bb (ED.wMainWindow);
        auto params = ED.make_active_profile_paramset();
        // don't let it throw on insufficiently scored recordings
        params.req_percent_scored       = 0.;
        params.swa_laden_pages_before_SWA_0 = 0u;
 
+       aghui::SBusyBlock *bb = nullptr;
+       for ( auto &G : ED.groups )
+               for ( auto &J : G )
+                       if ( J.cprofile and J.cprofile->need_compute( params) ) 
{
+                               bb = new aghui::SBusyBlock (ED.wMainWindow);
+                               goto proceed;
+                       }
+proceed:
+
        for ( auto &G : ED.groups )
                for ( auto &J : G )
                        if ( J.cprofile )
@@ -142,6 +150,9 @@ eMsmtProfileType_changed_cb( GtkComboBox* b, gpointer 
userdata)
        ED.adjust_op_freq_spinbuttons();
 
        gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
+
+       if ( bb )
+               delete bb;
 }
 
 

-- 
Sleep experiment manager

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to