[med-svn] [aghermann] 40/85: fix remaining regressions in patterns

andrei zavada hmmr-guest at alioth.debian.org
Thu Sep 26 23:46:28 UTC 2013


This is an automated email from the git hooks/post-receive script.

hmmr-guest pushed a commit to branch master
in repository aghermann.

commit 1b16bc850bfa2d714504bc62d32e93c471d6ca1b
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Sun Sep 15 02:35:04 2013 +0300

    fix remaining regressions in patterns
---
 upstream/src/aghermann/patterns/patterns.cc        |   62 +++++--
 upstream/src/aghermann/patterns/patterns.hh        |  194 ++++++++++----------
 .../src/aghermann/ui/sf/d/patterns-profiles.cc     |   55 +++---
 .../src/aghermann/ui/sf/d/patterns-profiles_cb.cc  |   36 ++--
 upstream/src/aghermann/ui/sf/d/patterns.cc         |   22 ++-
 upstream/src/aghermann/ui/sf/d/patterns.hh         |    4 +-
 6 files changed, 209 insertions(+), 164 deletions(-)

diff --git a/upstream/src/aghermann/patterns/patterns.cc b/upstream/src/aghermann/patterns/patterns.cc
index 2943cef..8bb6434 100644
--- a/upstream/src/aghermann/patterns/patterns.cc
+++ b/upstream/src/aghermann/patterns/patterns.cc
@@ -22,6 +22,9 @@ using namespace std;
 using namespace agh::pattern;
 
 
+namespace agh {
+namespace pattern {
+
 template CPatternTool<TFloat>::CPatternTool( const sigproc::SSignalRef<TFloat>&, const TContext&, const SPatternPPack<TFloat>&);
 template int CPatternTool<TFloat>::do_search( const valarray<TFloat>&, const valarray<TFloat>&, const valarray<TFloat>&, const valarray<TFloat>&, size_t);
 template int CPatternTool<TFloat>::do_search( const sigproc::SSignalRef<TFloat>&, size_t);
@@ -29,29 +32,29 @@ template int CPatternTool<TFloat>::do_search( const valarray<TFloat>&, size_t);
 
 
 
-
-
-namespace agh {
-namespace pattern {
+using confval::SValidator;
 
 
 template <>
 int
-agh::pattern::SPattern<TFloat>::
+SPattern<TFloat>::
 save()
 {
-        if ( saved || origin == agh::TExpDirLevel::transient || origin == agh::TExpDirLevel::system )
+        if ( saved || level == agh::TExpDirLevel::transient || level == agh::TExpDirLevel::system )
                 return 0;
 
         if ( thing.size() == 0 ) {
                 fprintf( stderr, "save_pattern(\"%s\"): thing is empty\n", path().c_str());
-        if ( agh::fs::mkdir_with_parents( agh::fs::dirname(path)) ) {
-                fprintf( stderr, "save_pattern(\"%s\"): mkdir failed\n", path.c_str());
                 return -1;
         }
-        printf( "saving pattern in %s\n", path.c_str());
 
-        FILE *fd = fopen( path.c_str(), "w");
+        if ( agh::fs::mkdir_with_parents( agh::fs::dirname(path())) ) {
+                fprintf( stderr, "save_pattern(\"%s\"): mkdir failed\n", path().c_str());
+                return -1;
+        }
+
+        string fname {path()};
+        FILE *fd = fopen( fname.c_str(), "w");
         try {
                 if ( !fd )
                         throw -2;
@@ -66,13 +69,13 @@ save()
                               get<0>(criteria), get<1>(criteria), get<2>(criteria), get<3>(criteria),
                               samplerate, context.first, context.second,
                               thing.size()) < 1 ) {
-                        fprintf( stderr, "save_pattern(\"%s\"): write failed\n", path.c_str());
+                        fprintf( stderr, "save_pattern(\"%s\"): write failed\n", fname.c_str());
                         throw -3;
                 }
 
                 for ( size_t i = 0; i < thing.size(); ++i )
                         if ( fprintf( fd, "%a\n", (double)thing[i]) < 1 ) {
-                                fprintf( stderr, "save_pattern(\"%s\"): write failed\n", path.c_str());
+                                fprintf( stderr, "save_pattern(\"%s\"): write failed\n", fname.c_str());
                                 throw -3;
                         }
                 fclose( fd);
@@ -93,7 +96,7 @@ save()
 template <>
 int
 agh::pattern::SPattern<TFloat>::
-load( const string& fname_)
+load()
 {
         string msg;
         using agh::str::sasprintf;
@@ -129,7 +132,7 @@ load( const string& fname_)
                         throw invalid_argument ("Bogus data in header");
                 }
 
-                criteria = CMatch<float>(t1, t2, t3, t4);
+                criteria = CMatch(t1, t2, t3, t4);
 
                 if ( samplerate == 0 || samplerate > 4096 ||
                      full_sample == 0 || full_sample > samplerate * 10 ||
@@ -151,7 +154,6 @@ load( const string& fname_)
                 printf( "loaded pattern in %s\n", fname);
                 saved = true;
                 name = agh::str::tokens( fname, "/").back();
-                path = fname;
 
                 return 0;
 
@@ -172,11 +174,39 @@ load( const string& fname_)
 
 
 template <>
+SPattern<TFloat>::
+SPattern (const string& name_, TExpDirLevel level_, CExpDesign& ED_, const SExpDirLevelId& level_id_)
+      : CStorablePPack (".patterns", name_, level_, ED_, level_id_),
+        samplerate (0),
+        context ({0, 0})
+{
+        config_keys_g.assign({
+                SValidator<double>("env_scope",    &Pp.env_scope),
+                SValidator<double>("bwf_ffrom",    &Pp.bwf_ffrom),
+                SValidator<double>("bwf_fupto",    &Pp.bwf_fupto),
+                SValidator<double>("dzcdf_step",   &Pp.dzcdf_step),
+                SValidator<double>("dzcdf_sigma",  &Pp.dzcdf_sigma),
+                SValidator<double>("criteria.c0",  &get<0>(criteria)),
+                SValidator<double>("criteria.c1",  &get<1>(criteria)),
+                SValidator<double>("criteria.c2",  &get<2>(criteria)),
+                SValidator<double>("criteria.c3",  &get<3>(criteria)),
+        });
+        config_keys_d.assign({
+                SValidator<int>("bwf_order",    &Pp.bwf_order),
+                SValidator<int>("dzcdf_smooth", &Pp.dzcdf_smooth),
+        });
+
+        load();
+}
+
+
+template <>
 int
 SPattern<TFloat>::
 delete_file()
 {
-        return unlink( path.c_str());
+        printf( "deleting %s\n", path().c_str());
+        return unlink( path().c_str());
 }
 
 
diff --git a/upstream/src/aghermann/patterns/patterns.hh b/upstream/src/aghermann/patterns/patterns.hh
index ae9c9c1..793ee80 100644
--- a/upstream/src/aghermann/patterns/patterns.hh
+++ b/upstream/src/aghermann/patterns/patterns.hh
@@ -30,18 +30,17 @@ using namespace std;
 namespace agh {
 namespace pattern {
 
-template <typename T>
 class CMatch
-  : public tuple<T, T, T, T> {
+  : public tuple<double, double, double, double> {
     public:
         CMatch ()
-              : tuple<T, T, T, T> (.1, .1, .1, .1) // empirically ok default
+              : tuple<double, double, double, double> (.1, .1, .1, .1) // empirically ok default
                 {}
-        CMatch (T t1, T t2, T t3, T t4)
-              : tuple<T, T, T, T> (t1, t2, t3, t4)
+        CMatch (double t1, double t2, double t3, double t4)
+              : tuple<double, double, double, double> (t1, t2, t3, t4)
                 {}
 
-        bool good_enough( const CMatch<T>& rv) const
+        bool good_enough( const CMatch& rv) const
                 {
                         return get<0>(*this) < get<0>(rv) &&
                                get<1>(*this) < get<1>(rv) &&
@@ -104,105 +103,46 @@ struct SPatternPPack {
 
 
 
-using TContext = pair<size_t, size_t>;
-
 template <typename T>
-class CPatternTool
-  : public SPatternPPack<T> {
-        DELETE_DEFAULT_METHODS (CPatternTool);
+struct SPattern
+  : public CStorablePPack {
 
-    public:
-      // the complete pattern signature is made of:
-      // (a) signal breadth at given tightness;
-      // (b) its course;
-      // (c) target frequency (band-passed);
-      // (d) instantaneous frequency at fine intervals;
+        static constexpr const char* common_subdir = ".patterns/";
 
-        CPatternTool (const sigproc::SSignalRef<T>& thing,
-                      const TContext& context_,
-                      const SPatternPPack<T>& Pp_)
-              : SPatternPPack<T> (Pp_),
-                penv             (thing),
-                ptarget_freq     (thing),
-                pdzcdf           (thing),
-                samplerate       (thing.samplerate),
-                context          (context_)
+        SPattern<T> (const string& name_, TExpDirLevel level_, CExpDesign& ED_, const SExpDirLevelId& level_id_)
+              : CStorablePPack (common_subdir, name_, level_, ED_, level_id_),
+                samplerate (0),
+                context ({0, 0})
                 {
-                        if ( context.first + context.second >= thing.signal.size() )
-                                throw invalid_argument ("pattern size too small");
+                        load();
                 }
-
-        int
-        do_search( const sigproc::SSignalRef<T>& field,
-                   size_t inc);
-        int
-        do_search( const valarray<T>& field,
-                   size_t inc);
-        int
-        do_search( const valarray<T>& env_u,  // field broken down
-                   const valarray<T>& env_l,
-                   const valarray<T>& target_freq,
-                   const valarray<T>& dzcdf,
-                   size_t inc);
-
-        size_t
-        size_with_context() const
-                { return ptarget_freq.signal.size(); }
-        size_t
-        size_essential() const
-                { return size_with_context() - context.first - context.second; }
-
-        vector<CMatch<T>>
-                diff;
-
-    private:
-        sigproc::SCachedEnvelope<T>
-                penv;
-        sigproc::SCachedBandPassCourse<T>
-                ptarget_freq;
-        sigproc::SCachedDzcdf<T>
-                pdzcdf;
-
-        size_t  samplerate;
-        TContext
-                context;
-
-        T       crit_linear_unity;
-        double  crit_dzcdf_unity;
-};
-
-
-
-
-template <typename T>
-struct SPattern : public CStorablePPack {
-
-        SPattern<T> ()
-              : name   ("(unnamed)"),
-                origin (agh::TExpDirLevel::transient),
-                saved  (false),
+        SPattern<T> (CExpDesign& ED_, const SExpDirLevelId& level_id_)
+              : CStorablePPack (common_subdir, "(unnamed)", TExpDirLevel::transient, ED_, level_id_),
                 samplerate (0),
                 context ({0, 0})
                 {}
 
         explicit SPattern<T> (const SPattern<T>& rv)
-              : thing      (rv.thing),
+              : CStorablePPack (common_subdir, rv.name + " (dup)", TExpDirLevel::transient, rv.ED, rv.level_id),
+                thing      (rv.thing),
                 samplerate (rv.samplerate),
                 context    (rv.context),
                 Pp         (rv.Pp),
                 criteria   (rv.criteria)
-                {}
+                {
+                        // assign_keys();
+                }
         explicit SPattern<T> (SPattern<T>&& rv)
-              : thing      (move(rv.thing)),
+              : CStorablePPack (common_subdir, move(rv.name), rv.level_, rv.ED, move(rv.level_id)),
+                thing      (move(rv.thing)),
                 samplerate (rv.samplerate),
                 context    (rv.context),
                 Pp         (move(rv.Pp)),
                 criteria   (move(rv.criteria))
-                {}
-
-        SPattern<T> (const string& name_, TExpDirLevel level_, CExpDesign& ED_, const SExpDirLevelId& level_id_)
-              : CStorablePPack (".patterns", name_, level_, ED_, level_id_)
-                {}
+                {
+                        rv.level = TExpDirLevel::transient;  // we do the saving, prevent rv from doing so
+                        // assign_keys();
+                }
 
        ~SPattern<T> ()
                 {
@@ -212,21 +152,20 @@ struct SPattern : public CStorablePPack {
         SPattern&
         operator=( SPattern<T>&& rv)
                 {
-                        swap       (name, rv.name);
-                        swap       (path, rv.path);
-                        origin      = rv.origin;
-                        saved       = rv.saved;
                         swap       (thing, rv.thing);
                         samplerate  = rv.samplerate;
                         context     = rv.context;
                         swap       (Pp, rv.Pp);
                         swap       (criteria, rv.criteria);
+
+                        // assign_keys(); // have specialized save/load
+
                         return *this;
                 }
 
         bool
         operator==( const SPattern<T>& rv) const
-                { return origin == rv.origin && name == rv.name; }
+                { return level == rv.level && name == rv.name; }
 
         size_t
         pattern_size_essential() const
@@ -257,11 +196,80 @@ struct SPattern : public CStorablePPack {
 
         SPatternPPack<TFloat>
                 Pp;
-        CMatch<T>
-                criteria;
+        CMatch  criteria;
 };
 
 
+
+using TContext = pair<size_t, size_t>;
+
+template <typename T>
+class CPatternTool
+  : public SPatternPPack<T> {
+        DELETE_DEFAULT_METHODS (CPatternTool);
+
+    public:
+      // the complete pattern signature is made of:
+      // (a) signal breadth at given tightness;
+      // (b) its course;
+      // (c) target frequency (band-passed);
+      // (d) instantaneous frequency at fine intervals;
+
+        CPatternTool (const sigproc::SSignalRef<T>& thing,
+                      const TContext& context_,
+                      const SPatternPPack<T>& Pp_)
+              : SPatternPPack<T> (Pp_),
+                penv             (thing),
+                ptarget_freq     (thing),
+                pdzcdf           (thing),
+                samplerate       (thing.samplerate),
+                context          (context_)
+                {
+                        if ( context.first + context.second >= thing.signal.size() )
+                                throw invalid_argument ("pattern size too small");
+                }
+
+        int
+        do_search( const sigproc::SSignalRef<T>& field,
+                   size_t inc);
+        int
+        do_search( const valarray<T>& field,
+                   size_t inc);
+        int
+        do_search( const valarray<T>& env_u,  // field broken down
+                   const valarray<T>& env_l,
+                   const valarray<T>& target_freq,
+                   const valarray<T>& dzcdf,
+                   size_t inc);
+
+        size_t
+        size_with_context() const
+                { return ptarget_freq.signal.size(); }
+        size_t
+        size_essential() const
+                { return size_with_context() - context.first - context.second; }
+
+        vector<CMatch>
+                diff;
+
+    private:
+        sigproc::SCachedEnvelope<T>
+                penv;
+        sigproc::SCachedBandPassCourse<T>
+                ptarget_freq;
+        sigproc::SCachedDzcdf<T>
+                pdzcdf;
+
+        size_t  samplerate;
+        TContext
+                context;
+
+        T       crit_linear_unity;
+        double  crit_dzcdf_unity;
+};
+
+
+
 #include "patterns.ii"
 
 }
diff --git a/upstream/src/aghermann/ui/sf/d/patterns-profiles.cc b/upstream/src/aghermann/ui/sf/d/patterns-profiles.cc
index 97a1762..18fb7b9 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns-profiles.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns-profiles.cc
@@ -70,27 +70,31 @@ import_from_selection( SScoringFacility::SChannel& field)
                 full_sample = run + context_before + context_after;
 
         // transient is always the last
-        if ( patterns.empty() || patterns.back().origin != TExpDirLevel::transient )
-                patterns.emplace_back();
-        patterns.back() = pattern::SPattern<TFloat> (
-                {{field.signal_filtered[ slice (field.selection_start - context_before, full_sample, 1) ]},
-                field.samplerate(),
-                {context_before, context_after},
-                Pp2, criteria});
+        if ( patterns.empty() || patterns.back().level != TExpDirLevel::transient )
+                patterns.emplace_back(
+                        *_p._p.ED,
+                        agh::SExpDirLevelId {_p._p.ED->group_of(_p.csubject()), _p.csubject().id, _p.session()});
+        {
+                auto& P = patterns.back();
+                P.thing.resize( full_sample);
+                P.thing = field.signal_filtered[ slice (field.selection_start - context_before, full_sample, 1) ];
+                P.samplerate = field.samplerate();
+                P.context = {context_before, context_after};
+                P.Pp = Pp2;
+                P.criteria = criteria;
+        }
 
         current_pattern = prev(patterns.end());
-
         populate_combo();
 
         field_channel_saved = field_channel = &field;
 
         thing_display_scale = field.signal_display_scale;
-
         set_thing_da_width( full_sample / field.spp());
 
         preselect_channel( _p.channel_idx( &field));
-
         setup_controls_for_find();
+        set_profile_manage_buttons_visibility();
 
         gtk_widget_queue_draw( (GtkWidget*)daSFFDThing);
 
@@ -107,26 +111,15 @@ load_patterns()
         patterns.clear();
 
         using namespace agh;
-        patterns.splice(
-                patterns.end(),
-                load_profiles_from_location<SPattern<TFloat>>(
-                        TExpDirLevel::system, *_p.ED, SExpDirLevelId(),
-                        ));
-        patterns.splice(
-                patterns.end(),
-                load_patterns_from_location<TFloat>(
-                        pattern::make_user_location(),
-                        TExpDirLevel::user));
-        patterns.splice(
-                patterns.end(),
-                load_patterns_from_location<TFloat>(
-                        pattern::make_experiment_location( *_p._p.ED),
-                        TExpDirLevel::experiment));
-        patterns.splice(
-                patterns.end(),
-                load_patterns_from_location<TFloat>(
-                        pattern::make_subject_location( *_p._p.ED, _p.csubject()),
-                        TExpDirLevel::subject));
+        for ( auto A : {TExpDirLevel::system, TExpDirLevel::user, TExpDirLevel::experiment, TExpDirLevel::subject} )
+                patterns.splice(
+                        patterns.end(),
+                        load_profiles_from_location<pattern::SPattern<TFloat>>(
+                                pattern::SPattern<TFloat>::common_subdir,
+                                A,
+                                *_p._p.ED,
+                                {_p._p.ED->group_of(_p.csubject()), _p.csubject().id, _p.session()}
+                                ));
 
         current_pattern = patterns.end();
 }
@@ -157,7 +150,7 @@ populate_combo()
                                 &iter);
                         gtk_list_store_set(
                                 mSFFDPatterns, &iter,
-                                0, snprintf_buf( "%s %s", agh::exp_dir_level_s(I->origin), I->name.c_str()),
+                                0, snprintf_buf( "%s %s", I->exp_dir_level_s(), I->name.c_str()),
                                 -1);
                         if ( I == current_pattern )
                                 current_pattern_iter = iter;
diff --git a/upstream/src/aghermann/ui/sf/d/patterns-profiles_cb.cc b/upstream/src/aghermann/ui/sf/d/patterns-profiles_cb.cc
index 00e65b6..e10a5dc 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns-profiles_cb.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns-profiles_cb.cc
@@ -67,20 +67,33 @@ bSFFDProfileSave_clicked_cb(
         if ( GTK_RESPONSE_OK == gtk_dialog_run( FD.wSFFDPatternSave) ) {
                 using namespace agh;
 
-                // replace unnamed, else make a duplicate
-                auto& P = (FD.current_pattern->origin == agh::TExpDirLevel::transient)
-                        ? * FD.current_pattern
-                        : *(FD.current_pattern = FD.patterns.insert(FD.current_pattern, *FD.current_pattern));
-
-                P.name = gtk_entry_get_text( FD.eSFFDPatternSaveName);
-                P.origin =
+                // replace unnamed, else check if one exists, else add new
+                auto this_name = gtk_entry_get_text( FD.eSFFDPatternSaveName);
+                auto this_level =
                         gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginSubject)
                         ? TExpDirLevel::subject
                         : gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginExperiment)
                         ? TExpDirLevel::experiment
                         : TExpDirLevel::user;
 
-                
+                auto overwriting =
+                        find_if( FD.patterns.begin(), FD.patterns.end(),
+                                 [&] ( const pattern::SPattern<TFloat>& P) -> bool
+                                 { return P.name == this_name && P.level == this_level; });
+                auto& P =
+                        (overwriting != FD.patterns.end())
+                        ? *overwriting
+                        : (FD.current_pattern->level == agh::TExpDirLevel::transient)
+                        ? * FD.current_pattern
+                        : *(FD.current_pattern = FD.patterns.insert(FD.current_pattern, *FD.current_pattern));
+
+                tie(P.name, P.level, P.Pp, P.criteria) =
+                        make_tuple(
+                                this_name,
+                                this_level,
+                                FD.Pp2,
+                                FD.criteria);
+
                 FD.populate_combo();
                 FD.set_profile_manage_buttons_visibility();
         }
@@ -99,7 +112,7 @@ hildebranden( const gpointer userdata)
 
         using namespace agh;
         auto this_name = gtk_entry_get_text( FD.eSFFDPatternSaveName);
-        auto this_origin = gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginSubject)
+        auto this_level = gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginSubject)
                         ? TExpDirLevel::subject
                         : gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginExperiment)
                         ? TExpDirLevel::experiment
@@ -108,7 +121,7 @@ hildebranden( const gpointer userdata)
         bool overwriting =
                 find_if( FD.patterns.begin(), FD.patterns.end(),
                          [&] ( const pattern::SPattern<TFloat>& P) -> bool
-                         { return P.name == this_name && P.origin == this_origin; })
+                         { return P.name == this_name && P.level == this_level; })
                 != FD.patterns.end();
         gtk_button_set_label(
                 FD.bSFFDPatternSaveOK,
@@ -142,7 +155,6 @@ bSFFDProfileDiscard_clicked_cb(
         gint ci = gtk_combo_box_get_active( FD.eSFFDPatternList);
 
         assert ( FD.current_pattern != FD.patterns.end() );
-        assert ( FD.current_pattern->origin != agh::TExpDirLevel::transient );
         assert ( ci != -1 );
         assert ( ci < (int)FD.patterns.size() );
 
@@ -171,7 +183,7 @@ bSFFDProfileRevert_clicked_cb(
         auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
         assert ( FD.current_pattern != FD.patterns.end() );
-        assert ( FD.current_pattern->origin != agh::TExpDirLevel::transient );
+        assert ( FD.current_pattern->level != agh::TExpDirLevel::transient );
 
         FD.Pp2 = FD.current_pattern->Pp;
         FD.criteria = FD.current_pattern->criteria;
diff --git a/upstream/src/aghermann/ui/sf/d/patterns.cc b/upstream/src/aghermann/ui/sf/d/patterns.cc
index 674d4ad..88571d0 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns.cc
@@ -59,7 +59,7 @@ SPatternsDialog (SScoringFacility& parent)
 SScoringFacility::SPatternsDialog::
 ~SPatternsDialog ()
 {
-        save_patterns();
+        // save_patterns(); // saved by ~SPattern
 
         // g_object_unref( mPatterns);
         gtk_widget_destroy( (GtkWidget*)wSFFDPatternSave);
@@ -70,6 +70,7 @@ SScoringFacility::SPatternsDialog::
 
 
 
+
 void
 SScoringFacility::SPatternsDialog::
 search()
@@ -166,7 +167,7 @@ setup_controls_for_find()
 
         gtk_widget_set_sensitive( (GtkWidget*)eSFFDPatternList, TRUE);
 
-        gtk_widget_set_sensitive( (GtkWidget*)iibSFFDMenu, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)iibSFFDMenu, FALSE);
 
         gtk_label_set_markup( lSFFDFoundInfo, "");
 }
@@ -186,7 +187,7 @@ setup_controls_for_wait()
 
         gtk_widget_set_sensitive( (GtkWidget*)eSFFDPatternList, FALSE);
 
-        gtk_widget_set_sensitive( (GtkWidget*)iibSFFDMenu, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)iibSFFDMenu, FALSE);
 }
 
 void
@@ -204,7 +205,7 @@ setup_controls_for_tune()
 
         gtk_widget_set_sensitive( (GtkWidget*)eSFFDPatternList, FALSE);
 
-        gtk_widget_set_sensitive( (GtkWidget*)iibSFFDMenu, TRUE);
+        gtk_widget_set_visible( (GtkWidget*)iibSFFDMenu, TRUE);
 }
 
 
@@ -213,12 +214,13 @@ void
 SScoringFacility::SPatternsDialog::
 set_profile_manage_buttons_visibility()
 {
-        bool    have_any = current_pattern != patterns.end(),
-                is_transient = have_any && current_pattern->origin == agh::TExpDirLevel::transient,
-                is_modified  = have_any && not (current_pattern->Pp == Pp2) and not (current_pattern->criteria == criteria);
-        gtk_widget_set_visible( (GtkWidget*)bSFFDProfileSave, have_any);
-        gtk_widget_set_visible( (GtkWidget*)bSFFDProfileRevert, have_any and not is_transient and is_modified);
-        gtk_widget_set_visible( (GtkWidget*)bSFFDProfileDiscard, have_any and not is_transient);
+        bool    have_active  = current_pattern != patterns.end(),
+                is_transient = have_active && current_pattern->level == agh::TExpDirLevel::transient,
+                is_modified  = have_active && not (current_pattern->Pp == Pp2); // and not (current_pattern->criteria == criteria);
+        gtk_widget_set_visible( (GtkWidget*)bSFFDProfileSave, have_active);
+        gtk_widget_set_visible( (GtkWidget*)bSFFDProfileRevert, have_active and not is_transient and is_modified);
+        gtk_widget_set_visible( (GtkWidget*)bSFFDProfileDiscard, have_active and not is_transient);
+        gtk_widget_set_sensitive( (GtkWidget*)eSFFDPatternList, not is_modified);
 }
 
 
diff --git a/upstream/src/aghermann/ui/sf/d/patterns.hh b/upstream/src/aghermann/ui/sf/d/patterns.hh
index 966bc84..ca42f08 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns.hh
+++ b/upstream/src/aghermann/ui/sf/d/patterns.hh
@@ -126,9 +126,9 @@ struct SScoringFacility::SPatternsDialog
         double  increment; // in seconds
 
       // matches
-        pattern::CMatch<TFloat>
+        pattern::CMatch
                 criteria;
-        vector<pattern::CMatch<TFloat>>
+        vector<pattern::CMatch>
                 diff_line;
         vector<size_t>
                 occurrences;

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git



More information about the debian-med-commit mailing list